summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Funk <juergen.funk_ml@cib.de>2014-11-07 10:09:07 +0100
committerSamuel Mehrbrodt <s.mehrbrodt@gmail.com>2014-11-07 09:18:18 +0000
commit8923bf821cab049e8f82380450b2440d5e146c7c (patch)
treedf415a413cc43ca294b24ecfbbfb13785d24c82e
parentbd15fb03dfc3a14b8f1f233080ec3084e0bf25be (diff)
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.mehrbrodt@gmail.com> Tested-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
-rw-r--r--svx/source/tbxctrls/SvxColorValueSet.cxx21
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx1
2 files changed, 10 insertions, 12 deletions
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index 4085912edf9f..11e90edc133e 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 e5b0d1ae2c06..a0a9649e171d 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;
}