sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx                |   13 +++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx              |    4 ++++
 writerfilter/source/dmapper/ConversionHelper.cxx          |    4 ++++
 4 files changed, 21 insertions(+)

New commits:
commit d7b6269bd5414ca0aa502a2fef7a838bcfbc1161
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Mar 20 17:54:02 2020 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Mar 20 22:37:47 2020 +0100

    sw pad-to-4 numbering: add DOCX filter
    
    Now that style::NumberingType::ARABIC_ZERO3 is already handled, this is
    much easier.
    
    Change-Id: Ibe76d90253a5bfad84560395502590a380d559d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90828
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx 
b/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx
new file mode 100644
index 000000000000..6779d85989a9
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 0292587800c6..c4cd522caccb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -163,6 +163,19 @@ DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering, 
"arabic-zero3-numbering.docx")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.docx")
+{
+    auto xNumberingRules
+        = 
getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), 
"NumberingRules");
+    comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0));
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 66
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO4.
+    
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
 {
     // Create a document, set footnote numbering type to ARABIC_ZERO.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 342c2a4d8557..da71d1fe1176 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6376,6 +6376,10 @@ static OString impl_LevelNFC(sal_uInt16 nNumberingType, 
const SfxItemSet* pOutSe
             aType = "custom";
             rFormat = "001, 002, 003, ...";
             break;
+        case style::NumberingType::ARABIC_ZERO4:
+            aType = "custom";
+            rFormat = "0001, 0002, 0003, ...";
+            break;
 /*
         Fallback the rest to decimal.
         case style::NumberingType::NATIVE_NUMBERING:
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx 
b/writerfilter/source/dmapper/ConversionHelper.cxx
index 39fc03606626..9700607d523b 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -626,6 +626,10 @@ sal_Int16 ConvertCustomNumberFormat(const OUString& 
rFormat)
     {
         nRet = style::NumberingType::ARABIC_ZERO3;
     }
+    else if (rFormat == "0001, 0002, 0003, ...")
+    {
+        nRet = style::NumberingType::ARABIC_ZERO4;
+    }
 
     return nRet;
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to