diff --git a/sw/CppunitTest_sw_ooxmlexport22.mk b/sw/CppunitTest_sw_ooxmlexport22.mk new file mode 100644 index 000000000000..e1137f9c302c --- /dev/null +++ b/sw/CppunitTest_sw_ooxmlexport22.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +#************************************************************************* + +$(eval $(call sw_ooxmlexport_test,22)) + +$(eval $(call gb_CppunitTest_use_custom_headers,sw_ooxmlexport22,\ + officecfg/registry \ +)) + +ifneq ($(filter MORE_FONTS,$(BUILD_TYPE)),) +$(eval $(call gb_CppunitTest_set_non_application_font_use,sw_ooxmlexport22,abort)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 6d4ed9f55967..19fecbe6d9cf 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -99,6 +99,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_ooxmlexport19 \ CppunitTest_sw_ooxmlexport20 \ CppunitTest_sw_ooxmlexport21 \ + CppunitTest_sw_ooxmlexport22 \ CppunitTest_sw_ooxmlexport_template \ CppunitTest_sw_ooxmlfieldexport \ CppunitTest_sw_ooxmllinks \ diff --git a/sw/qa/extras/ooxmlexport/data/tdf165642_glossaryFootnote.docx b/sw/qa/extras/ooxmlexport/data/tdf165642_glossaryFootnote.docx new file mode 100644 index 000000000000..6188a919522b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf165642_glossaryFootnote.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx new file mode 100644 index 000000000000..34408dcc958b --- /dev/null +++ b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +#include + +#include +#include +#include + +#include +#include +#include + +namespace +{ +class Test : public SwModelTestBase +{ +public: + Test() + : SwModelTestBase(u"/sw/qa/extras/ooxmlexport/data/"_ustr, u"Office Open XML Text"_ustr) + { + } +}; + +CPPUNIT_TEST_FIXTURE(Test, testTdf165642_glossaryFootnote) +{ + loadAndSave("tdf165642_glossaryFootnote.docx"); + // round-trip'ing the settings.xml file as is, it contains footnote/endnote references + xmlDocUniquePtr pXmlSettings = parseExport(u"word/glossary/settings.xml"_ustr); + assertXPath(pXmlSettings, "//w:endnotePr", 1); + assertXPath(pXmlSettings, "//w:footnotePr", 1); + + // thus, the footnote and endnote files must also be round-tripped + parseExport(u"word/glossary/endnotes.xml"_ustr); + parseExport(u"word/glossary/footnotes.xml"_ustr); +} + +} // end of anonymous namespace +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx index 9192f1055a89..8caaddbc1e6a 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx @@ -608,10 +608,14 @@ void OOXMLDocumentImpl::resolveCustomXmlStream(Stream & rStream) namespace { constexpr OUStringLiteral sSettingsType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; +constexpr OUStringLiteral sEndnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"; +constexpr OUStringLiteral sFootnotesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"; constexpr OUStringLiteral sStylesType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; constexpr OUStringLiteral sFonttableType = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"; constexpr OUStringLiteral sWebSettings = u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; constexpr OUStringLiteral sSettingsTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; +constexpr OUStringLiteral sEndnoteTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/endnotes"; +constexpr OUStringLiteral sFootnoteTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/footnotes"; constexpr OUStringLiteral sStylesTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/styles"; constexpr OUStringLiteral sFonttableTypeStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable"; constexpr OUStringLiteral sWebSettingsStrict = u"http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; @@ -623,6 +627,8 @@ constexpr OUStringLiteral sTargetMode = u"TargetMode"; constexpr OUString sContentType = u"_contentType"_ustr; constexpr OUStringLiteral sRelDom = u"_relDom"; constexpr OUStringLiteral sSettingsContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"; +constexpr OUStringLiteral sEndnotesContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"; +constexpr OUStringLiteral sFootnotesContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"; constexpr OUStringLiteral sStylesContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"; constexpr OUStringLiteral sWebsettingsContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"; constexpr OUStringLiteral sFonttableContentType = u"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"; @@ -663,6 +669,16 @@ void OOXMLDocumentImpl::resolveGlossaryStream(Stream & /*rStream*/) nType = OOXMLStream::SETTINGS; aRelDefinition.put(sContentType, sSettingsContentType); } + else if (gType == sEndnotesType || gType == sEndnoteTypeStrict) + { + nType = OOXMLStream::ENDNOTES; + aRelDefinition.put(sContentType, sEndnotesContentType); + } + else if (gType == sFootnotesType || gType == sFootnoteTypeStrict) + { + nType = OOXMLStream::FOOTNOTES; + aRelDefinition.put(sContentType, sFootnotesContentType); + } else if (gType == sStylesType || gType == sStylesTypeStrict) { nType = OOXMLStream::STYLES;