summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdotextdecomposition.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/svdraw/svdotextdecomposition.cxx')
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index ff3b839710b2..7102edaedd65 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -25,6 +25,7 @@
#include <svx/svdmodel.hxx>
#include <svx/textchain.hxx>
#include <svx/textchainflow.hxx>
+#include <svx/sdasitm.hxx>
#include <svx/sdtacitm.hxx>
#include <svx/sdtayitm.hxx>
#include <svx/sdtaiitm.hxx>
@@ -45,6 +46,7 @@
#include <drawinglayer/animation/animationtiming.hxx>
#include <basegfx/color/bcolor.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/canvastools.hxx>
#include <editeng/escapementitem.hxx>
#include <editeng/svxenum.hxx>
#include <editeng/flditem.hxx>
@@ -1094,6 +1096,23 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
const basegfx::B2DTuple aAdjOffset(fStartInX, fStartInY);
basegfx::B2DHomMatrix aNewTransformA(basegfx::utils::createTranslateB2DHomMatrix(aAdjOffset.getX(), aAdjOffset.getY()));
+ // Apply the camera rotation. It have to be applied after adjustment of
+ // the text (top, bottom, center, left, right).
+ if(GetCameraZRotation() != 0)
+ {
+ // First find the text rect.
+ basegfx::B2DRange aTextRectangle(/*x1=*/aTranslate.getX() + aAdjustTranslate.getX(),
+ /*y1=*/aTranslate.getY() + aAdjustTranslate.getY(),
+ /*x2=*/aTranslate.getX() + aOutlinerScale.getX() - aAdjustTranslate.getX(),
+ /*y2=*/aTranslate.getY() + aOutlinerScale.getY() - aAdjustTranslate.getY());
+
+ // Rotate the text from the center point.
+ basegfx::B2DVector aTranslateToCenter(aTextRectangle.getWidth() / 2, aTextRectangle.getHeight() / 2);
+ aNewTransformA.translate(-aTranslateToCenter.getX(), -aTranslateToCenter.getY());
+ aNewTransformA.rotate(basegfx::deg2rad(360.0 - GetCameraZRotation() ));
+ aNewTransformA.translate(aTranslateToCenter.getX(), aTranslateToCenter.getY());
+ }
+
// mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
// move the null point which was top left to bottom right.
const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
@@ -1105,6 +1124,7 @@ void SdrTextObj::impDecomposeBlockTextPrimitive(
bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0,
fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+
// create ClipRange (if needed)
basegfx::B2DRange aClipRange;
@@ -1649,4 +1669,19 @@ void SdrTextObj::impDecomposeBlockTextPrimitiveDirect(
rTarget.append(aConverter.getPrimitive2DSequence());
}
+double SdrTextObj::GetCameraZRotation() const
+{
+ const css::uno::Any* pAny;
+ double fTextCameraZRotateAngle = 0.0;
+ const SfxItemSet& rSet = GetObjectItemSet();
+ const SdrCustomShapeGeometryItem& rGeometryItem(rSet.Get(SDRATTR_CUSTOMSHAPE_GEOMETRY));
+
+ pAny = rGeometryItem.GetPropertyValueByName("TextCameraZRotateAngle");
+
+ if ( pAny )
+ *pAny >>= fTextCameraZRotateAngle;
+
+ return fTextCameraZRotateAngle;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */