summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx15
-rw-r--r--oox/source/export/shapes.cxx6
2 files changed, 13 insertions, 8 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aec1aaecc6a5..3d5a7ace8262 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1157,11 +1157,6 @@ void DrawingML::WriteStretch( const css::uno::Reference< css::beans::XPropertySe
void DrawingML::WriteTransformation( const tools::Rectangle& rRect,
sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, sal_Int32 nRotation )
{
- //OOXML flips shapes before rotating them.
- if(bFlipH)
- nRotation = nRotation * -1 + 60000*360;
- if(bFlipV)
- nRotation = nRotation * -1 + 60000*360;
mpFS->startElementNS( nXmlNamespace, XML_xfrm,
XML_flipH, bFlipH ? "1" : nullptr,
@@ -1183,7 +1178,7 @@ void DrawingML::WriteTransformation( const tools::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");
@@ -1220,6 +1215,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( tools::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 b5d4a450b94b..df34231a225b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -823,7 +823,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.
@@ -831,8 +831,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)