Kaydet (Commit) 14150826 authored tarafından Miklos Vajna's avatar Miklos Vajna

drawingML export: fix remaining rotation / flip combinations

With this, each rotation = 0 / 90 / 180 / 270 and flip = none /
horizontal / vertical / horizontal+vertical combination (16 cases) are
exported perfectly.

Also, this matches what the (binary) [MS-ODRAW] export does, see
ImplEESdrWriter::ImplWriteShape().

Change-Id: I04030c8c6819c35c06ce97400eb7e2f1f7389a5f
üst 09196ca6
...@@ -1166,19 +1166,10 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32 ...@@ -1166,19 +1166,10 @@ void DrawingML::WriteShapeTransformation( Reference< XShape > rXShape, sal_Int32
aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; 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; aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2;
} }
}
if (!bSuppressRotation) // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here.
{ uno::Reference<beans::XPropertySet> xPropertySet(rXShape, uno::UNO_QUERY);
// See SdrObjCustomShape::NbcRotate(). xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
int nSwap = 0;
if (bFlipH)
nSwap ^= 1;
if (bFlipV)
nSwap ^= 1;
if (nSwap)
{
nRotation=(nRotation+18000)%36000;
}
} }
WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) ); WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
} }
......
...@@ -326,6 +326,17 @@ DECLARE_OOXMLEXPORT_TEST(testRot180Flipv, "rot180-flipv.docx") ...@@ -326,6 +326,17 @@ DECLARE_OOXMLEXPORT_TEST(testRot180Flipv, "rot180-flipv.docx")
} }
} }
DECLARE_OOXMLEXPORT_TEST(testRot270Flipv, "rot270-flipv.docx")
{
// 270° rotation got turned into 90° after roundtrip.
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
assertXPath(pXmlDoc, "//a:xfrm", "flipV", "1");
// This was 5400000.
assertXPath(pXmlDoc, "//a:xfrm", "rot", "16200000");
}
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment