From f9c43356d7492d1c7a9d267f47d10e123fe4fe37 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 17 Sep 2019 17:08:02 +0200 Subject: Related: tdf#124600 sw textbox: sync left/right margin of shape to textbox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 74fc3dd94adeaac750e4cea08281d912dc5a11ee) Reviewed-on: https://gerrit.libreoffice.org/80439 Reviewed-by: Xisco FaulĂ­ Reviewed-by: Adolfo Jayme Barrientos Tested-by: Mike Kaganski --- sw/qa/extras/ooxmlimport/data/tdf124600.docx | Bin 15667 -> 15746 bytes sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 11 +++++++++++ 2 files changed, 11 insertions(+) (limited to 'sw/qa') 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 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(0), getProperty(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") -- cgit