From 0172f58071be13178a9fd5d6a7e1143d5a2edf23 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 4 Mar 2020 11:22:09 +0100 Subject: 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 --- sw/qa/extras/ww8export/data/arabic-zero-numbering.doc | Bin 0 -> 10752 bytes sw/qa/extras/ww8export/ww8export3.cxx | 13 +++++++++++++ sw/source/filter/ww8/wrtw8num.cxx | 4 ++++ sw/source/filter/ww8/ww8par3.cxx | 4 ++++ 4 files changed, 21 insertions(+) create mode 100644 sw/qa/extras/ww8export/data/arabic-zero-numbering.doc 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 d4a65e685f4a..925af30ba55e 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -51,6 +51,19 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty(xStyle, "FillStyle")); } +DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc") +{ + auto xNumberingRules + = getProperty>(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(style::NumberingType::ARABIC_ZERO), + aMap["NumberingType"].get()); +} + DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") { uno::Reference pageStyles = getStyles("PageStyles"); diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index afe0204a48cd..7300afca81e9 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -283,6 +283,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 c07da7e81efb..f0c1ab4e0c3b 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -751,6 +751,10 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr