summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2019-10-03 08:37:00 +0300
committerGülşah Köse <gulsah.kose@collabora.com>2019-10-16 10:44:00 +0200
commitc50e44b270bc3048ff9c1a000c3afed1dab9e0bf (patch)
treed152dc897d7a54e0e01a1b594b1830f9a45f1e19 /svx/source/sdr
parente1b08d46d1861bfca88af5d8c7137419bcc131aa (diff)
tdf#126060 Handle text camera z rotation while pptx import.
Change-Id: Ifa4589fb50affc4c5ffb52288db8533c98ec6dd9 Reviewed-on: https://gerrit.libreoffice.org/80587 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index ada854fd5503..8630b6dd1923 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -30,6 +30,7 @@
#include <svx/obj3d.hxx>
#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
#include <vcl/canvastools.hxx>
+#include <sal/log.hxx>
namespace sdr
@@ -166,13 +167,18 @@ namespace sdr
// #i101684# get the text range unrotated and absolute to the object range
const basegfx::B2DRange aTextRange(getCorrectedTextBoundRect());
+ // Get the text range before unrotated and independent from object range
+ const tools::Rectangle aIndTextRect(Point(aTextRange.getMinX(), aTextRange.getMinY()), GetCustomShapeObj().GetTextSize());
+ const basegfx::B2DRange aIndTextRange = vcl::unotools::b2DRectangleFromRectangle(aIndTextRect);
+
// Rotation before scaling
- if(!basegfx::fTools::equalZero(GetCustomShapeObj().GetExtraTextRotation(true)))
+ if(!basegfx::fTools::equalZero(GetCustomShapeObj().GetExtraTextRotation(true)) ||
+ !basegfx::fTools::equalZero(GetCustomShapeObj().GetCameraRotation()))
{
basegfx::B2DVector aTranslation(0.5, 0.5);
aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
aTextBoxMatrix.rotate(basegfx::deg2rad(
- 360.0 - GetCustomShapeObj().GetExtraTextRotation(true)));
+ 360.0 - GetCustomShapeObj().GetExtraTextRotation(true) - GetCustomShapeObj().GetCameraRotation()));
aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
// give text object a size
@@ -180,6 +186,7 @@ namespace sdr
// check if we have a rotation/shear at all to take care of
const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation());
+ const double fTextCameraZRotation(GetCustomShapeObj().GetCameraRotation());
const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat());
if(rGeoStat.nShearAngle || rGeoStat.nRotationAngle || !basegfx::fTools::equalZero(fExtraTextRotation))
@@ -192,13 +199,13 @@ namespace sdr
aTextRange.getMinY() - aObjectRange.getMinimum().getY());
}
- if(!basegfx::fTools::equalZero(fExtraTextRotation))
+ if(!basegfx::fTools::equalZero(fExtraTextRotation) || !basegfx::fTools::equalZero(fTextCameraZRotation))
{
basegfx::B2DVector aTranslation(
( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
- aTextBoxMatrix.rotate(basegfx::deg2rad(360.0 - fExtraTextRotation));
+ aTextBoxMatrix.rotate(basegfx::deg2rad(360.0 - fExtraTextRotation + fTextCameraZRotation));
aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
@@ -215,6 +222,13 @@ namespace sdr
// give text it's target position
aTextBoxMatrix.translate(aObjectRange.getMinimum().getX(), aObjectRange.getMinimum().getY());
}
+ // If text overflows from textbox we should use text info instead of textbox to relocation.
+ else if((aTextRange.getWidth() < aIndTextRange.getWidth() ||
+ aTextRange.getHeight() < aIndTextRange.getHeight()) &&
+ !basegfx::fTools::equalZero(fTextCameraZRotation))
+ {
+ aTextBoxMatrix.translate(aIndTextRange.getCenterX(), aIndTextRange.getCenterY());
+ }
else
{
aTextBoxMatrix.translate(aTextRange.getMinX(), aTextRange.getMinY());