diff options
-rw-r--r-- | svx/source/tbxctrls/colorwindow.hxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 48 |
2 files changed, 15 insertions, 35 deletions
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx index 191c706d736d..702cf87ad3d7 100644 --- a/svx/source/tbxctrls/colorwindow.hxx +++ b/svx/source/tbxctrls/colorwindow.hxx @@ -45,8 +45,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 f44f869ec3f8..f3bfbe5ef0a9 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -96,7 +96,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 @@ -1059,7 +1058,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(); @@ -1073,26 +1071,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() @@ -1151,7 +1130,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; } @@ -1163,7 +1143,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() @@ -1182,7 +1171,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 ( SfxItemState::DEFAULT <= eState ) { @@ -1420,7 +1409,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( @@ -2516,14 +2506,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 ); |