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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 2 15:11:44 UTC 2020


 sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf |   14 ++++++++++++++
 sw/qa/extras/rtfexport/rtfexport3.cxx                 |   13 +++++++++++++
 sw/qa/extras/ww8export/data/arabic-zero-numbering.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx                 |   13 +++++++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx           |    3 +++
 sw/source/filter/ww8/wrtw8num.cxx                     |    4 ++++
 sw/source/filter/ww8/ww8par3.cxx                      |    4 ++++
 7 files changed, 51 insertions(+)

New commits:
commit 64f00a277711aaa1e537dd7d717dd4c3910fbbe3
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 4 13:33:40 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Apr 2 17:11:24 2020 +0200

    sw padded numbering: add RTF export
    
    RTF import was working already.
    
    (cherry picked from commit dc05428405fb96f28b2d7c7bcfa9033f3f5248a3)
    
    Change-Id: Ifa71035645d4738138790e72c3f9dee640833d0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91561
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf b/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf
new file mode 100644
index 000000000000..0969ba9088ca
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf
@@ -0,0 +1,14 @@
+{\rtf1
+{\*\listtable
+{\list
+{\listlevel\levelnfc22\levelstartat1
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+}
+\listid0}
+}
+{\*\listoverridetable
+{\listoverride\listid0\ls1}
+}
+\pard\plain\ls1 A\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 1f282f79ac85..40f7c9e25c81 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -130,6 +130,19 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx")
     CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218 && cell2Width <= 220);
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.rtf")
+{
+    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: 64
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
 {
     // This was 0, left margin was ignored as we assumed the default is already
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 266b63ad57d4..13c1a8c72478 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1455,6 +1455,9 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart,
         case SVX_NUM_NUMBER_NONE:
             nVal = 255;
             break;
+        case SVX_NUM_ARABIC_ZERO:
+            nVal = 22;
+            break;
     }
     m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELNFC);
     m_rExport.OutULong(nVal);
commit 481a5b23960a5858559f52164b7b4648af1a1e2f
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 4 11:22:09 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Apr 2 17:11:12 2020 +0200

    sw padded numbering: add DOC filter
    
    [MS-OSHARED] 2.2.1.3 MSONFC says msonfcArabicLZ / 0x16 should be used
    for this.
    
    (cherry picked from commit a8a5fc175a8af2bf3750497d7ebe2c8ea9176981)
    
    Change-Id: I6bdf460d77acabf54cecc2ec2d2bca91bc814518
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91560
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc
new file mode 100644
index 000000000000..c198c4aa44d0
Binary files /dev/null and b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 7d6f4b756a39..b9531e3159bc 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -48,6 +48,19 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), xSections->getCount());
     }
 
+DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
+{
+    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: 64
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc")
 {
     uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index b0b0cde57768..1302a68e7404 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -227,6 +227,10 @@ static sal_uInt8 GetLevelNFC(  sal_uInt16 eNumType, const SfxItemSet *pOutSet)
     case style::NumberingType::NUMBER_HANGUL_KO: nRet = 41; break;
     case style::NumberingType::NUMBER_UPPER_KO: nRet = 44; break;
     case SVX_NUM_NUMBER_NONE:           nRet = 0xff;    break;
+    case SVX_NUM_ARABIC_ZERO:
+        // 0x16, msonfcArabicLZ
+        nRet = 22;
+        break;
     }
     return nRet;
 }
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 2eae61737df4..1d9de8283541 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -755,6 +755,10 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
             // actually: ORDINAL
             nType = SVX_NUM_ARABIC;
             break;
+        case 22:
+            // 0x16, msonfcArabicLZ
+            nType = SVX_NUM_ARABIC_ZERO;
+            break;
         case 23:
             nType = SVX_NUM_CHAR_SPECIAL;
             //For i120928,type info


More information about the Libreoffice-commits mailing list