[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 20 14:00:08 UTC 2021
sw/qa/extras/ooxmlexport/data/tdf143399.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 17 +++++++++++++++++
writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 15 ++++++++-------
writerfilter/source/ooxml/OOXMLDocumentImpl.hxx | 3 ++-
4 files changed, 27 insertions(+), 8 deletions(-)
New commits:
commit f78a21df119603cd6db03f8544871c7a41f16864
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Jul 20 09:51:47 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 20 15:59:26 2021 +0200
tdf#143399 DOCX import: fix lost endnotes or footnotes
in a document containing both of them.
Regression from commit 7dd8f8aace536a8e60e87e61ee1d90d61fba15eb
"tdf#120351 DOCX import: fix slow endnote import".
Change-Id: I0fe764f3b48dd2688afa4b7cf0ee6658737ef9fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119239
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 732b08b22eee2682351a9295be29188852fb0489)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119187
Tested-by: Jenkins
diff --git a/sw/qa/extras/ooxmlexport/data/tdf143399.docx b/sw/qa/extras/ooxmlexport/data/tdf143399.docx
new file mode 100644
index 000000000000..191e46f36bb1
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf143399.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index e383984c1170..9944636960c0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1160,6 +1160,23 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf141548, "tdf141548.docx")
assertXPathContent(pXml, "/w:endnotes/w:endnote[4]/w:p/w:r[2]/w:t[2]", "new line");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf143399, "tdf143399.docx")
+{
+ xmlDocUniquePtr pXml = parseExport("word/footnotes.xml");
+ CPPUNIT_ASSERT(pXml);
+ // These were 0 (lost text content of documents both with footnotes and endnotes)
+ assertXPath(pXml, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", 1);
+ assertXPathContent(pXml, "/w:footnotes/w:footnote[3]/w:p/w:r[3]/w:t", "Footnotes_graphic2");
+ assertXPath(pXml, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", 1);
+ assertXPathContent(pXml, "/w:footnotes/w:footnote[4]/w:p/w:r[3]/w:t", "Footnotes_grahic");
+
+ xmlDocUniquePtr pXml2 = parseExport("word/endnotes.xml");
+ CPPUNIT_ASSERT(pXml);
+ // This was 0 (lost text content of the run with endnoteRef)
+ assertXPath(pXml2, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t", 1);
+ assertXPathContent(pXml2, "/w:endnotes/w:endnote[3]/w:p/w:r[3]/w:t[1]", "Endnotes");
+}
+
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/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 0331d3539508..9a666947d91f 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -52,7 +52,8 @@ namespace writerfilter::ooxml
OOXMLDocumentImpl::OOXMLDocumentImpl(OOXMLStream::Pointer_t const & pStream, const uno::Reference<task::XStatusIndicator>& xStatusIndicator, bool bSkipImages, const uno::Sequence<beans::PropertyValue>& rDescriptor)
: mpStream(pStream)
, mxStatusIndicator(xStatusIndicator)
- , mpXNoteStream()
+ , mpXFootnoteStream()
+ , mpXEndnoteStream()
, mnXNoteId(0)
, mbIsSubstream(false)
, mbSkipImages(bSkipImages)
@@ -270,8 +271,8 @@ void OOXMLDocumentImpl::resolveFootnote(Stream & rStream,
Id aType,
const sal_Int32 nNoteId)
{
- if (!mpXNoteStream)
- mpXNoteStream = getXNoteStream(OOXMLStream::FOOTNOTES, nNoteId);
+ if (!mpXFootnoteStream)
+ mpXFootnoteStream = getXNoteStream(OOXMLStream::FOOTNOTES, nNoteId);
Id nId;
switch (aType)
@@ -285,15 +286,15 @@ void OOXMLDocumentImpl::resolveFootnote(Stream & rStream,
break;
}
- resolveFastSubStreamWithId(rStream, mpXNoteStream, nId);
+ resolveFastSubStreamWithId(rStream, mpXFootnoteStream, nId);
}
void OOXMLDocumentImpl::resolveEndnote(Stream & rStream,
Id aType,
const sal_Int32 nNoteId)
{
- if (!mpXNoteStream)
- mpXNoteStream = getXNoteStream(OOXMLStream::ENDNOTES, nNoteId);
+ if (!mpXEndnoteStream)
+ mpXEndnoteStream = getXNoteStream(OOXMLStream::ENDNOTES, nNoteId);
Id nId;
switch (aType)
@@ -307,7 +308,7 @@ void OOXMLDocumentImpl::resolveEndnote(Stream & rStream,
break;
}
- resolveFastSubStreamWithId(rStream, mpXNoteStream, nId);
+ resolveFastSubStreamWithId(rStream, mpXEndnoteStream, nId);
}
void OOXMLDocumentImpl::resolveCommentsExtendedStream(Stream& rStream)
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
index ed9db125cbe8..3b98cbac58ba 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
@@ -35,7 +35,8 @@ class OOXMLDocumentImpl : public OOXMLDocument
{
OOXMLStream::Pointer_t mpStream;
css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
- writerfilter::Reference<Stream>::Pointer_t mpXNoteStream;
+ writerfilter::Reference<Stream>::Pointer_t mpXFootnoteStream;
+ writerfilter::Reference<Stream>::Pointer_t mpXEndnoteStream;
sal_Int32 mnXNoteId;
css::uno::Reference<css::frame::XModel> mxModel;
More information about the Libreoffice-commits
mailing list