From e654b1e27eb1690104d360dfc1a7d7ef84dd220f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 20 Mar 2020 13:38:45 +0100 Subject: 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). (cherry picked from commit fcef4857e042ff3c9dd8a6c60cf1a58e07f3224c) Change-Id: I7fdf67488955ab3ee0db169f11fffd21d9cc1e3b --- .../qa/cppunit/test_defaultnumberingprovider.cxx | 29 ++++++++++++++++++++++ .../defaultnumberingprovider.cxx | 4 +++ 2 files changed, 33 insertions(+) (limited to 'i18npool') diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index 4418a283de2b..e5991ee6461d 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -81,6 +81,35 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) CPPUNIT_ASSERT_EQUAL(OUString("100"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) +{ + uno::Reference xComponentContext + = comphelper::getComponentContext(getMultiServiceFactory()); + + // 100 -> "0100" + uno::Reference xFormatter( + text::DefaultNumberingProvider::create(xComponentContext), uno::UNO_QUERY); + uno::Sequence aProperties = { + comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO4)), + comphelper::makePropertyValue("Value", static_cast(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(style::NumberingType::ARABIC_ZERO4)), + comphelper::makePropertyValue("Value", static_cast(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 39b7954cee7a..5f79508a6766 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -945,6 +945,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequence