diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-05-13 03:09:43 +0300 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2018-06-08 15:08:33 +0200 |
commit | 90d233b0311a208967a3e264820e00395bf057fb (patch) | |
tree | 62ce991f6a6f2829a068a5cfe8279a28de80c28e /include | |
parent | 465fedc3501284cc5db43b03163d5bd9fc344cd7 (diff) |
tdf#115007: Use [NatNum12 params...] syntax
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 <ci@libreoffice.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/zformat.hxx | 6 | ||||
-rw-r--r-- | include/unotools/nativenumberwrapper.hxx | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index 33b5bf8b2062..92a8080e3383 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -64,7 +64,8 @@ struct ImpSvNumberformatInfo // Struct for FormatInfo // eLang specifies the Locale to use. class SvNumberNatNum { - LanguageType eLang; + OUString sParams; // For [NatNum12 ordinal-number]-like syntax + LanguageType eLang; sal_uInt8 nNum; bool bDBNum :1; // DBNum, to be converted to NatNum bool bDate :1; // Used in date? (needed for DBNum/NatNum mapping) @@ -90,6 +91,8 @@ public: } bool IsSet() const { return bSet; } void SetDate( bool bDateP ) { bDate = bDateP; } + void SetParams(const OUString& s) { sParams = s; } + OUString GetParams() const { return sParams; } }; class CharClass; @@ -125,6 +128,7 @@ public: void SetNatNumNum( sal_uInt8 nNum, bool bDBNum ) { aNatNum.SetNum( nNum, bDBNum ); } void SetNatNumLang( LanguageType eLang ) { aNatNum.SetLang( eLang ); } void SetNatNumDate( bool bDate ) { aNatNum.SetDate( bDate ); } + void SetNatNumParams(const OUString& sParams) { aNatNum.SetParams(sParams); } const SvNumberNatNum& GetNatNum() const { return aNatNum; } private: diff --git a/include/unotools/nativenumberwrapper.hxx b/include/unotools/nativenumberwrapper.hxx index 064a438a85ef..be699f216d8b 100644 --- a/include/unotools/nativenumberwrapper.hxx +++ b/include/unotools/nativenumberwrapper.hxx @@ -21,7 +21,7 @@ #define INCLUDED_UNOTOOLS_NATIVENUMBERWRAPPER_HXX #include <unotools/unotoolsdllapi.h> -#include <com/sun/star/i18n/XNativeNumberSupplier.hpp> +#include <com/sun/star/i18n/XNativeNumberSupplier2.hpp> namespace com { namespace sun { namespace star { namespace uno { @@ -31,7 +31,7 @@ namespace com { namespace sun { namespace star { class UNOTOOLS_DLLPUBLIC NativeNumberWrapper { - css::uno::Reference< css::i18n::XNativeNumberSupplier > xNNS; + css::uno::Reference< css::i18n::XNativeNumberSupplier2 > xNNS; NativeNumberWrapper( const NativeNumberWrapper& ) = delete; NativeNumberWrapper& operator=( const NativeNumberWrapper& ) = delete; @@ -47,7 +47,13 @@ public: OUString getNativeNumberString( const OUString& rNumberString, const css::lang::Locale& rLocale, - sal_Int16 nNativeNumberMode ) const; + sal_Int16 nNativeNumberMode) const; + + OUString getNativeNumberStringParams( + const OUString& rNumberString, + const css::lang::Locale& rLocale, + sal_Int16 nNativeNumberMode, + const OUString& rNativeNumberParams) const; css::i18n::NativeNumberXmlAttributes convertToXmlAttributes( const css::lang::Locale& rLocale, |