diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2017-03-17 02:25:39 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2017-03-17 14:21:58 +0200 |
commit | d920613f6733fdc5931b972177788eb3fbaee6c9 (patch) | |
tree | 0bfb71d951cd154b88bb019f70faf80cf6acefa2 /svx/source/tbxctrls | |
parent | 3d67719edab741d1a62a3efd2c4e6019957725e1 (diff) |
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
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r-- | svx/source/tbxctrls/SvxColorValueSet.cxx | 7 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 15 |
2 files changed, 10 insertions, 12 deletions
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()); |