diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-03-20 13:38:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-03-20 16:58:53 +0100 |
commit | fcef4857e042ff3c9dd8a6c60cf1a58e07f3224c (patch) | |
tree | 8054ef0ec1d1870e65265e512833df78df7af075 /i18npool | |
parent | 6bc2b598d6b748a130b84d4a7e07f3b3c34fe3e1 (diff) |
sw pad-to-4 numbering: add doc model, UNO API and layout
This is the actual numbering the customer needed, pad-to-2 and pad-to-3
was added just for compleness (since Word has it and it's related).
Change-Id: I7fdf67488955ab3ee0db169f11fffd21d9cc1e3b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90791
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 26 | ||||
-rw-r--r-- | i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 4 |
2 files changed, 30 insertions, 0 deletions
diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index fee8df329520..a74e92b7c432 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -74,6 +74,32 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) CPPUNIT_ASSERT_EQUAL(OUString("100"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) +{ + // 100 -> "0100" + uno::Reference<text::XNumberingFormatter> xFormatter( + text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProperties = { + comphelper::makePropertyValue("NumberingType", + static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4)), + comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)), + }; + 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_ZERO4 was missing. + CPPUNIT_ASSERT_EQUAL(OUString("0100"), aActual); + + // 1000 -> "1000" + aProperties = { + comphelper::makePropertyValue("NumberingType", + static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4)), + comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1000)), + }; + aActual = xFormatter->makeNumberingString(aProperties, aLocale); + CPPUNIT_ASSERT_EQUAL(OUString("1000"), 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 9abb5ae5c051..17d398077ce0 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -945,6 +945,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal result += lcl_formatArabicZero(number, 3); break; + case ARABIC_ZERO4: + result += lcl_formatArabicZero(number, 4); + break; + default: OSL_ASSERT(false); throw IllegalArgumentException(); |