[Libreoffice-commits] core.git: include/svx officecfg/registry sc/source sd/source svx/source svx/util sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 8 16:15:57 UTC 2020


 include/svx/ParaLineSpacingPopup.hxx                            |   18 ++--
 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu |   11 ++
 sc/source/ui/app/scdll.cxx                                      |    1 
 sd/source/ui/app/sddll.cxx                                      |    1 
 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx         |   42 +---------
 svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx         |   10 +-
 svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx           |   39 ++++++---
 svx/util/svx.component                                          |    4 
 sw/source/uibase/app/swmodule.cxx                               |    1 
 9 files changed, 68 insertions(+), 59 deletions(-)

New commits:
commit 7e4b2d90f8b877bd954b7549e17c790fa05ea96a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 7 20:01:32 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 8 17:15:23 2020 +0100

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

diff --git a/include/svx/ParaLineSpacingPopup.hxx b/include/svx/ParaLineSpacingPopup.hxx
index 0cacabdf072e..835fbb6fca23 100644
--- a/include/svx/ParaLineSpacingPopup.hxx
+++ b/include/svx/ParaLineSpacingPopup.hxx
@@ -19,20 +19,26 @@
 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGPOPUP_HXX
 #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGPOPUP_HXX
 
-#include <sfx2/tbxctrl.hxx>
+#include <svtools/popupwindowcontroller.hxx>
 #include <svx/svxdllapi.h>
 
 namespace svx {
 
-class SVX_DLLPUBLIC ParaLineSpacingPopup final : public SfxToolBoxControl
+class SVX_DLLPUBLIC SvxLineSpacingToolBoxControl final : public svt::PopupWindowController
 {
 public:
-    SFX_DECL_TOOLBOX_CONTROL();
+    explicit SvxLineSpacingToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
+    virtual ~SvxLineSpacingToolBoxControl() override;
 
-    ParaLineSpacingPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
-    virtual ~ParaLineSpacingPopup() override;
+    using svt::ToolboxController::createPopupWindow;
+    virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) override;
 
-    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() 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;
 };
 
 }
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 722df647ce3b..c9870cec546c 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1272,6 +1272,17 @@
           <value>com.sun.star.comp.svx.LineEndToolBoxControl</value>
         </prop>
       </node>
+      <node oor:name="LineSpacingToolBoxControl" oor:op="replace">
+        <prop oor:name="Command">
+          <value>.uno:LineSpacing</value>
+        </prop>
+        <prop oor:name="Module">
+          <value/>
+        </prop>
+        <prop oor:name="Controller">
+          <value>com.sun.star.comp.svx.LineSpacingToolBoxControl</value>
+        </prop>
+      </node>
       <node oor:name="BorderStyleToolBoxControl" oor:op="replace">
         <prop oor:name="Command">
           <value>.uno:SetBorderStyle</value>
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 45129b81b089..4df0bf295e80 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -153,7 +153,6 @@ void ScDLL::Init()
     SvxClipBoardControl             ::RegisterControl(SID_PASTE_UNFORMATTED,    pMod );
     SvxUndoRedoControl              ::RegisterControl(SID_UNDO,                 pMod );
     SvxUndoRedoControl              ::RegisterControl(SID_REDO,                 pMod );
-    svx::ParaLineSpacingPopup       ::RegisterControl(SID_ATTR_PARA_LINESPACE,  pMod );
     svx::TextCharacterSpacingPopup  ::RegisterControl(SID_ATTR_CHAR_KERNING,    pMod );
     svx::TextUnderlinePopup         ::RegisterControl(SID_ATTR_CHAR_UNDERLINE,  pMod );
     svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH,  pMod );
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 55d306e53925..43f40d8df7bf 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -215,7 +215,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
     SvxClipBoardControl::RegisterControl( SID_PASTE, pMod );
     SvxClipBoardControl::RegisterControl( SID_PASTE_UNFORMATTED, pMod );
 
-    svx::ParaLineSpacingPopup::RegisterControl(SID_ATTR_PARA_LINESPACE, pMod);
     svx::TextCharacterSpacingPopup::RegisterControl(SID_ATTR_CHAR_KERNING, pMod);
     svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
 
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index 90fb26e99b7e..ccb4359b0ef2 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -29,9 +29,12 @@
 #include <svtools/unitconv.hxx>
 #include <vcl/button.hxx>
 #include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
 
 #include <svl/itempool.hxx>
 
+#include <svx/ParaLineSpacingPopup.hxx>
+
 #define DEFAULT_LINE_SPACING  200
 #define FIX_DIST_DEF          283
 #define LINESPACE_1           100
@@ -53,8 +56,8 @@
 
 using namespace svx;
 
-ParaLineSpacingControl::ParaLineSpacingControl(sal_uInt16 nId, vcl::Window* pParent)
-    : SfxPopupWindow(nId, pParent, "ParaLineSpacingControl", "svx/ui/paralinespacingcontrol.ui"),
+ParaLineSpacingControl::ParaLineSpacingControl(SvxLineSpacingToolBoxControl* pControl, vcl::Window* pParent)
+    : ToolbarPopup( pControl->getFrameInterface(), pParent, "ParaLineSpacingControl", "svx/ui/paralinespacingcontrol.ui"),
       meLNSpaceUnit(MapUnit::Map100thMM),
       mpSpacing1Button(get<PushButton>("spacing_1")),
       mpSpacing115Button(get<PushButton>("spacing_115")),
@@ -108,7 +111,7 @@ void ParaLineSpacingControl::dispose()
     mpLineDistLabel.clear();
     mpLineDistAtPercentBox.clear();
     mpLineDistAtMetricBox.clear();
-    SfxPopupWindow::dispose();
+    ToolbarPopup::dispose();
 }
 
 void ParaLineSpacingControl::Initialize()
@@ -208,39 +211,6 @@ void ParaLineSpacingControl::Initialize()
     }
 
     mpLineDist->SaveValue();
-
-    /* TODO
-    const sal_uInt16 uCount = mpLineDist->GetEntryCount();
-    if( uCount == LLINESPACE_FIX + 1 )
-    {
-        switch (currentContext.GetCombinedContext_DI())
-        {
-        case CombinedEnumContext(Application::DrawImpress, Context::Table):
-        case CombinedEnumContext(Application::DrawImpress, Context::DrawText):
-        case CombinedEnumContext(Application::DrawImpress, Context::Draw):
-        case CombinedEnumContext(Application::DrawImpress, Context::TextObject):
-        case CombinedEnumContext(Application::DrawImpress, Context::Graphic):
-        case CombinedEnumContext(Application::Calc, Context::DrawText):
-        case CombinedEnumContext(Application::WriterVariants, Context::DrawText):
-        case CombinedEnumContext(Application::WriterVariants, Context::Annotation):
-            {
-                mpLineDist->RemoveEntry(LLINESPACE_FIX);
-            }
-        }
-    }
-    else if( uCount == LLINESPACE_FIX)
-    {
-        switch (currentContext.GetCombinedContext_DI())
-        {
-            case CombinedEnumContext(Application::WriterVariants, Context::Default):
-            case CombinedEnumContext(Application::WriterVariants, Context::Text):
-            case CombinedEnumContext(Application::WriterVariants, Context::Table):
-            {
-                mpLineDist->InsertEntry(OUString("Fixed"), LLINESPACE_FIX);
-            }
-        }
-    }
-    */
 }
 
 void ParaLineSpacingControl::UpdateMetricFields()
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
index 9814737aeab2..5e7501406605 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.hxx
@@ -19,18 +19,22 @@
 #ifndef INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGCONTROL_HXX
 #define INCLUDED_SVX_SOURCE_SIDEBAR_PARAGRAPH_PARALINESPACINGCONTROL_HXX
 
-#include <svtools/ctrlbox.hxx>
+#include <svtools/toolbarmenu.hxx>
 #include <sfx2/tbxctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
 
 class SvxLineSpacingItem;
 class Button;
 
 namespace svx {
 
-class ParaLineSpacingControl : public SfxPopupWindow
+class SvxLineSpacingToolBoxControl;
+
+class ParaLineSpacingControl : public svtools::ToolbarPopup
 {
 public:
-    explicit ParaLineSpacingControl(sal_uInt16 nId, vcl::Window* pParent);
+    explicit ParaLineSpacingControl(SvxLineSpacingToolBoxControl* pControl, vcl::Window* pParent);
     virtual ~ParaLineSpacingControl() override;
     virtual void dispose() override;
 
diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
index cea47f656e6b..eb7d70c38b79 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingPopup.cxx
@@ -26,27 +26,44 @@
 
 using namespace svx;
 
-SFX_IMPL_TOOLBOX_CONTROL(ParaLineSpacingPopup, SvxLineSpacingItem);
-
-ParaLineSpacingPopup::ParaLineSpacingPopup(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx)
-    : SfxToolBoxControl(nSlotId, nId, rTbx)
+SvxLineSpacingToolBoxControl::SvxLineSpacingToolBoxControl(const css::uno::Reference<css::uno::XComponentContext>& rContext)
+    : PopupWindowController(rContext, nullptr, OUString())
 {
-    rTbx.SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits(nId));
 }
 
-ParaLineSpacingPopup::~ParaLineSpacingPopup()
+SvxLineSpacingToolBoxControl::~SvxLineSpacingToolBoxControl() {}
+
+void SvxLineSpacingToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
 {
+    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));
 }
 
-VclPtr<SfxPopupWindow> ParaLineSpacingPopup::CreatePopupWindow()
+VclPtr<vcl::Window> SvxLineSpacingToolBoxControl::createPopupWindow( vcl::Window* pParent )
 {
-    VclPtr<ParaLineSpacingControl> pControl = VclPtr<ParaLineSpacingControl>::Create(GetSlotId(), &GetToolBox());
+    return VclPtr<ParaLineSpacingControl>::Create(this, pParent);
+}
 
-    pControl->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
+OUString SvxLineSpacingToolBoxControl::getImplementationName()
+{
+    return "com.sun.star.comp.svx.LineSpacingToolBoxControl";
+}
 
-    SetPopupWindow(pControl);
+css::uno::Sequence<OUString> SvxLineSpacingToolBoxControl::getSupportedServiceNames()
+{
+    return { "com.sun.star.frame.ToolbarController" };
+}
 
-    return pControl;
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
+com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation(
+    css::uno::XComponentContext* rContext,
+    css::uno::Sequence<css::uno::Any> const & )
+{
+    return cppu::acquire( new SvxLineSpacingToolBoxControl( rContext ) );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/util/svx.component b/svx/util/svx.component
index bc5bbb2a04d6..323126691b1e 100644
--- a/svx/util/svx.component
+++ b/svx/util/svx.component
@@ -104,4 +104,8 @@
       constructor="com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation">
     <service name="com.sun.star.frame.ToolbarController"/>
   </implementation>
+  <implementation name="com.sun.star.comp.svx.LineSpacingToolBoxControl"
+    constructor="com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation">
+    <service name="com.sun.star.frame.ToolbarController"/>
+  </implementation>
 </component>
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 91bda9aea631..49b96b4bf0cb 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -274,7 +274,6 @@ void SwDLL::RegisterControls()
     SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
     SvxTbxCtlDraw::RegisterControl(SID_TRACK_CHANGES_BAR, pMod );
     SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
-    svx::ParaLineSpacingPopup::RegisterControl(SID_ATTR_PARA_LINESPACE, pMod);
     svx::TextCharacterSpacingPopup::RegisterControl(SID_ATTR_CHAR_KERNING, pMod);
     svx::TextUnderlinePopup::RegisterControl(SID_ATTR_CHAR_UNDERLINE, pMod);
     svx::ParaAboveSpacingControl::RegisterControl(SID_ATTR_PARA_ABOVESPACE, pMod);


More information about the Libreoffice-commits mailing list