diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2020-10-05 14:57:33 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2020-10-16 12:05:02 +0200 |
commit | c7ada1cc8a294f0d2da32ffc02d0941b1b1afd29 (patch) | |
tree | 22ba18439f8dbe7ef3db43131572b4f523dc0843 /svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | |
parent | 3503c03ece2fd912f4ba4767894eb97d8f9aae07 (diff) |
tdf#128212 Change the text z camera rotation order.
Old order:
1) Apply all rotation values (normal and camera z)
2) Do the adjustment (top, middle, bottom)
New Order:
1) Apply rotation values except camera z
2) Do the adjustment (top, middle, bottom)
3) Apply camera z rotation.
We rotate the text at the center of the already positioned rectangle
of the text, which depends on e.g. the length of the laid out text.
This matches the PowerPoint behavior.
Change-Id: I8741cf443834bf01cc07c04318fd6205ed6a0dd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103965
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index ccc70b0d3805..2b1a1913f003 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -159,18 +159,13 @@ namespace sdr::contact // #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)) || - !basegfx::fTools::equalZero(GetCustomShapeObj().GetCameraRotation())) + if(!basegfx::fTools::equalZero(GetCustomShapeObj().GetExtraTextRotation(true))) { basegfx::B2DVector aTranslation(0.5, 0.5); aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() ); aTextBoxMatrix.rotate(basegfx::deg2rad( - 360.0 - GetCustomShapeObj().GetExtraTextRotation(true) - GetCustomShapeObj().GetCameraRotation())); + 360.0 - GetCustomShapeObj().GetExtraTextRotation(true))); aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); } // give text object a size @@ -178,7 +173,6 @@ namespace sdr::contact // 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)) @@ -191,13 +185,13 @@ namespace sdr::contact aTextRange.getMinY() - aObjectRange.getMinimum().getY()); } - if(!basegfx::fTools::equalZero(fExtraTextRotation) || !basegfx::fTools::equalZero(fTextCameraZRotation)) + if(!basegfx::fTools::equalZero(fExtraTextRotation)) { 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 + fTextCameraZRotation)); + aTextBoxMatrix.rotate(basegfx::deg2rad(360.0 - fExtraTextRotation)); aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() ); } @@ -214,13 +208,6 @@ namespace sdr::contact // 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()); |