From 90d233b0311a208967a3e264820e00395bf057fb Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 13 May 2018 03:09:43 +0300 Subject: tdf#115007: Use [NatNum12 params...] syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows using all the libnumbertext library functions. [NatNum12] gives cardinal number names (one, two, three, ...) [NatNum12 ordinal] gives ordinal number names (first, second, third, ...) [NatNum12 ordinal-number] gives ordinal indicators (1st, 2nd, 3rd, ...) [NatNum12 money USD][$-409] gives formal English (US) money text ... etc (see numbertext.org for syntax). Change-Id: I16dbb44d8d4bdb82a1b950de6d438c8311b554ff Reviewed-on: https://gerrit.libreoffice.org/54366 Tested-by: Jenkins Reviewed-by: László Németh --- offapi/UnoApi_offapi.mk | 2 + offapi/com/sun/star/i18n/NativeNumberMode.idl | 13 ++-- offapi/com/sun/star/i18n/NativeNumberSupplier2.idl | 45 ++++++++++++++ .../com/sun/star/i18n/XNativeNumberSupplier2.idl | 69 ++++++++++++++++++++++ 4 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 offapi/com/sun/star/i18n/NativeNumberSupplier2.idl create mode 100644 offapi/com/sun/star/i18n/XNativeNumberSupplier2.idl (limited to 'offapi') diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index e25fc4495805..bd8932463c12 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -232,6 +232,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/i18n,\ LocaleData \ LocaleData2 \ NativeNumberSupplier \ + NativeNumberSupplier2 \ NumberFormatMapper \ OrdinalSuffix \ TextConversion \ @@ -2788,6 +2789,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/i18n,\ XLocaleData4 \ XLocaleData5 \ XNativeNumberSupplier \ + XNativeNumberSupplier2 \ XNumberFormatCode \ XOrdinalSuffix \ XScriptTypeDetector \ diff --git a/offapi/com/sun/star/i18n/NativeNumberMode.idl b/offapi/com/sun/star/i18n/NativeNumberMode.idl index f19980b96edc..8fbf058f3e12 100644 --- a/offapi/com/sun/star/i18n/NativeNumberMode.idl +++ b/offapi/com/sun/star/i18n/NativeNumberMode.idl @@ -146,17 +146,12 @@ published constants NativeNumberMode */ const short NATNUM11 = 11; - /** Transliteration to cardinal number names (one, two, three, ...) + /** Transliteration to cardinal number names (one, two, three, ...), + ordinal number names (first, second, third, ...), + ordinal indicators (1st, 2nd, 3rd, ...), etc. + Uses NatNum params string */ const short NATNUM12 = 12; - - /** Transliteration to ordinal number names (first, second, third, ...) - */ - const short NATNUM13 = 13; - - /** Transliteration to ordinal indicators (1st, 2nd, 3rd, ...) - */ - const short NATNUM14 = 14; }; }; }; }; }; diff --git a/offapi/com/sun/star/i18n/NativeNumberSupplier2.idl b/offapi/com/sun/star/i18n/NativeNumberSupplier2.idl new file mode 100644 index 000000000000..721c1642afda --- /dev/null +++ b/offapi/com/sun/star/i18n/NativeNumberSupplier2.idl @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_i18n_NativeNumberSupplier2_idl__ +#define __com_sun_star_i18n_NativeNumberSupplier2_idl__ + +#include + + +module com { module sun { module star { module i18n { + + +/** Supplier for transliteration of numerals (native number strings). + + @since LibreOffice 6.1 + + @internal + + ATTENTION: This service is marked internal and does not + have the published flag, which means it is subject to + change without notice and should not be used outside the LibreOffice core. +*/ +service NativeNumberSupplier2 : com::sun::star::i18n::XNativeNumberSupplier2; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/i18n/XNativeNumberSupplier2.idl b/offapi/com/sun/star/i18n/XNativeNumberSupplier2.idl new file mode 100644 index 000000000000..08c0d37ce663 --- /dev/null +++ b/offapi/com/sun/star/i18n/XNativeNumberSupplier2.idl @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __com_sun_star_i18n_XNativeNumberSupplier2_idl__ +#define __com_sun_star_i18n_XNativeNumberSupplier2_idl__ + +#include + + +module com { module sun { module star { module i18n { + + +/** Methods to convert between strings of ASCII Arabic digits and native + numeral strings, using NatNum params. + + @since LibreOffice 6.1 + + @internal + + ATTENTION: This service is marked internal and does not + have the published flag, which means it is subject to + change without notice and should not be used outside the LibreOffice core. + */ + +interface XNativeNumberSupplier2 : ::com::sun::star::i18n::XNativeNumberSupplier +{ + /** Returns native number string for given number string, using NatNum params. + + @param NumberString + The input string. + + @param NativeNumberMode + One of NativeNumberMode values. + + @param Locale + The locale. + + @param NativeNumberParams + The NatNum params (like "ordinal-digits" in [NatNum12 ordinal-digits]). + */ + string getNativeNumberStringParams( + [in] string NumberString, + [in] ::com::sun::star::lang::Locale Locale, + [in] short NativeNumberMode, + [in] string NativeNumberParameters ); + +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit