sw padded numbering: add ODF filter

ODF allows any string as style:num-format="...", go with "01, 02, 03,
...", because that seems to be consistent with both
DefaultNumberingProvider::makeNumberingIdentifier()'s fallback mechanism
and with OOXML (which uses "001, 002, 003, ..." for the "pad to 3"
case).

Change-Id: I5c5c7ee5bd61175afc3e682276e69344852106d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89891
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna 2020-03-03 15:54:19 +01:00
parent 657d8c3e32
commit 7a8450c3ec
3 changed files with 14 additions and 0 deletions

View file

@ -1039,6 +1039,7 @@ static const Supported_NumberingType aSupportedTypes[] =
{style::NumberingType::CHARS_PERSIAN_WORD, nullptr, LANG_CTL},
{style::NumberingType::CHARS_GREEK_UPPER_LETTER, C_GR_A ", " C_GR_B ", ... (gr)", LANG_ALL},
{style::NumberingType::CHARS_GREEK_LOWER_LETTER, S_GR_A ", " S_GR_B ", ... (gr)", LANG_ALL},
{style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL},
};
static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes);

Binary file not shown.

View file

@ -2344,5 +2344,18 @@ DECLARE_ODFEXPORT_TEST(tdf121658, "tdf121658.odt")
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle1, "ParaHyphenationNoCaps"));
}
DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.odt")
{
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_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */