summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf108849.docxbin0 -> 1360 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx8
-rw-r--r--writerfilter/source/ooxml/model.xml14
3 files changed, 21 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf108849.docx b/sw/qa/extras/ooxmlimport/data/tdf108849.docx
new file mode 100644
index 000000000000..6f3664374cd8
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf108849.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3778c52d7a50..ce4676dcab88 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1492,6 +1492,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf109053, "tdf109053.docx")
CPPUNIT_ASSERT_EQUAL(getPages(), 2);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf108849, "tdf108849.docx")
+{
+ // sectPr element that is child element of body must be the last child. Hovewer, Word accepts it
+ // in wrong places, and we should do the same (bug-to-bug compatibility) without creating extra sections.
+ CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Misplaced body-level sectPr's create extra sections!", 2, getPages());
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index a5c9a8afabc9..05a7ff6d2a70 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -13194,6 +13194,14 @@
</element>
<ref name="AG_SectPrAttributes"/>
</define>
+ <define name="CT_finalSectPr">
+ <ref name="EG_HdrFtrReferences"/>
+ <ref name="EG_SectPrContents"/>
+ <element name="sectPrChange">
+ <ref name="CT_SectPrChange"/>
+ </element>
+ <ref name="AG_SectPrAttributes"/>
+ </define>
<define name="ST_BrType">
<choice>
<!-- Page Break -->
@@ -16322,7 +16330,7 @@
<define name="CT_Body">
<ref name="EG_BlockLevelElts"/>
<element name="sectPr">
- <ref name="CT_SectPr"/>
+ <ref name="CT_finalSectPr"/>
</element>
</define>
<define name="CT_ShapeDefaults">
@@ -17859,6 +17867,10 @@
<element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/>
<action name="start" action="setLastParagraphInSection"/>
</resource>
+ <resource name="CT_finalSectPr" resource="Properties">
+ <action name="start" action="handleLastParagraphInSection"/>
+ <element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/>
+ </resource>
<resource name="ST_BrType" resource="List">
<value tokenid="ooxml:Value_ST_BrType_column">column</value>
<value tokenid="ooxml:Value_ST_BrType_page">page</value>