summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-09-17 17:08:02 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-10-04 09:17:23 +0200
commit74fc3dd94adeaac750e4cea08281d912dc5a11ee (patch)
tree0f107333f425dad7bef48816a6492ba597c999fc
parent6de9cff1f918b6fc3ef58d9e080388c741e84b55 (diff)
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/80109 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf124600.docxbin15667 -> 15746 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx11
-rw-r--r--sw/source/core/doc/textboxhelper.cxx13
3 files changed, 24 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf124600.docx b/sw/qa/extras/ooxmlimport/data/tdf124600.docx
index d5dfa313665e..16c4ceb2be5d 100644
--- a/sw/qa/extras/ooxmlimport/data/tdf124600.docx
+++ b/sw/qa/extras/ooxmlimport/data/tdf124600.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index a186e34db0f1..008e68839896 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -112,6 +112,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 686485ff33e5..718123e3b1a7 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -444,6 +444,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)
{