Kaydet (Commit) 8ece576c authored tarafından Caolán McNamara's avatar Caolán McNamara

fix OptionString to set a correct item size

Change-Id: I3406b5481991e459ac051868e441c0c04a2f7d5a
üst 2022c84d
...@@ -36,8 +36,32 @@ public: ...@@ -36,8 +36,32 @@ public:
void SetValue(const OUString &rValue) { maValue = rValue; } void SetValue(const OUString &rValue) { maValue = rValue; }
virtual void Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* pView, const SvTreeListEntry* pEntry); 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*/) void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
{ {
Point aPos = rPos; Point aPos = rPos;
...@@ -49,10 +73,12 @@ void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDat ...@@ -49,10 +73,12 @@ void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, const SvViewDat
Font aFont = aOldFont; Font aFont = aOldFont;
aFont.SetWeight(WEIGHT_BOLD); 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.DrawText(aPos, maValue);
rDev.Control::SetFont(aOldFont);
rDev.SetFont(aOldFont);
} }
formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos) formula::FormulaGrammar::AddressConvention toAddressConvention(sal_uInt16 nPos)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment