sw/qa/extras/ooxmlimport/data/tdf124600.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx    |   11 +++++++++++
 sw/source/core/doc/textboxhelper.cxx         |   13 +++++++++++++
 3 files changed, 24 insertions(+)

New commits:
commit 858ba31da42b8c9c0367bf20ebbeded74fe0165b
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Sep 17 17:08:02 2019 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Oct 1 12:47:35 2019 +0200

    Related: tdf#124600 sw textbox: sync left/right margin of shape to textbox
    
    Writer TextFrames have a default left/right margin; sync from shape to
    textbox is needed to have correct layout when a DOCX shape has 0 left or
    right margin.
    
    The left margin of the shape was already correct.
    
    (The shape in the docx file was extended to have text.)
    
    (cherry picked from commit ff5f02b9282e19a2a8a68604c588e9487021b0b5)
    
    Change-Id: I832f1bc460f2553bd7f08252d3e21000b4906538
    Reviewed-on: https://gerrit.libreoffice.org/79910
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx 
b/sw/qa/extras/ooxmlimport/data/tdf124600.docx
index d5dfa313665e..16c4ceb2be5d 100644
Binary files a/sw/qa/extras/ooxmlimport/data/tdf124600.docx and 
b/sw/qa/extras/ooxmlimport/data/tdf124600.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 5af1a4021242..99c6d5aaca51 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -110,6 +110,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124600, "tdf124600.docx")
     // i.e. the shape had an unexpected left margin, but not in Word.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
                          getProperty<sal_Int32>(xShape, "HoriOrientPosition"));
+
+    // Make sure that "Shape 1 text" (anchored in the header) has the same 
left margin as the body
+    // text.
+    OUString aShapeTextLeft = 
parseDump("/root/page/header/txt/anchored/fly/infos/bounds", "left");
+    OUString aBodyTextLeft = parseDump("/root/page/body/txt/infos/bounds", 
"left");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1701
+    // - Actual  : 1815
+    // i.e. there was a >0 left margin on the text of the shape, resulting in 
incorrect horizontal
+    // position.
+    CPPUNIT_ASSERT_EQUAL(aBodyTextLeft, aShapeTextLeft);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testTdf120548, "tdf120548.docx")
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index 532f1ea9f00f..d840a66645c1 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -472,6 +472,19 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, 
sal_uInt16 nWID, sal_u
                         break;
                 }
                 break;
+            case RES_LR_SPACE:
+            {
+                switch (nMemberID)
+                {
+                    case MID_L_MARGIN:
+                        aPropertyName = UNO_NAME_LEFT_MARGIN;
+                        break;
+                    case MID_R_MARGIN:
+                        aPropertyName = UNO_NAME_RIGHT_MARGIN;
+                        break;
+                }
+                break;
+            }
             case RES_VERT_ORIENT:
                 switch (nMemberID)
                 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to