From d920613f6733fdc5931b972177788eb3fbaee6c9 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Fri, 17 Mar 2017 02:25:39 +0200 Subject: tdf#106458 Color widget should have same number of rows ... across different platforms/themes, so the standard palette will always fit without a scrollbar. For this, we must not hardcode some arbitrary fixed size, but calculate the size based on the number of rows of the standard palette. Change-Id: Ica1d615b43b350aece6b2c29a73337439dd05ac6 --- svx/source/tbxctrls/SvxColorValueSet.cxx | 7 ++----- svx/source/tbxctrls/tbcontrl.cxx | 15 ++++++++------- svx/uiconfig/ui/colorwindow.ui | 4 +--- 3 files changed, 11 insertions(+), 15 deletions(-) (limited to 'svx') diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index 65955445e602..bef5006d07d6 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -122,10 +122,7 @@ Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount) void SvxColorValueSet::Resize() { - vcl::Window *pParent = GetParent(); - //don't do this for the drop down color palettes - if (pParent && pParent->GetType() != WindowType::FLOATINGWINDOW) - layoutToGivenHeight(GetOutputSizePixel().Height(), GetItemCount()); + layoutToGivenHeight(GetSizePixel().Height(), GetItemCount()); ValueSet::Resize(); } @@ -136,7 +133,7 @@ Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntry nEntryCount++; } - const Size aItemSize(getEntryEdgeLength(), getEntryEdgeLength()); + const Size aItemSize(getEntryEdgeLength() - 2, getEntryEdgeLength() - 2); const WinBits aWinBits(GetStyle() & ~WB_VSCROLL); // get size with all fields disabled diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index aeab85cdb3c8..2a9afe6474f3 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1324,10 +1324,9 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, } OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() ); mpPaletteListBox->SelectEntry( aPaletteName ); - if (mpPaletteListBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) - { - SelectPaletteHdl( *mpPaletteListBox ); - } + const sal_Int32 nSelectedEntry(mpPaletteListBox->GetSelectEntryPos()); + if (nSelectedEntry != LISTBOX_ENTRY_NOTFOUND) + mrPaletteManager.SetPalette(nSelectedEntry); mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); mpButtonNoneColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); @@ -1339,11 +1338,13 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand, mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL ); mrPaletteManager.ReloadColorSet(*mpColorSet); - mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount()); + const sal_uInt32 nMaxItems(mpColorSet->getMaxRowCount() * mpColorSet->getColumnCount()); + Size aSize = mpColorSet->layoutAllVisible(nMaxItems); + mpColorSet->set_height_request(aSize.Height()); + mpColorSet->set_width_request(aSize.Width()); mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet); - mpRecentColorSet->SetLineCount( 1 ); - Size aSize = mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount()); + aSize = mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount()); mpRecentColorSet->set_height_request(aSize.Height()); mpRecentColorSet->set_width_request(aSize.Width()); diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui index 06d41994e78d..427fe869a539 100644 --- a/svx/uiconfig/ui/colorwindow.ui +++ b/svx/uiconfig/ui/colorwindow.ui @@ -103,14 +103,12 @@ - 200 - 150 True True True - True + False True 3 -- cgit