diff options
author | Eike Rathke <erack@redhat.com> | 2017-10-26 21:34:17 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-10-27 03:06:22 +0200 |
commit | ba9f44d6ee560bbba09834b1070d19ec62d35783 (patch) | |
tree | 56652acadd0334fe257bca5d5f26253892eaeaad | |
parent | 91987a559bf1fde4a8d1eadc81e5711a7670fe69 (diff) |
Implement LocaleData2, XLocaleData5, LocaleDataItem2, tdf#81671
Change-Id: Idba5a30bc44c7b2bd951f954ea3bfd048b022660
Reviewed-on: https://gerrit.libreoffice.org/43920
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | i18npool/inc/localedata.hxx | 9 | ||||
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 46 | ||||
-rw-r--r-- | i18npool/util/i18npool.component | 1 |
3 files changed, 52 insertions, 4 deletions
diff --git a/i18npool/inc/localedata.hxx b/i18npool/inc/localedata.hxx index c3aa6cf57d2c..4a83d44375b2 100644 --- a/i18npool/inc/localedata.hxx +++ b/i18npool/inc/localedata.hxx @@ -23,7 +23,7 @@ #include <comphelper/processfactory.hxx> -#include <com/sun/star/i18n/XLocaleData4.hpp> +#include <com/sun/star/i18n/XLocaleData5.hpp> #include <cppuhelper/implbase.hxx> @@ -35,7 +35,7 @@ #include <com/sun/star/i18n/FormatElement.hpp> #include <com/sun/star/i18n/Currency.hpp> #include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/i18n/LocaleDataItem.hpp> +#include <com/sun/star/i18n/LocaleDataItem2.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/XInterface.hpp> @@ -61,7 +61,7 @@ namespace i18npool { class LocaleDataImpl : public cppu::WeakImplHelper < - css::i18n::XLocaleData4, + css::i18n::XLocaleData5, css::lang::XServiceInfo > { @@ -108,6 +108,9 @@ public: // XLocaleData4 virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const css::lang::Locale& rLocale ) override; + // XLocaleData5 + virtual css::i18n::LocaleDataItem2 SAL_CALL getLocaleItem2( const css::lang::Locale& rLocale ) override; + // following methods are used by indexentry service /// @throws css::uno::RuntimeException css::uno::Sequence< OUString > SAL_CALL getIndexAlgorithm( const css::lang::Locale& rLocale ); diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 500a9408136e..e84f2b6282e7 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -423,6 +423,47 @@ LocaleDataImpl::getLocaleItem( const Locale& rLocale ) } } + +LocaleDataItem2 SAL_CALL +LocaleDataImpl::getLocaleItem2( const Locale& rLocale ) +{ + MyFunc_Type func = reinterpret_cast<MyFunc_Type>(getFunctionSymbol( rLocale, "getLocaleItem" )); + + if ( func ) { + sal_Int16 dataItemCount = 0; + sal_Unicode **dataItem = func(dataItemCount); + + assert(dataItemCount >= 18); + + LocaleDataItem2 item( + dataItem[0], + dataItem[1], + dataItem[2], + dataItem[3], + dataItem[4], + dataItem[5], + dataItem[6], + dataItem[7], + dataItem[8], + dataItem[9], + dataItem[10], + dataItem[11], + dataItem[12], + dataItem[13], + dataItem[14], + dataItem[15], + dataItem[16], + dataItem[17], + dataItemCount >= 19 ? dataItem[18] : OUString() + ); + return item; + } + else { + LocaleDataItem2 item1; + return item1; + } +} + #ifndef DISABLE_DYNLOADING extern "C" { static void SAL_CALL thisModule() {} } @@ -1560,7 +1601,10 @@ sal_Bool SAL_CALL LocaleDataImpl::supportsService(const OUString& rServiceName) Sequence< OUString > SAL_CALL LocaleDataImpl::getSupportedServiceNames() { - Sequence< OUString > aRet { "com.sun.star.i18n.LocaleData" }; + Sequence< OUString > aRet { + "com.sun.star.i18n.LocaleData", + "com.sun.star.i18n.LocaleData2" + }; return aRet; } diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index 1b74fd736f54..3598ffa8b781 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -128,6 +128,7 @@ <implementation name="com.sun.star.i18n.LocaleDataImpl" constructor="com_sun_star_i18n_LocaleDataImpl_get_implementation"> <service name="com.sun.star.i18n.LocaleData"/> + <service name="com.sun.star.i18n.LocaleData2"/> </implementation> <implementation name="com.sun.star.i18n.NativeNumberSupplier" constructor="com_sun_star_i18n_NativeNumberSupplier_get_implementation"> |