sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   29 +++++++++++++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    3 ++
 2 files changed, 32 insertions(+)

New commits:
commit 3ea32f2b6cbe515353218bc1f3d5746ca66f6a5a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Mar 5 13:12:27 2020 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Mar 5 14:57:23 2020 +0100

    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 <vmik...@collabora.com>
    Tested-by: Jenkins

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:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to