[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/qa sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 3 07:19:45 UTC 2020


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

New commits:
commit 9aaf5bcbf41260993cdf7716cdaf3f6b6dd82627
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Mar 5 13:12:27 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Apr 3 09:19:11 2020 +0200

    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 at collabora.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

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:


More information about the Libreoffice-commits mailing list