From 7f9b242331327c5c1b137b91861a6bb57bfb0ecc Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 26 Sep 2014 18:34:15 +0200 Subject: DOCX drawingML import: fix remaining rotation / flip combinations With this, each rotation = 0 / 90 / 180 / 270 and flip = none / horizontal / vertical / horizontal+vertical combination (16 cases) are imported perfectly. Also adjust a few testcases -- now that in many cases we only set the position in oox, some rounding errors went away. Change-Id: I5567a7d6964775f2caf10a0e539f3eb84d10461e --- oox/source/drawingml/shape.cxx | 11 ++++++++--- oox/source/export/drawingml.cxx | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'oox') diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 1276c9743a33..534317298501 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -418,7 +418,9 @@ Reference< XShape > Shape::createAndInsert( aServiceName == "com.sun.star.drawing.ConnectorShape" ); bool bUseRotationTransform = ( !mbWps || aServiceName == "com.sun.star.drawing.LineShape" || - aServiceName == "com.sun.star.drawing.GroupShape" ); + aServiceName == "com.sun.star.drawing.GroupShape" || + mbFlipH || + mbFlipV ); basegfx::B2DHomMatrix aTransformation; @@ -458,7 +460,10 @@ Reference< XShape > Shape::createAndInsert( if( maPosition.X != 0 || maPosition.Y != 0) { // if global position is used, add it to transformation - aTransformation.translate( maPosition.X, maPosition.Y ); + if (mbWps && aParentTransformation.isIdentity()) + aTransformation.translate( maPosition.X * 360, maPosition.Y * 360); + else + aTransformation.translate( maPosition.X, maPosition.Y ); } aTransformation = aParentTransformation*aTransformation; @@ -986,7 +991,7 @@ Reference< XShape > Shape::createAndInsert( // These can have a custom geometry, so position should be set here, // after creation but before custom shape handling, using the position // we got from the caller. - if (mbWps && aServiceName != "com.sun.star.text.TextFrame") + if (mbWps && aServiceName == "com.sun.star.drawing.LineShape") mxShape->setPosition(maPosition); if( bIsCustomShape ) diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0ca30540dc0e..066049858a4b 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1169,7 +1169,13 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 } if (!bSuppressRotation) { + // See SdrObjCustomShape::NbcRotate(). + int nSwap = 0; + if (bFlipH) + nSwap ^= 1; if (bFlipV) + nSwap ^= 1; + if (nSwap) { nRotation=(nRotation+18000)%36000; } -- cgit