[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - i18npool/qa i18npool/source include/editeng offapi/com
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 3 17:22:49 UTC 2020
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 29 ++++++++++
i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 4 +
include/editeng/svxenum.hxx | 1
offapi/com/sun/star/style/NumberingType.idl | 7 ++
4 files changed, 41 insertions(+)
New commits:
commit 409d7bba96b194080791e12ed15290b5c3adedd4
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 13:38:45 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Apr 3 19:22:18 2020 +0200
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
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91637
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
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<uno::XComponentContext> xComponentContext
+ = comphelper::getComponentContext(getMultiServiceFactory());
+
+ // 100 -> "0100"
+ 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_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 85b0b55bcc00..0cb55a04b701 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -947,6 +947,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();
diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
index eced6c884afa..b020ebd26e50 100644
--- a/include/editeng/svxenum.hxx
+++ b/include/editeng/svxenum.hxx
@@ -208,6 +208,7 @@ enum SvxNumType : sal_Int16
SVX_NUM_SYMBOL_CHICAGO = css::style::NumberingType::SYMBOL_CHICAGO,
SVX_NUM_ARABIC_ZERO = css::style::NumberingType::ARABIC_ZERO,
SVX_NUM_ARABIC_ZERO3 = css::style::NumberingType::ARABIC_ZERO3,
+ SVX_NUM_ARABIC_ZERO4 = css::style::NumberingType::ARABIC_ZERO4,
};
#endif
diff --git a/offapi/com/sun/star/style/NumberingType.idl b/offapi/com/sun/star/style/NumberingType.idl
index 2ecf03734e10..e19bd25aecd3 100644
--- a/offapi/com/sun/star/style/NumberingType.idl
+++ b/offapi/com/sun/star/style/NumberingType.idl
@@ -506,6 +506,13 @@ published constants NumberingType
@since LibreOffice 7.0
*/
const short ARABIC_ZERO3 = 65;
+
+ /** Numbering is in Arabic numbers, padded with zero to have a length of at least four, as
+ "0001, 0002, ..., 1000, 1001, ...".
+
+ @since LibreOffice 7.0
+ */
+ const short ARABIC_ZERO4 = 66;
};
More information about the Libreoffice-commits
mailing list