[Libreoffice-commits] core.git: cui/source desktop/source desktop/uiconfig desktop/UIConfig_deployment.mk extras/source include/sfx2 solenv/bin solenv/sanitizers
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 14 14:34:53 UTC 2019
cui/source/factory/dlgfact.cxx | 4
cui/source/factory/dlgfact.hxx | 2
desktop/UIConfig_deployment.mk | 1
desktop/source/deployment/gui/dp_gui_dialog2.cxx | 599 +++++--------
desktop/source/deployment/gui/dp_gui_dialog2.hxx | 111 +-
desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 62 +
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 302 +++---
desktop/source/deployment/gui/dp_gui_extlistbox.hxx | 29
desktop/source/deployment/gui/dp_gui_service.cxx | 4
desktop/source/deployment/gui/dp_gui_theextmgr.cxx | 99 +-
desktop/source/deployment/gui/dp_gui_theextmgr.hxx | 26
desktop/uiconfig/ui/extensionmanager.ui | 55 -
desktop/uiconfig/ui/extensionmenu.ui | 9
desktop/uiconfig/ui/updaterequireddialog.ui | 187 ++--
extras/source/glade/libreoffice-catalog.xml.in | 6
include/sfx2/sfxdlg.hxx | 2
solenv/bin/native-code.py | 2
solenv/sanitizers/ui/desktop.suppr | 4
18 files changed, 721 insertions(+), 783 deletions(-)
New commits:
commit daa1ab5d59e3cee21324cdfa1329f2d36c4eda05
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jun 12 11:32:40 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jun 14 16:33:45 2019 +0200
weld ExtMgrDialog and UpdateRequiredDialog
Change-Id: I97e5cda847fd7f98990a87d0b1ca6d6b8b3f9d0f
Reviewed-on: https://gerrit.libreoffice.org/73899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 0c1fbe4612c8..af99be370a81 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -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)
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 58548d82463b..ca07530a4f94 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -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;
diff --git a/desktop/UIConfig_deployment.mk b/desktop/UIConfig_deployment.mk
index a1e08c8b599b..80e5e96c121a 100644
--- a/desktop/UIConfig_deployment.mk
+++ b/desktop/UIConfig_deployment.mk
@@ -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 \
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index da0a3cf3a1a8..0de89e91d050 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -101,35 +101,23 @@ struct StrAllFiles : public rtl::StaticWithInit< OUString, StrAllFiles >
}
};
-// ExtBoxWithBtns_Impl
-
-enum MENU_COMMAND
-{
- CMD_NONE = 0,
- CMD_REMOVE = 1,
- CMD_ENABLE,
- CMD_DISABLE,
- CMD_UPDATE,
- CMD_SHOW_LICENSE
-};
-
+// ExtBoxWithBtns_Impl
class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
{
bool m_bInterfaceLocked;
- VclPtr<ExtMgrDialog> m_pParent;
+ ExtMgrDialog* m_pParent;
void SetButtonStatus( const TEntry_Impl& rEntry );
- MENU_COMMAND ShowPopupMenu( const Point &rPos, const long nPos );
+ OString ShowPopupMenu( const Point &rPos, const long nPos );
public:
- explicit ExtBoxWithBtns_Impl(vcl::Window* pParent);
- virtual ~ExtBoxWithBtns_Impl() override;
- virtual void dispose() override;
+ explicit ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll);
void InitFromDialog(ExtMgrDialog *pParentDialog);
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
+ virtual bool ContextMenu( const CommandEvent& rCEvt ) override;
virtual void RecalcAll() override;
virtual void selectEntry( const long nPos ) override;
@@ -137,8 +125,8 @@ public:
void enableButtons( bool bEnable );
};
-ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl(vcl::Window* pParent)
- : ExtensionBox_Impl(pParent)
+ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll)
+ : ExtensionBox_Impl(std::move(xScroll))
, m_bInterfaceLocked(false)
, m_pParent(nullptr)
{
@@ -151,23 +139,6 @@ void ExtBoxWithBtns_Impl::InitFromDialog(ExtMgrDialog *pParentDialog)
m_pParent = pParentDialog;
}
-extern "C" SAL_DLLPUBLIC_EXPORT void makeExtBoxWithBtns(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &)
-{
- rRet = VclPtr<ExtBoxWithBtns_Impl>::Create(pParent);
-}
-
-ExtBoxWithBtns_Impl::~ExtBoxWithBtns_Impl()
-{
- disposeOnce();
-}
-
-void ExtBoxWithBtns_Impl::dispose()
-{
- m_pParent.clear();
- ExtensionBox_Impl::dispose();
-}
-
-
void ExtBoxWithBtns_Impl::RecalcAll()
{
const sal_Int32 nActive = getSelIndex();
@@ -243,15 +214,44 @@ void ExtBoxWithBtns_Impl::SetButtonStatus(const TEntry_Impl& rEntry)
}
}
-MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
+bool ExtBoxWithBtns_Impl::ContextMenu(const CommandEvent& rCEvt)
+{
+ if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
+ return false;
+
+ const Point aMousePos(rCEvt.GetMousePosPixel());
+ const auto nPos = PointToPos(aMousePos);
+ OString sCommand = ShowPopupMenu(aMousePos, nPos);
+
+ if (sCommand == "CMD_ENABLE")
+ m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
+ else if (sCommand == "CMD_DISABLE")
+ m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false );
+ else if (sCommand == "CMD_UPDATE")
+ m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage );
+ else if (sCommand == "CMD_REMOVE")
+ m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
+ else if (sCommand == "CMD_SHOW_LICENSE")
+ {
+ m_pParent->incBusy();
+ ShowLicenseDialog aLicenseDlg(m_pParent->getDialog(), GetEntryData(nPos)->m_xPackage);
+ aLicenseDlg.run();
+ m_pParent->decBusy();
+ }
+
+ return true;
+}
+
+OString ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
{
if ( nPos >= static_cast<long>(getItemCount()) )
- return CMD_NONE;
+ return "CMD_NONE";
- ScopedVclPtrInstance<PopupMenu> aPopup;
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "desktop/ui/extensionmenu.ui"));
+ std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
#if ENABLE_EXTENSION_UPDATE
- aPopup->InsertItem( CMD_UPDATE, DpResId( RID_CTX_ITEM_CHECK_UPDATE ) );
+ xPopup->append("CMD_UPDATE", DpResId( RID_CTX_ITEM_CHECK_UPDATE ) );
#endif
if ( ! GetEntryData( nPos )->m_bLocked )
@@ -259,61 +259,27 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
if ( GetEntryData( nPos )->m_bUser )
{
if ( GetEntryData( nPos )->m_eState == REGISTERED )
- aPopup->InsertItem( CMD_DISABLE, DpResId( RID_CTX_ITEM_DISABLE ) );
+ xPopup->append("CMD_DISABLE", DpResId(RID_CTX_ITEM_DISABLE));
else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
- aPopup->InsertItem( CMD_ENABLE, DpResId( RID_CTX_ITEM_ENABLE ) );
+ xPopup->append("CMD_ENABLE", DpResId(RID_CTX_ITEM_ENABLE));
}
if (!officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
{
- aPopup->InsertItem( CMD_REMOVE, DpResId( RID_CTX_ITEM_REMOVE ) );
+ xPopup->append("CMD_REMOVE", DpResId(RID_CTX_ITEM_REMOVE));
}
}
if ( !GetEntryData( nPos )->m_sLicenseText.isEmpty() )
- aPopup->InsertItem( CMD_SHOW_LICENSE, DpResId( RID_STR_SHOW_LICENSE_CMD ) );
+ xPopup->append("CMD_SHOW_LICENSE", DpResId(RID_STR_SHOW_LICENSE_CMD));
- return static_cast<MENU_COMMAND>(aPopup->Execute( this, rPos ));
+ return xPopup->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1, 1)));
}
-
-void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+bool ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
{
- if ( m_bInterfaceLocked )
- return;
-
- const Point aMousePos( rMEvt.GetPosPixel() );
- const long nPos = PointToPos( aMousePos );
-
- if ( rMEvt.IsRight() )
- {
- switch( ShowPopupMenu( aMousePos, nPos ) )
- {
- case CMD_NONE: break;
- case CMD_ENABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
- break;
- case CMD_DISABLE: m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false );
- break;
- case CMD_UPDATE: m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage );
- break;
- case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
- break;
- case CMD_SHOW_LICENSE:
- {
- ShowLicenseDialog aLicenseDlg(m_pParent->GetFrameWeld(), GetEntryData(nPos)->m_xPackage);
- aLicenseDlg.run();
- break;
- }
- }
- }
- else if ( rMEvt.IsLeft() )
- {
- const SolarMutexGuard aGuard;
- if ( rMEvt.IsMod1() && HasActive() )
- selectEntry( ExtensionBox_Impl::ENTRY_NOTFOUND );
- // selecting a not existing entry will deselect the current one
- else
- selectEntry( nPos );
- }
+ if (m_bInterfaceLocked)
+ return false;
+ return ExtensionBox_Impl::MouseButtonDown(rMEvt);
}
void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
@@ -337,8 +303,8 @@ void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
// DialogHelper
DialogHelper::DialogHelper(const uno::Reference< uno::XComponentContext > &xContext,
- Dialog *pWindow)
- : m_xVCLWindow(pWindow)
+ weld::Window* pWindow)
+ : m_pWindow(pWindow)
, m_nEventID(nullptr)
{
m_xContext = xContext;
@@ -458,14 +424,13 @@ void DialogHelper::PostUserEvent( const Link<void*,void>& rLink, void* pCaller )
if ( m_nEventID )
Application::RemoveUserEvent( m_nEventID );
- m_nEventID = Application::PostUserEvent( rLink, pCaller, true/*bReferenceLink*/ );
+ m_nEventID = Application::PostUserEvent(rLink, pCaller);
}
// ExtMgrDialog
-ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager, Dialog::InitFlag eFlag)
- : ModelessDialog(pParent, "ExtensionManagerDialog", "desktop/ui/extensionmanager.ui", eFlag)
- , DialogHelper(pManager->getContext(), static_cast<Dialog*>(this))
- , m_xRestartParent(pParent ? pParent : Application::GetDefDialogParent())
+ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
+ : GenericDialogController(pParent, "desktop/ui/extensionmanager.ui", "ExtensionManagerDialog")
+ , DialogHelper(pManager->getContext(), m_xDialog.get())
, m_sAddPackages(DpResId(RID_STR_ADD_PACKAGES))
, m_bHasProgress(false)
, m_bProgressChanged(false)
@@ -477,60 +442,60 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager,
, m_bClosed(false)
, m_nProgress(0)
, m_pManager(pManager)
-{
- get(m_pExtensionBox, "extensions");
- get(m_pOptionsBtn, "optionsbtn");
- get(m_pAddBtn, "addbtn");
- get(m_pRemoveBtn, "removebtn");
- get(m_pEnableBtn, "enablebtn");
- get(m_pUpdateBtn, "updatebtn");
- get(m_pCloseBtn, "close");
- get(m_pBundledCbx, "bundled");
- get(m_pSharedCbx, "shared");
- get(m_pUserCbx, "user");
- get(m_pGetExtensions, "getextensions");
- get(m_pProgressText, "progressft");
- get(m_pProgressBar, "progressbar");
- get(m_pCancelBtn, "cancel");
-
- m_pExtensionBox->InitFromDialog(this);
-
- m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
-
- m_pOptionsBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleOptionsBtn ) );
- m_pAddBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) );
- m_pRemoveBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleRemoveBtn ) );
- m_pEnableBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleEnableBtn ) );
- m_pCloseBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleCloseBtn ) );
-
- m_pCancelBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
-
- m_pBundledCbx->SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
- m_pSharedCbx->SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
- m_pUserCbx->SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
-
- m_pBundledCbx->Check();
- m_pSharedCbx->Check();
- m_pUserCbx->Check();
-
- m_pProgressBar->Hide();
+ , m_xExtensionBox(new ExtBoxWithBtns_Impl(m_xBuilder->weld_scrolled_window("scroll")))
+ , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, "extensions", *m_xExtensionBox))
+ , m_xOptionsBtn(m_xBuilder->weld_button("optionsbtn"))
+ , m_xAddBtn(m_xBuilder->weld_button("addbtn"))
+ , m_xRemoveBtn(m_xBuilder->weld_button("removebtn"))
+ , m_xEnableBtn(m_xBuilder->weld_button("enablebtn"))
+ , m_xUpdateBtn(m_xBuilder->weld_button("updatebtn"))
+ , m_xCloseBtn(m_xBuilder->weld_button("close"))
+ , m_xBundledCbx(m_xBuilder->weld_check_button("bundled"))
+ , m_xSharedCbx(m_xBuilder->weld_check_button("shared"))
+ , m_xUserCbx(m_xBuilder->weld_check_button("user"))
+ , m_xGetExtensions(m_xBuilder->weld_link_button("getextensions"))
+ , m_xProgressText(m_xBuilder->weld_label("progressft"))
+ , m_xProgressBar(m_xBuilder->weld_progress_bar("progressbar"))
+ , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
+{
+ m_xExtensionBox->InitFromDialog(this);
+
+ m_xEnableBtn->set_help_id(HID_EXTENSION_MANAGER_LISTBOX_ENABLE);
+
+ m_xOptionsBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleOptionsBtn ) );
+ m_xAddBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleAddBtn ) );
+ m_xRemoveBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleRemoveBtn ) );
+ m_xEnableBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleEnableBtn ) );
+ m_xCloseBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCloseBtn ) );
+
+ m_xCancelBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
+
+ m_xBundledCbx->connect_clicked( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
+ m_xSharedCbx->connect_clicked( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
+ m_xUserCbx->connect_clicked( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
+
+ m_xBundledCbx->set_active(true);
+ m_xSharedCbx->set_active(true);
+ m_xUserCbx->set_active(true);
+
+ m_xProgressBar->hide();
#if ENABLE_EXTENSION_UPDATE
- m_pUpdateBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
- m_pUpdateBtn->Enable(false);
+ m_xUpdateBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
+ m_xUpdateBtn->set_sensitive(false);
#else
- m_pUpdateBtn->Hide();
+ m_xUpdateBtn->hide();
#endif
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
{
- m_pAddBtn->Disable();
- m_pAddBtn->SetQuickHelpText(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
+ m_xAddBtn->set_sensitive(false);
+ m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
}
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
{
- m_pRemoveBtn->Disable();
- m_pRemoveBtn->SetQuickHelpText(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
+ m_xRemoveBtn->set_sensitive(false);
+ m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
}
m_aIdle.SetPriority(TaskPriority::LOWEST);
@@ -538,75 +503,52 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager,
m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
}
-
ExtMgrDialog::~ExtMgrDialog()
{
- disposeOnce();
-}
-
-void ExtMgrDialog::dispose()
-{
m_aIdle.Stop();
- m_pExtensionBox.clear();
- m_pOptionsBtn.clear();
- m_pAddBtn.clear();
- m_pRemoveBtn.clear();
- m_pEnableBtn.clear();
- m_pUpdateBtn.clear();
- m_pCloseBtn.clear();
- m_pBundledCbx.clear();
- m_pSharedCbx.clear();
- m_pUserCbx.clear();
- m_pGetExtensions.clear();
- m_pProgressText.clear();
- m_pProgressBar.clear();
- m_pCancelBtn.clear();
- m_xRestartParent.clear();
- ModelessDialog::dispose();
}
-
void ExtMgrDialog::setGetExtensionsURL( const OUString &rURL )
{
- m_pGetExtensions->SetURL( rURL );
+ m_xGetExtensions->set_uri( rURL );
}
void ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
bool bLicenseMissing )
{
const SolarMutexGuard aGuard;
- m_pUpdateBtn->Enable();
+ m_xUpdateBtn->set_sensitive(true);
- if (m_pBundledCbx->IsChecked() && (xPackage->getRepositoryName() == BUNDLED_PACKAGE_MANAGER) )
+ if (m_xBundledCbx->get_active() && (xPackage->getRepositoryName() == BUNDLED_PACKAGE_MANAGER) )
{
- m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
+ m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
}
- else if (m_pSharedCbx->IsChecked() && (xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER) )
+ else if (m_xSharedCbx->get_active() && (xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER) )
{
- m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
+ m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
}
- else if (m_pUserCbx->IsChecked() && (xPackage->getRepositoryName() == USER_PACKAGE_MANAGER ))
+ else if (m_xUserCbx->get_active() && (xPackage->getRepositoryName() == USER_PACKAGE_MANAGER ))
{
- m_pExtensionBox->addEntry( xPackage, bLicenseMissing );
+ m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
}
}
void ExtMgrDialog::prepareChecking()
{
- m_pExtensionBox->prepareChecking();
+ m_xExtensionBox->prepareChecking();
}
void ExtMgrDialog::checkEntries()
{
const SolarMutexGuard guard;
- m_pExtensionBox->checkEntries();
+ m_xExtensionBox->checkEntries();
}
bool ExtMgrDialog::removeExtensionWarn(const OUString &rExtensionName)
{
const SolarMutexGuard guard;
incBusy();
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::OkCancel,
DpResId(RID_STR_WARNING_REMOVE_EXTENSION)));
@@ -629,12 +571,12 @@ void ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &
if ( bEnable )
{
- if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning))
+ if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning))
return;
}
else
{
- if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning))
+ if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning))
return;
}
@@ -653,7 +595,7 @@ void ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > &
return;
}
- if (!continueOnSharedExtension(xPackage, GetFrameWeld(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning))
+ if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning))
return;
m_pManager->getCmdQueue()->removeExtension( xPackage );
@@ -692,7 +634,7 @@ bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > &
uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
{
- sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld());
+ sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
const uno::Reference<ui::dialogs::XFilePicker3>& xFilePicker = aDlgHelper.GetFilePicker();
xFilePicker->setTitle( m_sAddPackages );
@@ -757,43 +699,43 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
void ExtMgrDialog::enableOptionsButton( bool bEnable )
{
- m_pOptionsBtn->Enable( bEnable );
+ m_xOptionsBtn->set_sensitive( bEnable );
}
void ExtMgrDialog::enableRemoveButton( bool bEnable )
{
- m_pRemoveBtn->Enable( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get());
+ m_xRemoveBtn->set_sensitive( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get());
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
{
- m_pRemoveBtn->SetQuickHelpText(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
+ m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
}
else
{
- m_pRemoveBtn->SetQuickHelpText("");
+ m_xRemoveBtn->set_tooltip_text("");
}
}
void ExtMgrDialog::enableEnableButton( bool bEnable )
{
- m_pEnableBtn->Enable( bEnable );
+ m_xEnableBtn->set_sensitive( bEnable );
}
void ExtMgrDialog::enableButtontoEnable( bool bEnable )
{
if (bEnable)
{
- m_pEnableBtn->SetText( DpResId( RID_CTX_ITEM_ENABLE ) );
- m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
+ m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_ENABLE ) );
+ m_xEnableBtn->set_help_id( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
}
else
{
- m_pEnableBtn->SetText( DpResId( RID_CTX_ITEM_DISABLE ) );
- m_pEnableBtn->SetHelpId( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
+ m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_DISABLE ) );
+ m_xEnableBtn->set_help_id( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
}
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, weld::Button&, void)
{
if ( m_xAbortChannel.is() )
{
@@ -808,11 +750,28 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, Button*, void)
}
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void)
{
- Close();
-}
+ bool bCallClose = true;
+
+ //only suggest restart if modified and this is the first close attempt
+ if (!m_bClosed && m_pManager->isModified())
+ {
+ m_pManager->clearModified();
+
+ //only suggest restart if we're actually running, e.g. not from standalone unopkg gui
+ if (dp_misc::office_is_running())
+ {
+ SolarMutexGuard aGuard;
+ bCallClose = !::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
+ m_xDialog.get(),
+ svtools::RESTART_REASON_EXTENSION_INSTALL);
+ }
+ }
+ if (bCallClose)
+ m_xDialog->response(RET_CANCEL);
+}
IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
{
@@ -824,8 +783,8 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
if ( m_bStopProgress )
{
- if ( m_pProgressBar->IsVisible() )
- m_pProgressBar->SetValue( 100 );
+ if ( m_xProgressBar->get_visible() )
+ m_xProgressBar->set_percentage( 100 );
m_xAbortChannel.clear();
SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
@@ -835,19 +794,19 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
SAL_INFO( "desktop.deployment", " startProgress handler: start" );
}
- m_pCancelBtn->Enable( bLockInterface );
- m_pAddBtn->Enable( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get());
+ m_xCancelBtn->set_sensitive( bLockInterface );
+ m_xAddBtn->set_sensitive( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get());
if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
{
- m_pAddBtn->SetQuickHelpText(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
+ m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
}
else
{
- m_pAddBtn->SetQuickHelpText("");
+ m_xAddBtn->set_tooltip_text("");
}
- m_pUpdateBtn->Enable( !bLockInterface && m_pExtensionBox->getItemCount() );
- m_pExtensionBox->enableButtons( !bLockInterface );
+ m_xUpdateBtn->set_sensitive( !bLockInterface && m_xExtensionBox->getItemCount() );
+ m_xExtensionBox->enableButtons( !bLockInterface );
clearEventID();
}
@@ -903,25 +862,25 @@ void ExtMgrDialog::updateProgress( const OUString &rText,
void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
{
const SolarMutexGuard aGuard;
- m_pExtensionBox->updateEntry( xPackage );
+ m_xExtensionBox->updateEntry( xPackage );
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, weld::Button&, void)
{
- const sal_Int32 nActive = m_pExtensionBox->getSelIndex();
+ const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
{
SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- OUString sExtensionId = m_pExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
- ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog( this, sExtensionId ));
+ OUString sExtensionId = m_xExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
+ ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog(m_xDialog.get(), sExtensionId));
pDlg->Execute();
}
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, weld::Button&, void)
{
incBusy();
@@ -935,24 +894,24 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, Button*, void)
decBusy();
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleRemoveBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleRemoveBtn, weld::Button&, void)
{
- const sal_Int32 nActive = m_pExtensionBox->getSelIndex();
+ const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
{
- TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nActive );
+ TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
removePackage( pEntry->m_xPackage );
}
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, weld::Button&, void)
{
- const sal_Int32 nActive = m_pExtensionBox->getSelIndex();
+ const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
{
- TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nActive );
+ TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
if ( pEntry->m_bMissingLic )
acceptLicense( pEntry->m_xPackage );
@@ -964,7 +923,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, Button*, void)
}
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, weld::Button&, void)
{
// re-creates the list of packages with addEntry selecting the packages
prepareChecking();
@@ -972,7 +931,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, Button*, void)
checkEntries();
}
-IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, Button*, void)
+IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, weld::Button&, void)
{
#if ENABLE_EXTENSION_UPDATE
m_pManager->checkUpdates();
@@ -987,83 +946,43 @@ IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Timer *, void)
{
m_bHasProgress = false;
m_bStopProgress = false;
- m_pProgressText->Hide();
- m_pProgressBar->Hide();
- m_pCancelBtn->Hide();
+ m_xProgressText->hide();
+ m_xProgressBar->hide();
+ m_xCancelBtn->hide();
}
else
{
if ( m_bProgressChanged )
{
m_bProgressChanged = false;
- m_pProgressText->SetText(m_sProgressText);
+ m_xProgressText->set_label(m_sProgressText);
}
if ( m_bStartProgress )
{
m_bStartProgress = false;
m_bHasProgress = true;
- m_pProgressBar->Show();
- m_pProgressText->Show();
- m_pCancelBtn->Enable();
- m_pCancelBtn->Show();
+ m_xProgressBar->show();
+ m_xProgressText->show();
+ m_xCancelBtn->set_sensitive(true);
+ m_xCancelBtn->show();
}
- if ( m_pProgressBar->IsVisible() )
- m_pProgressBar->SetValue( static_cast<sal_uInt16>(m_nProgress) );
+ if ( m_xProgressBar->get_visible() )
+ m_xProgressBar->set_percentage( static_cast<sal_uInt16>(m_nProgress) );
}
}
-
-// VCL::Window / Dialog
-
-bool ExtMgrDialog::EventNotify( NotifyEvent& rNEvt )
+void ExtMgrDialog::Close()
{
- bool bHandled = false;
-
- if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
- {
- const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
- vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
-
- if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
- bHandled = m_pExtensionBox->EventNotify(rNEvt);
- }
-// VclEventId::WindowClose
- if ( !bHandled )
- return ModelessDialog::EventNotify(rNEvt);
- else
- return true;
-}
-
-IMPL_STATIC_LINK(ExtMgrDialog, Restart, void*, pParent, void)
-{
- SolarMutexGuard aGuard;
- ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
- pParent ? static_cast<vcl::Window*>(pParent)->GetFrameWeld() : nullptr,
- svtools::RESTART_REASON_EXTENSION_INSTALL);
-}
-
-bool ExtMgrDialog::Close()
-{
- bool bRet = ModelessDialog::Close();
m_pManager->terminateDialog();
- //only suggest restart if modified and this is the first close attempt
- if (!m_bClosed && m_pManager->isModified())
- {
- m_pManager->clearModified();
- //only suggest restart if we're actually running, e.g. not from standalone unopkg gui
- if (dp_misc::office_is_running())
- Application::PostUserEvent(LINK(nullptr, ExtMgrDialog, Restart), m_xRestartParent);
- }
m_bClosed = true;
- return bRet;
}
//UpdateRequiredDialog
-UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionManager *pManager)
- : ModalDialog(pParent, "UpdateRequiredDialog", "desktop/ui/updaterequireddialog.ui")
- , DialogHelper(pManager->getContext(), static_cast<Dialog*>(this))
+UpdateRequiredDialog::UpdateRequiredDialog(weld::Window *pParent, TheExtensionManager *pManager)
+ : GenericDialogController(pParent, "desktop/ui/updaterequireddialog.ui", "UpdateRequiredDialog")
+ , DialogHelper(pManager->getContext(), m_xDialog.get())
, m_sCloseText(DpResId(RID_STR_CLOSE_BTN))
, m_bHasProgress(false)
, m_bProgressChanged(false)
@@ -1072,28 +991,29 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
, m_bHasLockedEntries(false)
, m_nProgress(0)
, m_pManager(pManager)
-{
- get(m_pExtensionBox, "extensions");
- m_pExtensionBox->setExtensionManager(pManager);
- get(m_pUpdateNeeded, "updatelabel");
- get(m_pUpdateBtn, "check");
- get(m_pCloseBtn, "disable");
- get(m_pCancelBtn, "cancel");
- get(m_pProgressText, "progresslabel");
- get(m_pProgressBar, "progress");
-
- m_pUpdateBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
- m_pCloseBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
- m_pCancelBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
-
- OUString aText = m_pUpdateNeeded->GetText();
+ , m_xExtensionBox(new ExtensionBox_Impl(m_xBuilder->weld_scrolled_window("scroll")))
+ , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, "extensions", *m_xExtensionBox))
+ , m_xUpdateNeeded(m_xBuilder->weld_label("updatelabel"))
+ , m_xUpdateBtn(m_xBuilder->weld_button("ok"))
+ , m_xCloseBtn(m_xBuilder->weld_button("disable"))
+ , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
+ , m_xProgressText(m_xBuilder->weld_label("progresslabel"))
+ , m_xProgressBar(m_xBuilder->weld_progress_bar("progress"))
+{
+ m_xExtensionBox->setExtensionManager(pManager);
+
+ m_xUpdateBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
+ m_xCloseBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
+ m_xCancelBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
+
+ OUString aText = m_xUpdateNeeded->get_label();
aText = aText.replaceAll(
"%PRODUCTNAME", utl::ConfigManager::getProductName());
- m_pUpdateNeeded->SetText(aText);
+ m_xUpdateNeeded->set_label(aText);
- m_pProgressBar->Hide();
- m_pUpdateBtn->Enable( false );
- m_pCloseBtn->GrabFocus();
+ m_xProgressBar->hide();
+ m_xUpdateBtn->set_sensitive( false );
+ m_xCloseBtn->grab_focus();
m_aIdle.SetPriority( TaskPriority::LOWEST );
m_aIdle.SetDebugName( "UpdateRequiredDialog m_aIdle TimeOutHdl" );
@@ -1102,20 +1022,7 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
UpdateRequiredDialog::~UpdateRequiredDialog()
{
- disposeOnce();
-}
-
-void UpdateRequiredDialog::dispose()
-{
m_aIdle.Stop();
- m_pExtensionBox.clear();
- m_pUpdateNeeded.clear();
- m_pUpdateBtn.clear();
- m_pCloseBtn.clear();
- m_pCancelBtn.clear();
- m_pProgressText.clear();
- m_pProgressBar.clear();
- ModalDialog::dispose();
}
void UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
@@ -1126,32 +1033,32 @@ void UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::X
{
m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage );
const SolarMutexGuard aGuard;
- m_pUpdateBtn->Enable();
- m_pExtensionBox->addEntry( xPackage );
+ m_xUpdateBtn->set_sensitive(true);
+ m_xExtensionBox->addEntry( xPackage );
}
}
void UpdateRequiredDialog::prepareChecking()
{
- m_pExtensionBox->prepareChecking();
+ m_xExtensionBox->prepareChecking();
}
void UpdateRequiredDialog::checkEntries()
{
const SolarMutexGuard guard;
- m_pExtensionBox->checkEntries();
+ m_xExtensionBox->checkEntries();
if ( ! hasActiveEntries() )
{
- m_pCloseBtn->SetText( m_sCloseText );
- m_pCloseBtn->GrabFocus();
+ m_xCloseBtn->set_label( m_sCloseText );
+ m_xCloseBtn->grab_focus();
}
}
-IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn, Button*, void)
+IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn, weld::Button&, void)
{
if ( m_xAbortChannel.is() )
{
@@ -1177,8 +1084,8 @@ IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
if ( m_bStopProgress )
{
- if ( m_pProgressBar->IsVisible() )
- m_pProgressBar->SetValue( 100 );
+ if ( m_xProgressBar->get_visible() )
+ m_xProgressBar->set_percentage( 100 );
m_xAbortChannel.clear();
SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
}
@@ -1187,8 +1094,8 @@ IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
SAL_INFO( "desktop.deployment", " startProgress handler: start" );
}
- m_pCancelBtn->Enable( bLockInterface );
- m_pUpdateBtn->Enable( false );
+ m_xCancelBtn->set_sensitive( bLockInterface );
+ m_xUpdateBtn->set_sensitive( false );
clearEventID();
}
@@ -1247,28 +1154,28 @@ void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::
// of the 'disable all' button
const SolarMutexGuard aGuard;
if ( isEnabled( xPackage ) && checkDependencies( xPackage ) )
- m_pExtensionBox->removeEntry( xPackage );
+ m_xExtensionBox->removeEntry( xPackage );
else
- m_pExtensionBox->updateEntry( xPackage );
+ m_xExtensionBox->updateEntry( xPackage );
if ( ! hasActiveEntries() )
{
- m_pCloseBtn->SetText( m_sCloseText );
- m_pCloseBtn->GrabFocus();
+ m_xCloseBtn->set_label( m_sCloseText );
+ m_xCloseBtn->grab_focus();
}
}
-IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, Button*, void)
+IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void)
{
::osl::ClearableMutexGuard aGuard( m_aMutex );
std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
- sal_Int32 nCount = m_pExtensionBox->GetEntryCount();
+ sal_Int32 nCount = m_xExtensionBox->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
- TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( i );
+ TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( i );
vUpdateEntries.push_back( pEntry->m_xPackage );
}
@@ -1278,18 +1185,18 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, Button*, void)
}
-IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, Button*, void)
+IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, weld::Button&, void)
{
::osl::MutexGuard aGuard( m_aMutex );
if ( !isBusy() )
{
if ( m_bHasLockedEntries )
- EndDialog( -1 );
+ m_xDialog->response(-1);
else if ( hasActiveEntries() )
disableAllEntries();
else
- EndDialog();
+ m_xDialog->response(RET_CANCEL);
}
}
@@ -1300,35 +1207,35 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, TimeOutHdl, Timer *, void)
{
m_bHasProgress = false;
m_bStopProgress = false;
- m_pProgressText->Hide();
- m_pProgressBar->Hide();
- m_pCancelBtn->Hide();
+ m_xProgressText->hide();
+ m_xProgressBar->hide();
+ m_xCancelBtn->hide();
}
else
{
if ( m_bProgressChanged )
{
m_bProgressChanged = false;
- m_pProgressText->SetText( m_sProgressText );
+ m_xProgressText->set_label( m_sProgressText );
}
if ( m_bStartProgress )
{
m_bStartProgress = false;
m_bHasProgress = true;
- m_pProgressBar->Show();
- m_pProgressText->Show();
- m_pCancelBtn->Enable();
- m_pCancelBtn->Show();
+ m_xProgressBar->show();
+ m_xProgressText->show();
+ m_xCancelBtn->set_sensitive(true);
+ m_xCancelBtn->show();
}
- if ( m_pProgressBar->IsVisible() )
- m_pProgressBar->SetValue( static_cast<sal_uInt16>(m_nProgress) );
+ if (m_xProgressBar->get_visible())
+ m_xProgressBar->set_percentage(m_nProgress);
}
}
// VCL::Dialog
-short UpdateRequiredDialog::Execute()
+short UpdateRequiredDialog::run()
{
//ToDo
//I believe m_bHasLockedEntries was used to prevent showing extensions which cannot
@@ -1340,35 +1247,15 @@ short UpdateRequiredDialog::Execute()
if ( m_bHasLockedEntries )
{
// Set other text, disable update btn, remove not shared entries from list;
- m_pUpdateNeeded->SetText( DpResId( RID_STR_NO_ADMIN_PRIVILEGE ) );
- m_pCloseBtn->SetText( DpResId( RID_STR_EXIT_BTN ) );
- m_pUpdateBtn->Enable( false );
- m_pExtensionBox->RemoveUnlocked();
- Resize();
- }
-
- return Dialog::Execute();
-}
-
-// VCL::Dialog
-bool UpdateRequiredDialog::Close()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !isBusy() )
- {
- if ( m_bHasLockedEntries )
- EndDialog( -1 );
- else if ( hasActiveEntries() )
- disableAllEntries();
- else
- EndDialog();
+ m_xUpdateNeeded->set_label( DpResId( RID_STR_NO_ADMIN_PRIVILEGE ) );
+ m_xCloseBtn->set_label( DpResId( RID_STR_EXIT_BTN ) );
+ m_xUpdateBtn->set_sensitive( false );
+ m_xExtensionBox->RemoveUnlocked();
}
- return false;
+ return GenericDialogController::run();
}
-
// Check dependencies of all packages
bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage )
@@ -1415,10 +1302,10 @@ bool UpdateRequiredDialog::hasActiveEntries()
::osl::MutexGuard aGuard( m_aMutex );
bool bRet = false;
- long nCount = m_pExtensionBox->GetEntryCount();
+ long nCount = m_xExtensionBox->GetEntryCount();
for ( long nIndex = 0; nIndex < nCount; nIndex++ )
{
- TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+ TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
if ( isEnabled(pEntry->m_xPackage) && !checkDependencies( pEntry->m_xPackage ) )
{
@@ -1437,17 +1324,17 @@ void UpdateRequiredDialog::disableAllEntries()
incBusy();
- long nCount = m_pExtensionBox->GetEntryCount();
+ long nCount = m_xExtensionBox->GetEntryCount();
for ( long nIndex = 0; nIndex < nCount; nIndex++ )
{
- TEntry_Impl pEntry = m_pExtensionBox->GetEntryData( nIndex );
+ TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
m_pManager->getCmdQueue()->enableExtension( pEntry->m_xPackage, false );
}
decBusy();
if ( ! hasActiveEntries() )
- m_pCloseBtn->SetText( m_sCloseText );
+ m_xCloseBtn->set_label( m_sCloseText );
}
// ShowLicenseDialog
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index afb375fb16cd..84a755677843 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -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,
diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
index 9d60a0a607db..9fada8ce9db3 100644
--- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx
@@ -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() );
}
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 9d987b18bfce..e0691e6430ee 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -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,29 +215,15 @@ 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,64 +735,93 @@ 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());
}
-}
-
-bool ExtensionBox_Impl::EventNotify( NotifyEvent& rNEvt )
-{
- if ( !m_bInDelete )
- DeleteRemoved();
+ if (bOverHyperlink)
+ SetPointer(PointerStyle::RefHand);
+ else
+ SetPointer(PointerStyle::Arrow);
- bool bHandled = false;
+ return false;
+}
- if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
+OUString ExtensionBox_Impl::RequestHelp(tools::Rectangle& rRect)
+{
+ auto nPos = PointToPos( rRect.TopLeft() );
+ if ( ( nPos >= 0 ) && ( nPos < static_cast<long>(m_vEntries.size()) ) )
{
- 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 );
+ 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;
+ }
}
- if ( rNEvt.GetType() == MouseNotifyEvent::COMMAND )
+ return OUString();
+}
+
+bool ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( rMEvt.IsLeft() )
{
- if ( m_bHasScrollBar &&
- ( rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel ) )
+ if (rMEvt.IsMod1() && m_bHasActive)
+ selectEntry(ExtensionBox_Impl::ENTRY_NOTFOUND); // Selecting a not existing entry will deselect the current one
+ else
{
- const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == CommandWheelMode::SCROLL )
+ auto nPos = PointToPos( rMEvt.GetPosPixel() );
+
+ if ( ( nPos >= 0 ) && ( nPos < static_cast<long>(m_vEntries.size()) ) )
{
- long nThumbPos = m_pScrollBar->GetThumbPos();
- if ( pData->GetDelta() < 0 )
- m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
- else
- m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
- bHandled = true;
+ 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;
}
- if ( !bHandled )
- return Control::EventNotify(rNEvt);
- else
- 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);
+
+ 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 )
-{
- 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 )
+IMPL_LINK(ExtensionBox_Impl, ScrollHdl, weld::ScrolledWindow&, rScrBar, void)
{
- DoScroll( pScrBar->GetDelta() );
+ m_nTopIndex = rScrBar.vadjustment_get_value();
+ Invalidate();
}
} //namespace dp_gui
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 79397f30ddbb..ccdc63e42526 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -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();
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index a8e0f37b1388..12683e6af260 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -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();
}
}
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 2693d44836ce..65b4e1c0592c 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -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*/ )
{
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
index 4980458f0dfd..c75ec34872b0 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx
@@ -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();
diff --git a/desktop/uiconfig/ui/extensionmanager.ui b/desktop/uiconfig/ui/extensionmanager.ui
index da108c5c6d0a..b749f057d806 100644
--- a/desktop/uiconfig/ui/extensionmanager.ui
+++ b/desktop/uiconfig/ui/extensionmanager.ui
@@ -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/>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list