diff options
25 files changed, 89 insertions, 102 deletions
diff --git a/basic/CppunitTest_basic_enable.mk b/basic/CppunitTest_basic_enable.mk index 3857909e4750..76a9ecd02664 100644 --- a/basic/CppunitTest_basic_enable.mk +++ b/basic/CppunitTest_basic_enable.mk @@ -52,5 +52,6 @@ $(eval $(call gb_CppunitTest_use_ure,basic_enable)) $(eval $(call gb_CppunitTest_use_components,basic_enable,\ configmgr/source/configmgr \ + i18npool/util/i18npool \ )) $(eval $(call gb_CppunitTest_use_configuration,basic_enable)) diff --git a/basic/CppunitTest_basic_nested_struct.mk b/basic/CppunitTest_basic_nested_struct.mk index 4b0e33d42b67..098840c5cd54 100644 --- a/basic/CppunitTest_basic_nested_struct.mk +++ b/basic/CppunitTest_basic_nested_struct.mk @@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_ure,basic_nested_struct)) $(eval $(call gb_CppunitTest_use_components,basic_nested_struct,\ configmgr/source/configmgr \ + i18npool/util/i18npool \ )) $(eval $(call gb_CppunitTest_use_configuration,basic_nested_struct)) diff --git a/connectivity/inc/connectivity/predicateinput.hxx b/connectivity/inc/connectivity/predicateinput.hxx index 63508215215f..56abc6e2959a 100644 --- a/connectivity/inc/connectivity/predicateinput.hxx +++ b/connectivity/inc/connectivity/predicateinput.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/util/XNumberFormatter.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <connectivity/sqlparse.hxx> #include "connectivity/dbtoolsdllapi.hxx" @@ -48,7 +48,7 @@ namespace dbtools m_xConnection; ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData > + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 > m_xLocaleData; ::connectivity::OSQLParser diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx index acdf43cb2d43..a4a64b3a2480 100644 --- a/connectivity/inc/connectivity/sqlparse.hxx +++ b/connectivity/inc/connectivity/sqlparse.hxx @@ -34,7 +34,7 @@ #endif #include <com/sun/star/i18n/XCharacterClassification.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include "connectivity/IParseContext.hxx" #include "connectivity/dbtoolsdllapi.hxx" #include "connectivity/sqlerror.hxx" @@ -165,7 +165,7 @@ namespace connectivity sal_Int32 m_nDateFormatKey; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass; - static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> s_xLocaleData; + static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> s_xLocaleData; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627 // convert a string into double trim it to scale of _nscale and than transform it back to string diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index f72b1163ab36..67ec21fcc810 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -21,6 +21,7 @@ #include <connectivity/predicateinput.hxx> #include <comphelper/types.hxx> #include <connectivity/dbtools.hxx> +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/sdbc/DataType.hpp> #include <com/sun/star/sdbc/ColumnValue.hpp> #include <com/sun/star/util/NumberFormatter.hpp> @@ -47,6 +48,7 @@ namespace dbtools using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::lang::Locale; using ::com::sun::star::uno::Exception; + using ::com::sun::star::i18n::LocaleData; using ::com::sun::star::i18n::XLocaleData; using ::com::sun::star::i18n::LocaleDataItem; @@ -123,9 +125,7 @@ namespace dbtools // create the locale data if ( m_xORB.is() ) { - m_xLocaleData = m_xLocaleData.query( m_xORB->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) ) ) - ); + m_xLocaleData = LocaleData::create( comphelper::ComponentContext(m_xORB).getUNOContext() ); } } catch( const Exception& ) diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index ce2d0e778e99..96d078291d5f 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4579,7 +4579,7 @@ sal_Int32 OSQLParser::s_nRefCount = 0; // ::osl::Mutex OSQLParser::s_aMutex; OSQLScanner* OSQLParser::s_pScanner = 0; OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = 0; -::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> OSQLParser::s_xLocaleData = NULL; +::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> OSQLParser::s_xLocaleData = NULL; //----------------------------------------------------------------------------- void setParser(OSQLParser* _pParser) { diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 9cc9101298b7..9936d18f91c6 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/util/XNumberFormatter.hpp> #include <com/sun/star/util/XNumberFormatTypes.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/i18n/NumberFormatIndex.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/sdbc/XDatabaseMetaData.hpp> @@ -1285,7 +1286,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: s_pGarbageCollector = new OSQLParseNodesGarbageCollector(); if(!s_xLocaleData.is()) - s_xLocaleData = Reference<XLocaleData>(m_xServiceFactory->createInstance(::rtl::OUString("com.sun.star.i18n.LocaleData")),UNO_QUERY); + s_xLocaleData = LocaleData::create(comphelper::ComponentContext(m_xServiceFactory).getUNOContext()); // reset to 0 memset(OSQLParser::s_nRuleIDs,0,sizeof(OSQLParser::s_nRuleIDs[0]) * (OSQLParseNode::rule_count+1)); diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index da159c39ff00..a3d35e281162 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/script/Converter.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> @@ -258,8 +258,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc m_aLocale = SvtSysLocale().GetLocaleData().getLocale(); m_xNumberFormatsSupplier = dbtools::getNumberFormats( m_xConnection, sal_True, m_aContext.getLegacyServiceFactory() ); - Reference< XLocaleData > xLocaleData; - m_aContext.createComponent( "com.sun.star.i18n.LocaleData", xLocaleData ); + Reference< XLocaleData4 > xLocaleData( LocaleData::create(m_aContext.getUNOContext()) ); LocaleDataItem aData = xLocaleData->getLocaleItem(m_aLocale); m_sDecimalSep = aData.decimalSeparator; OSL_ENSURE(m_sDecimalSep.getLength() == 1,"OSingleSelectQueryComposer::OSingleSelectQueryComposer decimal separator is not 1 length"); diff --git a/filter/CppunitTest_filter_pict_test.mk b/filter/CppunitTest_filter_pict_test.mk index ce9eeb6dbfe6..59a3244824e9 100644 --- a/filter/CppunitTest_filter_pict_test.mk +++ b/filter/CppunitTest_filter_pict_test.mk @@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_ure,filter_pict_test)) $(eval $(call gb_CppunitTest_use_components,filter_pict_test,\ configmgr/source/configmgr \ + i18npool/util/i18npool \ )) $(eval $(call gb_CppunitTest_use_configuration,filter_pict_test)) diff --git a/i18npool/inc/cclass_unicode.hxx b/i18npool/inc/cclass_unicode.hxx index a9d78789d732..340b72fad63f 100644 --- a/i18npool/inc/cclass_unicode.hxx +++ b/i18npool/inc/cclass_unicode.hxx @@ -21,7 +21,7 @@ #include <com/sun/star/i18n/XNativeNumberSupplier.hpp> #include <com/sun/star/i18n/XCharacterClassification.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <cppuhelper/implbase1.hxx> // helper for implementations #include <com/sun/star/lang/XServiceInfo.hpp> @@ -122,7 +122,7 @@ private: /// used for parser only com::sun::star::lang::Locale aParserLocale; - com::sun::star::uno::Reference < XLocaleData > xLocaleData; + com::sun::star::uno::Reference < XLocaleData4 > mxLocaleData; com::sun::star::uno::Reference < com::sun::star::i18n::XNativeNumberSupplier > xNatNumSup; rtl::OUString aStartChars; rtl::OUString aContChars; diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx index f09edfef3466..7af96199cbbd 100644 --- a/i18npool/inc/collatorImpl.hxx +++ b/i18npool/inc/collatorImpl.hxx @@ -22,7 +22,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/Reference.h> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/i18n/XCollator.hpp> #include <com/sun/star/lang/Locale.hpp> #include <cppuhelper/weak.hxx> @@ -97,7 +97,7 @@ private : // Service Factory com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; // lang::Locale Data - com::sun::star::uno::Reference < XLocaleData > localedata; + com::sun::star::uno::Reference < XLocaleData4 > mxLocaleData; sal_Bool SAL_CALL createCollator(const lang::Locale& rLocale, const rtl::OUString& serviceName, const rtl::OUString& rSortAlgorithm) throw(com::sun::star::uno::RuntimeException); diff --git a/i18npool/inc/numberformatcode.hxx b/i18npool/inc/numberformatcode.hxx index ee825eedff8f..9433b111d44e 100644 --- a/i18npool/inc/numberformatcode.hxx +++ b/i18npool/inc/numberformatcode.hxx @@ -25,7 +25,7 @@ #include <cppuhelper/implbase2.hxx> // helper for implementations #include <com/sun/star/i18n/XNumberFormatCode.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -37,7 +37,7 @@ class NumberFormatCodeMapper : public cppu::WeakImplHelper2 { public: NumberFormatCodeMapper( const ::com::sun::star::uno::Reference < - ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ::com::sun::star::uno::XComponentContext >& rxContext ); ~NumberFormatCodeMapper(); virtual ::com::sun::star::i18n::NumberFormatCode SAL_CALL getDefault( sal_Int16 nFormatType, sal_Int16 nFormatUsage, const ::com::sun::star::lang::Locale& rLocale ) throw(::com::sun::star::uno::RuntimeException); @@ -55,9 +55,9 @@ public: private: ::com::sun::star::lang::Locale aLocale; - ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF; + ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > mxContext; ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > aFormatSeq; - ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData > xlocaleData; + ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XLocaleData4 > mxLocaleData; sal_Bool bFormatsValid; void setupLocale( const ::com::sun::star::lang::Locale& rLocale ); diff --git a/i18npool/inc/transliterationImpl.hxx b/i18npool/inc/transliterationImpl.hxx index 3ff345239da9..fd12616507d1 100644 --- a/i18npool/inc/transliterationImpl.hxx +++ b/i18npool/inc/transliterationImpl.hxx @@ -19,10 +19,10 @@ #ifndef _I18N_TRANSLITERATIONIMPL_HXX_ #define _I18N_TRANSLITERATIONIMPL_HXX_ -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/XLocaleData4.hpp> #include <com/sun/star/i18n/XExtendedTransliteration.hpp> #include <cppuhelper/implbase2.hxx> // helper for implementations -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <sal/types.h> @@ -44,7 +44,7 @@ class TransliterationImpl : public cppu::WeakImplHelper2 { public: // Constructors - TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF); + TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& xContext); // Destructor ~TransliterationImpl(); @@ -104,8 +104,8 @@ private: com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > bodyCascade[maxCascade]; sal_Int16 numCascade; sal_Bool caseignoreOnly; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMgr; - com::sun::star::uno::Reference< XLocaleData > localedata; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; + com::sun::star::uno::Reference< XLocaleData4 > mxLocaledata; com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > caseignore; virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName, diff --git a/i18npool/source/characterclassification/cclass_unicode_parser.cxx b/i18npool/source/characterclassification/cclass_unicode_parser.cxx index 5de6eaaba658..f538933c6207 100644 --- a/i18npool/source/characterclassification/cclass_unicode_parser.cxx +++ b/i18npool/source/characterclassification/cclass_unicode_parser.cxx @@ -25,8 +25,9 @@ #include <com/sun/star/i18n/KParseTokens.hpp> #include <com/sun/star/i18n/KParseType.hpp> #include <com/sun/star/i18n/UnicodeType.hpp> -#include <com/sun/star/i18n/XLocaleData.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/i18n/NativeNumberMode.hpp> +#include <comphelper/componentcontext.hxx> #include <string.h> // memcpy() @@ -398,17 +399,9 @@ sal_Bool cclass_Unicode::setupInternational( const Locale& rLocale ) aParserLocale.Country = rLocale.Country; aParserLocale.Variant = rLocale.Variant; } - if ( !xLocaleData.is() && xMSF.is() ) + if ( !mxLocaleData.is() ) { - Reference < - XInterface > xI = - xMSF->createInstance( OUString( - RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.LocaleData" ) ) ); - if ( xI.is() ) - { - Any x = xI->queryInterface( getCppuType((const Reference< XLocaleData>*)0) ); - x >>= xLocaleData; - } + mxLocaleData.set( LocaleData::create(comphelper::ComponentContext(xMSF).getUNOContext()) ); } return bChanged; } @@ -458,10 +451,10 @@ void cclass_Unicode::initParserTable( const Locale& rLocale, sal_Int32 startChar aContChars = userDefinedCharactersCont; // specials - if( xLocaleData.is() ) + if( mxLocaleData.is() ) { LocaleDataItem aItem = - xLocaleData->getLocaleItem( aParserLocale ); + mxLocaleData->getLocaleItem( aParserLocale ); //!TODO: theoretically separators may be a string, adjustment would have to be //! done here and in parsing and in ::rtl::math::stringToDouble() cGroupSep = aItem.thousandSeparator.getStr()[0]; diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index 90da69ff79fc..12a3cc62cbaa 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -20,7 +20,9 @@ #include <collatorImpl.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> #include <rtl/ustrbuf.hxx> +#include <comphelper/componentcontext.hxx> using namespace com::sun::star; using namespace com::sun::star::lang; @@ -33,12 +35,7 @@ namespace com { namespace sun { namespace star { namespace i18n { CollatorImpl::CollatorImpl( const Reference < XMultiServiceFactory >& rxMSF ) : xMSF(rxMSF) { - if ( rxMSF.is()) { - Reference < XInterface > xI = - xMSF->createInstance( OUString("com.sun.star.i18n.LocaleData")); - if ( xI.is() ) - xI->queryInterface(::getCppuType((const Reference< XLocaleData>*)0)) >>= localedata; - } + mxLocaleData.set(LocaleData::create(comphelper::ComponentContext(xMSF).getUNOContext())); cachedItem = NULL; } @@ -78,7 +75,7 @@ CollatorImpl::compareString( const OUString& in_str1, const OUString& in_str2) t sal_Int32 SAL_CALL CollatorImpl::loadDefaultCollator(const lang::Locale& rLocale, sal_Int32 collatorOptions) throw(RuntimeException) { - const Sequence< Implementation > &imp = localedata->getCollatorImplementations(rLocale); + const Sequence< Implementation > &imp = mxLocaleData->getCollatorImplementations(rLocale); for (sal_Int16 i = 0; i < imp.getLength(); i++) if (imp[i].isDefault) return loadCollatorAlgorithm(imp[i].unoID, rLocale, collatorOptions); @@ -116,7 +113,7 @@ Sequence< OUString > SAL_CALL CollatorImpl::listCollatorAlgorithms( const lang::Locale& rLocale ) throw(RuntimeException) { nLocale = rLocale; - const Sequence< Implementation > &imp = localedata->getCollatorImplementations(rLocale); + const Sequence< Implementation > &imp = mxLocaleData->getCollatorImplementations(rLocale); Sequence< OUString > list(imp.getLength()); for (sal_Int32 i = 0; i < imp.getLength(); i++) { @@ -134,7 +131,7 @@ CollatorImpl::listCollatorAlgorithms( const lang::Locale& rLocale ) throw(Runtim Sequence< sal_Int32 > SAL_CALL CollatorImpl::listCollatorOptions( const OUString& /*collatorAlgorithmName*/ ) throw(RuntimeException) { - Sequence< OUString > option_str = localedata->getCollationOptions(nLocale); + Sequence< OUString > option_str = mxLocaleData->getCollationOptions(nLocale); Sequence< sal_Int32 > option_int(option_str.getLength()); for (sal_Int32 i = 0; i < option_str.getLength(); i++) @@ -157,21 +154,18 @@ CollatorImpl::createCollator(const lang::Locale& rLocale, const OUString& servic return sal_True; } } - if (xMSF.is()) { - Reference < XInterface > xI = - xMSF->createInstance(OUString("com.sun.star.i18n.Collator_") + serviceName); - - if (xI.is()) { - Reference < XCollator > xC; - xI->queryInterface( getCppuType((const Reference< XCollator>*)0) ) >>= xC; - if (xC.is()) { - lookupTable.push_back(cachedItem = new lookupTableItem(rLocale, rSortAlgorithm, serviceName, xC)); - return sal_True; - } + Reference < XInterface > xI = + xMSF->createInstance(OUString("com.sun.star.i18n.Collator_") + serviceName); + + if (xI.is()) { + Reference < XCollator > xC; + xI->queryInterface( getCppuType((const Reference< XCollator>*)0) ) >>= xC; + if (xC.is()) { + lookupTable.push_back(cachedItem = new lookupTableItem(rLocale, rSortAlgorithm, serviceName, xC)); + return sal_True; } - return sal_False; } - throw RuntimeException(); + return sal_False; } void SAL_CALL diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 5caacbdc3127..dc2e6089d77f 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -25,6 +25,7 @@ #include <nativenumbersupplier.hxx> #include <stdio.h> #include <string.h> +#include <comphelper/componentcontext.hxx> // Cyrillic upper case #define C_CYR_A "\xD0\x90" @@ -271,7 +272,7 @@ DefaultNumberingProvider::~DefaultNumberingProvider() void DefaultNumberingProvider::impl_loadTranslit() { if ( !translit ) - translit = new TransliterationImpl(xSMgr); + translit = new TransliterationImpl(comphelper::ComponentContext(xSMgr).getUNOContext()); } Sequence< Reference<container::XIndexAccess> > diff --git a/i18npool/source/numberformatcode/numberformatcode.cxx b/i18npool/source/numberformatcode/numberformatcode.cxx index 96b837725f67..6ec23799719a 100644 --- a/i18npool/source/numberformatcode/numberformatcode.cxx +++ b/i18npool/source/numberformatcode/numberformatcode.cxx @@ -21,14 +21,16 @@ #include <numberformatcode.hxx> #include <com/sun/star/i18n/KNumberFormatUsage.hpp> #include <com/sun/star/i18n/KNumberFormatType.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> +#include <comphelper/componentcontext.hxx> NumberFormatCodeMapper::NumberFormatCodeMapper( const ::com::sun::star::uno::Reference < - ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) + ::com::sun::star::uno::XComponentContext >& rxContext ) : - xMSF( rxMSF ), + mxContext( rxContext ), bFormatsValid( sal_False ) { } @@ -164,10 +166,10 @@ void NumberFormatCodeMapper::getFormats( const ::com::sun::star::lang::Locale& r if ( !bFormatsValid ) { createLocaleDataObject(); - if( !xlocaleData.is() ) + if( !mxLocaleData.is() ) aFormatSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::FormatElement > (0); else - aFormatSeq = xlocaleData->getAllFormats( aLocale ); + aFormatSeq = mxLocaleData->getAllFormats( aLocale ); bFormatsValid = sal_True; } } @@ -255,17 +257,10 @@ NumberFormatCodeMapper::mapElementUsageStringToShort(const ::rtl::OUString& form void NumberFormatCodeMapper::createLocaleDataObject() { - if(xlocaleData.is()) + if(mxLocaleData.is()) return; - ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > - xI = xMSF->createInstance( - ::rtl::OUString( "com.sun.star.i18n.LocaleData" )); - - if ( xI.is() ) { - ::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData >*)0) ); - x >>= xlocaleData; - } + mxLocaleData.set( com::sun::star::i18n::LocaleData::create(mxContext) ); } ::rtl::OUString SAL_CALL diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 85e3af8b3383..3eba12e2cc3c 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> #include <osl/mutex.hxx> @@ -101,6 +102,17 @@ new ImplName( rxMSF ) ); \ } +#define IMPL_CREATEINSTANCE_CTX( ImplName ) \ + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > \ + SAL_CALL ImplName##_CreateInstance( \ + const ::com::sun::star::uno::Reference< \ + ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) \ +{ \ + return ::com::sun::star::uno::Reference < \ + ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) \ + new ImplName( comphelper::ComponentContext(rxMSF).getUNOContext() ) ); \ +} + typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > (SAL_CALL *FN_CreateInstance)( const ::com::sun::star::uno::Reference< @@ -115,7 +127,7 @@ typedef ::com::sun::star::uno::Reference< using namespace ::com::sun::star::i18n; -IMPL_CREATEINSTANCE_MSF( NumberFormatCodeMapper ) +IMPL_CREATEINSTANCE_CTX( NumberFormatCodeMapper ) IMPL_CREATEINSTANCE( NativeNumberSupplier ) IMPL_CREATEINSTANCE( LocaleData ) IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider ) @@ -147,7 +159,7 @@ IMPL_CREATEINSTANCE( Collator_Unicode ) IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl ) IMPL_CREATEINSTANCE_MSF( cclass_Unicode ) -IMPL_CREATEINSTANCE_MSF( TransliterationImpl ) +IMPL_CREATEINSTANCE_CTX( TransliterationImpl ) IMPL_CREATEINSTANCE( UnoScriptTypeDetector ) IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl ) diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index d6b1e144d972..af5ca8f0bdbf 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -21,9 +21,11 @@ #include "transliterationImpl.hxx" #include "servicename.hxx" +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/i18n/TransliterationType.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <rtl/instance.hxx> #include <rtl/string.h> @@ -136,25 +138,17 @@ static struct TMlist { }; // Constructor/Destructor -TransliterationImpl::TransliterationImpl(const Reference <XMultiServiceFactory>& xMSF) : xSMgr(xMSF) +TransliterationImpl::TransliterationImpl(const Reference <XComponentContext>& xContext) : mxContext(xContext) { numCascade = 0; caseignoreOnly = sal_True; - if ( xMSF.is() ) - { - Reference < XInterface > xI= - xMSF->createInstance(OUString("com.sun.star.i18n.LocaleData")); - if ( xI.is() ) { - Any x = xI->queryInterface( ::getCppuType( (const uno::Reference< i18n::XLocaleData >*)0) ); - x >>= localedata; - } - } + mxLocaledata.set(LocaleData::create(xContext)); } TransliterationImpl::~TransliterationImpl() { - localedata.clear(); + mxLocaledata.clear(); clear(); } @@ -261,7 +255,7 @@ TransliterationImpl::loadModulesByImplNames(const Sequence< OUString >& implName Sequence<OUString> SAL_CALL TransliterationImpl::getAvailableModules( const Locale& rLocale, sal_Int16 sType ) throw(RuntimeException) { - const Sequence<OUString> &translist = localedata->getTransliterations(rLocale); + const Sequence<OUString> &translist = mxLocaledata->getTransliterations(rLocale); Sequence<OUString> r(translist.getLength()); Reference<XExtendedTransliteration> body; sal_Int32 n = 0; @@ -597,7 +591,7 @@ void TransliterationImpl::loadBody( OUString &implName, Reference<XExtendedTrans if (implName != lastTransBody.Name) { lastTransBody.Body.set( - xSMgr->createInstance(implName), UNO_QUERY_THROW); + mxContext->getServiceManager()->createInstanceWithContext(implName, mxContext), UNO_QUERY_THROW); lastTransBody.Name = implName; } body = lastTransBody.Body; diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk index 8605c3712e29..3a089135415b 100644 --- a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk +++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk @@ -54,6 +54,7 @@ $(eval $(call gb_CppunitTest_use_ure,lotuswordpro_test_lotuswordpro)) $(eval $(call gb_CppunitTest_use_components,lotuswordpro_test_lotuswordpro,\ configmgr/source/configmgr \ + i18npool/util/i18npool \ lotuswordpro/util/lwpfilter \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 558747878479..e5606da48aa5 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -150,6 +150,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/inspection )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\ BreakIterator \ + LocaleData \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\ LanguageGuessing \ @@ -847,7 +848,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\ IndexEntrySupplier \ InputSequenceChecker \ LocaleCalendar \ - LocaleData \ NativeNumberSupplier \ NumberFormatMapper \ OrdinalSuffix \ diff --git a/offapi/com/sun/star/i18n/LocaleData.idl b/offapi/com/sun/star/i18n/LocaleData.idl index fd951688305f..93d7962bf779 100644 --- a/offapi/com/sun/star/i18n/LocaleData.idl +++ b/offapi/com/sun/star/i18n/LocaleData.idl @@ -36,14 +36,7 @@ module com { module sun { module star { module i18n { /// Access locale specific data. -published service LocaleData -{ - interface com::sun::star::i18n::XLocaleData; - - [optional] interface com::sun::star::i18n::XLocaleData2; - [optional] interface com::sun::star::i18n::XLocaleData3; - [optional] interface com::sun::star::i18n::XLocaleData4; -}; +published service LocaleData : com::sun::star::i18n::XLocaleData4; }; }; }; }; diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 674109c7195f..8f2fe3bdb063 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/svtools/CppunitTest_svtools_filters_test.mk b/svtools/CppunitTest_svtools_filters_test.mk index c6abe11a10ac..96a1a8d551a4 100644 --- a/svtools/CppunitTest_svtools_filters_test.mk +++ b/svtools/CppunitTest_svtools_filters_test.mk @@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_ure,svtools_filters_test)) $(eval $(call gb_CppunitTest_use_components,svtools_filters_test,\ configmgr/source/configmgr \ + i18npool/util/i18npool \ ucb/source/core/ucb1 \ )) diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index db5e2b85e266..8e81c2f21b98 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -32,10 +32,12 @@ #include "instance.hxx" #include <com/sun/star/i18n/KNumberFormatUsage.hpp> #include <com/sun/star/i18n/KNumberFormatType.hpp> +#include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/i18n/CalendarFieldIndex.hpp> #include <com/sun/star/i18n/CalendarDisplayIndex.hpp> - #include <com/sun/star/i18n/NumberFormatIndex.hpp> + +#include <comphelper/componentcontext.hxx> #include <rtl/instance.hxx> #include <rtl/ustrbuf.hxx> #include <sal/macros.h> @@ -73,9 +75,7 @@ LocaleDataWrapper::LocaleDataWrapper( bReservedWordValid( sal_False ) { setLocale( rLocale ); - xLD = Reference< XLocaleData4 > ( - intl_createInstance( xSMgr, "com.sun.star.i18n.LocaleData", - "LocaleDataWrapper" ), uno::UNO_QUERY ); + xLD = LocaleData::create(comphelper::ComponentContext(xSMgr).getUNOContext()); } |