sw/qa/extras/ooxmlexport/data/tdf143583_emptyParaAtEndOfFootnote.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 13 ++++++++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 5 +++ 3 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 65b64d70875bc65d0a0da7ef85a98e2152cbbe53 Author: László Németh <[email protected]> AuthorDate: Tue Aug 10 13:05:48 2021 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Aug 11 20:28:08 2021 +0200 tdf#143583 DOCX import: fix lost empty paragraphs of footnotes Last empty paragraphs of footnotes were removed (except in the case of the first footnote), related to the double call of RemoveLastParagraph() during footnote load and later during its copying. Regression from commit 9b39ce0e66acfe812e1d50e530dc2ccdef3e1357 "tdf#76260 DOCX import: fix slow footnote import". Change-Id: I61d9aa6765f3af1893451684dde12c199251d06b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120270 Tested-by: Jenkins Reviewed-by: László Németh <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120334 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf143583_emptyParaAtEndOfFootnote.docx b/sw/qa/extras/ooxmlexport/data/tdf143583_emptyParaAtEndOfFootnote.docx new file mode 100644 index 000000000000..e8b42b840a93 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf143583_emptyParaAtEndOfFootnote.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 9944636960c0..aefa24911b43 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -1177,6 +1177,19 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143399, "tdf143399.docx") assertXPathContent(pXml2, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t[1]", "Endnotes"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143583, "tdf143583_emptyParaAtEndOfFootnote.docx") +{ + xmlDocUniquePtr pXml = parseExport("word/footnotes.xml"); + CPPUNIT_ASSERT(pXml); + assertXPath(pXml, "/w:footnotes/w:footnote[3]/w:p", 2); + // This was 1 + assertXPath(pXml, "/w:footnotes/w:footnote[4]/w:p", 2); + // This was 2 + assertXPath(pXml, "/w:footnotes/w:footnote[5]/w:p", 3); + // This was 2 + assertXPath(pXml, "/w:footnotes/w:footnote[6]/w:p", 3); +} + DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx") { // Load a document with a continuous section break on page 2. diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index b52b24162344..56451b752221 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3135,6 +3135,7 @@ void DomainMapper_Impl::PopFootOrEndnote() // FIXME: add footnote IDs to handle possible differences in footnote serialization uno::Reference< text::XFootnotesSupplier> xFootnotesSupplier( GetTextDocument(), uno::UNO_QUERY ); uno::Reference< text::XEndnotesSupplier> xEndnotesSupplier( GetTextDocument(), uno::UNO_QUERY ); + bool bCopied = false; if ( IsInFootOrEndnote() && ( ( IsInFootnote() && GetFootnoteCount() > -1 && xFootnotesSupplier.is() ) || ( !IsInFootnote() && GetEndnoteCount() > -1 && xEndnotesSupplier.is() ) ) ) { @@ -3173,6 +3174,8 @@ void DomainMapper_Impl::PopFootOrEndnote() // remove processed redlines for( size_t i = 0; redIdx > -1 && i <= sal::static_int_cast<size_t>(redIdx) + 2; i++) m_aStoredRedlines[eType].pop_front(); + + bCopied = true; } // remove temporary footnote @@ -3180,7 +3183,7 @@ void DomainMapper_Impl::PopFootOrEndnote() } } - if (!IsRTFImport()) + if (!IsRTFImport() && !bCopied) RemoveLastParagraph(); // In case the foot or endnote did not contain a tab.
