sw/qa/extras/layout/data/tdf58521_endnotes.docx |binary
 sw/qa/extras/layout/layout2.cxx                 |   16 ++++++++++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx       |    2 +-
 writerfilter/source/filter/WriterFilter.cxx     |    1 +
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit f9982c24066d6dd2f938cc20176af0f196bc018f
Author:     Gabor Kelemen <kelemen.gab...@nisz.hu>
AuthorDate: Wed Jul 7 00:38:46 2021 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Jul 13 10:45:19 2021 +0200

    tdf#58521 DOCX import: enable ContinuousEndnotes compat flag
    
    like Writer for DOC import and MSO do to avoid to start
    endnotes on a new page.
    
    Change-Id: I37d54f189e7aa1f4d0ac829b6af0c03aec64b9f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118541
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/layout/data/tdf58521_endnotes.docx 
b/sw/qa/extras/layout/data/tdf58521_endnotes.docx
new file mode 100644
index 000000000000..f709a104c918
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf58521_endnotes.docx 
differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 1db5f1e69214..a1c94ea2cb39 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -1571,6 +1571,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, 
testUserFieldTypeLanguage)
                 "1,234.56");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf58521)
+{
+    // This is a testcase for the ContinuousEndnotes compat flag in docx.
+    // The document has 2 pages, the endnote anchor is on the first page.
+    // The endnote should be on the 2nd page together with the last page 
content.
+    createSwDoc(DATA_DIRECTORY, "tdf58521_endnotes.docx");
+    xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 2
+    // - Actual  : 3
+    // i.e. there was a separate endnote page
+    assertXPath(pXmlDoc, "/root/page", 2);
+    assertXPath(pXmlDoc, "/root/page[2]/ftncont", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 6f784e6174c1..f6d643f7af88 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -948,7 +948,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, 
"tdf82173_endnoteStyle.docx"
 
 DECLARE_OOXMLEXPORT_TEST(testTdf55427_footnote2endnote, 
"tdf55427_footnote2endnote.odt")
 {
-    CPPUNIT_ASSERT_EQUAL(4, getPages());
+    CPPUNIT_ASSERT_EQUAL(5, getPages());
     uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("ParagraphStyles")->getByName("Footnote"), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote style is rose color", 
sal_Int32(0xFF007F), getProperty< sal_Int32 >(xPageStyle, "CharColor") );
     xPageStyle.set(getStyles("ParagraphStyles")->getByName("Endnote"), 
uno::UNO_QUERY);
diff --git a/writerfilter/source/filter/WriterFilter.cxx 
b/writerfilter/source/filter/WriterFilter.cxx
index 2d20ab1ef0c3..a42e4bd186b4 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -332,6 +332,7 @@ void WriterFilter::setTargetDocument(const 
uno::Reference<lang::XComponent>& xDo
     xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", 
uno::makeAny(true));
     xSettings->setPropertyValue("DoNotCaptureDrawObjsOnPage", 
uno::makeAny(true));
     xSettings->setPropertyValue("DisableOffPagePositioning", 
uno::makeAny(true));
+    xSettings->setPropertyValue("ContinuousEndnotes", uno::makeAny(true));
 }
 
 void WriterFilter::setSourceDocument(const uno::Reference<lang::XComponent>& 
xDoc)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to