diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-03-23 13:37:25 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-04-06 13:46:45 +0200 |
commit | 3982bb872ec39d47b41cd530784d6d3639e8d196 (patch) | |
tree | f4bcf1d5dd402b1cd1a23d9439136a92e506ed4a /i18npool | |
parent | af32de21ade9d6d3b7a92f5988b4c8074489be14 (diff) |
sw: add pad-to-5 numbering
This is the last padded numbering type that is supported by Word but was
not supported by Writer.
(cherry picked from commit 8540c7b18bae9c9b46e6feb7658198a7fc62e811)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
Change-Id: Ica1a0843897c61a4b569105fd21e5bfe7b5012cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91640
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 29 | ||||
-rw-r--r-- | i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 5 |
2 files changed, 34 insertions, 0 deletions
diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index e5991ee6461d..b3d3b42963a8 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -110,6 +110,35 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) CPPUNIT_ASSERT_EQUAL(OUString("1000"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) +{ + uno::Reference<uno::XComponentContext> xComponentContext + = comphelper::getComponentContext(getMultiServiceFactory()); + + // 1000 -> "01000" + uno::Reference<text::XNumberingFormatter> xFormatter( + text::DefaultNumberingProvider::create(xComponentContext), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProperties = { + comphelper::makePropertyValue("NumberingType", + static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)), + comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1000)), + }; + lang::Locale aLocale; + OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); + // Without the accompanying fix in place, this test would have failed with a + // lang.IllegalArgumentException, support for ARABIC_ZERO5 was missing. + CPPUNIT_ASSERT_EQUAL(OUString("01000"), aActual); + + // 10000 -> "10000" + aProperties = { + comphelper::makePropertyValue("NumberingType", + static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)), + comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10000)), + }; + aActual = xFormatter->makeNumberingString(aProperties, aLocale); + CPPUNIT_ASSERT_EQUAL(OUString("10000"), aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 5a13c6c8f054..3895dec8ca1f 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -951,6 +951,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal result += lcl_formatArabicZero(number, 4); break; + case ARABIC_ZERO5: + result += lcl_formatArabicZero(number, 5); + break; + default: OSL_ASSERT(false); throw IllegalArgumentException(); @@ -1051,6 +1055,7 @@ static const Supported_NumberingType aSupportedTypes[] = {style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL}, {style::NumberingType::ARABIC_ZERO3, "001, 002, 003, ...", LANG_ALL}, {style::NumberingType::ARABIC_ZERO4, "0001, 0002, 0003, ...", LANG_ALL}, + {style::NumberingType::ARABIC_ZERO5, "00001, 00002, 00003, ...", LANG_ALL}, }; static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes); |