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

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 12 07:47:19 UTC 2020


 oox/source/vml/vmlshape.cxx                  |   14 ++++++++++----
 sw/qa/extras/ooxmlexport/data/tdf123622.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   13 +++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 459c7d4190461123057ca05af15d7199d40ed258
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Fri May 8 10:32:09 2020 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Fri Jun 12 09:46:49 2020 +0200

    tdf#123622 DOCX VML import: fix relative horizontal alignment
    
    Margin (left, right, inner, outer) alignments of VML shapes
    weren't handled.
    
    Co-authored-by: Attila Bakos (NISZ)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93723
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 52442a4c0192cbedafe7b77459dd2c3d1cf3614b)
    
    Change-Id: I5f8ece64707a2d699b71d6151887db05ac39c4f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96138
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e1c857f5528e..c26d512ecd23 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -643,10 +643,16 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType
 
     if ( rTypeModel.maPositionHorizontalRelative == "page" )
         rPropSet.setAnyProperty(PROP_HoriOrientRelation, makeAny(text::RelOrientation::PAGE_FRAME));
-    else if ( rTypeModel.maPositionVerticalRelative == "margin" )
-        rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
-    else if ( rTypeModel.maPositionVerticalRelative == "text" )
-        rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME);
+    else if ( rTypeModel.maPositionHorizontalRelative == "margin" )
+        rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
+    else if (rTypeModel.maPositionHorizontalRelative == "right-margin-area" ||
+             rTypeModel.maPositionHorizontalRelative == "inner-margin-area")
+        rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_RIGHT);
+    else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" ||
+             rTypeModel.maPositionHorizontalRelative == "outer-margin-area")
+        rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::PAGE_LEFT);
+    else if ( rTypeModel.maPositionHorizontalRelative == "text" )
+        rPropSet.setProperty(PROP_HoriOrientRelation, text::RelOrientation::FRAME);
 
     if ( rTypeModel.maPositionVertical == "center" )
         rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::CENTER));
diff --git a/sw/qa/extras/ooxmlexport/data/tdf123622.docx b/sw/qa/extras/ooxmlexport/data/tdf123622.docx
new file mode 100644
index 000000000000..54ef0cbd7670
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf123622.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 8d347be29038..cf01b3231e37 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -35,6 +35,19 @@ protected:
     }
 };
 
+DECLARE_OOXMLIMPORT_TEST(testTdf123622, "tdf123622.docx")
+{
+    uno::Reference<beans::XPropertySet> XPropsRight(getShape(1),uno::UNO_QUERY);
+    sal_Int16 nRelativePosR = 0;
+    XPropsRight->getPropertyValue("HoriOrientRelation")>>=nRelativePosR;
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(4), nRelativePosR);
+
+    uno::Reference<beans::XPropertySet> XPropsLeft(getShape(2), uno::UNO_QUERY);
+    sal_Int16 nRelativePosL = 0;
+    XPropsLeft->getPropertyValue("HoriOrientRelation") >>= nRelativePosL;
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Shape inside the margin", sal_Int16(3), nRelativePosL);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf78749, "tdf78749.docx")
 {
     //Shape lost the background image before, now check if it still has...


More information about the Libreoffice-commits mailing list