diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-09-28 11:50:31 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-10-01 19:10:17 +0200 |
commit | 5294e6b70bf755b87bc4f87af866c9dd9e99f53e (patch) | |
tree | 19baacccc9468e61ef2e9a5a477f688186db082c /sc | |
parent | 9fea1806224c853076640f79b93461b3d2263e4c (diff) |
improve conditional formatting height calculations.
Change-Id: If5080892b820d268ffef22111d0caee217586b56
Signed-off-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/condformat/condformatdlg.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 5c6d0f2586e1..9fe983fc4367 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -494,30 +494,25 @@ void ScCondFrmtEntry::HideColorScaleElements() void ScCondFrmtEntry::SetHeight() { - if(mbActive) + long nPad = LogicToPixel(Size(42,2), MapMode(MAP_APPFONT)).getHeight(); + + // Calculate maximum height we need from visible widgets + sal_uInt16 nChildren = GetChildCount(); + + long nMaxHeight = 0; + for(sal_uInt16 i = 0; i < nChildren; i++) { - Size aSize = GetSizePixel(); - switch (meType) - { - case CONDITION: - case FORMULA: - aSize.Height() = 120; - break; - case COLORSCALE: - aSize.Height() = 200; - break; - case DATABAR: - aSize.Height() = 200; - break; - default: - break; - } - SetSizePixel(aSize); + Window *pChild = GetChild(i); + if(!pChild || !pChild->IsVisible()) + continue; + Point aPos = pChild->GetPosPixel(); + Size aSize = pChild->GetSizePixel(); + nMaxHeight = std::max(aPos.Y() + aSize.Height(), nMaxHeight); } - else + Size aSize = GetSizePixel(); + if(nMaxHeight > 0) { - Size aSize = GetSizePixel(); - aSize.Height() = 40; + aSize.Height() = nMaxHeight + nPad; SetSizePixel(aSize); } } |