sw/qa/extras/ooxmlexport/data/tdf141548.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    4 +++-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 6fd2bb9b8967c4945550b0f7b7541aaace8020c1
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Mon Apr 19 17:52:17 2021 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Apr 19 22:24:44 2021 +0200

    tdf#141548 DOCX import: fix lost text after endnoteRef
    
    First run of the endnote (footnote) can contain not
    only the footnoteRef/endnoteRef, but endnote (footnote)
    text, too. This text was lost as a regression from
    commit 7dd8f8aace536a8e60e87e61ee1d90d61fba15eb
    "tdf#120351 DOCX import: fix slow endnote import",
    and in the case of the footnotes, from
    commit 9b39ce0e66acfe812e1d50e530dc2ccdef3e1357
    "tdf#76260 DOCX import: fix slow footnote import".
    
    Change-Id: I9964ee47f456a7632a21ab3b0588d3cb70388011
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114300
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf141548.docx 
b/sw/qa/extras/ooxmlexport/data/tdf141548.docx
new file mode 100644
index 000000000000..65c4e8b90756
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf141548.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 7709c46afb66..06c5a16e578a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1178,6 +1178,16 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf141172, 
"tdf141172.docx")
     assertXPath(pXml, "/w:endnotes/w:endnote/w:tbl", 2);
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf141548, "tdf141548.docx")
+{
+    xmlDocUniquePtr pXml = parseExport("word/endnotes.xml");
+    CPPUNIT_ASSERT(pXml);
+    // This was 0 (lost text content of the run with endnoteRef)
+    assertXPath(pXml, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t", 2);
+    assertXPathContent(pXml, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[1]", 
"another endnote");
+    assertXPathContent(pXml, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[2]", 
"new line");
+}
+
 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.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 9d163f2e671e..fddbea557c6c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3645,7 +3645,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
             if (pContext && pContext->GetFootnote().is())
             {
                 pContext->GetFootnote()->setLabel( sText );
-                //otherwise ignore sText
+                // tdf#141548 don't lose footnote/endnote text of the run with 
uFtnEdnRef
+                // (i.e. when footnoteRef/endnoteRef is followed by some text 
in the same run)
+                m_pImpl->appendTextPortion( sText, pContext );
             }
             else if (m_pImpl->IsOpenFieldCommand() && 
!m_pImpl->IsForceGenericFields())
             {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to