Kaydet (Commit) a1a52ee9 authored tarafından Krisztian Pinter's avatar Krisztian Pinter Kaydeden (comit) Tomaž Vajngerl

Move palette selection ComboBox to top of popup window

Change-Id: Iff958cc8d2ef301a43db406aa38dd446bb2242a5
üst ecbbf4c7
...@@ -45,8 +45,6 @@ private: ...@@ -45,8 +45,6 @@ private:
const sal_uInt16 nButtonHeight; const sal_uInt16 nButtonHeight;
PaletteManager& mrPaletteManager; PaletteManager& mrPaletteManager;
void UpdateGUI();
DECL_LINK( SelectHdl, void * ); DECL_LINK( SelectHdl, void * );
DECL_LINK( SelectPaletteHdl, void *); DECL_LINK( SelectPaletteHdl, void *);
DECL_LINK( OpenPickerClickHdl, void * ); DECL_LINK( OpenPickerClickHdl, void * );
......
...@@ -96,7 +96,6 @@ ...@@ -96,7 +96,6 @@
// don't make more than 15 entries visible at once // don't make more than 15 entries visible at once
#define MAX_STYLES_ENTRIES static_cast< sal_uInt16 >( 15 ) #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 ); static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
// namespaces // namespaces
...@@ -1059,7 +1058,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, ...@@ -1059,7 +1058,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] ); aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
aButtonPicker.SetText("P"); aButtonPicker.SetText("P");
aButtonPicker.SetSizePixel(Size(nButtonWidth, nButtonHeight));
aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) ); aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
aButtonPicker.Show(); aButtonPicker.Show();
...@@ -1073,26 +1071,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, ...@@ -1073,26 +1071,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
AddStatusListener( OUString( ".uno:ColorTableState" )); AddStatusListener( OUString( ".uno:ColorTableState" ));
AddStatusListener( maCommand ); AddStatusListener( maCommand );
UpdateGUI();
}
void SvxColorWindow_Impl::UpdateGUI()
{
mrPaletteManager.ReloadColorSet(aColorSet); 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() SvxColorWindow_Impl::~SvxColorWindow_Impl()
...@@ -1151,7 +1130,8 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl) ...@@ -1151,7 +1130,8 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
OUString sSrchTxt = aPaletteComboBox.GetText(); OUString sSrchTxt = aPaletteComboBox.GetText();
sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt ); sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt );
mrPaletteManager.SetPalette( nPos ); mrPaletteManager.SetPalette( nPos );
UpdateGUI(); mrPaletteManager.ReloadColorSet(aColorSet);
Resize();
return 0; return 0;
} }
...@@ -1163,7 +1143,16 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl) ...@@ -1163,7 +1143,16 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
void SvxColorWindow_Impl::Resize() 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() void SvxColorWindow_Impl::StartSelection()
...@@ -1182,7 +1171,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co ...@@ -1182,7 +1171,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
{ {
if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem ))) if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
{ {
UpdateGUI(); mrPaletteManager.ReloadColorSet(aColorSet);
} }
else if ( SfxItemState::DEFAULT <= eState ) else if ( SfxItemState::DEFAULT <= eState )
{ {
...@@ -1420,7 +1409,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) ...@@ -1420,7 +1409,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
void SvxFrameWindow_Impl::Resize() 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( void SvxFrameWindow_Impl::StateChanged(
...@@ -2516,14 +2506,6 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState, ...@@ -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 ) static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
{ {
Size aSize = rValueSet.CalcWindowSizePixel( aItemSize ); Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment