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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 6 11:46:55 UTC 2020


 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    1 
 sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt                |binary
 sw/qa/extras/odfexport/odfexport.cxx                                  |   13 ++++++++++
 sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx                            |   13 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                          |    4 +++
 writerfilter/source/dmapper/ConversionHelper.cxx                      |    4 +++
 7 files changed, 35 insertions(+)

New commits:
commit af32de21ade9d6d3b7a92f5988b4c8074489be14
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 17:54:02 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Apr 6 13:46:35 2020 +0200

    sw pad-to-4 numbering: add DOCX filter
    
    Now that style::NumberingType::ARABIC_ZERO3 is already handled, this is
    much easier.
    
    (cherry picked from commit d7b6269bd5414ca0aa502a2fef7a838bcfbc1161)
    
    Conflicts:
            sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
    
    Change-Id: Ibe76d90253a5bfad84560395502590a380d559d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91639
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at 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/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index a4ad95ff7901..e43d5f5cb8c2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -626,6 +626,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_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 9ae8d551668e..126f366943ff 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6496,6 +6496,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 694bf956cc6e..ad8c5190d882 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -622,6 +622,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;
 }
commit 0cb3cde0a8aec707e40400befb8d70cf0610e432
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 17:27:21 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Apr 6 13:46:23 2020 +0200

    sw pad-to-4 numbering: add ODF filter
    
    This makes the UI work as well.
    
    (cherry picked from commit 5b071c10d36371d1f9ce14ab13230bfd703d0245)
    
    Change-Id: I4e94b85097cc359b257b07ba7517edfab3011093
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91638
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 0cb55a04b701..5a13c6c8f054 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -1050,6 +1050,7 @@ static const Supported_NumberingType aSupportedTypes[] =
         {style::NumberingType::CHARS_GREEK_LOWER_LETTER,   S_GR_A ", " S_GR_B ", ... (gr)", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO3, "001, 002, 003, ...", LANG_ALL},
+        {style::NumberingType::ARABIC_ZERO4, "0001, 0002, 0003, ...", LANG_ALL},
 };
 static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes);
 
diff --git a/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt b/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt
new file mode 100644
index 000000000000..2eb9b49cedaa
Binary files /dev/null and b/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 86c55f2a5984..da4005697099 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2254,6 +2254,19 @@ DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering, "arabic-zero3-numbering.odt")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO3),
                          aMap["NumberingType"].get<sal_uInt16>());
 }
+
+DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.odt")
+{
+    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>());
+}
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list