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

DOCX drawingML filter: avoid fake rotation on vertical flip

This also improves positioning a bit, in the changed testcase the
perfect position would be 211.663888889, and reality is now 210 instead
of 208 (100th millimeters).

Change-Id: I5226f2165224a8bbfebfd11d9c612f72d83b8c69
üst dbbd89ef
......@@ -290,6 +290,20 @@ DECLARE_OOXMLEXPORT_TEST(testNumberingFont, "numbering-font.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Verdana"), getProperty<OUString>(xStyle, "CharFontName"));
}
DECLARE_OOXMLEXPORT_TEST(testDrawingmlFlipv, "drawingml-flipv.docx")
{
// The problem was that the shape had vertical flip only, but then we added rotation as well on export.
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
xmlXPathObjectPtr pXPath = getXPathNode(pXmlDoc, "//a:xfrm");
xmlNodeSetPtr pXmlNodes = pXPath->nodesetval;
CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes));
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
// The attribute existed, so xmlGetProp() returned non-NULL.
CPPUNIT_ASSERT_EQUAL(static_cast<xmlChar*>(0), xmlGetProp(pXmlNode, BAD_CAST("rot")));
}
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1665,7 +1665,7 @@ DECLARE_OOXMLIMPORT_TEST(lineWpsOnly, "line-wps-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
// Check position, it was -7223 as it was set after the CustomShapeGeometry property.
CPPUNIT_ASSERT_EQUAL(sal_Int32(208), xShape->getPosition().X);
CPPUNIT_ASSERT_EQUAL(sal_Int32(210), xShape->getPosition().X);
}
DECLARE_OOXMLIMPORT_TEST(lineRotation, "line-rotation.docx")
......
......@@ -749,11 +749,14 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
if (m_pImpl->isYSizeValis())
aSize.Height = m_pImpl->getYSize();
// TODO: avoid this setSize(), just send the size to
// oox, so it can set the right transformation matrix
// right away.
uno::Any aRotation;
if (bKeepRotation)
aRotation = xShapeProps->getPropertyValue("RotateAngle");
m_xShape->setSize(aSize);
if (bKeepRotation)
if (bKeepRotation && aRotation.hasValue() && aRotation.get<sal_Int32>() != 0)
xShapeProps->setPropertyValue("RotateAngle", aRotation);
m_pImpl->bIsGraphic = true;
......
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