From 9ae1e094d5a8a5b4432c88ebea0ca9fc1c79f602 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Tue, 24 Oct 2017 22:39:08 +0200 Subject: PPTX export: correct position of rotated groups MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added testcase for tdf#113263 Change-Id: I7abf68d8fb4ffd8b883cfbf4d69916912add8182 Reviewed-on: https://gerrit.libreoffice.org/43794 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- oox/source/export/drawingml.cxx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'oox') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 5e1487dd9d9c..d243a4f99d13 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1294,11 +1294,17 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa awt::Point aPos = rXShape->getPosition(); awt::Size aSize = rXShape->getSize(); + bool bPositiveY = true; + bool bPositiveX = true; + if (GetDocumentType() == DOCUMENT_DOCX && m_xParent.is()) { awt::Point aParentPos = m_xParent->getPosition(); aPos.X -= aParentPos.X; aPos.Y -= aParentPos.Y; + + bPositiveX = aParentPos.X >= 0; + bPositiveY = aParentPos.Y >= 0; } if ( aSize.Width < 0 ) @@ -1316,6 +1322,17 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2; } + else if(nRotation == 18000) + { + if (!bFlipV && bPositiveX) + { + aPos.X -= aSize.Width; + } + if (!bFlipH && bPositiveY) + { + aPos.Y -= aSize.Height; + } + } // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here. uno::Reference xPropertySet(rXShape, uno::UNO_QUERY); -- cgit v1.2.3