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

Krisztian Pinter pin.terminator at gmail.com
Tue Jun 17 10:18:41 PDT 2014


 include/svx/tbcontrl.hxx            |    4 +-
 svx/source/tbxctrls/colorwindow.hxx |   10 +++++-
 svx/source/tbxctrls/tbcontrl.cxx    |   55 ++++++++++++++++++++++++++++--------
 3 files changed, 56 insertions(+), 13 deletions(-)

New commits:
commit 02fce2a4074d0e8e90c46da6059863ae6dd02838
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Tue Jun 17 18:56:29 2014 +0200

    Add navigation buttons to SvxColorWindow_Impl
    
    Change-Id: I346af872f78396d51a458539f7d3038fc63dad8e

diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1694d13..b1b578f 100644
--- a/include/svx/tbcontrl.hxx
+++ b/include/svx/tbcontrl.hxx
@@ -221,6 +221,7 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
 
     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
     Color                               mLastColor;
+    sal_uInt16                          nCurrentPalette;
     DECL_LINK( SelectedHdl, Color* );
 public:
     SFX_DECL_TOOLBOX_CONTROL();
@@ -240,7 +241,8 @@ public:
 class SVX_DLLPUBLIC SvxLineColorToolBoxControl : public SfxToolBoxControl
 {
     ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > pBtnUpdater;
-    Color mLastColor;
+    Color                               mLastColor;
+    sal_uInt16                          nCurrentPalette;
     DECL_LINK( SelectedHdl, Color* );
 public:
     SFX_DECL_TOOLBOX_CONTROL();
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 6ed74f3..6bb9f92 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -41,11 +41,18 @@ class SvxColorWindow_Impl : public SfxPopupWindow
 private:
     const sal_uInt16 theSlotId;
     SvxColorValueSet aColorSet;
-    SvxColorValueSet aDocColorSet;
+    PushButton aButtonLeft;
+    PushButton aButtonRight;
     OUString  maCommand;
     Link maSelectedLink;
 
+    const sal_uInt16 nNavButtonWidth;
+    const sal_uInt16 nNavButtonHeight;
+    sal_uInt16& rnCurrentPalette;
+
     DECL_LINK( SelectHdl, void * );
+    DECL_LINK( StepLeftClickHdl, void * );
+    DECL_LINK( StepRightClickHdl, void * );
 
 protected:
     virtual void    Resize() SAL_OVERRIDE;
@@ -53,6 +60,7 @@ protected:
 
 public:
     SvxColorWindow_Impl( const OUString& rCommand,
+                         sal_uInt16& rnCurrentPalette_,
                          sal_uInt16 nSlotId,
                          const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
                          const OUString& rWndTitle,
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index dd2c7b8..1c8763f 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -102,7 +102,7 @@
 // don't make more than 15 entries visible at once
 #define MAX_STYLES_ENTRIES          static_cast< sal_uInt16 >( 15 )
 
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet );
+static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding );
 static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
 
 // namespaces
@@ -1076,6 +1076,7 @@ void SvxFontNameBox_Impl::Select()
 #endif
 
 SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
+                                          sal_uInt16&                rnCurrentPalette_,
                                           sal_uInt16                 nSlotId,
                                           const Reference< XFrame >& rFrame,
                                           const OUString&            rWndTitle,
@@ -1085,8 +1086,12 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
 
     theSlotId( nSlotId ),
     aColorSet   ( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
-    aDocColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
-    maCommand( rCommand )
+    aButtonLeft ( this ),
+    aButtonRight( this ),
+    maCommand( rCommand ),
+    nNavButtonWidth ( 20 ),
+    nNavButtonHeight( 20 ),
+    rnCurrentPalette( rnCurrentPalette_ )
 
 {
     SfxObjectShell* pDocSh = SfxObjectShell::Current();
@@ -1150,9 +1155,21 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
         aColorSet.SetOutputSizePixel(aNewSize);
         static sal_Int32 nAdd = 4;
 
-        SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd));
+        SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nNavButtonHeight));
         aColorSet.Clear();
         aColorSet.addEntriesForXColorList(*pColorList);
+
+        aButtonLeft.SetText("<");
+        aButtonLeft.SetClickHdl( LINK( this, SvxColorWindow_Impl, StepLeftClickHdl ) );
+        aButtonLeft.SetSizePixel(Size(nNavButtonWidth, nNavButtonHeight));
+        aButtonLeft.SetPosPixel(Point(0, aNewSize.Height() + nAdd + 1));
+        aButtonLeft.Show();
+
+        aButtonRight.SetText(">");
+        aButtonRight.SetClickHdl( LINK( this, SvxColorWindow_Impl, StepRightClickHdl ) );
+        aButtonRight.SetSizePixel(Size(nNavButtonWidth, nNavButtonHeight));
+        aButtonRight.SetPosPixel(Point(aNewSize.Width() + nAdd - nNavButtonWidth, aNewSize.Height() + nAdd + 1));
+        aButtonRight.Show();
     }
 
     aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
@@ -1176,7 +1193,7 @@ void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
 
 SfxPopupWindow* SvxColorWindow_Impl::Clone() const
 {
-    return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent() );
+    return new SvxColorWindow_Impl( maCommand, rnCurrentPalette, theSlotId, GetFrame(), GetText(), GetParent() );
 }
 
 IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
@@ -1216,9 +1233,21 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
     return 0;
 }
 
+IMPL_LINK_NOARG(SvxColorWindow_Impl, StepLeftClickHdl)
+{
+    rnCurrentPalette--;
+    return 0;
+}
+
+IMPL_LINK_NOARG(SvxColorWindow_Impl, StepRightClickHdl)
+{
+    rnCurrentPalette++;
+    return 0;
+}
+
 void SvxColorWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aColorSet);
+    lcl_ResizeValueSet( *this, aColorSet, nNavButtonHeight + 2);
 }
 
 void SvxColorWindow_Impl::StartSelection()
@@ -1492,7 +1521,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
 
 void SvxFrameWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aFrameSet);
+    lcl_ResizeValueSet( *this, aFrameSet, 0 );
 }
 
 
@@ -2331,7 +2360,8 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
     ToolBox& rTbx ) :
 
     SfxToolBoxControl( nSlotId, nId, rTbx ),
-    mLastColor( COL_AUTO )
+    mLastColor( COL_AUTO ),
+    nCurrentPalette( 0 )
 {
     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
 
@@ -2385,6 +2415,7 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
     SvxColorWindow_Impl* pColorWin =
         new SvxColorWindow_Impl(
                             m_aCommandURL,
+                            nCurrentPalette,
                             GetSlotId(),
                             m_xFrame,
                             SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
@@ -2497,7 +2528,8 @@ SvxLineColorToolBoxControl::SvxLineColorToolBoxControl(
     ToolBox& rTbx ) :
 
     SfxToolBoxControl( nSlotId, nId, rTbx ),
-    mLastColor( COL_BLACK )
+    mLastColor( COL_BLACK ),
+    nCurrentPalette( 0 )
 {
     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
     addStatusListener( OUString( ".uno:XLineColor" ) );
@@ -2518,6 +2550,7 @@ SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow()
     SvxColorWindow_Impl* pColorWin =
         new SvxColorWindow_Impl(
                             m_aCommandURL,
+                            nCurrentPalette,
                             GetSlotId(),
                             m_xFrame,
                             SVX_RESSTR( RID_SVXSTR_LINECOLOR ),
@@ -2695,11 +2728,11 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState,
 
 
 
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet )
+static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding)
 {
     Size aSize = rWin.GetOutputSizePixel();
     aSize.Width()  -= 4;
-    aSize.Height() -= 4;
+    aSize.Height() -= 4 + nVertPadding;
     rValueSet.SetPosSizePixel( Point(2,2), aSize );
 }
 


More information about the Libreoffice-commits mailing list