sw/qa/extras/ooxmlexport/data/rot90-fliph.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx       |   11 +++++++++++
 writerfilter/source/dmapper/GraphicImport.cxx  |   19 ++++++++++++-------
 3 files changed, 23 insertions(+), 7 deletions(-)

New commits:
commit dd2b8472a97d1ab01111f9969b046a1c2ec5586a
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Sep 26 12:45:12 2014 +0200

    DOCX drawingML import: fix handling of rotation in case of horizontal flip
    
    Change-Id: I95f74c3d3222a4d713c8d71bcd3263ecb16dba54

diff --git a/sw/qa/extras/ooxmlexport/data/rot90-fliph.docx 
b/sw/qa/extras/ooxmlexport/data/rot90-fliph.docx
new file mode 100644
index 0000000..c2a916d8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/rot90-fliph.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index be44a07..43ea669 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -304,6 +304,17 @@ DECLARE_OOXMLEXPORT_TEST(testDrawingmlFlipv, 
"drawingml-flipv.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRot90Fliph, "rot90-fliph.docx")
+{
+    // The problem was that a shape rotation of 90° got turned into 270° 
after roundtrip.
+    if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+    {
+        assertXPath(pXmlDoc, "//a:xfrm", "flipH", "1");
+        // This was 16200000 (270 * 60000).
+        assertXPath(pXmlDoc, "//a:xfrm", "rot", "5400000");
+    }
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 28550bd..0c914af 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -41,6 +41,8 @@
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
 
+#include <svx/svdobj.hxx>
+#include <svx/unoapi.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/math.hxx>
@@ -749,15 +751,18 @@ 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;
+                        sal_Int32 nRotation = 0;
                         if (bKeepRotation)
-                            aRotation = 
xShapeProps->getPropertyValue("RotateAngle");
+                        {
+                            // Use internal API, getPropertyValue(RotateAngle)
+                            // would use GetObjectRotation(), which is not what
+                            // we want.
+                            if (SdrObject* pShape = 
GetSdrObjectFromXShape(m_xShape))
+                                nRotation = pShape->GetRotateAngle();
+                        }
                         m_xShape->setSize(aSize);
-                        if (bKeepRotation && aRotation.hasValue() && 
aRotation.get<sal_Int32>() != 0)
-                            xShapeProps->setPropertyValue("RotateAngle", 
aRotation);
+                        if (bKeepRotation)
+                            xShapeProps->setPropertyValue("RotateAngle", 
uno::makeAny(nRotation));
 
                         m_pImpl->bIsGraphic = true;
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to