[Libreoffice-commits] core.git: sw/qa sw/source

Szabolcs (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 8 10:55:19 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                  |   12 ++++++++++++
 sw/source/filter/ww8/docxsdrexport.cxx                     |    8 ++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 08a11f8fe19560b000c62da00d7425b4f500d605
Author:     Szabolcs <szabolcs450 at gmail.com>
AuthorDate: Tue Mar 24 15:38:14 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Apr 8 12:54:45 2020 +0200

    tdf#104565 DOCX drawing object export: fix arrow positions
    
    Saving some arrows from ODT to DOCX scattered them around
    their correct position. This happened because of a function that
    recalculates the position of drawing objects when they are rotated,
    according to the rotation. It turns out we don't have to do this
    with lines and such.
    
    Co-Author: Balázs Regényi
    
    Change-Id: Iea6a34d15003cacc27a8030cb73511aba39225f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90989
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx
new file mode 100644
index 000000000000..514eeddbafb8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 498cf8a95772..99aa70e27cd5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1115,6 +1115,18 @@ DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx")
     CPPUNIT_ASSERT(arrowStyle.indexOf(u"flip:xy") != sal_Int32(-1));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testArrowPosition, "tdf104565_ArrowPosition.docx")
+{
+    // tdf#104565: Test correct position.
+    xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+
+    // This is the correct Y coordinate, the incorrect was 817880.
+    assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+        "/wp:positionV/wp:posOffset", "516255");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index fbdee23ebd70..66ab33a15ac9 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -441,8 +441,12 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons
                                     ->getIDocumentDrawModelAccess()
                                     .GetInvisibleHellId();
 
-            nRotation = pObj->GetRotateAngle();
-            lclMovePositionWithRotation(aPos, rSize, nRotation);
+            // Do not do this with lines.
+            if (pObj->GetObjIdentifier() != OBJ_LINE)
+            {
+                nRotation = pObj->GetRotateAngle();
+                lclMovePositionWithRotation(aPos, rSize, nRotation);
+            }
         }
         attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
         // Extend distance with the effect extent if the shape is not rotated, which is the opposite


More information about the Libreoffice-commits mailing list