[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - include/svx sc/source sd/source svx/source sw/source

Krisztian Pinter pin.terminator at gmail.com
Tue Aug 5 06:53:47 PDT 2014


 include/svx/tbcontrl.hxx          |   27 +-------------
 sc/source/ui/app/scdll.cxx        |    2 -
 sd/source/ui/app/sddll.cxx        |    2 -
 svx/source/tbxctrls/tbcontrl.cxx  |   69 +++-----------------------------------
 sw/source/uibase/app/swmodule.cxx |    2 -
 5 files changed, 12 insertions(+), 90 deletions(-)

New commits:
commit c7705d871e76040fc2106a7ef8d519f79b6881bd
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Tue Aug 5 15:39:20 2014 +0200

    Remove redundant class SvxLineColorToolBoxControl
    
    Change-Id: I882ee959baae429307218d3076a2a198ff960ddd

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 762f33d..3d2fa35 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -42,7 +42,8 @@
         SvxColorToolBoxControl
         ----------------------
         Item type:      SvxColorItem
-                    and SfxBoolItem
+                        SfxBoolItem
+                    and XLineColorItem
 
         for font color (writer, ...)
         Execute-Id      SID_ATTR_CHAR_COLOR2
@@ -66,9 +67,7 @@
         for 3D extrusion
         Execute-Id      SID_EXTRUSION_3D_COLOR
 
-        SvxLineColorToolBoxControl
-        --------------------------
-        Item type:      XLineColorItem
+        for line color
         Execute-Id      SID_ATTR_LINE_COLOR
 
         SvxPatternToolBoxControl
@@ -236,26 +235,6 @@ public:
 };
 
 
-// class SvxLineColorToolBoxControl --------------------------------------
-
-class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl
-{
-    ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
-    PaletteManager                      mPaletteManager;
-    DECL_LINK( SelectedHdl, Color* );
-public:
-    SFX_DECL_TOOLBOX_CONTROL();
-    SvxLineColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
-    virtual ~SvxLineColorToolBoxControl();
-
-    virtual void                StateChanged( sal_uInt16 nSID, SfxItemState eState,
-                                              const SfxPoolItem* pState ) SAL_OVERRIDE;
-    virtual SfxPopupWindowType  GetPopupWindowType() const SAL_OVERRIDE;
-    virtual SfxPopupWindow*     CreatePopupWindow() SAL_OVERRIDE;
-    virtual void                Select(sal_uInt16 nSelectModifier) SAL_OVERRIDE;
-};
-
-
 // class SvxFrameToolBoxControl ------------------------------------------
 
 class SVX_DLLPUBLIC SvxFrameToolBoxControl : public SfxToolBoxControl
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 58da249..d3244a2 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -172,7 +172,7 @@ void ScDLL::Init()
     SvxFillToolBoxControl           ::RegisterControl(0, pMod);
     SvxLineStyleToolBoxControl      ::RegisterControl(0, pMod);
     SvxLineWidthToolBoxControl      ::RegisterControl(0, pMod);
-    SvxLineColorToolBoxControl      ::RegisterControl(0, pMod);
+    SvxColorToolBoxControl          ::RegisterControl(0, pMod);
     SvxLineEndToolBoxControl        ::RegisterControl(SID_ATTR_LINEEND_STYLE,   pMod);
     SvxStyleToolBoxControl          ::RegisterControl(SID_STYLE_APPLY,          pMod);
     SvxFontNameToolBoxControl       ::RegisterControl(SID_ATTR_CHAR_FONT,       pMod);
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 69ec0aa..1d54c57 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -211,7 +211,7 @@ void SdDLL::RegisterControllers()
     SvxFillToolBoxControl::RegisterControl(0, pMod);
     SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
     SvxLineWidthToolBoxControl::RegisterControl(0, pMod);
-    SvxLineColorToolBoxControl::RegisterControl(0, pMod);
+    SvxColorToolBoxControl::RegisterControl(0, pMod);
 
     SvxLineEndToolBoxControl::RegisterControl( SID_ATTR_LINEEND_STYLE, pMod );
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 4274ad1..7fc11de 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -110,8 +110,6 @@ using namespace ::com::sun::star::lang;
 
 SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxColorToolBoxControl, SvxColorItem );
-SFX_IMPL_TOOLBOX_CONTROL( SvxLineColorToolBoxControl, XLineColorItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem );
 SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem );
@@ -2345,73 +2343,18 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
     Dispatch( aCommand, aArgs );
 }
 
-// class SvxLineColorToolBoxControl ----------------------------------------
-
-SvxLineColorToolBoxControl::SvxLineColorToolBoxControl(
-    sal_uInt16 nSlotId,
-    sal_uInt16 nId,
-    ToolBox& rTbx ) :
-
-    SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-    rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
-    addStatusListener( OUString( ".uno:XLineColor" ) );
-    pBtnUpdater.reset( new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() ) );
-    mPaletteManager.SetLastColor( COL_BLACK );
-    mPaletteManager.SetBtnUpdater( pBtnUpdater.get() );
-}
-
-SvxLineColorToolBoxControl::~SvxLineColorToolBoxControl()
-{
-}
-
-SfxPopupWindowType SvxLineColorToolBoxControl::GetPopupWindowType() const
-{
-    return SFX_POPUPWINDOW_ONTIMEOUT;
-}
-
-SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow()
-{
-    SvxColorWindow_Impl* pColorWin =
-        new SvxColorWindow_Impl(
-                            m_aCommandURL,
-                            mPaletteManager,
-                            GetSlotId(),
-                            m_xFrame,
-                            SVX_RESSTR( RID_SVXSTR_LINECOLOR ),
-                            &GetToolBox() );
-
-    pColorWin->StartPopupMode( &GetToolBox(),
-        FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
-    pColorWin->StartSelection();
-    SetPopupWindow( pColorWin );
-    pColorWin->SetSelectedHdl( LINK( this, SvxLineColorToolBoxControl, SelectedHdl ) );
-    return pColorWin;
-}
-
-IMPL_LINK(SvxLineColorToolBoxControl, SelectedHdl, Color*, pColor)
+SfxToolBoxControl* SvxColorToolBoxControl::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx )
 {
-    pBtnUpdater->Update( *pColor );
-    mPaletteManager.SetLastColor( *pColor );
-    return 0;
+    return new SvxColorToolBoxControl( nSlotId, nId, rTbx );
 }
 
-void SvxLineColorToolBoxControl::StateChanged(
-    sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* /*pState*/ )
+void SvxColorToolBoxControl::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod)
 {
-    ToolBox& rTbx = GetToolBox();
-    sal_uInt16 nId = GetId();
-    rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
-    rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? TRISTATE_INDET : TRISTATE_FALSE );
+    SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(SvxColorItem), nSlotId ) );
+    SfxToolBoxControl::RegisterToolBoxControl( pMod, new SfxTbxCtrlFactory( SvxColorToolBoxControl::CreateImpl, TYPE(XLineColorItem), nSlotId ) );
 }
 
-void SvxLineColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
-{
-    Sequence< PropertyValue > aArgs( 1 );
-    aArgs[0].Name  = "XLineColor";
-    aArgs[0].Value = makeAny( (sal_uInt32)( mPaletteManager.GetLastColor().GetColor() ));
-    Dispatch( OUString( ".uno:XLineColor" ), aArgs );
-}
+// class SvxFrameToolBoxControl --------------------------------------------
 
 SvxFrameToolBoxControl::SvxFrameToolBoxControl(
     sal_uInt16      nSlotId,
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index 8a48251..081b9c5 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -321,7 +321,7 @@ void SwDLL::RegisterControls()
     SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
     SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
     SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
-    SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
+    SvxColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
     SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
 
     SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );


More information about the Libreoffice-commits mailing list