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>
This commit is contained in:
Eike Rathke 2017-10-26 21:34:17 +02:00
parent 91987a559b
commit ba9f44d6ee
3 changed files with 52 additions and 4 deletions

View File

@ -23,7 +23,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/i18n/XLocaleData5.hpp>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
@ -35,7 +35,7 @@
#include <com/sun/star/i18n/FormatElement.hpp> #include <com/sun/star/i18n/FormatElement.hpp>
#include <com/sun/star/i18n/Currency.hpp> #include <com/sun/star/i18n/Currency.hpp>
#include <com/sun/star/lang/Locale.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/i18n/UnicodeScript.hpp>
#include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/XInterface.hpp>
@ -61,7 +61,7 @@ namespace i18npool {
class LocaleDataImpl : public cppu::WeakImplHelper class LocaleDataImpl : public cppu::WeakImplHelper
< <
css::i18n::XLocaleData4, css::i18n::XLocaleData5,
css::lang::XServiceInfo css::lang::XServiceInfo
> >
{ {
@ -108,6 +108,9 @@ public:
// XLocaleData4 // XLocaleData4
virtual css::uno::Sequence< OUString > SAL_CALL getDateAcceptancePatterns( const css::lang::Locale& rLocale ) override; 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 // following methods are used by indexentry service
/// @throws css::uno::RuntimeException /// @throws css::uno::RuntimeException
css::uno::Sequence< OUString > SAL_CALL getIndexAlgorithm( const css::lang::Locale& rLocale ); css::uno::Sequence< OUString > SAL_CALL getIndexAlgorithm( const css::lang::Locale& rLocale );

View File

@ -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 #ifndef DISABLE_DYNLOADING
extern "C" { static void SAL_CALL thisModule() {} } extern "C" { static void SAL_CALL thisModule() {} }
@ -1560,7 +1601,10 @@ sal_Bool SAL_CALL LocaleDataImpl::supportsService(const OUString& rServiceName)
Sequence< OUString > SAL_CALL Sequence< OUString > SAL_CALL
LocaleDataImpl::getSupportedServiceNames() 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; return aRet;
} }

View File

@ -128,6 +128,7 @@
<implementation name="com.sun.star.i18n.LocaleDataImpl" <implementation name="com.sun.star.i18n.LocaleDataImpl"
constructor="com_sun_star_i18n_LocaleDataImpl_get_implementation"> constructor="com_sun_star_i18n_LocaleDataImpl_get_implementation">
<service name="com.sun.star.i18n.LocaleData"/> <service name="com.sun.star.i18n.LocaleData"/>
<service name="com.sun.star.i18n.LocaleData2"/>
</implementation> </implementation>
<implementation name="com.sun.star.i18n.NativeNumberSupplier" <implementation name="com.sun.star.i18n.NativeNumberSupplier"
constructor="com_sun_star_i18n_NativeNumberSupplier_get_implementation"> constructor="com_sun_star_i18n_NativeNumberSupplier_get_implementation">