[Libreoffice-commits] core.git: 2 commits - officecfg/registry svx/source sw/inc sw/source sw/util vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 14 12:14:57 UTC 2020


 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu |   11 ++
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx         |    1 
 svx/source/sidebar/text/TextUnderlineControl.cxx                |    1 
 sw/inc/PageSizePopup.hxx                                        |   18 +++-
 sw/source/uibase/app/swmodule.cxx                               |    1 
 sw/source/uibase/sidebar/PageSizeControl.cxx                    |    8 +-
 sw/source/uibase/sidebar/PageSizeControl.hxx                    |   11 +-
 sw/source/uibase/sidebar/PageSizePopup.cxx                      |   38 +++++++---
 sw/util/sw.component                                            |    4 +
 vcl/unx/gtk3/gtk3gtkinst.cxx                                    |    1 
 10 files changed, 68 insertions(+), 26 deletions(-)

New commits:
commit 3afc718eddcd81232392d46fccc24b8ec626c8df
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 10:06:30 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 13:14:36 2020 +0100

    rework PageSizePopup to be a PopupWindowController
    
    Change-Id: Ib8a0acbceca607b0820437d66e18c7cd8c16904e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86748
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 829f9f17c4e8..f01223dc1d6a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1162,6 +1162,17 @@
           <value>lo.writer.MMExcludeEntryController</value>
         </prop>
       </node>
+      <node oor:name="PageSizeToolBoxControl" oor:op="replace">
+        <prop oor:name="Command">
+          <value>.uno:AttributePageSize</value>
+        </prop>
+        <prop oor:name="Module">
+          <value/>
+        </prop>
+        <prop oor:name="Controller">
+          <value>lo.writer.PageSizeToolBoxControl</value>
+        </prop>
+      </node>
       <node oor:name="com.sun.star.svx.FindTextToolboxController" oor:op="replace">
         <prop oor:name="Command">
           <value>.uno:FindText</value>
diff --git a/sw/inc/PageSizePopup.hxx b/sw/inc/PageSizePopup.hxx
index 5315863bf2b2..5f7354bb3da1 100644
--- a/sw/inc/PageSizePopup.hxx
+++ b/sw/inc/PageSizePopup.hxx
@@ -19,18 +19,24 @@
 #ifndef INCLUDED_SW_INC_PAGESIZEPOPUP_HXX
 #define INCLUDED_SW_INC_PAGESIZEPOPUP_HXX
 
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
 #include "swdllapi.h"
 
-class PageSizePopup final : public SfxToolBoxControl
+class PageSizePopup final : public svt::PopupWindowController
 {
 public:
-    SFX_DECL_TOOLBOX_CONTROL();
-
-    PageSizePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+    PageSizePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext);
     virtual ~PageSizePopup() 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 dd596895786e..613dda8d345f 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -282,7 +282,6 @@ void SwDLL::RegisterControls()
     PageMarginPopup::RegisterControl(SID_ATTR_PAGE_MARGIN, pMod);
     PageOrientationPopup::RegisterControl(SID_ATTR_PAGE_ORIENTATION, pMod);
     PageColumnPopup::RegisterControl(SID_ATTR_PAGE_COLUMN, pMod);
-    PageSizePopup::RegisterControl(SID_ATTR_PAGE_SIZE, pMod);
 
     SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
     SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx
index cd38ccf29953..dc33541466b9 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -39,6 +39,8 @@
 #include <svtools/unitconv.hxx>
 #include <editeng/sizeitem.hxx>
 
+#include <PageSizePopup.hxx>
+
 namespace
 {
     FieldUnit lcl_GetFieldUnit()
@@ -68,8 +70,8 @@ namespace
 
 namespace sw { namespace sidebar {
 
-PageSizeControl::PageSizeControl( sal_uInt16 nId, vcl::Window* pParent )
-    : SfxPopupWindow( nId, pParent, "PageSizeControl", "modules/swriter/ui/pagesizecontrol.ui" )
+PageSizeControl::PageSizeControl(PageSizePopup* pControl, vcl::Window* pParent)
+    : ToolbarPopup(pControl->getFrameInterface(), pParent, "PageSizeControl", "modules/swriter/ui/pagesizecontrol.ui")
     , maPaperList()
 {
     get(maMoreButton, "moreoptions");
@@ -200,7 +202,7 @@ void PageSizeControl::dispose()
     maMoreButton.disposeAndClear();
     maWidthHeightField.disposeAndClear();
     maContainer.disposeAndClear();
-    SfxPopupWindow::dispose();
+    ToolbarPopup::dispose();
 }
 
 void PageSizeControl::ExecuteSizeChange( const Paper ePaper )
diff --git a/sw/source/uibase/sidebar/PageSizeControl.hxx b/sw/source/uibase/sidebar/PageSizeControl.hxx
index e67f624998e4..695140f6a4f6 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.hxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.hxx
@@ -23,23 +23,26 @@
 
 #include <vcl/button.hxx>
 #include <vcl/field.hxx>
-#include <sfx2/tbxctrl.hxx>
 #include <vcl/layout.hxx>
 
-#include <vector>
+#include <svtools/toolbarmenu.hxx>
 #include <svtools/valueset.hxx>
 
+#include <vector>
+
 namespace svx { namespace sidebar {
     class ValueSetWithTextControl;
 } }
+
+class PageSizePopup;
 class ValueSet;
 
 namespace sw { namespace sidebar {
 
-class PageSizeControl : public SfxPopupWindow
+class PageSizeControl final : public svtools::ToolbarPopup
 {
 public:
-    explicit PageSizeControl(sal_uInt16 nId, vcl::Window* pParent);
+    explicit PageSizeControl(PageSizePopup* pControl, vcl::Window* pParent);
     virtual ~PageSizeControl() override;
     virtual void dispose() override;
 
diff --git a/sw/source/uibase/sidebar/PageSizePopup.cxx b/sw/source/uibase/sidebar/PageSizePopup.cxx
index b94ae4dfda0f..b68e714d1713 100644
--- a/sw/source/uibase/sidebar/PageSizePopup.cxx
+++ b/sw/source/uibase/sidebar/PageSizePopup.cxx
@@ -21,26 +21,46 @@
 #include <editeng/sizeitem.hxx>
 #include <vcl/toolbox.hxx>
 
-SFX_IMPL_TOOLBOX_CONTROL(PageSizePopup, SvxSizeItem);
+PageSizePopup::PageSizePopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+    : PopupWindowController(rContext, nullptr, OUString())
+{
+}
 
-PageSizePopup::PageSizePopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
-    : SfxToolBoxControl(nSlotId, nId, rTbx)
+void PageSizePopup::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));
 }
 
 PageSizePopup::~PageSizePopup()
 {
 }
 
-VclPtr<SfxPopupWindow> PageSizePopup::CreatePopupWindow()
+VclPtr<vcl::Window> PageSizePopup::createPopupWindow(vcl::Window* pParent)
+{
+    return VclPtr<sw::sidebar::PageSizeControl>::Create(this, pParent);
+}
+
+OUString PageSizePopup::getImplementationName()
 {
-    VclPtr<sw::sidebar::PageSizeControl> pControl = VclPtr<sw::sidebar::PageSizeControl>::Create(GetSlotId(), &GetToolBox());
-    pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
-    SetPopupWindow(pControl);
+    return "lo.writer.PageSizeToolBoxControl";
+}
 
-    return pControl;
+css::uno::Sequence<OUString> PageSizePopup::getSupportedServiceNames()
+{
+    return { "com.sun.star.frame.ToolbarController" };
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+lo_writer_PageSizeToolBoxControl_get_implementation(
+    css::uno::XComponentContext* rContext,
+    css::uno::Sequence<css::uno::Any> const & )
+{
+    return cppu::acquire(new PageSizePopup(rContext));
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/util/sw.component b/sw/util/sw.component
index ef96a6943230..f05b81a2e71a 100644
--- a/sw/util/sw.component
+++ b/sw/util/sw.component
@@ -47,6 +47,10 @@
       constructor="lo_writer_MMExcludeEntryController_get_implementation">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
+  <implementation name="lo.writer.PageSizeToolBoxControl"
+    constructor="lo_writer_PageSizeToolBoxControl_get_implementation">
+    <service name="com.sun.star.frame.ToolbarController"/>
+  </implementation>
   <implementation name="SwXModule"
       constructor="SwXModule_get_implementation">
     <service name="com.sun.star.text.GlobalSettings"/>
commit 998a9470f1d5728b3f9702ef7aca77aa53bff96b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 14 09:27:52 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 14 13:14:22 2020 +0100

    remove some unneeded includes
    
    Change-Id: I798230983b612ee2b9a0f6cc17751a3a5d703e9f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86744
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index e19044e2eb25..b04dd42caabb 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -27,7 +27,6 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/sidebar/Theme.hxx>
 #include <svx/TextCharacterSpacingPopup.hxx>
-#include <vcl/button.hxx>
 #include <vcl/settings.hxx>
 #include <svl/itempool.hxx>
 #include <helpids.h>
diff --git a/svx/source/sidebar/text/TextUnderlineControl.cxx b/svx/source/sidebar/text/TextUnderlineControl.cxx
index 1d8770c91e0c..eff6cb932843 100644
--- a/svx/source/sidebar/text/TextUnderlineControl.cxx
+++ b/svx/source/sidebar/text/TextUnderlineControl.cxx
@@ -24,7 +24,6 @@
 #include <svx/TextUnderlinePopup.hxx>
 #include <editeng/editids.hrc>
 #include <editeng/udlnitem.hxx>
-#include <vcl/button.hxx>
 #include <vcl/settings.hxx>
 #include <helpids.h>
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c6dee4674a4f..45b4c529f50b 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -68,7 +68,6 @@
 #include <unx/gstsink.hxx>
 #include <vcl/ImageTree.hxx>
 #include <vcl/abstdlg.hxx>
-#include <vcl/button.hxx>
 #include <vcl/event.hxx>
 #include <vcl/i18nhelp.hxx>
 #include <vcl/quickselectionengine.hxx>


More information about the Libreoffice-commits mailing list