sw/qa/extras/ooxmlimport/data/tdf104167.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 13 +++++++++++++ writerfilter/source/dmapper/StyleSheetTable.cxx | 9 --------- 3 files changed, 13 insertions(+), 9 deletions(-)
New commits: commit a283627036c9b1c56e4b765866b8fb8a26ec87ab Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Sep 23 21:02:54 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Sep 24 09:00:57 2019 +0200 tdf#104167 DOCX import: don't map Heading1 to Heading 1 para style This is nominally a regression from commit c12a78e42e1cbaaf4ea021c82acbec5ea177b1f6 (writerfilter: reset properties of reused styles, 2014-06-04), which assumed that style names are unique. They are not unique for the bugdoc, as it has paragraph styles named 'heading 1' and 'Heading1', both mapped to 'Heading 1'. The mapping for the style name without a space was added in commit 1d2af74e226bf44e1a0f1e1981ca965cffeaa0b2 (INTEGRATION: CWS xmlfilter02 (1.27.12); FILE MERGED, 2008-01-10), in the "2007/11/22 14:53:43 os 1.27.12.9: Tab stops almost perfect now" part, sadly without any indication on why that would be a good idea. The binary DOC import never mapped Heading1 to Heading 1, so it doesn't have this problem. Fix the problem by removing this mapping, it leads to formatting loss when a document has both HeadingN and Heading N styles. Change-Id: I26dd999f5a536e079ac351ba5d40d20c83b99310 Reviewed-on: https://gerrit.libreoffice.org/79422 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlimport/data/tdf104167.docx b/sw/qa/extras/ooxmlimport/data/tdf104167.docx new file mode 100644 index 000000000000..3bd881ba02df Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf104167.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index ef8c41158a05..42bbd3308f00 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp> #include <com/sun/star/embed/Aspects.hpp> #include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/style/BreakType.hpp> #include <xmloff/odffields.hxx> #include <IDocumentMarkAccess.hxx> #include <IMark.hxx> @@ -309,6 +310,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124398, "tdf124398.docx") CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.OLE2Shape"), xShape->getShapeType()); } +DECLARE_OOXMLIMPORT_TEST(testTdf104167, "tdf104167.docx") +{ + // Make sure that heading 1 paragraphs start on a new page. + uno::Any xStyle = getStyles("ParagraphStyles")->getByName("Heading 1"); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4 + // - Actual : 0 + // i.e. the <w:pageBreakBefore/> was lost on import. + CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, + getProperty<style::BreakType>(xStyle, "BreakType")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") { OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top"); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index bd983857545a..825f1511b60b 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1278,15 +1278,6 @@ static const sal_Char* const aStyleNamePairs[] = "heading 7", "Heading 7", "heading 8", "Heading 8", "heading 9", "Heading 9", - "Heading1", "Heading 1", - "Heading2", "Heading 2", - "Heading3", "Heading 3", - "Heading4", "Heading 4", - "Heading5", "Heading 5", - "Heading6", "Heading 6", - "Heading7", "Heading 7", - "Heading8", "Heading 8", - "Heading9", "Heading 9", "Heading 1", "Heading 1", "Heading 2", "Heading 2", "Heading 3", "Heading 3", _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits