summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive2d/textprimitive2d.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/primitive2d/textprimitive2d.cxx')
-rw-r--r--drawinglayer/source/primitive2d/textprimitive2d.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index c845289dd4f8..bf46f4ab21d0 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -241,7 +241,8 @@ namespace drawinglayer
maDXArray(rDXArray),
maFontAttributes(rFontAttributes),
maLocale(rLocale),
- maFontColor(rFontColor)
+ maFontColor(rFontColor),
+ maB2DRange()
{
#ifdef DBG_UTIL
const xub_StrLen aStringLength(getText().Len());
@@ -278,9 +279,7 @@ namespace drawinglayer
basegfx::B2DRange TextSimplePortionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- basegfx::B2DRange aRetval;
-
- if(getTextLength())
+ if(maB2DRange.isEmpty() && getTextLength())
{
// get TextBoundRect as base size
// decompose object transformation to single values
@@ -304,7 +303,7 @@ namespace drawinglayer
aTextLayouter.setFontAttributes(getFontAttributes(), aFontScale.getX(), aFontScale.getY());
// get basic text range
- aRetval = aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength());
+ basegfx::B2DRange aNewRange(aTextLayouter.getTextBoundRect(getText(), getTextPosition(), getTextLength()));
#ifdef WIN32
// when under Windows and the font is unequally scaled, need to correct font X-Scaling factor
if(bCorrectScale)
@@ -321,11 +320,14 @@ namespace drawinglayer
aRangeTransformation.translate(aTranslate.getX(), aTranslate.getY());
// apply range transformation to it
- aRetval.transform(aRangeTransformation);
+ aNewRange.transform(aRangeTransformation);
+
+ // assign to buffered value
+ const_cast< TextSimplePortionPrimitive2D* >(this)->maB2DRange = aNewRange;
}
}
- return aRetval;
+ return maB2DRange;
}
// provide unique ID