[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - oox/source sw/qa

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 1 08:50:32 UTC 2020


 oox/source/vml/vmlshape.cxx                                |   19 ++++---------
 sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                  |   12 ++++++++
 3 files changed, 18 insertions(+), 13 deletions(-)

New commits:
commit 14f11a2a26163123502ac9ea915416871d180cc0
Author:     Szabolcs Toth <szabolcs450 at gmail.com>
AuthorDate: Tue Mar 17 11:39:33 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Apr 1 10:50:00 2020 +0200

    tdf#100751 DOCX VML shape import: fix arrow direction
    
    Flips along both the y- and x-axis weren't imported,
    resulting wrong direction of arrow and other shapes.
    
    Co-Author: Balázs Regényi
    
    Change-Id: Iac222ac2a6a6110289969c32b40828b83da0aefd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90646
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga991 at gmail.com>
    (cherry picked from commit cb441c4d0adf698e6af9073c6c3285a66b76871e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91391
    Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 45409c3f23a3..e1c857f5528e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -671,11 +671,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
         oRotation = ConversionHelper::decodeRotation(maTypeModel.maRotation);
     if (!maTypeModel.maFlip.isEmpty())
     {
-        if (maTypeModel.maFlip == "x")
+        if (maTypeModel.maFlip.startsWith("x"))
         {
             bFlipX = true;
         }
-        else if (maTypeModel.maFlip == "y")
+        if (maTypeModel.maFlip.endsWith("y"))
         {
             bFlipY = true;
         }
@@ -831,17 +831,10 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
         // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur.
         // It might occur internally in SdrObject of "sw" module, not here.
         // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally.
-        if (bFlipX || bFlipY)
-        {
-            assert(!(bFlipX && bFlipY));
-            css::beans::PropertyValue aProp;
-            if (bFlipX)
-                aProp.Name = "MirroredX";
-            else
-                aProp.Name = "MirroredY";
-            aProp.Value <<= true;
-            aPropVec.push_back(aProp);
-        }
+        if (bFlipX)
+            aPropVec.push_back(comphelper::makePropertyValue("MirroredX", true));
+        if (bFlipY)
+            aPropVec.push_back(comphelper::makePropertyValue("MirroredY", true));
 
         if (!maTypeModel.maAdjustments.isEmpty())
         {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx
new file mode 100644
index 000000000000..8a57f69eaef0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf100751_arrowBothFlip.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 71628cb81e93..566eb076feef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1082,6 +1082,18 @@ DECLARE_OOXMLEXPORT_TEST(testVerticalBorders, "calendar3.docx")
     assertXPathChildren(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[3]/w:tc[3]/w:tcPr/w:tcBorders", 2);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx")
+{
+    // tdf#100751: Both x and y flip should happen.
+
+    xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+
+    OUString arrowStyle = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group/v:shape[2]", "style");
+    CPPUNIT_ASSERT(arrowStyle.indexOf(u"flip:xy") != sal_Int32(-1));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list