summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-06-26 13:42:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-06-26 13:55:24 +0100
commit8ece576c35094b9277a7536f0f6d23526341194e (patch)
tree412cf601ba44ad8d5d5e8c3dc60c689bcad479ca /sc
parent2022c84d1e7e88e65243c6dfd1a62ec17f1361a1 (diff)
fix OptionString to set a correct item size
Change-Id: I3406b5481991e459ac051868e441c0c04a2f7d5a
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx32
1 files changed, 29 insertions, 3 deletions
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 88eb78e6c774..69eecd9f1aed 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -36,8 +36,32 @@ public:
void SetValue(const OUString &rValue) { maValue = rValue; }
virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry);
+
+ virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData);
};
+void OptionString::InitViewData(
+ SvTreeListBox* pView, SvTreeListEntry* pEntry, SvViewDataItem* pViewData)
+{
+ if( !pViewData )
+ pViewData = pView->GetViewDataItem( pEntry, this );
+
+ OUString aDesc = maDesc + OUString(": ");
+ Size aDescSize(pView->GetTextWidth(aDesc), pView->GetTextHeight());
+
+ Font aOldFont = pView->GetFont();
+ Font aFont = aOldFont;
+ aFont.SetWeight(WEIGHT_BOLD);
+ //To not make the SvTreeListBox try and recalculate all rows, call the
+ //underlying SetFont, we just want to know what size this text will be
+ //and are going to reset the font to the original again afterwards
+ pView->Control::SetFont(aFont);
+ Size aValueSize(pView->GetTextWidth(maValue), pView->GetTextHeight());
+ pView->Control::SetFont(aOldFont);
+
+ pViewData->maSize = Size(aDescSize.Width() + aValueSize.Width(), std::max(aDescSize.Height(), aValueSize.Height()));
+}
+
void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
{
Point aPos = rPos;
@@ -49,10 +73,12 @@ void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDat
Font aFont = aOldFont;
aFont.SetWeight(WEIGHT_BOLD);
- rDev.SetFont(aFont);
+ //To not make the SvTreeListBox try and recalculate all rows, call the
+ //underlying SetFont, we are going to draw this string and then going to
+ //reset the font to the original again afterwards
+ rDev.Control::SetFont(aFont);
rDev.DrawText(aPos, maValue);
-
- rDev.SetFont(aOldFont);
+ rDev.Control::SetFont(aOldFont);
}
formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos)