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

Maxim Monastirsky momonasmon at gmail.com
Thu Oct 6 21:32:07 UTC 2016


 include/svx/tbcontrl.hxx                                        |   11 -
 officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu |   13 ++
 sc/source/ui/app/scdll.cxx                                      |    1 
 sd/source/ui/app/sddll.cxx                                      |    1 
 svx/source/tbxctrls/tbcontrl.cxx                                |   59 ++--------
 sw/source/uibase/app/swmodule.cxx                               |    1 
 6 files changed, 25 insertions(+), 61 deletions(-)

New commits:
commit 5e87eea81bab8a954a2c1ad6c923dd4134ec8901
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Fri Oct 7 00:22:01 2016 +0300

    Base SvxLineWindow_Impl on ToolbarPopup
    
    Change-Id: I93dbb180fc65bca77e0eb58f116d0a0a5266556a

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1067fa0..7c19420 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -254,17 +254,6 @@ public:
     void setColorSelectFunction(const ColorSelectFunction& aColorSelectFunction);
 };
 
-class SVX_DLLPUBLIC SvxFrameLineStyleToolBoxControl : public SfxToolBoxControl
-{
-public:
-    SFX_DECL_TOOLBOX_CONTROL();
-    SvxFrameLineStyleToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rToolBox);
-
-    virtual VclPtr<SfxPopupWindow> CreatePopupWindow() override;
-    virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
-                              const SfxPoolItem* pState) override;
-};
-
 class SVX_DLLPUBLIC SvxSimpleUndoRedoController : public SfxToolBoxControl
 {
 private:
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
index 9f0e3ec..73f9d17 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Controller.xcu
@@ -1082,7 +1082,7 @@
           <value>com.sun.star.comp.sfx2.ClassificationCategoriesController</value>
         </prop>
       </node>
-      <node oor:name="com.sun.star.comp.svx.FrameToolBoxControl" oor:op="replace">
+      <node oor:name="BorderStyleToolBoxControl" oor:op="replace">
         <prop oor:name="Command">
           <value>.uno:SetBorderStyle</value>
         </prop>
@@ -1093,6 +1093,17 @@
           <value>com.sun.star.comp.svx.FrameToolBoxControl</value>
         </prop>
       </node>
+      <node oor:name="BorderLineStyleToolBoxControl" oor:op="replace">
+        <prop oor:name="Command">
+          <value>.uno:LineStyle</value>
+        </prop>
+        <prop oor:name="Module">
+          <value/>
+        </prop>
+        <prop oor:name="Controller">
+          <value>com.sun.star.comp.svx.FrameToolBoxControl</value>
+        </prop>
+      </node>
       <node oor:name="c4" oor:op="replace" install:module="reportbuilder">
         <prop oor:name="Command">
           <value>.uno:FontColor</value>
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index abc587c..4e249d3 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -167,7 +167,6 @@ void ScDLL::Init()
     SvxColorToolBoxControl          ::RegisterControl(SID_ATTR_CHAR_COLOR,      pMod);
     SvxColorToolBoxControl          ::RegisterControl(SID_BACKGROUND_COLOR,     pMod);
     SvxColorToolBoxControl          ::RegisterControl(SID_ATTR_CHAR_BACK_COLOR, pMod);
-    SvxFrameLineStyleToolBoxControl ::RegisterControl(SID_FRAME_LINESTYLE,      pMod);
     SvxColorToolBoxControl          ::RegisterControl(SID_FRAME_LINECOLOR,      pMod);
     SvxClipBoardControl             ::RegisterControl(SID_PASTE,                pMod );
     SvxUndoRedoControl              ::RegisterControl(SID_UNDO,                 pMod );
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 035fda3..41fed94 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -235,7 +235,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
     XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
     SdTemplateControl::RegisterControl( SID_STATUS_LAYOUT, pMod );
     SvxTableToolBoxControl::RegisterControl(SID_INSERT_TABLE, pMod );
-    SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
     SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
     SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 220146d..3b45779 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -115,7 +115,6 @@ using namespace ::com::sun::star::lang;
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxCurrencyToolBoxControl, SfxBoolItem );
 
@@ -270,10 +269,11 @@ public:
     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) override;
 };
 
-class SvxLineWindow_Impl : public SfxPopupWindow
+class SvxLineWindow_Impl : public svtools::ToolbarPopup
 {
 private:
     VclPtr<LineListBox> m_aLineStyleLb;
+    svt::ToolboxController& m_rController;
     bool                m_bIsWriter;
 
     DECL_LINK( SelectHdl, ListBox&, void );
@@ -282,9 +282,9 @@ protected:
     virtual void    Resize() override;
     virtual void    GetFocus() override;
 public:
-    SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow );
+    SvxLineWindow_Impl( svt::ToolboxController& rController, vcl::Window* pParentWindow );
     virtual ~SvxLineWindow_Impl() override { disposeOnce(); }
-    virtual void dispose() override { m_aLineStyleLb.disposeAndClear(); SfxPopupWindow::dispose(); }
+    virtual void dispose() override { m_aLineStyleLb.disposeAndClear(); ToolbarPopup::dispose(); }
 };
 
 class SvxCurrencyToolBoxControl;
@@ -1928,14 +1928,14 @@ void SvxCurrencyList_Impl::dispose()
     SfxPopupWindow::dispose();
 }
 
-SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, vcl::Window* pParentWindow ) :
-
-    SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_AUTOSIZE ) ),
-    m_aLineStyleLb( VclPtr<LineListBox>::Create(this) )
+SvxLineWindow_Impl::SvxLineWindow_Impl( svt::ToolboxController& rController, vcl::Window* pParentWindow ) :
+    ToolbarPopup( rController.getFrameInterface(), pParentWindow, WB_STDPOPUP | WB_MOVEABLE | WB_CLOSEABLE ),
+    m_aLineStyleLb( VclPtr<LineListBox>::Create(this) ),
+    m_rController( rController )
 {
     try
     {
-        Reference< lang::XServiceInfo > xServices( rFrame->getController()->getModel(), UNO_QUERY_THROW );
+        Reference< lang::XServiceInfo > xServices( rController.getFrameInterface()->getController()->getModel(), UNO_QUERY_THROW );
         m_bIsWriter = xServices->supportsService("com.sun.star.text.TextDocument");
     }
     catch(const uno::Exception& )
@@ -2026,9 +2026,7 @@ IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl, ListBox&, void)
     aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 );
     aArgs[0].Value = a;
 
-    SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
-                                 ".uno:LineStyle",
-                                 aArgs );
+    m_rController.dispatchCommand( ".uno:LineStyle", aArgs );
 }
 
 void SvxLineWindow_Impl::Resize()
@@ -2929,6 +2927,9 @@ void SvxFrameToolBoxControl::initialize( const css::uno::Sequence< css::uno::Any
 
 VclPtr<vcl::Window> SvxFrameToolBoxControl::createPopupWindow( vcl::Window* pParent )
 {
+    if ( m_aCommandURL == ".uno:LineStyle" )
+        return VclPtr<SvxLineWindow_Impl>::Create( *this, pParent );
+
     return VclPtr<SvxFrameWindow_Impl>::Create( *this, pParent );
 }
 
@@ -2952,40 +2953,6 @@ com_sun_star_comp_svx_FrameToolBoxControl_get_implementation(
     return cppu::acquire( new SvxFrameToolBoxControl( rContext ) );
 }
 
-SvxFrameLineStyleToolBoxControl::SvxFrameLineStyleToolBoxControl(
-    sal_uInt16          nSlotId,
-    sal_uInt16          nId,
-    ToolBox&        rTbx )
-
-    :    SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-    rTbx.SetItemBits( nId, ToolBoxItemBits::DROPDOWNONLY | rTbx.GetItemBits( nId ) );
-}
-
-VclPtr<SfxPopupWindow> SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
-{
-    VclPtr<SvxLineWindow_Impl> pLineWin = VclPtr<SvxLineWindow_Impl>::Create( GetSlotId(), m_xFrame, &GetToolBox() );
-    pLineWin->StartPopupMode( &GetToolBox(),
-                              FloatWinPopupFlags::GrabFocus |
-                              FloatWinPopupFlags::AllowTearOff |
-                              FloatWinPopupFlags::NoAppFocusClose );
-    SetPopupWindow( pLineWin );
-
-    return pLineWin;
-}
-
-void SvxFrameLineStyleToolBoxControl::StateChanged(
-    sal_uInt16 , SfxItemState eState, const SfxPoolItem*  )
-{
-    sal_uInt16       nId    = GetId();
-    ToolBox&     rTbx   = GetToolBox();
-
-    rTbx.EnableItem( nId, SfxItemState::DISABLED != eState );
-    rTbx.SetItemState( nId, (SfxItemState::DONTCARE == eState)
-                                ? TRISTATE_INDET
-                                : TRISTATE_FALSE );
-}
-
 SvxSimpleUndoRedoController::SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx  )
     :SfxToolBoxControl( nSlotId, nId, rTbx )
 {
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 6ca46d4..6269338 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -320,7 +320,6 @@ void SwDLL::RegisterControls()
     SvxColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
     SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
     SvxColorToolBoxControl::RegisterControl( SID_BACKGROUND_COLOR, pMod );
-    SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
     SvxColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
 
     SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );


More information about the Libreoffice-commits mailing list