summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-09-23 21:02:54 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-09-24 09:00:57 +0200
commita283627036c9b1c56e4b765866b8fb8a26ec87ab (patch)
tree020b93265dbac84428a5c5b3ed900492440c8fb2 /sw
parentb2d8093b19642038631dfb8f1ab6745a380a652c (diff)
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 <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf104167.docxbin0 -> 10909 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx13
2 files changed, 13 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf104167.docx
Binary files 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");