[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Sep 25 06:56:38 PDT 2014
sw/qa/extras/ooxmlexport/data/drawingml-flipv.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 14 ++++++++++++++
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 +-
writerfilter/source/dmapper/GraphicImport.cxx | 5 ++++-
4 files changed, 19 insertions(+), 2 deletions(-)
New commits:
commit 9791453283407a0a129a71767a290058ac759da2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Sep 25 15:14:22 2014 +0200
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
diff --git a/sw/qa/extras/ooxmlexport/data/drawingml-flipv.docx b/sw/qa/extras/ooxmlexport/data/drawingml-flipv.docx
new file mode 100644
index 0000000..f10a83f
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/drawingml-flipv.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 0b2c78f..be44a07 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -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: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 7136808..eca11e6 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -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")
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index e2ad109..28550bd 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -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;
More information about the Libreoffice-commits
mailing list