svx/source/tbxctrls/SvxColorValueSet.cxx | 21 +++++++++------------ svx/source/tbxctrls/tbcontrl.cxx | 1 + 2 files changed, 10 insertions(+), 12 deletions(-)
New commits: commit 8923bf821cab049e8f82380450b2440d5e146c7c Author: Juergen Funk <juergen.funk...@cib.de> Date: Fri Nov 7 10:09:07 2014 +0100 Fix fdo#84574 - COLOR PICKER: Palette color list should have scrollbar Change-Id: Ib927d3e1b1349f9a1b5f575180d217fe31f1f11f Reviewed-on: https://gerrit.libreoffice.org/12296 Reviewed-by: Samuel Mehrbrodt <s.mehrbr...@gmail.com> Tested-by: Samuel Mehrbrodt <s.mehrbr...@gmail.com> diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx index 4085912..11e90ed 100644 --- a/svx/source/tbxctrls/SvxColorValueSet.cxx +++ b/svx/source/tbxctrls/SvxColorValueSet.cxx @@ -162,22 +162,19 @@ Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntry SetStyle(aWinBits); Size aNewSize(CalcWindowSizePixel(aItemSize, getColumnCount())); - // evtl. activate vertical scroll - const bool bAdaptHeight(static_cast< sal_uInt32 >(aNewSize.Height()) > nHeight); - - if(bAdaptHeight) - { - SetStyle(aWinBits|WB_VSCROLL); - aNewSize = CalcWindowSizePixel(aItemSize, getColumnCount()); - } - + const Size aItemSizePixel(CalcItemSizePixel(aItemSize)); // calculate field height and available height for requested height const sal_uInt32 nFieldHeight(aNewSize.Height() - aSizeNoScrollNoFields.Height()); - const sal_uInt32 nAvailableHeight(nHeight >= nFieldHeight ? nHeight - nFieldHeight : 0); + const sal_uInt32 nAvailableHeight(nHeight >= nFieldHeight ? nHeight - nFieldHeight + aItemSizePixel.Height() - 1 : 0); // calculate how many lines can be shown there - const Size aItemSizePixel(CalcItemSizePixel(aItemSize)); - const sal_uInt32 nLineCount((nAvailableHeight + aItemSizePixel.Height() - 1) / aItemSizePixel.Height()); + const sal_uInt32 nLineCount(nAvailableHeight / aItemSizePixel.Height()); + const sal_uInt32 nLineMax(ceil(double(nEntryCount)/getColumnCount())); + + if(nLineMax > nLineCount) + { + SetStyle(aWinBits|WB_VSCROLL); + } // set height to wanted height aNewSize.Height() = nHeight; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e5b0d1a..a0a9649 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1270,6 +1270,7 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl) sal_Int32 nPos = mpPaletteListBox->GetSelectEntryPos(); mrPaletteManager.SetPalette( nPos ); mrPaletteManager.ReloadColorSet(*mpColorSet); + mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount()); return 0; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits