summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrisztian Pinter <pin.terminator@gmail.com>2014-07-11 19:16:13 +0200
committerKrisztian Pinter <pin.terminator@gmail.com>2014-07-25 17:18:06 +0200
commitec8cad53209564c92e2d49cc2fa61cbbb58ed18c (patch)
tree9219a4589f9d1edce45935359e0beb959fc46689
parent1830d50c01fd871ce3a44d9b6cb72a062bc23181 (diff)
Move palette selection ComboBox to top of popup window
Change-Id: Iff958cc8d2ef301a43db406aa38dd446bb2242a5
-rw-r--r--svx/source/tbxctrls/colorwindow.hxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx48
2 files changed, 15 insertions, 35 deletions
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index fd8eef7701f6..086cdef64282 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -52,8 +52,6 @@ private:
const sal_uInt16 nButtonHeight;
PaletteManager& mrPaletteManager;
- void UpdateGUI();
-
DECL_LINK( SelectHdl, void * );
DECL_LINK( SelectPaletteHdl, void *);
DECL_LINK( OpenPickerClickHdl, void * );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f75c049450cc..d8210d28143e 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -98,7 +98,6 @@
// 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, sal_uInt16 nVertPadding );
static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
// namespaces
@@ -1075,7 +1074,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
aButtonPicker.SetText("P");
- aButtonPicker.SetSizePixel(Size(nButtonWidth, nButtonHeight));
aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
aButtonPicker.Show();
@@ -1089,26 +1087,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
AddStatusListener( OUString( ".uno:ColorTableState" ));
AddStatusListener( maCommand );
- UpdateGUI();
-}
-
-
-void SvxColorWindow_Impl::UpdateGUI()
-{
mrPaletteManager.ReloadColorSet(aColorSet);
-
- const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
- aColorSet.SetOutputSizePixel(aNewSize);
- static sal_Int32 nAdd = 4;
-
- //TODO: Move left/right buttons above the colors
- SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nButtonHeight));
-
- aPaletteComboBox.SetPosPixel(Point(0, aNewSize.Height() + nAdd + 1));
-
- aButtonPicker.SetPosPixel(Point(aNewSize.Width() + nAdd - nButtonWidth, aNewSize.Height() + nAdd + 1));
-
- aPaletteComboBox.SetSizePixel(Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
}
SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1167,7 +1146,8 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
OUString sSrchTxt = aPaletteComboBox.GetText();
sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt );
mrPaletteManager.SetPalette( nPos );
- UpdateGUI();
+ mrPaletteManager.ReloadColorSet(aColorSet);
+ Resize();
return 0;
}
@@ -1179,7 +1159,16 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
void SvxColorWindow_Impl::Resize()
{
- lcl_ResizeValueSet( *this, aColorSet, nButtonHeight + 2);
+ const Size aSize(this->GetOutputSizePixel());
+ aColorSet.SetPosSizePixel( Point(2, nButtonHeight + 2), Size(aSize.Width() - 4, aSize.Height() - 6 - nButtonHeight) );
+
+ const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
+ aColorSet.SetOutputSizePixel(aNewSize);
+
+ SetOutputSizePixel(Size(aNewSize.Width() + 4, aNewSize.Height() + 4 + nButtonHeight));
+
+ aPaletteComboBox.SetPosSizePixel(Point(2, 0), Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
+ aButtonPicker.SetPosSizePixel(Point(aNewSize.Width() + 4 - nButtonWidth, 0), Size(nButtonWidth, nButtonHeight));
}
void SvxColorWindow_Impl::StartSelection()
@@ -1198,7 +1187,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
{
if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
{
- UpdateGUI();
+ mrPaletteManager.ReloadColorSet(aColorSet);
}
else if ( SFX_ITEM_DEFAULT <= eState )
{
@@ -1436,7 +1425,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
void SvxFrameWindow_Impl::Resize()
{
- lcl_ResizeValueSet( *this, aFrameSet, 0 );
+ const Size aSize(this->GetOutputSizePixel());
+ aFrameSet.SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4));
}
void SvxFrameWindow_Impl::StateChanged(
@@ -2532,14 +2522,6 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState,
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding)
-{
- Size aSize = rWin.GetOutputSizePixel();
- aSize.Width() -= 4;
- aSize.Height() -= 4 + nVertPadding;
- rValueSet.SetPosSizePixel( Point(2,2), aSize );
-}
-
static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
{
Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );