summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-03-05 13:12:27 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-04-03 09:19:11 +0200
commit9aaf5bcbf41260993cdf7716cdaf3f6b6dd82627 (patch)
treec2c7f407719bdfd51894375e5b0b4ac1332f632f
parent64f00a277711aaa1e537dd7d717dd4c3910fbbe3 (diff)
sw padded numbering: add DOCX footnote export
This is mapping separate from paragraph numbering. I'm not exactly why; perhaps because this is modeled after DOC, where certain numbering types are not allowed for paragraph numbering (but are allowed for other numbering types). (cherry picked from commit 3ea32f2b6cbe515353218bc1f3d5746ca66f6a5a) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport14.cxx Change-Id: I06503389da520bd3bfd39252c4dcef39bac03eee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91562 Tested-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx29
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 073844d6c75d..a1f1c330d533 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/style/LineSpacing.hpp>
#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XTextContentAppend.hpp>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
@@ -556,6 +557,34 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testSemiTransparentText)
CPPUNIT_ASSERT_EQUAL(nTransparence, nActual);
}
+CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
+{
+ // Create a document, set footnote numbering type to ARABIC_ZERO.
+ loadURL("private:factory/swriter", nullptr);
+ uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xFootnoteSettings
+ = xFootnotesSupplier->getFootnoteSettings();
+ sal_uInt16 nNumberingType = style::NumberingType::ARABIC_ZERO;
+ xFootnoteSettings->setPropertyValue("NumberingType", uno::makeAny(nNumberingType));
+
+ // Insert a footnote.
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextContent> xFootnote(
+ xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY);
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
+ uno::UNO_QUERY);
+ xTextContentAppend->appendTextContent(xFootnote, {});
+
+ reload("Office Open XML Text", "");
+
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ // Without the accompanying fix in place, this test would have failed with:
+ // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect
+ // because the exporter had no idea what markup to use for ARABIC_ZERO.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "decimalZero");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 02c6b8f370d0..81d24638a901 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7855,6 +7855,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr
case SVX_NUM_CHAR_SPECIAL:
fmt = "bullet";
break;
+ case SVX_NUM_ARABIC_ZERO:
+ fmt = "decimalZero";
+ break;
case SVX_NUM_PAGEDESC:
case SVX_NUM_BITMAP:
default: