summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2022-05-25 11:57:13 +0200
committerAron Budea <aron.budea@collabora.com>2023-03-29 19:43:05 +0000
commit8bc5e39f8df1b8f387fd1c3b6d5a16e48eb2e50a (patch)
tree53136badad940461c1006119afeaa3b5afcb7b0b /sw
parent416b47096203b13365953eff93eb800860f7a4cf (diff)
tdf#146955 DOCX import: fix SAX exception with footnotes
(Likely broken) DOCX documents exported by Writer raised a SAX exception, when PopFootOrEndnote() tried to access to a not-existent footnote, because PushFootOrEndnote() failed to create that. Note: the original ODT contains hundreds of frames, and these and the text content of the document have been put into the TOC section during Writer's DOCX export, resulting a broken document. Regression from commit 9b39ce0e66acfe812e1d50e530dc2ccdef3e1357 "tdf#76260 DOCX import: fix slow footnote import". Change-Id: I9e32feb0cae778a87f034a8b5c41989fec90899d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134934 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 73696a01224a3758bde686f32ec7e6f4c90877fe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149727 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf146955.odtbin0 -> 77349 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx12
2 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf146955.odt b/sw/qa/extras/ooxmlexport/data/tdf146955.odt
new file mode 100644
index 000000000000..c7a849f9b756
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf146955.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 98be0085ab6e..e889b07009ea 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -13,6 +13,7 @@
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/util/XRefreshable.hpp>
@@ -633,6 +634,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx")
}
}
+// broken test document?
+#if !defined(_WIN32)
+DECLARE_OOXMLEXPORT_TEST(testTdf146955, "tdf146955.odt")
+{
+ // import of a (broken?) DOCX export with dozens of frames raised a SAX exception,
+ // when the code tried to access to a non-existent footnote
+ uno::Reference<text::XFootnotesSupplier> xNotes(mxComponent, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xNotes->getFootnotes()->getCount());
+}
+#endif
+
DECLARE_OOXMLEXPORT_TEST(testTdf144668, "tdf144668.odt")
{
uno::Reference<beans::XPropertySet> xPara1(getParagraph(1, u"level1"), uno::UNO_QUERY);