diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-03-04 09:13:11 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-04-02 12:57:21 +0200 |
commit | 5c397440529bbfd997a3fd75f64c4e4e78fc80ac (patch) | |
tree | 4beafd61deff7fc66ba4fa69bff04f3e3b1ee228 | |
parent | aa258391ecc86dad47a52f51fdaf773dbe9ca6f5 (diff) |
sw padded numbering: add DOCX filter
DOCX uses <w:numFmt w:val="decimalZero"/> for this.
(cherry picked from commit 5435ea2afc5da5633a440f2f06d79265bcbb040c)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
writerfilter/source/dmapper/ConversionHelper.cxx
Change-Id: I12a4a88f472af42a04244d30f9e59fc0b8b4855c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91503
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx | bin | 0 -> 5730 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 1 | ||||
-rw-r--r-- | writerfilter/source/dmapper/ConversionHelper.cxx | 4 |
4 files changed, 17 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx b/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx Binary files differnew file mode 100644 index 000000000000..f87dce364c9e --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 9dcc609fcf6a..073844d6c75d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -425,6 +425,19 @@ DECLARE_OOXMLEXPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header- } } +DECLARE_OOXMLEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-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: 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>()); +} + CPPUNIT_TEST_FIXTURE(SwModelTestBase, testZeroLineSpacing) { // Create the doc model. diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f75d4aa0d02d..02c6b8f370d0 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6491,6 +6491,7 @@ static OString impl_LevelNFC( sal_uInt16 nNumberingType , const SfxItemSet *pOut case style::NumberingType::TEXT_CARDINAL: aType="cardinalText"; break; case style::NumberingType::TEXT_ORDINAL: aType="ordinalText"; break; case style::NumberingType::SYMBOL_CHICAGO: aType="chicago"; break; + case style::NumberingType::ARABIC_ZERO: aType = "decimalZero"; 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 996c284f1779..c0eaf005d4dd 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -585,6 +585,9 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt) case NS_ooxml::LN_Value_ST_NumberFormat_chicago: nRet = style::NumberingType::SYMBOL_CHICAGO; break; + case NS_ooxml::LN_Value_ST_NumberFormat_decimalZero: + nRet = style::NumberingType::ARABIC_ZERO; + break; default: nRet = style::NumberingType::ARABIC; } /* TODO: Lots of additional values are available - some are supported in the I18 framework @@ -593,7 +596,6 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt) NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth = 91692; NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand = 91694; NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircle = 91695; - NS_ooxml::LN_Value_ST_NumberFormat_decimalZero = 91699; NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop = 91703; NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen = 91704; NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiacTraditional = 91709; |