weld ExtMgrDialog and UpdateRequiredDialog

Change-Id: I97e5cda847fd7f98990a87d0b1ca6d6b8b3f9d0f
Reviewed-on: https://gerrit.libreoffice.org/73899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2019-06-12 11:32:40 +01:00
parent 5128f7bf6c
commit daa1ab5d59
18 changed files with 717 additions and 779 deletions

View file

@ -1565,9 +1565,9 @@ VclPtr<SvxAbstractNewTableDialog> AbstractDialogFactory_Impl::CreateSvxNewTableD
}
VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateOptionsDialog(
vcl::Window* pParent, const OUString& rExtensionId )
weld::Window* /*pParent*/, const OUString& rExtensionId )
{
return VclPtr<CuiVclAbstractDialog_Impl>::Create( VclPtr<OfaTreeOptionsDialog>::Create( pParent, rExtensionId ) );
return VclPtr<CuiVclAbstractDialog_Impl>::Create( VclPtr<OfaTreeOptionsDialog>::Create(nullptr /* TODO: pParent*/, rExtensionId ) );
}
VclPtr<SvxAbstractInsRowColDlg> AbstractDialogFactory_Impl::CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId)

View file

@ -844,7 +844,7 @@ public:
virtual VclPtr<SvxAbstractNewTableDialog> CreateSvxNewTableDialog(weld::Window* pParent) override ;
virtual VclPtr<VclAbstractDialog> CreateOptionsDialog(
vcl::Window* pParent, const OUString& rExtensionId ) override;
weld::Window* pParent, const OUString& rExtensionId ) override;
virtual VclPtr<SvxAbstractInsRowColDlg> CreateSvxInsRowColDlg(weld::Window* pParent, bool bCol, const OString& rHelpId) override;

View file

@ -12,6 +12,7 @@ $(eval $(call gb_UIConfig_UIConfig,desktop))
$(eval $(call gb_UIConfig_add_uifiles,desktop,\
desktop/uiconfig/ui/dependenciesdialog \
desktop/uiconfig/ui/extensionmanager \
desktop/uiconfig/ui/extensionmenu \
desktop/uiconfig/ui/installforalldialog \
desktop/uiconfig/ui/licensedialog \
desktop/uiconfig/ui/showlicensedialog \

File diff suppressed because it is too large Load diff

View file

@ -22,14 +22,10 @@
#include <config_extensions.h>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/prgsbar.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
#include <osl/conditn.hxx>
@ -60,18 +56,17 @@ class TheExtensionManager;
class DialogHelper
{
css::uno::Reference< css::uno::XComponentContext > m_xContext;
VclPtr<Dialog> m_xVCLWindow;
weld::Window* m_pWindow;
ImplSVEvent * m_nEventID;
TopLevelWindowLocker m_aBusy;
public:
DialogHelper( const css::uno::Reference< css::uno::XComponentContext > &,
Dialog *pWindow );
DialogHelper(const css::uno::Reference< css::uno::XComponentContext > &,
weld::Window* pWindow);
virtual ~DialogHelper();
void openWebBrowser(const OUString& rURL, const OUString& rTitle);
Dialog* getWindow() const { return m_xVCLWindow; };
weld::Window* getFrameWeld() const { return m_xVCLWindow ? m_xVCLWindow->GetFrameWeld() : nullptr; }
weld::Window* getFrameWeld() const { return m_pWindow; }
void PostUserEvent( const Link<void*,void>& rLink, void* pCaller );
void clearEventID() { m_nEventID = nullptr; }
@ -93,31 +88,16 @@ public:
const char* pResID,
bool &bHadWarning );
void incBusy() { m_aBusy.incBusy(m_xVCLWindow->GetFrameWeld()); }
void incBusy() { m_aBusy.incBusy(m_pWindow); }
void decBusy() { m_aBusy.decBusy(); }
bool isBusy() const { return m_aBusy.isBusy(); }
bool installExtensionWarn(const OUString &rExtensionURL);
bool installForAllUsers(bool &bInstallForAll);
};
class ExtMgrDialog : public ModelessDialog,
public DialogHelper
class ExtMgrDialog : public weld::GenericDialogController
, public DialogHelper
{
VclPtr<vcl::Window> m_xRestartParent;
VclPtr<ExtBoxWithBtns_Impl> m_pExtensionBox;
VclPtr<PushButton> m_pOptionsBtn;
VclPtr<PushButton> m_pAddBtn;
VclPtr<PushButton> m_pRemoveBtn;
VclPtr<PushButton> m_pEnableBtn;
VclPtr<PushButton> m_pUpdateBtn;
VclPtr<CloseButton> m_pCloseBtn;
VclPtr<CheckBox> m_pBundledCbx;
VclPtr<CheckBox> m_pSharedCbx;
VclPtr<CheckBox> m_pUserCbx;
VclPtr<FixedHyperlink> m_pGetExtensions;
VclPtr<FixedText> m_pProgressText;
VclPtr<ProgressBar> m_pProgressBar;
VclPtr<CancelButton> m_pCancelBtn;
const OUString m_sAddPackages;
OUString m_sProgressText;
OUString m_sLastFolderURL;
@ -136,27 +116,38 @@ class ExtMgrDialog : public ModelessDialog,
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel;
std::unique_ptr<ExtBoxWithBtns_Impl> m_xExtensionBox;
std::unique_ptr<weld::CustomWeld> m_xExtensionBoxWnd;
std::unique_ptr<weld::Button> m_xOptionsBtn;
std::unique_ptr<weld::Button> m_xAddBtn;
std::unique_ptr<weld::Button> m_xRemoveBtn;
std::unique_ptr<weld::Button> m_xEnableBtn;
std::unique_ptr<weld::Button> m_xUpdateBtn;
std::unique_ptr<weld::Button> m_xCloseBtn;
std::unique_ptr<weld::CheckButton> m_xBundledCbx;
std::unique_ptr<weld::CheckButton> m_xSharedCbx;
std::unique_ptr<weld::CheckButton> m_xUserCbx;
std::unique_ptr<weld::LinkButton> m_xGetExtensions;
std::unique_ptr<weld::Label> m_xProgressText;
std::unique_ptr<weld::ProgressBar> m_xProgressBar;
std::unique_ptr<weld::Button> m_xCancelBtn;
bool removeExtensionWarn(const OUString &rExtensionTitle);
DECL_LINK( HandleOptionsBtn, Button*, void );
DECL_LINK( HandleAddBtn, Button*, void );
DECL_LINK( HandleRemoveBtn, Button*, void );
DECL_LINK( HandleEnableBtn, Button*, void );
DECL_LINK( HandleUpdateBtn, Button*, void );
DECL_LINK( HandleCancelBtn, Button*, void );
DECL_LINK( HandleCloseBtn, Button*, void );
DECL_LINK( HandleExtTypeCbx, Button*, void );
DECL_LINK( HandleOptionsBtn, weld::Button&, void );
DECL_LINK( HandleAddBtn, weld::Button&, void );
DECL_LINK( HandleRemoveBtn, weld::Button&, void );
DECL_LINK( HandleEnableBtn, weld::Button&, void );
DECL_LINK( HandleUpdateBtn, weld::Button&, void );
DECL_LINK( HandleCancelBtn, weld::Button&, void );
DECL_LINK( HandleCloseBtn, weld::Button&, void );
DECL_LINK( HandleExtTypeCbx, weld::Button&, void );
DECL_LINK( TimeOutHdl, Timer *, void );
DECL_LINK( startProgress, void *, void );
DECL_STATIC_LINK( ExtMgrDialog, Restart, void *, void );
public:
ExtMgrDialog( vcl::Window * pParent, TheExtensionManager *pManager, Dialog::InitFlag eFlag = Dialog::InitFlag::Default );
virtual ~ExtMgrDialog() override;
virtual void dispose() override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
virtual bool Close() override;
ExtMgrDialog(weld::Window * pParent, TheExtensionManager *pManager);
virtual ~ExtMgrDialog() override;
virtual void showProgress( bool bStart ) override;
virtual void updateProgress( const OUString &rText,
@ -174,6 +165,8 @@ public:
void updatePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage );
bool acceptLicense(const css::uno::Reference< css::deployment::XPackage > &xPackage );
void Close();
TheExtensionManager* getExtensionManager() const { return m_pManager; }
virtual void prepareChecking() override;
@ -192,16 +185,9 @@ public:
};
class UpdateRequiredDialog : public ModalDialog,
public DialogHelper
class UpdateRequiredDialog : public weld::GenericDialogController
, public DialogHelper
{
VclPtr<ExtensionBox_Impl> m_pExtensionBox;
VclPtr<FixedText> m_pUpdateNeeded;
VclPtr<PushButton> m_pUpdateBtn;
VclPtr<PushButton> m_pCloseBtn;
VclPtr<CancelButton> m_pCancelBtn;
VclPtr<FixedText> m_pProgressText;
VclPtr<ProgressBar> m_pProgressBar;
const OUString m_sCloseText;
OUString m_sProgressText;
::osl::Mutex m_aMutex;
@ -216,9 +202,18 @@ class UpdateRequiredDialog : public ModalDialog,
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel;
DECL_LINK( HandleUpdateBtn, Button*, void );
DECL_LINK( HandleCloseBtn, Button*, void );
DECL_LINK( HandleCancelBtn, Button*, void );
std::unique_ptr<ExtensionBox_Impl> m_xExtensionBox;
std::unique_ptr<weld::CustomWeld> m_xExtensionBoxWnd;
std::unique_ptr<weld::Label> m_xUpdateNeeded;
std::unique_ptr<weld::Button> m_xUpdateBtn;
std::unique_ptr<weld::Button> m_xCloseBtn;
std::unique_ptr<weld::Button> m_xCancelBtn;
std::unique_ptr<weld::Label> m_xProgressText;
std::unique_ptr<weld::ProgressBar> m_xProgressBar;
DECL_LINK( HandleUpdateBtn, weld::Button&, void );
DECL_LINK( HandleCloseBtn, weld::Button&, void );
DECL_LINK( HandleCancelBtn, weld::Button&, void );
DECL_LINK( TimeOutHdl, Timer *, void );
DECL_LINK( startProgress, void *, void );
@ -228,12 +223,10 @@ class UpdateRequiredDialog : public ModalDialog,
void disableAllEntries();
public:
UpdateRequiredDialog( vcl::Window * pParent, TheExtensionManager *pManager );
UpdateRequiredDialog(weld::Window * pParent, TheExtensionManager *pManager);
virtual ~UpdateRequiredDialog() override;
virtual void dispose() override;
virtual short Execute() override;
virtual bool Close() override;
virtual short run() override;
virtual void showProgress( bool bStart ) override;
virtual void updateProgress( const OUString &rText,

View file

@ -375,8 +375,12 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
}
{
SolarMutexGuard guard;
DependencyDialog aDlg(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, deps);
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
DependencyDialog aDlg(activeDialog(), deps);
short n = aDlg.run();
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
// Distinguish between closing the dialog and programmatically
// canceling the dialog (headless VCL):
approve = n == RET_OK
@ -386,11 +390,17 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
else if (request >>= licExc)
{
SolarMutexGuard guard;
weld::Window *pTopLevel = activeDialog();
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
deployment::ui::LicenseDialog::create(
m_xContext, VCLUnoHelper::GetInterface( m_pDialogHelper? m_pDialogHelper->getWindow() : nullptr ),
m_xContext, pTopLevel ? pTopLevel->GetXWindow() : nullptr,
licExc.ExtensionName, licExc.Text ) );
sal_Int16 res = xDialog->execute();
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
if ( res == ui::dialogs::ExecutableDialogResults::CANCEL )
abort = true;
else if ( res == ui::dialogs::ExecutableDialogResults::OK )
@ -421,7 +431,11 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
verExc.Deployed->getDisplayName();
{
SolarMutexGuard guard;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr,
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(activeDialog(),
VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(id)));
OUString s;
if (bEqualNames)
@ -449,6 +463,8 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
s = s.replaceAll("$DEPLOYED", getVersion(verExc.Deployed));
xBox->set_primary_text(s);
approve = xBox->run() == RET_OK;
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
abort = !approve;
}
}
@ -476,9 +492,13 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const &
SolarMutexGuard guard;
OUString sMsg(DpResId(RID_STR_UNSUPPORTED_PLATFORM));
sMsg = sMsg.replaceAll("%Name", platExc.package->getDisplayName());
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr,
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(activeDialog(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
xBox->run();
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
approve = true;
}
@ -540,9 +560,13 @@ void ProgressCmdEnv::update_( uno::Any const & rStatus )
text = ::comphelper::anyToString( rStatus ); // fallback
const SolarMutexGuard aGuard;
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr,
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(activeDialog(),
VclMessageType::Warning, VclButtonsType::Ok, text));
xBox->run();
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
}
++m_nCurrentProgress;
updateProgress();
@ -783,12 +807,17 @@ void ExtensionCmdQueue::Thread::execute()
msg = ::comphelper::anyToString(exc);
const SolarMutexGuard guard;
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(currentCmdEnv->activeDialog(),
VclMessageType::Warning, VclButtonsType::Ok, msg));
if (m_pDialogHelper)
xBox->set_title(m_pDialogHelper->getWindow()->GetText());
xBox->set_title(m_pDialogHelper->getFrameWeld()->get_title());
xBox->run();
//Continue with installation of the remaining extensions
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
//Continue with installation of the remaining extensions
}
{
osl::MutexGuard aGuard( m_mutex );
@ -895,12 +924,19 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
{
const SolarMutexGuard guard;
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
std::vector< UpdateData > vData;
UpdateDialog aUpdateDialog(m_xContext, m_pDialogHelper? m_pDialogHelper->getFrameWeld() : nullptr, vExtensionList, &vData);
UpdateDialog aUpdateDialog(m_xContext, m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, vExtensionList, &vData);
aUpdateDialog.notifyMenubar( true, false ); // prepare the checking, if there updates to be notified via menu bar icon
if (aUpdateDialog.run() == RET_OK && !vData.empty())
bool bOk = aUpdateDialog.run() == RET_OK;
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
if (bOk && !vData.empty())
{
// If there is at least one directly downloadable extension then we
// open the install dialog.
@ -915,8 +951,12 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
short nDialogResult = RET_OK;
if ( !dataDownload.empty() )
{
UpdateInstallDialog aDlg(m_pDialogHelper? m_pDialogHelper->getFrameWeld() : nullptr, dataDownload, m_xContext);
if (m_pDialogHelper)
m_pDialogHelper->incBusy();
UpdateInstallDialog aDlg(m_pDialogHelper ? m_pDialogHelper->getFrameWeld() : nullptr, dataDownload, m_xContext);
nDialogResult = aDlg.run();
if (m_pDialogHelper)
m_pDialogHelper->decBusy();
aUpdateDialog.notifyMenubar( false, true ); // Check, if there are still pending updates to be notified via menu bar icon
}
else
@ -928,7 +968,7 @@ void ExtensionCmdQueue::Thread::_checkForUpdates(
for (auto const& data : vData)
{
if ( m_pDialogHelper && ( !data.sWebsiteURL.isEmpty() ) )
m_pDialogHelper->openWebBrowser( data.sWebsiteURL, m_pDialogHelper->getWindow()->GetText() );
m_pDialogHelper->openWebBrowser( data.sWebsiteURL, m_pDialogHelper->getFrameWeld()->get_title() );
}
}
}

View file

@ -33,11 +33,14 @@
#include <com/sun/star/deployment/DependencyException.hpp>
#include <com/sun/star/deployment/DeploymentException.hpp>
#include <com/sun/star/deployment/ExtensionRemovedException.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <cppuhelper/weakref.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <vcl/event.hxx>
#include <vcl/ptrstyle.hxx>
#include <vcl/settings.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/commandevent.hxx>
#include <algorithm>
@ -81,7 +84,6 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
m_bHasButtons( false ),
m_bMissingLic( false ),
m_eState( eState ),
m_pPublisher( nullptr ),
m_xPackage( xPackage )
{
try
@ -175,37 +177,32 @@ ExtensionRemovedListener::~ExtensionRemovedListener()
// ExtensionBox_Impl
ExtensionBox_Impl::ExtensionBox_Impl(vcl::Window* pParent) :
Control( pParent, WB_BORDER | WB_TABSTOP ),
m_bHasScrollBar( false ),
m_bHasActive( false ),
m_bNeedsRecalc( true ),
m_bInCheckMode( false ),
m_bAdjustActive( false ),
m_bInDelete( false ),
m_nActive( 0 ),
m_nTopIndex( 0 ),
m_nActiveHeight( 0 ),
m_aSharedImage(StockImage::Yes, RID_BMP_SHARED),
m_aLockedImage(StockImage::Yes, RID_BMP_LOCKED),
m_aWarningImage(StockImage::Yes, RID_BMP_WARNING),
m_aDefaultImage(StockImage::Yes, RID_BMP_EXTENSION),
m_pScrollBar( nullptr ),
m_pManager( nullptr )
ExtensionBox_Impl::ExtensionBox_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll)
: m_bHasScrollBar( false )
, m_bHasActive( false )
, m_bNeedsRecalc( true )
, m_bInCheckMode( false )
, m_bAdjustActive( false )
, m_bInDelete( false )
, m_nActive( 0 )
, m_nTopIndex( 0 )
, m_nActiveHeight( 0 )
, m_aSharedImage(StockImage::Yes, RID_BMP_SHARED)
, m_aLockedImage(StockImage::Yes, RID_BMP_LOCKED)
, m_aWarningImage(StockImage::Yes, RID_BMP_WARNING)
, m_aDefaultImage(StockImage::Yes, RID_BMP_EXTENSION)
, m_pManager( nullptr )
, m_xScrollBar(std::move(xScroll))
{
Init();
}
void ExtensionBox_Impl::Init()
{
m_pScrollBar = VclPtr<ScrollBar>::Create( this, WB_VERT );
m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
m_pScrollBar->EnableDrag();
m_xScrollBar->set_user_managed_scrolling();
m_xScrollBar->connect_vadjustment_changed( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
SetPaintTransparent( true );
SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
auto nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
auto nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
if ( nIconHeight < nTitleHeight )
m_nStdHeight = nTitleHeight;
else
@ -218,28 +215,14 @@ void ExtensionBox_Impl::Init()
m_nActiveHeight = m_nStdHeight;
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
if( IsControlBackground() )
SetBackground( GetControlBackground() );
else
SetBackground( rStyleSettings.GetFieldColor() );
m_xRemoveListener = new ExtensionRemovedListener( this );
m_pLocale.reset( new lang::Locale( Application::GetSettings().GetLanguageTag().getLocale() ) );
m_pCollator.reset( new CollatorWrapper( ::comphelper::getProcessComponentContext() ) );
m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
Show();
}
ExtensionBox_Impl::~ExtensionBox_Impl()
{
disposeOnce();
}
void ExtensionBox_Impl::dispose()
{
if ( ! m_bInDelete )
DeleteRemoved();
@ -248,22 +231,17 @@ void ExtensionBox_Impl::dispose()
for (auto const& entry : m_vEntries)
{
entry->m_pPublisher.disposeAndClear();
entry->m_xPackage->removeEventListener( m_xRemoveListener.get() );
}
m_vEntries.clear();
m_pScrollBar.disposeAndClear();
m_xRemoveListener.clear();
m_pLocale.reset();
m_pCollator.reset();
Control::dispose();
}
sal_Int32 ExtensionBox_Impl::getItemCount() const
{
return static_cast< sal_Int32 >( m_vEntries.size() );
@ -299,7 +277,7 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
// calc description height
Size aSize = GetOutputSizePixel();
if ( m_bHasScrollBar )
aSize.AdjustWidth( -(m_pScrollBar->GetSizePixel().Width()) );
aSize.AdjustWidth(-m_xScrollBar->get_vscroll_width());
aSize.AdjustWidth( -(ICON_OFFSET) );
aSize.setHeight( 10000 );
@ -309,8 +287,8 @@ void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
aText += "\n";
aText += m_vEntries[ nPos ]->m_sDescription;
tools::Rectangle aRect = GetTextRect( tools::Rectangle( Point(), aSize ), aText,
DrawTextFlags::MultiLine | DrawTextFlags::WordBreak );
tools::Rectangle aRect = GetDrawingArea()->get_ref_device().GetTextRect(tools::Rectangle( Point(), aSize ), aText,
DrawTextFlags::MultiLine | DrawTextFlags::WordBreak);
aTextHeight += aRect.GetHeight();
if ( aTextHeight < m_nStdHeight )
@ -329,7 +307,7 @@ tools::Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
Size aSize( GetOutputSizePixel() );
if ( m_bHasScrollBar )
aSize.AdjustWidth( -(m_pScrollBar->GetSizePixel().Width()) );
aSize.AdjustWidth(-m_xScrollBar->get_vscroll_width());
if ( m_vEntries[ nPos ]->m_bActive )
aSize.setHeight( m_nActiveHeight );
@ -350,15 +328,7 @@ void ExtensionBox_Impl::DeleteRemoved()
m_bInDelete = true;
if ( ! m_vRemovedEntries.empty() )
{
for (auto const& removedEntry : m_vRemovedEntries)
{
removedEntry->m_pPublisher.disposeAndClear();
}
m_vRemovedEntries.clear();
}
m_vRemovedEntries.clear();
m_bInDelete = false;
}
@ -424,8 +394,6 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools:
rRenderContext.SetTextColor(rStyleSettings.GetHighlightTextColor());
else if ((rEntry->m_eState != REGISTERED) && (rEntry->m_eState != NOT_AVAILABLE))
rRenderContext.SetTextColor(rStyleSettings.GetDisableColor());
else if (IsControlForeground())
rRenderContext.SetTextColor(GetControlForeground());
else
rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
@ -437,11 +405,7 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools:
}
else
{
if (IsControlBackground())
rRenderContext.SetBackground(GetControlBackground());
else
rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
rRenderContext.SetTextFillColor();
rRenderContext.Erase(rRect);
}
@ -463,37 +427,31 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools:
rRenderContext.DrawImage(aPos, Size(ICON_WIDTH, ICON_HEIGHT), aImage);
// Setup fonts
// expand the point size of the desired font to the equivalent pixel size
if (vcl::Window* pDefaultDevice = dynamic_cast<vcl::Window*>(Application::GetDefaultDevice()))
pDefaultDevice->SetPointFont(rRenderContext, GetDrawingArea()->get_font());
vcl::Font aStdFont(rRenderContext.GetFont());
vcl::Font aBoldFont(aStdFont);
aBoldFont.SetWeight(WEIGHT_BOLD);
rRenderContext.SetFont(aBoldFont);
long aTextHeight = rRenderContext.GetTextHeight();
// Init publisher link here
if (!rEntry->m_pPublisher && !rEntry->m_sPublisher.isEmpty())
{
rEntry->m_pPublisher = VclPtr<FixedHyperlink>::Create(this);
rEntry->m_pPublisher->SetBackground();
rEntry->m_pPublisher->SetPaintTransparent(true);
rEntry->m_pPublisher->SetURL(rEntry->m_sPublisherURL);
rEntry->m_pPublisher->SetText(rEntry->m_sPublisher);
Size aSize = FixedText::CalcMinimumTextSize(rEntry->m_pPublisher);
rEntry->m_pPublisher->SetSizePixel(aSize);
}
auto aTextHeight = rRenderContext.GetTextHeight();
// Get max title width
long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
auto nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
nMaxTitleWidth -= (2 * SMALL_ICON_SIZE) + (4 * SPACE_BETWEEN);
if (rEntry->m_pPublisher)
rRenderContext.SetFont(aStdFont);
long nLinkWidth = 0;
if (!rEntry->m_sPublisher.isEmpty())
{
nMaxTitleWidth -= rEntry->m_pPublisher->GetSizePixel().Width() + (2 * SPACE_BETWEEN);
nLinkWidth = rRenderContext.GetTextWidth(rEntry->m_sPublisher);
nMaxTitleWidth -= nLinkWidth + (2 * SPACE_BETWEEN);
}
long aVersionWidth = rRenderContext.GetTextWidth(rEntry->m_sVersion);
long aTitleWidth = rRenderContext.GetTextWidth(rEntry->m_sTitle) + (aTextHeight / 3);
aPos = rRect.TopLeft() + Point(ICON_OFFSET, TOP_OFFSET);
rRenderContext.SetFont(aBoldFont);
if (aTitleWidth > nMaxTitleWidth - aVersionWidth)
{
aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
@ -541,18 +499,27 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const tools:
{
//replace LF to space, so words do not stick together in one line view
sDescription = sDescription.replace(0x000A, ' ');
const long nWidth = GetTextWidth( sDescription );
const long nWidth = rRenderContext.GetTextWidth( sDescription );
if (nWidth > rRect.GetWidth() - aPos.X())
sDescription = rRenderContext.GetEllipsisString(sDescription, rRect.GetWidth() - aPos.X());
rRenderContext.DrawText(aPos, sDescription);
}
// Draw publisher link
if (rEntry->m_pPublisher)
if (!rEntry->m_sPublisher.isEmpty())
{
rEntry->m_pPublisher->Show();
aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
rEntry->m_pPublisher->SetPosPixel(aPos);
rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR);
rRenderContext.SetTextColor(rStyleSettings.GetLinkColor());
rRenderContext.SetTextFillColor(rStyleSettings.GetFieldColor());
vcl::Font aFont = rRenderContext.GetFont();
// to underline
aFont.SetUnderline(LINESTYLE_SINGLE);
rRenderContext.SetFont(aFont);
rRenderContext.DrawText(aPos, rEntry->m_sPublisher);
rEntry->m_aLinkRect = tools::Rectangle(aPos, Size(nLinkWidth, aTextHeight));
rRenderContext.Pop();
}
// Draw status icons
@ -618,7 +585,7 @@ void ExtensionBox_Impl::RecalcAll()
}
if ( m_bHasScrollBar )
m_pScrollBar->SetThumbPos( m_nTopIndex );
m_xScrollBar->vadjustment_set_value( m_nTopIndex );
}
}
@ -683,7 +650,7 @@ void ExtensionBox_Impl::Paint(vcl::RenderContext& rRenderContext, const tools::R
Size aSize(GetOutputSizePixel());
if ( m_bHasScrollBar )
aSize.AdjustWidth( -(m_pScrollBar->GetSizePixel().Width()) );
aSize.AdjustWidth(-m_xScrollBar->get_vscroll_width());
const ::osl::MutexGuard aGuard( m_entriesMutex );
@ -713,8 +680,7 @@ long ExtensionBox_Impl::GetTotalHeight() const
void ExtensionBox_Impl::SetupScrollBar()
{
const Size aSize = GetOutputSizePixel();
const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
const long nTotalHeight = GetTotalHeight();
const auto nTotalHeight = GetTotalHeight();
const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
if ( bNeedsScrollBar )
@ -722,20 +688,16 @@ void ExtensionBox_Impl::SetupScrollBar()
if ( m_nTopIndex + aSize.Height() > nTotalHeight )
m_nTopIndex = nTotalHeight - aSize.Height();
m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
Size( nScrBarSize, aSize.Height() ) );
m_pScrollBar->SetRangeMax( nTotalHeight );
m_pScrollBar->SetVisibleSize( aSize.Height() );
m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
m_pScrollBar->SetLineSize( m_nStdHeight );
m_pScrollBar->SetThumbPos( m_nTopIndex );
m_xScrollBar->vadjustment_configure(m_nTopIndex, 0, nTotalHeight,
m_nStdHeight, ( aSize.Height() * 4 ) / 5,
aSize.Height());
if ( !m_bHasScrollBar )
m_pScrollBar->Show();
if (!m_bHasScrollBar)
m_xScrollBar->set_vpolicy(VclPolicyType::ALWAYS);
}
else if ( m_bHasScrollBar )
{
m_pScrollBar->Hide();
m_xScrollBar->set_vpolicy(VclPolicyType::NEVER);
m_nTopIndex = 0;
}
@ -748,14 +710,14 @@ void ExtensionBox_Impl::Resize()
RecalcAll();
}
Size ExtensionBox_Impl::GetOptimalSize() const
void ExtensionBox_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
return LogicToPixel(Size(250, 150), MapMode(MapUnit::MapAppFont));
}
Size aSize = pDrawingArea->get_ref_device().LogicToPixel(Size(250, 150), MapMode(MapUnit::MapAppFont));
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
CustomWidgetController::SetDrawingArea(pDrawingArea);
SetOutputSizePixel(aSize);
extern "C" SAL_DLLPUBLIC_EXPORT void makeExtensionBox(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &)
{
rRet = VclPtr<ExtensionBox_Impl>::Create(pParent);
Init();
}
long ExtensionBox_Impl::PointToPos( const Point& rPos )
@ -773,65 +735,94 @@ long ExtensionBox_Impl::PointToPos( const Point& rPos )
return nPos;
}
void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
bool ExtensionBox_Impl::MouseMove( const MouseEvent& rMEvt )
{
long nPos = PointToPos( rMEvt.GetPosPixel() );
bool bOverHyperlink = false;
if ( rMEvt.IsLeft() )
auto nPos = PointToPos( rMEvt.GetPosPixel() );
if ( ( nPos >= 0 ) && ( nPos < static_cast<long>(m_vEntries.size()) ) )
{
if ( rMEvt.IsMod1() && m_bHasActive )
selectEntry( m_vEntries.size() ); // Selecting a not existing entry will deselect the current one
else
selectEntry( nPos );
const auto& rEntry = m_vEntries[nPos];
bOverHyperlink = !rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.IsInside(rMEvt.GetPosPixel());
}
if (bOverHyperlink)
SetPointer(PointerStyle::RefHand);
else
SetPointer(PointerStyle::Arrow);
return false;
}
OUString ExtensionBox_Impl::RequestHelp(tools::Rectangle& rRect)
{
auto nPos = PointToPos( rRect.TopLeft() );
if ( ( nPos >= 0 ) && ( nPos < static_cast<long>(m_vEntries.size()) ) )
{
const auto& rEntry = m_vEntries[nPos];
bool bOverHyperlink = !rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.IsInside(rRect);
if (bOverHyperlink)
{
rRect = rEntry->m_aLinkRect;
return rEntry->m_sPublisherURL;
}
}
bool ExtensionBox_Impl::EventNotify( NotifyEvent& rNEvt )
return OUString();
}
bool ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( rMEvt.IsLeft() )
{
if (rMEvt.IsMod1() && m_bHasActive)
selectEntry(ExtensionBox_Impl::ENTRY_NOTFOUND); // Selecting a not existing entry will deselect the current one
else
{
auto nPos = PointToPos( rMEvt.GetPosPixel() );
if ( ( nPos >= 0 ) && ( nPos < static_cast<long>(m_vEntries.size()) ) )
{
const auto& rEntry = m_vEntries[nPos];
if (!rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.IsInside(rMEvt.GetPosPixel()))
{
try
{
css::uno::Reference<css::system::XSystemShellExecute> xSystemShellExecute(
css::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
//throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
xSystemShellExecute->execute(rEntry->m_sPublisherURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
}
catch (...)
{
}
return true;
}
}
selectEntry( nPos );
}
return true;
}
return false;
}
bool ExtensionBox_Impl::KeyInput(const KeyEvent& rKEvt)
{
if ( !m_bInDelete )
DeleteRemoved();
vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
sal_uInt16 nKeyCode = aKeyCode.GetCode();
bool bHandled = false;
if (nKeyCode != KEY_TAB && aKeyCode.GetGroup() == KEYGROUP_CURSOR)
bHandled = HandleCursorKey(nKeyCode);
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
sal_uInt16 nKeyCode = aKeyCode.GetCode();
if ( nKeyCode == KEY_TAB )
;
else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
bHandled = HandleCursorKey( nKeyCode );
}
if ( rNEvt.GetType() == MouseNotifyEvent::COMMAND )
{
if ( m_bHasScrollBar &&
( rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel ) )
{
const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
if ( pData->GetMode() == CommandWheelMode::SCROLL )
{
long nThumbPos = m_pScrollBar->GetThumbPos();
if ( pData->GetDelta() < 0 )
m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
else
m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
bHandled = true;
}
}
}
if ( !bHandled )
return Control::EventNotify(rNEvt);
else
return true;
return bHandled;
}
bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const long nStart,
const long nEnd, long &nPos )
{
@ -1149,23 +1140,10 @@ void ExtensionBox_Impl::checkEntries()
}
}
void ExtensionBox_Impl::DoScroll( long nDelta )
IMPL_LINK(ExtensionBox_Impl, ScrollHdl, weld::ScrolledWindow&, rScrBar, void)
{
m_nTopIndex += nDelta;
Point aNewSBPt( m_pScrollBar->GetPosPixel() );
tools::Rectangle aScrRect( Point(), GetOutputSizePixel() );
aScrRect.AdjustRight( -(m_pScrollBar->GetSizePixel().Width()) );
Scroll( 0, -nDelta, aScrRect );
m_pScrollBar->SetPosPixel( aNewSBPt );
}
IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar, void )
{
DoScroll( pScrBar->GetDelta() );
m_nTopIndex = rScrBar.vadjustment_get_value();
Invalidate();
}
} //namespace dp_gui

View file

@ -25,6 +25,8 @@
#include <vcl/fixed.hxx>
#include <vcl/fixedhyper.hxx>
#include <vcl/dialog.hxx>
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
@ -74,7 +76,7 @@ struct Entry_Impl
OUString m_sErrorText;
OUString m_sLicenseText;
Image m_aIcon;
VclPtr<FixedHyperlink> m_pPublisher;
tools::Rectangle m_aLinkRect;
css::uno::Reference<css::deployment::XPackage> m_xPackage;
@ -91,7 +93,7 @@ class ExtensionBox_Impl;
class ExtensionRemovedListener : public ::cppu::WeakImplHelper<css::lang::XEventListener>
{
VclPtr<ExtensionBox_Impl> m_pParent;
ExtensionBox_Impl* m_pParent;
public:
@ -103,7 +105,7 @@ public:
virtual void SAL_CALL disposing(css::lang::EventObject const& evt) override;
};
class ExtensionBox_Impl : public Control
class ExtensionBox_Impl : public weld::CustomWidgetController
{
bool m_bHasScrollBar : 1;
bool m_bHasActive : 1;
@ -122,8 +124,6 @@ class ExtensionBox_Impl : public Control
Image m_aWarningImage;
Image m_aDefaultImage;
VclPtr<ScrollBar> m_pScrollBar;
rtl::Reference<ExtensionRemovedListener> m_xRemoveListener;
TheExtensionManager *m_pManager;
@ -144,6 +144,9 @@ class ExtensionBox_Impl : public Control
//Holds weak references to extensions to which is we have added an XEventListener
std::vector< css::uno::WeakReference<
css::deployment::XPackage> > m_vListenerAdded;
std::unique_ptr<weld::ScrolledWindow> m_xScrollBar;
//Removes the dead weak references from m_vListenerAdded
void cleanVecListenerAdded();
void addEventListenerOnce(css::uno::Reference<css::deployment::XPackage> const & extension);
@ -156,27 +159,27 @@ class ExtensionBox_Impl : public Control
bool FindEntryPos( const TEntry_Impl& rEntry, long nStart, long nEnd, long &nFound );
void DeleteRemoved();
DECL_LINK( ScrollHdl, ScrollBar*, void );
DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void );
void Init();
public:
explicit ExtensionBox_Impl(vcl::Window* pParent);
explicit ExtensionBox_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll);
virtual ~ExtensionBox_Impl() override;
virtual void dispose() override;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
virtual bool MouseMove( const MouseEvent& rMEvt ) override;
virtual bool KeyInput(const KeyEvent& rKEvt) override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle &rPaintRect ) override;
virtual void Resize() override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
virtual Size GetOptimalSize() const override;
virtual OUString RequestHelp(tools::Rectangle& rRect) override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
TEntry_Impl const & GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
long GetEntryCount() { return static_cast<long>(m_vEntries.size()); }
tools::Rectangle GetEntryRect( const long nPos ) const;
bool HasActive() { return m_bHasActive; }
long PointToPos( const Point& rPos );
void DoScroll( long nDelta );
virtual void RecalcAll();
void RemoveUnlocked();

View file

@ -262,12 +262,12 @@ void ServiceImpl::startExecuteModal(
if ( bCloseDialog )
myExtMgr->Close();
else
myExtMgr->ToTop( ToTopFlags::RestoreWhenMin );
myExtMgr->ToTop();
}
else
{
myExtMgr->Show();
myExtMgr->ToTop( ToTopFlags::RestoreWhenMin );
myExtMgr->ToTop();
}
}

View file

@ -59,8 +59,6 @@ TheExtensionManager::TheExtensionManager( const uno::Reference< awt::XWindow > &
const uno::Reference< uno::XComponentContext > &xContext ) :
m_xContext( xContext ),
m_xParent( xParent ),
m_pExtMgrDialog( nullptr ),
m_pUpdReqDialog( nullptr ),
m_bModified(false)
{
m_xExtensionManager = deployment::ExtensionManager::get( xContext );
@ -102,72 +100,72 @@ TheExtensionManager::TheExtensionManager( const uno::Reference< awt::XWindow > &
}
}
TheExtensionManager::~TheExtensionManager()
{
m_pUpdReqDialog.disposeAndClear();
m_pExtMgrDialog.disposeAndClear();
if (m_xUpdReqDialog)
m_xUpdReqDialog->response(RET_CANCEL);
assert(!m_xUpdReqDialog);
if (m_xExtMgrDialog)
m_xExtMgrDialog->response(RET_CANCEL);
assert(!m_xExtMgrDialog);
}
void TheExtensionManager::createDialog( const bool bCreateUpdDlg )
{
const SolarMutexGuard guard;
if ( bCreateUpdDlg )
{
if ( !m_pUpdReqDialog )
if ( !m_xUpdReqDialog )
{
m_pUpdReqDialog = VclPtr<UpdateRequiredDialog>::Create( nullptr, this );
m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pUpdReqDialog.get(), this, m_xContext ) );
m_xUpdReqDialog.reset(new UpdateRequiredDialog(Application::GetFrameWeld(m_xParent), this));
m_xExecuteCmdQueue.reset( new ExtensionCmdQueue( m_xUpdReqDialog.get(), this, m_xContext ) );
createPackageList();
}
}
else if ( !m_pExtMgrDialog )
else if ( !m_xExtMgrDialog )
{
if (m_xParent.is())
m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( VCLUnoHelper::GetWindow(m_xParent), this );
else
m_pExtMgrDialog = VclPtr<ExtMgrDialog>::Create( nullptr, this, Dialog::InitFlag::NoParent );
m_pExecuteCmdQueue.reset( new ExtensionCmdQueue( m_pExtMgrDialog.get(), this, m_xContext ) );
m_pExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
m_xExtMgrDialog.reset(new ExtMgrDialog(Application::GetFrameWeld(m_xParent), this));
m_xExecuteCmdQueue.reset( new ExtensionCmdQueue( m_xExtMgrDialog.get(), this, m_xContext ) );
m_xExtMgrDialog->setGetExtensionsURL( m_sGetExtensionsURL );
createPackageList();
}
}
void TheExtensionManager::Show()
{
const SolarMutexGuard guard;
getDialog()->Show();
weld::DialogController::runAsync(m_xExtMgrDialog, [this](sal_Int32 /*nResult*/) {
auto xExtMgrDialog = m_xExtMgrDialog;
m_xExtMgrDialog.reset();
xExtMgrDialog->Close();
});
}
void TheExtensionManager::SetText( const OUString &rTitle )
{
const SolarMutexGuard guard;
getDialog()->SetText( rTitle );
getDialog()->set_title( rTitle );
}
void TheExtensionManager::ToTop( ToTopFlags nFlags )
void TheExtensionManager::ToTop()
{
const SolarMutexGuard guard;
getDialog()->ToTop( nFlags );
getDialog()->present();
}
bool TheExtensionManager::Close()
{
if ( m_pExtMgrDialog )
return m_pExtMgrDialog->Close();
else if ( m_pUpdReqDialog )
return m_pUpdReqDialog->Close();
else
return true;
if (m_xExtMgrDialog)
m_xExtMgrDialog->response(RET_CANCEL);
else if (m_xUpdReqDialog)
m_xUpdReqDialog->response(RET_CANCEL);
return true;
}
@ -175,10 +173,10 @@ sal_Int16 TheExtensionManager::execute()
{
sal_Int16 nRet = 0;
if ( m_pUpdReqDialog )
if ( m_xUpdReqDialog )
{
nRet = m_pUpdReqDialog->Execute();
m_pUpdReqDialog.disposeAndClear();
nRet = m_xUpdReqDialog->run();
m_xUpdReqDialog.reset();
}
return nRet;
@ -187,7 +185,7 @@ sal_Int16 TheExtensionManager::execute()
bool TheExtensionManager::isVisible()
{
return getDialog()->IsVisible();
return getDialog()->get_visible();
}
@ -221,7 +219,7 @@ void TheExtensionManager::checkUpdates()
}
}
m_pExecuteCmdQueue->checkForUpdates( vEntries );
m_xExecuteCmdQueue->checkForUpdates( vEntries );
}
@ -243,9 +241,9 @@ bool TheExtensionManager::installPackage( const OUString &rPackageURL, bool bWar
return false;
if ( bInstallForAll )
m_pExecuteCmdQueue->addExtension( rPackageURL, SHARED_PACKAGE_MANAGER, false );
m_xExecuteCmdQueue->addExtension( rPackageURL, SHARED_PACKAGE_MANAGER, false );
else
m_pExecuteCmdQueue->addExtension( rPackageURL, USER_PACKAGE_MANAGER, bWarnUser );
m_xExecuteCmdQueue->addExtension( rPackageURL, USER_PACKAGE_MANAGER, bWarnUser );
return true;
}
@ -256,8 +254,12 @@ void TheExtensionManager::terminateDialog()
if ( ! dp_misc::office_is_running() )
{
const SolarMutexGuard guard;
m_pExtMgrDialog.disposeAndClear();
m_pUpdReqDialog.disposeAndClear();
if (m_xExtMgrDialog)
m_xExtMgrDialog->response(RET_CANCEL);
assert(!m_xExtMgrDialog);
if (m_xUpdReqDialog)
m_xUpdReqDialog->response(RET_CANCEL);
assert(!m_xUpdReqDialog);
Application::Quit();
}
}
@ -421,22 +423,25 @@ void TheExtensionManager::disposing( lang::EventObject const & rEvt )
if ( dp_misc::office_is_running() )
{
const SolarMutexGuard guard;
m_pExtMgrDialog.disposeAndClear();
m_pUpdReqDialog.disposeAndClear();
if (m_xExtMgrDialog)
m_xExtMgrDialog->response(RET_CANCEL);
assert(!m_xExtMgrDialog);
if (m_xUpdReqDialog)
m_xUpdReqDialog->response(RET_CANCEL);
assert(!m_xUpdReqDialog);
}
s_ExtMgr.clear();
}
}
// XTerminateListener
void TheExtensionManager::queryTermination( ::lang::EventObject const & )
{
DialogHelper *pDialogHelper = getDialogHelper();
if ( m_pExecuteCmdQueue->isBusy() || ( pDialogHelper && pDialogHelper->isBusy() ) )
if ( m_xExecuteCmdQueue->isBusy() || ( pDialogHelper && pDialogHelper->isBusy() ) )
{
ToTop( ToTopFlags::RestoreWhenMin );
ToTop();
throw frame::TerminationVetoException(
"The office cannot be closed while the Extension Manager is running",
static_cast<frame::XTerminateListener*>(this));
@ -444,20 +449,18 @@ void TheExtensionManager::queryTermination( ::lang::EventObject const & )
else
{
clearModified();
if ( m_pExtMgrDialog )
m_pExtMgrDialog->Close();
if ( m_pUpdReqDialog )
m_pUpdReqDialog->Close();
if (m_xExtMgrDialog)
m_xExtMgrDialog->response(RET_CANCEL);
if (m_xUpdReqDialog)
m_xUpdReqDialog->response(RET_CANCEL);
}
}
void TheExtensionManager::notifyTermination( ::lang::EventObject const & rEvt )
{
disposing( rEvt );
}
// XModifyListener
void TheExtensionManager::modified( ::lang::EventObject const & /*rEvt*/ )
{

View file

@ -51,9 +51,9 @@ private:
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
css::uno::Reference< css::container::XNameAccess > m_xNameAccessNodes;
css::uno::Reference< css::awt::XWindow > m_xParent;
VclPtr<ExtMgrDialog> m_pExtMgrDialog;
VclPtr<UpdateRequiredDialog> m_pUpdReqDialog;
std::unique_ptr<ExtensionCmdQueue> m_pExecuteCmdQueue;
std::shared_ptr<ExtMgrDialog> m_xExtMgrDialog;
std::unique_ptr<UpdateRequiredDialog> m_xUpdReqDialog;
std::unique_ptr<ExtensionCmdQueue> m_xExecuteCmdQueue;
OUString m_sGetExtensionsURL;
bool m_bModified;
@ -71,23 +71,25 @@ public:
bool isModified() const { return m_bModified; }
void clearModified() { m_bModified = false; }
Dialog* getDialog()
weld::Window* getDialog()
{
if (m_pExtMgrDialog)
return m_pExtMgrDialog.get();
return m_pUpdReqDialog.get();
if (m_xExtMgrDialog)
return m_xExtMgrDialog->getDialog();
if (m_xUpdReqDialog)
return m_xUpdReqDialog->getDialog();
return nullptr;
}
DialogHelper* getDialogHelper()
{
if (m_pExtMgrDialog)
return m_pExtMgrDialog.get();
return m_pUpdReqDialog.get();
if (m_xExtMgrDialog)
return m_xExtMgrDialog.get();
return m_xUpdReqDialog.get();
}
ExtensionCmdQueue* getCmdQueue() const { return m_pExecuteCmdQueue.get(); }
ExtensionCmdQueue* getCmdQueue() const { return m_xExecuteCmdQueue.get(); }
void SetText( const OUString &rTitle );
void Show();
void ToTop( ToTopFlags nFlags );
void ToTop();
bool Close();
bool isVisible();

View file

@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dkt">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkDialog" id="ExtensionManagerDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="extensionmanager|ExtensionManagerDialog">Extension Manager</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@ -61,9 +65,28 @@
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="deploymentgui-ExtBoxWithBtns" id="extensions">
<object class="GtkScrolledWindow" id="scroll">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="extensions">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
@ -188,8 +211,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="halign">center</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
@ -205,8 +228,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
@ -222,8 +245,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="halign">end</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
@ -269,7 +292,6 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
@ -281,7 +303,7 @@
<property name="use_stock">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
@ -289,10 +311,11 @@
<object class="GtkProgressBar" id="progressbar">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
@ -309,17 +332,9 @@
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -338,7 +353,7 @@
</child>
<action-widgets>
<action-widget response="-11">help</action-widget>
<action-widget response="-7">close</action-widget>
<action-widget response="-6">close</action-widget>
</action-widgets>
</object>
</interface>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
<requires lib="gtk+" version="3.18"/>
<object class="GtkMenu" id="menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</interface>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dkt">
<requires lib="gtk+" version="3.18"/>
<requires lib="LibreOffice" version="1.0"/>
@ -7,102 +7,24 @@
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="title" translatable="yes" context="updaterequireddialog|UpdateRequiredDialog">Extension Update Required</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkLabel" id="updatelabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="updaterequireddialog|updatelabel">%PRODUCTNAME has been updated to a new version. Some installed %PRODUCTNAME extensions are not compatible with this version and need to be updated before they can be used.</property>
<property name="wrap">True</property>
<property name="max_width_chars">95</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="deploymentgui-ExtensionBox" id="extensions">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="progresslabel">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="updaterequireddialog|progresslabel">Adding %EXTENSION_NAME</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progress">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="check">
<object class="GtkButton" id="ok">
<property name="label" translatable="yes" context="updaterequireddialog|check">Check for _Updates...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -157,6 +79,7 @@
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
@ -167,10 +90,102 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkLabel" id="updatelabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="updaterequireddialog|updatelabel">%PRODUCTNAME has been updated to a new version. Some installed %PRODUCTNAME extensions are not compatible with this version and need to be updated before they can be used.</property>
<property name="wrap">True</property>
<property name="width_chars">95</property>
<property name="max_width_chars">95</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="extensions">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="progresslabel">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="label" translatable="yes" context="updaterequireddialog|progresslabel">Adding %EXTENSION_NAME</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkProgressBar" id="progress">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="101">check</action-widget>
<action-widget response="101">ok</action-widget>
<action-widget response="102">disable</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>

View file

@ -176,12 +176,6 @@
<glade-widget-class title="Table Preview" name="swuilo-AutoFmtPreview"
generic-name="Table Preview Window" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Extension List" name="deploymentgui-ExtensionBox"
generic-name="Extensions List" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Extension List With Buttons" name="deploymentgui-ExtBoxWithBtns"
generic-name="Extensions List With Buttons" parent="deploymentgui-ExtensionBox"
icon-name="widget-gtk-drawingarea"/>
<glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow"
generic-name="Print Preview" parent="GtkDrawingArea"
icon-name="widget-gtk-drawingarea"/>

View file

@ -140,7 +140,7 @@ public:
virtual VclPtr<VclAbstractDialog> CreateScriptErrorDialog( const css::uno::Any& rException ) = 0;
virtual VclPtr<VclAbstractDialog> CreateOptionsDialog(
vcl::Window* pParent, const OUString& rExtensionId ) = 0;
weld::Window* pParent, const OUString& rExtensionId ) = 0;
};
#endif

View file

@ -455,8 +455,6 @@ custom_widgets = [
'DriverListControl',
'DropdownBox',
'EmojiView',
'ExtBoxWithBtns',
'ExtensionBox',
'FontNameBox',
'FontSizeBox',
'FontStyleBox',

View file

@ -1,6 +1,6 @@
desktop/uiconfig/ui/dependenciesdialog.ui://GtkLabel[@id='label1'] orphan-label
desktop/uiconfig/ui/dependenciesdialog.ui://GtkTreeView[@id='depListTreeview'] no-labelled-by
desktop/uiconfig/ui/extensionmanager.ui://deploymentgui-ExtBoxWithBtns[@id='extensions'] no-labelled-by
desktop/uiconfig/ui/extensionmanager.ui://GtkDrawingArea[@id='extensions'] no-labelled-by
desktop/uiconfig/ui/extensionmanager.ui://GtkLabel[@id='progressft'] orphan-label
desktop/uiconfig/ui/extensionmanager.ui://GtkProgressBar[@id='progressbar'] no-labelled-by
desktop/uiconfig/ui/licensedialog.ui://GtkLabel[@id='head'] orphan-label
@ -17,6 +17,6 @@ desktop/uiconfig/ui/updatedialog.ui://GtkLabel[@id='DESCRIPTION_LABEL'] orphan-l
desktop/uiconfig/ui/updatedialog.ui://GtkTextView[@id='DESCRIPTIONS:border'] no-labelled-by
desktop/uiconfig/ui/updateinstalldialog.ui://GtkLabel[@id='EXTENSION_NAME'] orphan-label
desktop/uiconfig/ui/updaterequireddialog.ui://GtkLabel[@id='updatelabel'] orphan-label
desktop/uiconfig/ui/updaterequireddialog.ui://deploymentgui-ExtensionBox[@id='extensions'] no-labelled-by
desktop/uiconfig/ui/updaterequireddialog.ui://GtkDrawingArea[@id='extensions'] no-labelled-by
desktop/uiconfig/ui/updaterequireddialog.ui://GtkLabel[@id='progresslabel'] orphan-label
desktop/uiconfig/ui/updaterequireddialog.ui://GtkProgressBar[@id='progress'] no-labelled-by