diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de (CIB)> | 2018-02-15 15:41:50 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-02-18 02:13:37 +0100 |
commit | 3369410324fdcc221339685154f3168544c5817d (patch) | |
tree | a0b949bc966a1d46fe1d673333267d747df14dc6 /xmloff | |
parent | 7bffc6f745c86124326472b3719c2cb63869ef55 (diff) |
tdf#115529: Handle rotation for WriterFlyFrames correctly
Change-Id: I5f29b3640eaf24d63c64edfecd6732f336582640
Reviewed-on: https://gerrit.libreoffice.org/49826
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Reviewed-on: https://gerrit.libreoffice.org/49853
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 8 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index a7c806a185c8..118207cd00a4 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1026,6 +1026,14 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( // to me mirrored using * -1.0, see conversion there) const double fRotate(aDecomposedTransform.getRotate() * (1800.0/M_PI)); nRotation = static_cast< sal_Int16 >(basegfx::fround(fRotate) % 3600); + + // tdf#115519 may be negative, with the above modulo maximal -3599, so + // no loop needed here. nRotation is used in setPropertyValue("GraphicRotation") + // and *has* to be in the range [0 .. 3600[ + if(nRotation < 0) + { + nRotation += 3600; + } } } } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index e8fefb009a3a..89351f976236 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3082,13 +3082,14 @@ void XMLTextParagraphExport::_exportTextGraphic( // we have a right-handed coordinate system, so need to correct this by mirroring // the rotation to get the correct transformation. See also case XML_TOK_TEXT_FRAME_TRANSFORM // in XMLTextFrameContext_Impl::XMLTextFrameContext_Impl and #i78696# - const double fRotate(static_cast< double >(-nRotation) * (M_PI/1800.0)); + const double fRotate(static_cast< double >(-nRotation) * (F_PI/1800.0)); // transform to rotation center which is the object's center aSdXMLImExTransform2D.AddTranslate(-aCenter); // add rotation itself - aSdXMLImExTransform2D.AddRotate(fRotate); + // tdf#115529 but correct value modulo 2PI to have it positive and in the range of [0.0 .. 2PI[ + aSdXMLImExTransform2D.AddRotate(basegfx::normalizeToRange(fRotate, F_2PI)); // back-transform after rotation aSdXMLImExTransform2D.AddTranslate(aCenter); |