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 | |
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
-rw-r--r-- | include/vcl/settings.hxx | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/SvxColorValueSet.cxx | 7 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 15 | ||||
-rw-r--r-- | svx/uiconfig/ui/colorwindow.ui | 4 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 2 |
5 files changed, 13 insertions, 17 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index ef1835929fbd..8dcaa4ceacfc 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -590,7 +590,7 @@ public: sal_uInt16 GetColorValueSetColumnCount() const; // maximum row/line count for the ColorValueSet control. If more lines would be needed, a scrollbar will - // be used. Default is 40. + // be used. sal_uInt16 GetColorValueSetMaximumRowCount() const; const Size& GetListBoxPreviewDefaultPixelSize() const; 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 @@ </child> <child> <object class="svxcorelo-SvxColorValueSet" id="colorset"> - <property name="width_request">200</property> - <property name="height_request">150</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> </object> <packing> - <property name="expand">True</property> + <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> </packing> diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index e500d50bfa8a..456aca3e109e 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -550,7 +550,7 @@ ImplStyleData::ImplStyleData() : maEdgeBlendingBottomRightColor = RGB_COLORDATA(0x40, 0x40, 0x40); mnListBoxMaximumLineCount = 25; mnColorValueSetColumnCount = 12; - mnColorValueSetMaximumRowCount = 20; + mnColorValueSetMaximumRowCount = 8; maListBoxPreviewDefaultLogicSize = Size(15, 7); maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize() mnListBoxPreviewDefaultLineWidth = 1; |