summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2014-06-17 18:56:29 +0200
committerKrisztian Pinter <pin.terminator@gmail.com>2014-07-25 17:14:09 +0200
commit8fead2728c00c2f1019286676eda0b5a7d5161cd (patch)
tree3082be5ddaf10dc921b1710b055779a971feb95b
parente5ced35bf6cfb6e59da2a94f1afdfd520faeacb7 (diff)
Add navigation buttons to SvxColorWindow_Impl
Change-Id: I346af872f78396d51a458539f7d3038fc63dad8e
-rw-r--r--include/svx/tbcontrl.hxx4
-rw-r--r--svx/source/tbxctrls/colorwindow.hxx10
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx57
3 files changed, 58 insertions, 13 deletions
diff --git a/include/svx/tbcontrl.hxx b/include/svx/tbcontrl.hxx
index 1694d13b4ab2..b1b578f6548f 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 6ed74f31c115..6bb9f92f1ace 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 c802aa6c5777..4891ebe38889 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -100,7 +100,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
@@ -1019,6 +1019,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,
@@ -1026,8 +1027,12 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
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();
@@ -1091,9 +1096,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 ) );
@@ -1117,7 +1134,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)
@@ -1157,9 +1174,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()
@@ -1424,7 +1453,7 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
void SvxFrameWindow_Impl::Resize()
{
- lcl_ResizeValueSet( *this, aFrameSet);
+ lcl_ResizeValueSet( *this, aFrameSet, 0 );
}
void SvxFrameWindow_Impl::StateChanged(
@@ -2190,7 +2219,8 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
sal_uInt16 nId,
ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx ),
- mLastColor( COL_AUTO )
+ mLastColor( COL_AUTO ),
+ nCurrentPalette( 0 )
{
rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
@@ -2244,6 +2274,7 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
SvxColorWindow_Impl* pColorWin =
new SvxColorWindow_Impl(
m_aCommandURL,
+ nCurrentPalette,
GetSlotId(),
m_xFrame,
SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
@@ -2351,7 +2382,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" ) );
@@ -2372,6 +2404,7 @@ SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow()
SvxColorWindow_Impl* pColorWin =
new SvxColorWindow_Impl(
m_aCommandURL,
+ nCurrentPalette,
GetSlotId(),
m_xFrame,
SVX_RESSTR( RID_SVXSTR_LINECOLOR ),
@@ -2513,11 +2546,13 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState,
rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED );
}
-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 );
}