summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-03-05 13:12:27 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-03-05 14:57:23 +0100
commit3ea32f2b6cbe515353218bc1f3d5746ca66f6a5a (patch)
treee126e017372c671f7f199e7769a5f91ad08e905c
parentf27c6320e8496d690b5d341d3718430709263a1c (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). Change-Id: I06503389da520bd3bfd39252c4dcef39bac03eee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90013 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx29
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx3
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index b356a33e73e7..16aa8fdc4bab 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -25,6 +25,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>
char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
@@ -149,6 +150,34 @@ DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.docx")
aMap["NumberingType"].get<sal_uInt16>());
}
+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");
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
{
//if the original tdf87569 sample is upgraded it will have drawingml shapes...
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a2fbd2a96f33..6f512b85352c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7734,6 +7734,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: