From 1bf7f6a1a50ee9f24a3687240fe6ae390b905a6b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 4 Apr 2017 09:12:34 +0200 Subject: tdf#106690 DOCX import: fix automatic spacing before/after numbered para block The context is text nodes with automatic before/after spacing and numbering rules set, like: A * B * C * D E The correct behavior seems to be (though I haven't found this explicitly written in the OOXML spec) to drop spacing between B and C and C and D, but not before B and not after D. Originally no spacing was dropped, then commit c486e875de7c8e845594f5043a37ee8800865782 (tdf#95031 DOCX import: auto spacing inside numbering means no spacing, 2016-10-18) removed spacing around all B/C/D. Fix the problem by checking the numbering rules and automatic after spacing of the previous paragraph, so spacing before B and after D is not removed. Change-Id: Icbdb36e31057ab0e8ac033888cf5cc7c52dad5d0 Reviewed-on: https://gerrit.libreoffice.org/36062 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/ooxmlexport/data/tdf106690.docx | Bin 0 -> 20653 bytes sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf106690.docx (limited to 'sw/qa/extras') diff --git a/sw/qa/extras/ooxmlexport/data/tdf106690.docx b/sw/qa/extras/ooxmlexport/data/tdf106690.docx new file mode 100644 index 000000000000..b233ef81c6cf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf106690.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index e7bc9cbb03ff..178c71b6fcc0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -61,6 +61,15 @@ DECLARE_OOXMLEXPORT_TEST(testTdf95031, "tdf95031.docx") CPPUNIT_ASSERT_EQUAL(static_cast(0), getProperty(getParagraph(3), "ParaTopMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf106690, "tdf106690.docx") +{ + // This was 0, numbering rules with automatic spacing meant 0 + // before/autospacing for all text nodes, even for ones at the start/end of + // a numbered text node block. + CPPUNIT_ASSERT_EQUAL(static_cast(494), getProperty(getParagraph(2), "ParaBottomMargin")); + CPPUNIT_ASSERT_EQUAL(static_cast(494), getProperty(getParagraph(2), "ParaTopMargin")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.docx") { // the paragraph style should set table's text-flow break-before-page -- cgit