[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 4 09:14:52 UTC 2020


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

New commits:
commit 5435ea2afc5da5633a440f2f06d79265bcbb040c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 4 09:13:11 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Mar 4 10:14:17 2020 +0100

    sw padded numbering: add DOCX filter
    
    DOCX uses <w:numFmt w:val="decimalZero"/> for this.
    
    Change-Id: I12a4a88f472af42a04244d30f9e59fc0b8b4855c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89945
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx b/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx
new file mode 100644
index 000000000000..f87dce364c9e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/arabic-zero-numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index b607ed2c1522..b356a33e73e7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -136,6 +136,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf87569v, "tdf87569_vml.docx")
                                  text::RelOrientation::FRAME, nValue);
 }
 
+DECLARE_ODFEXPORT_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>());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
 {
     //if the original tdf87569 sample is upgraded it will have drawingml shapes...
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 90e9ff7fe17a..a2fbd2a96f33 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6327,6 +6327,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 04ce9528b0c3..0743bd45b891 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -590,6 +590,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
@@ -597,7 +600,6 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
     NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth = 91691;
     NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth = 91692;
     NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand = 91694;
-    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;


More information about the Libreoffice-commits mailing list