summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-14 11:30:55 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-01-14 14:34:46 +0100
commit85307c10d3ca4d7c9ed3fa1ca3700a6330b09da8 (patch)
treeaa29b3fb22d729f38009e12b8879b749d6f40053 /sw
parenta41fe32ba989cad3b6e2e20793b3fff469230eb6 (diff)
rework PageColumnPopup to be a PopupWindowController
Change-Id: I00d0ce6001f2eb3076c699bca7c64a72b94716c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86751 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/PageColumnPopup.hxx18
-rw-r--r--sw/source/uibase/app/swmodule.cxx1
-rw-r--r--sw/source/uibase/sidebar/PageColumnControl.cxx7
-rw-r--r--sw/source/uibase/sidebar/PageColumnControl.hxx8
-rw-r--r--sw/source/uibase/sidebar/PageColumnPopup.cxx38
-rw-r--r--sw/util/sw.component4
6 files changed, 54 insertions, 22 deletions
diff --git a/sw/inc/PageColumnPopup.hxx b/sw/inc/PageColumnPopup.hxx
index b0df45df4a96..a16b2893c807 100644
--- a/sw/inc/PageColumnPopup.hxx
+++ b/sw/inc/PageColumnPopup.hxx
@@ -19,18 +19,24 @@
#ifndef INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX
#define INCLUDED_SW_INC_PAGECOLUMNPOPUP_HXX
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
#include "swdllapi.h"
-class PageColumnPopup final : public SfxToolBoxControl
+class PageColumnPopup final : public svt::PopupWindowController
{
public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- PageColumnPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ PageColumnPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
virtual ~PageColumnPopup() override;
- virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
+ using svt::ToolboxController::createPopupWindow;
+ virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& rArguments ) override;
};
#endif
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 613dda8d345f..508dd07fdc8a 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -281,7 +281,6 @@ void SwDLL::RegisterControls()
svx::ParaFirstLineSpacingControl::RegisterControl(SID_ATTR_PARA_FIRSTLINESPACE, pMod);
PageMarginPopup::RegisterControl(SID_ATTR_PAGE_MARGIN, pMod);
PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod);
- PageColumnPopup::RegisterControl(SID_ATTR_PAGE_COLUMN, pMod);
SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
diff --git a/sw/source/uibase/sidebar/PageColumnControl.cxx b/sw/source/uibase/sidebar/PageColumnControl.cxx
index 6532472e5a9e..a7ee125ce33d 100644
--- a/sw/source/uibase/sidebar/PageColumnControl.cxx
+++ b/sw/source/uibase/sidebar/PageColumnControl.cxx
@@ -19,6 +19,7 @@
#include <memory>
#include "PageColumnControl.hxx"
+#include <PageColumnPopup.hxx>
#include <cmdid.h>
@@ -30,8 +31,8 @@
namespace sw { namespace sidebar {
-PageColumnControl::PageColumnControl( sal_uInt16 nId, vcl::Window* pParent )
- : SfxPopupWindow( nId, pParent, "PageColumnControl", "modules/swriter/ui/pagecolumncontrol.ui" )
+PageColumnControl::PageColumnControl(PageColumnPopup* pControl, vcl::Window* pParent)
+ : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageColumnControl", "modules/swriter/ui/pagecolumncontrol.ui" )
{
get( m_pMoreButton, "moreoptions" );
@@ -89,7 +90,7 @@ void PageColumnControl::dispose()
m_pLeft.disposeAndClear();
m_pRight.disposeAndClear();
m_pMoreButton.disposeAndClear();
- SfxPopupWindow::dispose();
+ ToolbarPopup::dispose();
}
void PageColumnControl::ExecuteColumnChange( const sal_uInt16 nColumnType )
diff --git a/sw/source/uibase/sidebar/PageColumnControl.hxx b/sw/source/uibase/sidebar/PageColumnControl.hxx
index 974d0632ab6f..a5a6ec3ef95b 100644
--- a/sw/source/uibase/sidebar/PageColumnControl.hxx
+++ b/sw/source/uibase/sidebar/PageColumnControl.hxx
@@ -19,15 +19,17 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGECOLUMNCONTROL_HXX
#define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGECOLUMNCONTROL_HXX
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/toolbarmenu.hxx>
#include <vcl/button.hxx>
+class PageColumnPopup;
+
namespace sw { namespace sidebar {
-class PageColumnControl : public SfxPopupWindow
+class PageColumnControl final : public svtools::ToolbarPopup
{
public:
- explicit PageColumnControl(sal_uInt16 nId, vcl::Window* pParent);
+ explicit PageColumnControl(PageColumnPopup* pControl, vcl::Window* pParent);
virtual ~PageColumnControl() override;
virtual void dispose() override;
diff --git a/sw/source/uibase/sidebar/PageColumnPopup.cxx b/sw/source/uibase/sidebar/PageColumnPopup.cxx
index c05546451c90..0ec50da9439c 100644
--- a/sw/source/uibase/sidebar/PageColumnPopup.cxx
+++ b/sw/source/uibase/sidebar/PageColumnPopup.cxx
@@ -21,26 +21,46 @@
#include <svl/intitem.hxx>
#include <vcl/toolbox.hxx>
-SFX_IMPL_TOOLBOX_CONTROL(PageColumnPopup, SfxInt16Item);
+PageColumnPopup::PageColumnPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+ : PopupWindowController(rContext, nullptr, OUString())
+{
+}
-PageColumnPopup::PageColumnPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
- : SfxToolBoxControl(nSlotId, nId, rTbx)
+void PageColumnPopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
{
- rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
+ PopupWindowController::initialize(rArguments);
+
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
+ pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
}
PageColumnPopup::~PageColumnPopup()
{
}
-VclPtr<SfxPopupWindow> PageColumnPopup::CreatePopupWindow()
+VclPtr<vcl::Window> PageColumnPopup::createPopupWindow(vcl::Window* pParent)
+{
+ return VclPtr<sw::sidebar::PageColumnControl>::Create(this, pParent);
+}
+
+OUString PageColumnPopup::getImplementationName()
{
- VclPtr<sw::sidebar::PageColumnControl> pControl = VclPtr<sw::sidebar::PageColumnControl>::Create(GetSlotId(), &GetToolBox());
- pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
- SetPopupWindow(pControl);
+ return "lo.writer.PageColumnToolBoxControl";
+}
- return pControl;
+css::uno::Sequence<OUString> PageColumnPopup::getSupportedServiceNames()
+{
+ return { "com.sun.star.frame.ToolbarController" };
}
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+lo_writer_PageColumnToolBoxControl_get_implementation(
+ css::uno::XComponentContext* rContext,
+ css::uno::Sequence<css::uno::Any> const & )
+{
+ return cppu::acquire(new PageColumnPopup(rContext));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/util/sw.component b/sw/util/sw.component
index f05b81a2e71a..a6fac075e4f9 100644
--- a/sw/util/sw.component
+++ b/sw/util/sw.component
@@ -51,6 +51,10 @@
constructor="lo_writer_PageSizeToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
+ <implementation name="lo.writer.PageColumnToolBoxControl"
+ constructor="lo_writer_PageColumnToolBoxControl_get_implementation">
+ <service name="com.sun.star.frame.ToolbarController"/>
+ </implementation>
<implementation name="SwXModule"
constructor="SwXModule_get_implementation">
<service name="com.sun.star.text.GlobalSettings"/>