summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-18 16:36:19 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-18 16:37:24 +0000
commitbc6479e92b56df742dd7339d337ffc78d2f9e4a1 (patch)
treec4db395d7143b22cb55f91f5b48a27ad087be260 /vcl
parent239e877d51399daedd315b6d1b31543e491169b6 (diff)
change DrawControlText to return new rect rather than change old one
Change-Id: Id5c80ff263e429d4239a844db216e87a656edb2e
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx8
-rw-r--r--vcl/source/control/ctrl.cxx15
-rw-r--r--vcl/source/control/fixed.cxx4
-rw-r--r--vcl/source/control/tabctrl.cxx4
4 files changed, 15 insertions, 16 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 486625ba1539..91cc0ddad8b0 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -286,7 +286,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
}
else if (bDrawText && !bDrawImage && !bHasSymbol)
{
- DrawControlText(*pDev, aOutRect, aText, nTextStyle, nullptr, nullptr);
+ aOutRect = DrawControlText(*pDev, aOutRect, aText, nTextStyle, nullptr, nullptr);
ImplSetFocusRect(aOutRect);
rSize = aOutRect.GetSize();
@@ -511,9 +511,9 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
if (bDrawText)
{
- Rectangle aTOutRect( aTextPos, aTextSize );
- ImplSetFocusRect( aTOutRect );
- DrawControlText( *pDev, aTOutRect, aText, nTextStyle, nullptr, nullptr );
+ const Rectangle aTOutRect(aTextPos, aTextSize);
+ ImplSetFocusRect(aTOutRect);
+ DrawControlText(*pDev, aTOutRect, aText, nTextStyle, nullptr, nullptr);
}
else
{
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 94af54c85d63..f75e54f75684 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -412,7 +412,7 @@ void Control::ImplInitSettings(const bool, const bool)
ApplySettings(*this);
}
-void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr,
+Rectangle Control::DrawControlText( OutputDevice& _rTargetDevice, const Rectangle& rRect, const OUString& _rStr,
DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const
{
OUString rPStr = _rStr;
@@ -429,14 +429,13 @@ void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRec
if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) )
{
- _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, rPStr, nPStyle );
- _rTargetDevice.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText );
- }
- else
- {
- ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice );
- _io_rRect = aRenderer.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText );
+ const Rectangle aRet = _rTargetDevice.GetTextRect(rRect, rPStr, nPStyle);
+ _rTargetDevice.DrawText(aRet, rPStr, nPStyle, _pVector, _pDisplayText);
+ return aRet;
}
+
+ ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice );
+ return aRenderer.DrawText(rRect, rPStr, nPStyle, _pVector, _pDisplayText);
}
Font
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 483e136d6976..46d1299d93a8 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -182,7 +182,7 @@ void FixedText::ImplDraw(OutputDevice* pDev, DrawFlags nDrawFlags,
if( bFillLayout )
(mpControlData->mpLayoutData->m_aDisplayText).clear();
- Rectangle aRect( Rectangle( aPos, rSize ) );
+ const Rectangle aRect(aPos, rSize);
DrawControlText(*pDev, aRect, aText, nTextStyle,
bFillLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : nullptr,
bFillLayout ? &mpControlData->mpLayoutData->m_aDisplayText : nullptr);
@@ -557,7 +557,7 @@ void FixedLine::ImplDraw(vcl::RenderContext& rRenderContext)
if (rStyleSettings.GetOptions() & StyleSettingsOptions::Mono)
nStyle |= DrawTextFlags::Mono;
- DrawControlText(*this, aRect, aText, nStyle, nullptr, nullptr);
+ aRect = DrawControlText(*this, aRect, aText, nStyle, nullptr, nullptr);
long nTop = aRect.Top() + ((aRect.GetHeight() - 1) / 2);
aDecoView.DrawSeparator(Point(aRect.Right() + FIXEDLINE_TEXT_BORDER, nTop), Point(aOutSize.Width() - 1, nTop), false);
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 4c69fcee32a7..f0369b5b6681 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -940,8 +940,8 @@ void TabControl::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* p
Color aOldColor(rRenderContext.GetTextColor());
rRenderContext.SetTextColor(aColor);
- Rectangle aOutRect(nXPos + aImageSize.Width(), nYPos,
- nXPos + aImageSize.Width() + nTextWidth, nYPos + nTextHeight);
+ const Rectangle aOutRect(nXPos + aImageSize.Width(), nYPos,
+ nXPos + aImageSize.Width() + nTextWidth, nYPos + nTextHeight);
DrawControlText(rRenderContext, aOutRect, pItem->maFormatText, nStyle,
nullptr, nullptr);