summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-09-28 11:50:31 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-28 18:12:21 +0200
commitbee798cf4a91030184e01073c9aaaa5a66174600 (patch)
tree9771b866abbc93bf333acec0c609da48128c6ca8 /sc/source/ui
parent9cce64934020576013ee03c3888a696a98d069de (diff)
improve conditional formatting height calculations.
Change-Id: If5080892b820d268ffef22111d0caee217586b56
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/condformat/condformatdlg.cxx37
1 files changed, 16 insertions, 21 deletions
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 3be5bc2ba239..ef69309bc64b 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -511,30 +511,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);
}
}