[Libreoffice-commits] core.git: sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 11 11:58:59 UTC 2021
sw/qa/extras/ooxmlexport/data/tdf143583_emptyParaAtEndOfFootnote.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 13 ++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++-
3 files changed, 16 insertions(+), 1 deletion(-)
New commits:
commit c46950fee11f5207fb8324947280cd565ae483e7
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Aug 10 13:05:48 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Wed Aug 11 13:58:26 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 <nemeth at numbertext.org>
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 d783c8f448de..41a5f26acb8b 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 c5bfed90ae1a..1249d45c82dd 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3210,6 +3210,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() ) ) )
{
@@ -3251,11 +3252,12 @@ void DomainMapper_Impl::PopFootOrEndnote()
// remove temporary footnote
xFootnoteFirst->getAnchor()->setString("");
+ bCopied = true;
}
}
}
- if (!IsRTFImport())
+ if (!IsRTFImport() && !bCopied)
RemoveLastParagraph();
// In case the foot or endnote did not contain a tab.
More information about the Libreoffice-commits
mailing list