From dc05428405fb96f28b2d7c7bcfa9033f3f5248a3 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 4 Mar 2020 13:33:40 +0100 Subject: sw padded numbering: add RTF export RTF import was working already. Change-Id: Ifa71035645d4738138790e72c3f9dee640833d0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89963 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf | 14 ++++++++++++++ sw/qa/extras/rtfexport/rtfexport3.cxx | 13 +++++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 3 +++ 3 files changed, 30 insertions(+) create mode 100644 sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf 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 a6b501f3f683..51390e001a51 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -143,6 +143,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>(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_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 36b03f6a0d94..fd1bb3656e3a 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -1488,6 +1488,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); -- cgit