summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorPaul Trojahn <paul.trojahn@gmail.com>2017-08-17 20:04:27 +0200
committerJan Holesovsky <kendy@collabora.com>2017-09-06 15:47:12 +0200
commit9c0387ef602d84d0079828f0ad4b53ada7ab1d8a (patch)
tree69c75bb2c4b7b8d80bbc629be6b3ed9f5d7c9de0 /oox
parentcc47ba8a8ba72acce94ef9c612afd9f16e3e9e86 (diff)
tdf#111798 Fix deformed export of flipped custom shapes to pptx
Shapes were deformed because flipping wasn't considered when removing the rotation. Also WriteShapeTransformation needs information about flipping to convert the angle correctly. Change-Id: I7d485e93c00e02b9ec6c73ad6ae2876e5bc6360a Reviewed-on: https://gerrit.libreoffice.org/41462 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/41996 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx10
-rw-r--r--oox/source/export/shapes.cxx6
2 files changed, 13 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c8d148aeb1c2..cbf3abb513d7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1165,7 +1165,7 @@ void DrawingML::WriteTransformation( const Rectangle& rRect,
mpFS->endElementNS( nXmlNamespace, XML_xfrm );
}
-void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation )
+void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation, bool bSuppressFlipping )
{
SAL_INFO("oox.shape", "write shape transformation");
@@ -1202,6 +1202,14 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
}
+
+ // OOXML flips shapes before rotating them.
+ if(bFlipH != bFlipV)
+ nRotation = nRotation * -1 + 36000;
+
+ if(bSuppressFlipping)
+ bFlipH = bFlipV = false;
+
WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
}
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7bd85a8cd39f..066a1ecf1021 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -827,7 +827,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
if (bHasHandles && bCustGeom && pShape)
{
- WriteShapeTransformation( xShape, XML_a ); // do not flip, polypolygon coordinates are flipped already
+ WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false, true );// do not flip, polypolygon coordinates are flipped already
tools::PolyPolygon aPolyPolygon( pShape->GetLineGeometry(true) );
sal_Int32 nRotation = 0;
// The RotateAngle property's value is independent from any flipping, and that's exactly what we need here.
@@ -835,8 +835,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const Reference< XShape >& xShape )
uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
+ // Remove rotation
+ bool bInvertRotation = bFlipH != bFlipV;
if (nRotation != 0)
- aPolyPolygon.Rotate(Point(0,0), static_cast<sal_uInt16>(3600-nRotation/10));
+ aPolyPolygon.Rotate(Point(0,0), static_cast<sal_uInt16>(bInvertRotation ? nRotation/10 : 3600-nRotation/10));
WritePolyPolygon( aPolyPolygon );
}
else if (bCustGeom)