oox/source/export/drawingml.cxx                  |   11 +++++++----
 sw/qa/extras/ooxmlexport/data/dml-textshape.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx         |    8 ++++++++
 3 files changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 305077c6c382aee1c5509b5b7809d8d73d65c674
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Jan 20 15:05:50 2014 +0100

    drawingML export: zero rotation shouldn't alter the shape position
    
    I'm not exactly sure why existing code didn't do this implicitly, but at
    least this improves the situation.
    
    Change-Id: Id2bb169c513827b7ef48640dc88fad90a83d2bee

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2a7d11a..2cddbf5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -743,10 +743,13 @@ void DrawingML::WriteShapeTransformation( Reference< 
XShape > rXShape, sal_Int32
     {
         SdrObject* pShape = (SdrObject*) GetSdrObjectFromXShape( rXShape );
         nRotation=pShape->GetRotateAngle();
-        int faccos=bFlipV ? -1 : 1;
-        int facsin=bFlipH ? -1 : 1;
-        
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;
+        if (nRotation)
+        {
+            int faccos=bFlipV ? -1 : 1;
+            int facsin=bFlipH ? -1 : 1;
+            
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;
+        }
     }
     if (!bSuppressRotation)
     {
diff --git a/sw/qa/extras/ooxmlexport/data/dml-textshape.docx 
b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx
index e5be42c..b98eea7 100644
Binary files a/sw/qa/extras/ooxmlexport/data/dml-textshape.docx and 
b/sw/qa/extras/ooxmlexport/data/dml-textshape.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8d01930..ae4ab8c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -43,6 +43,7 @@
 #include <unotools/tempfile.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <rtl/strbuf.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 #include <com/sun/star/text/XDocumentIndex.hpp>
 
 #include <libxml/xpathInternals.h>
@@ -2483,6 +2484,13 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, 
"dml-textshape.docx")
         return;
     // This was wrap="none".
     assertXPath(pXmlDocument, 
"/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:bodyPr",
 "wrap", "square");
+
+    xShape.set(xGroup->getByIndex(3), uno::UNO_QUERY);
+    OUString aType = 
comphelper::SequenceAsHashMap(getProperty<beans::PropertyValues>(xShape, 
"CustomShapeGeometry"))["Type"].get<OUString>();
+    CPPUNIT_ASSERT_EQUAL(OUString("ooxml-bentConnector3"), aType);
+    // Connector was incorrectly shifted towards the top left corner, X was 
552, Y was 0.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(4018), xShape->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1256), xShape->getPosition().Y);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, 
"shape-theme-preservation.docx")
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to