diff options
author | Dhiraj Holden <dhiraj.holden@gmail.com> | 2022-01-01 20:14:33 -0500 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2022-01-05 15:31:58 +0100 |
commit | 207d202ed2f1f44e5b62157b5a92ee5e8cc2c3e5 (patch) | |
tree | 94777e4219d3d1563fa68b51e9245d8b923b51e5 /xmloff/source/draw/ximpshap.cxx | |
parent | e242c0fb26c2bf5662b10fc6c8195deeda5b1097 (diff) |
tdf#130076 Fixed flip not working properly from file
Added code to check whether the angles need to be changed when the
section is flipped.
Change-Id: I9cc3e16db74c6e9616385bc39849e4c73686b56c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127853
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'xmloff/source/draw/ximpshap.cxx')
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 4d2dec38a3c8..a19a6c19d936 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1172,7 +1172,6 @@ void SdXMLEllipseShapeContext::startFastElement (sal_Int32 nElement, maPosition.X = mnCX - mnRX; maPosition.Y = mnCY - mnRY; } - // set pos, size, shear and rotate SetTransformation(); @@ -1181,6 +1180,30 @@ void SdXMLEllipseShapeContext::startFastElement (sal_Int32 nElement, uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY ); if( xPropSet.is() ) { + // calculate the correct start and end angle + sal_Int32 mnOldStartAngle = mnStartAngle; + sal_Int32 mnOldEndAngle = mnEndAngle; + basegfx::B2DTuple aScale; + basegfx::B2DTuple aTranslate; + double fRotate; + double fShearX; + maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX); + if (aScale.getX() < 0 || aScale.getY() < 0) + { + // The angle for a horizontal flip is the same as the angle for a + // vertical flip because a vertical flip is treated as a horizontal + // flip plus a rotation. + + // To perform the flip, the start and end angle are switched and we + // use the fact performing a horizontal flip on a shape will change + // the angle that a radius makes with the origin to 180 degrees + // minus that angle (we use 54000 hundredths of a degree to get the + // modulus operation to give a value between 0 and 36000). + + mnStartAngle = (54000 - mnOldEndAngle) % 36000; + mnEndAngle = (54000 - mnOldStartAngle) % 36000; + } + xPropSet->setPropertyValue("CircleKind", Any( meKind) ); xPropSet->setPropertyValue("CircleStartAngle", Any(mnStartAngle) ); xPropSet->setPropertyValue("CircleEndAngle", Any(mnEndAngle) ); |