From 56ea15091c69d280310aa8b28bb1e9488eaad756 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 8 Nov 2012 14:53:57 +0200 Subject: fdo#46808, use service constructor for i18n::Collator Change-Id: If6ad17fa9e274beff7ba872a095ced65438962af --- comphelper/source/compare/AnyCompareFactory.cxx | 24 +++++++--------------- comphelper/source/misc/string.cxx | 8 ++------ dbaccess/source/ui/browser/unodatbr.cxx | 3 ++- desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 9 +++----- i18npool/inc/chaptercollator.hxx | 2 +- i18npool/inc/collatorImpl.hxx | 5 ++--- i18npool/inc/indexentrysupplier_asian.hxx | 2 +- i18npool/inc/indexentrysupplier_common.hxx | 2 +- i18npool/inc/indexentrysupplier_default.hxx | 4 ++-- i18npool/inc/indexentrysupplier_ja_phonetic.hxx | 4 ++-- i18npool/source/collator/chaptercollator.cxx | 6 ++---- i18npool/source/collator/collatorImpl.cxx | 6 +++--- .../source/indexentry/indexentrysupplier_asian.cxx | 2 +- .../indexentry/indexentrysupplier_common.cxx | 4 ++-- .../indexentry/indexentrysupplier_default.cxx | 10 ++++----- .../source/registerservices/registerservices.cxx | 16 +++++++-------- .../ui/animations/CustomAnimationCreateDialog.cxx | 17 +++++---------- .../source/controls/grid/sortablegriddatamodel.cxx | 19 +++++++++-------- .../source/controls/grid/sortablegriddatamodel.hxx | 4 ++-- xmlhelp/source/cxxhelp/provider/databases.cxx | 6 ++---- 20 files changed, 64 insertions(+), 89 deletions(-) diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index 609c390acb0d..69ce7d19ec84 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.cxx @@ -21,7 +21,7 @@ #include "comphelper_module.hxx" #include -#include +#include #include #include #include @@ -51,16 +51,9 @@ class AnyCompare : public ::cppu::WeakImplHelper1< XAnyCompare > public: AnyCompare( Reference< XComponentContext > xContext, const Locale& rLocale ) throw() { - Reference< XMultiComponentFactory > xFactory = xContext->getServiceManager(); - if ( xFactory.is() ) - { - m_rCollator = Reference< XCollator >( - xFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.Collator" )), xContext ), - UNO_QUERY ); + m_rCollator = Collator::create( xContext ); m_rCollator->loadDefaultCollator( rLocale, 0 ); //??? - } - } virtual sal_Int16 SAL_CALL compare( const Any& any1, const Any& any2 ) throw(RuntimeException); @@ -102,16 +95,13 @@ sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) throw { sal_Int16 aResult = 0; - if( m_rCollator.is() ) - { - OUString aStr1; - OUString aStr2; + OUString aStr1; + OUString aStr2; - any1 >>= aStr1; - any2 >>= aStr2; + any1 >>= aStr1; + any2 >>= aStr2; - aResult = ( sal_Int16 )m_rCollator->compareString( aStr1, aStr2 ); - } + aResult = ( sal_Int16 )m_rCollator->compareString( aStr1, aStr2 ); return aResult; } diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 2fe8a3f508f8..1dae9e8c203f 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -36,6 +36,7 @@ #include #include +#include namespace comphelper { namespace string { @@ -343,12 +344,7 @@ NaturalStringSorter::NaturalStringSorter( const uno::Reference< uno::XComponentContext > &rContext, const lang::Locale &rLocale) : m_aLocale(rLocale) { - uno::Reference< lang::XMultiComponentFactory > xFactory(rContext->getServiceManager(), - uno::UNO_SET_THROW); - - m_xCollator = uno::Reference< i18n::XCollator >(xFactory->createInstanceWithContext( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")), rContext), - uno::UNO_QUERY_THROW); + m_xCollator = i18n::Collator::create( rContext ); m_xCollator->loadDefaultCollator(m_aLocale, 0); m_xBI = i18n::BreakIterator::create( rContext ); } diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 31b25862e3af..4963888f5174 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -360,7 +361,7 @@ sal_Bool SbaTableQueryBrowser::Construct(Window* pParent) xDatabaseRegistrations->addDatabaseRegistrationsListener( this ); // the collator for the string compares - m_xCollator = Reference< XCollator >( getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")) ), UNO_QUERY_THROW ); + m_xCollator = Collator::create( comphelper::getComponentContext( getORB() ) ); m_xCollator->loadDefaultCollator( Application::GetSettings().GetLanguageTag().getLocale(), 0 ); } catch(const Exception&) diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index e52a892b32db..39844e31dbbd 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -36,7 +36,7 @@ #include "com/sun/star/deployment/LicenseException.hpp" #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/PlatformException.hpp" -#include "com/sun/star/i18n/XCollator.hpp" +#include "com/sun/star/i18n/Collator.hpp" #include "com/sun/star/i18n/CollatorOptions.hpp" #include @@ -160,11 +160,8 @@ void CommandEnvironmentImpl::printLicense( dp_misc::writeConsole(s3); //the user may enter "yes" or "no", we compare in a case insensitive way - Reference< css::i18n::XCollator > xCollator( - m_xComponentContext->getServiceManager() - ->createInstanceWithContext( - OUSTR("com.sun.star.i18n.Collator"),m_xComponentContext), - UNO_QUERY_THROW ); + Reference< css::i18n::XCollator > xCollator = + css::i18n::Collator::create( m_xComponentContext ); xCollator->loadDefaultCollator( toLocale(utl::ConfigManager::getLocale()), css::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE); diff --git a/i18npool/inc/chaptercollator.hxx b/i18npool/inc/chaptercollator.hxx index cb50b257b062..83518d64a812 100644 --- a/i18npool/inc/chaptercollator.hxx +++ b/i18npool/inc/chaptercollator.hxx @@ -31,7 +31,7 @@ class ChapterCollator : public CollatorImpl { public: // Constructors - ChapterCollator( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + ChapterCollator( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); // Destructor ~ChapterCollator(); diff --git a/i18npool/inc/collatorImpl.hxx b/i18npool/inc/collatorImpl.hxx index 7af96199cbbd..52409c59796f 100644 --- a/i18npool/inc/collatorImpl.hxx +++ b/i18npool/inc/collatorImpl.hxx @@ -20,7 +20,6 @@ #define _I18N_COLLATORIMPL_HXX_ #include -#include #include #include #include @@ -44,7 +43,7 @@ class CollatorImpl : public cppu::WeakImplHelper2 public: // Constructors - CollatorImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + CollatorImpl( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); // Destructor ~CollatorImpl(); @@ -95,7 +94,7 @@ private : lookupTableItem *cachedItem; // Service Factory - com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF; + com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext; // lang::Locale Data com::sun::star::uno::Reference < XLocaleData4 > mxLocaleData; diff --git a/i18npool/inc/indexentrysupplier_asian.hxx b/i18npool/inc/indexentrysupplier_asian.hxx index 454fab80fdaa..d15ae9703655 100644 --- a/i18npool/inc/indexentrysupplier_asian.hxx +++ b/i18npool/inc/indexentrysupplier_asian.hxx @@ -31,7 +31,7 @@ namespace com { namespace sun { namespace star { namespace i18n { class IndexEntrySupplier_asian : public IndexEntrySupplier_Common { public: - IndexEntrySupplier_asian( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + IndexEntrySupplier_asian( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); ~IndexEntrySupplier_asian(); rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry, diff --git a/i18npool/inc/indexentrysupplier_common.hxx b/i18npool/inc/indexentrysupplier_common.hxx index b5abbc3b0c99..65277c2b5220 100644 --- a/i18npool/inc/indexentrysupplier_common.hxx +++ b/i18npool/inc/indexentrysupplier_common.hxx @@ -38,7 +38,7 @@ class IndexEntrySupplier_Common : public cppu::WeakImplHelper2 > { public: - IndexEntrySupplier_Common( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + IndexEntrySupplier_Common( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); ~IndexEntrySupplier_Common(); virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList() diff --git a/i18npool/inc/indexentrysupplier_default.hxx b/i18npool/inc/indexentrysupplier_default.hxx index e915ea7d3091..757a849af46a 100644 --- a/i18npool/inc/indexentrysupplier_default.hxx +++ b/i18npool/inc/indexentrysupplier_default.hxx @@ -30,7 +30,7 @@ class Index; // ---------------------------------------------------- class IndexEntrySupplier_Unicode : public IndexEntrySupplier_Common { public: - IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); + IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); ~IndexEntrySupplier_Unicode(); virtual sal_Bool SAL_CALL loadAlgorithm( @@ -81,7 +81,7 @@ public: class Index { public: - Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF); + Index(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext); ~Index(); void init(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& algorithm) throw (com::sun::star::uno::RuntimeException); diff --git a/i18npool/inc/indexentrysupplier_ja_phonetic.hxx b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx index 5419f0607131..33c8f7378390 100644 --- a/i18npool/inc/indexentrysupplier_ja_phonetic.hxx +++ b/i18npool/inc/indexentrysupplier_ja_phonetic.hxx @@ -30,7 +30,7 @@ namespace com { namespace sun { namespace star { namespace i18n { class IndexEntrySupplier_ja_phonetic : public IndexEntrySupplier_Common { public: - IndexEntrySupplier_ja_phonetic( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : IndexEntrySupplier_Common(rxMSF) { + IndexEntrySupplier_ja_phonetic( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ) : IndexEntrySupplier_Common(rxContext) { implementationName = "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic"; }; virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,\ @@ -49,7 +49,7 @@ public: #define INDEXENTRYSUPPLIER_JA_PHONETIC( algorithm ) \ class IndexEntrySupplier_##algorithm : public IndexEntrySupplier_ja_phonetic {\ public:\ - IndexEntrySupplier_##algorithm (const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF) : IndexEntrySupplier_ja_phonetic (rxMSF) {\ + IndexEntrySupplier_##algorithm (const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext) : IndexEntrySupplier_ja_phonetic (rxContext) {\ implementationName = "com.sun.star.i18n.IndexEntrySupplier_"#algorithm;\ };\ virtual sal_Bool SAL_CALL loadAlgorithm(\ diff --git a/i18npool/source/collator/chaptercollator.cxx b/i18npool/source/collator/chaptercollator.cxx index 8c0c1100c308..23c936df4a12 100644 --- a/i18npool/source/collator/chaptercollator.cxx +++ b/i18npool/source/collator/chaptercollator.cxx @@ -31,11 +31,9 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::i18n; using namespace ::rtl; -ChapterCollator::ChapterCollator( const Reference < XMultiServiceFactory >& rxMSF ) : CollatorImpl(rxMSF) +ChapterCollator::ChapterCollator( const Reference < XComponentContext >& rxContext ) : CollatorImpl(rxContext) { - if ( rxMSF.is()) { - cclass = CharacterClassification::create( comphelper::getComponentContext( rxMSF ) ); - } + cclass = CharacterClassification::create( rxContext ); } ChapterCollator::~ChapterCollator() diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx index d2a85d2c72a3..fde6eef3373a 100644 --- a/i18npool/source/collator/collatorImpl.cxx +++ b/i18npool/source/collator/collatorImpl.cxx @@ -33,9 +33,9 @@ using ::rtl::OUStringBuffer; namespace com { namespace sun { namespace star { namespace i18n { -CollatorImpl::CollatorImpl( const Reference < XMultiServiceFactory >& rxMSF ) : xMSF(rxMSF) +CollatorImpl::CollatorImpl( const Reference < XComponentContext >& rxContext ) : m_xContext(rxContext) { - mxLocaleData.set(LocaleData::create(comphelper::getComponentContext(xMSF))); + mxLocaleData.set( LocaleData::create(rxContext) ); cachedItem = NULL; } @@ -155,7 +155,7 @@ CollatorImpl::createCollator(const lang::Locale& rLocale, const OUString& servic } } Reference < XInterface > xI = - xMSF->createInstance(OUString("com.sun.star.i18n.Collator_") + serviceName); + m_xContext->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.i18n.Collator_") + serviceName, m_xContext ); if (xI.is()) { Reference < XCollator > xC; diff --git a/i18npool/source/indexentry/indexentrysupplier_asian.cxx b/i18npool/source/indexentry/indexentrysupplier_asian.cxx index 90a92d19a651..f77bc7d4676c 100644 --- a/i18npool/source/indexentry/indexentrysupplier_asian.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_asian.cxx @@ -35,7 +35,7 @@ extern "C" { static void SAL_CALL thisModule() {} } #endif IndexEntrySupplier_asian::IndexEntrySupplier_asian( - const Reference < XMultiServiceFactory >& rxMSF ) : IndexEntrySupplier_Common(rxMSF) + const Reference < XComponentContext >& rxContext ) : IndexEntrySupplier_Common(rxContext) { implementationName = "com.sun.star.i18n.IndexEntrySupplier_asian"; #ifndef DISABLE_DYNLOADING diff --git a/i18npool/source/indexentry/indexentrysupplier_common.cxx b/i18npool/source/indexentry/indexentrysupplier_common.cxx index d2c2486d88bc..bd647b2b2476 100644 --- a/i18npool/source/indexentry/indexentrysupplier_common.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_common.cxx @@ -28,10 +28,10 @@ using namespace ::rtl; namespace com { namespace sun { namespace star { namespace i18n { -IndexEntrySupplier_Common::IndexEntrySupplier_Common(const Reference < lang::XMultiServiceFactory >& rxMSF) +IndexEntrySupplier_Common::IndexEntrySupplier_Common(const Reference < uno::XComponentContext >& rxContext) { implementationName = "com.sun.star.i18n.IndexEntrySupplier_Common"; - collator = new CollatorImpl(rxMSF); + collator = new CollatorImpl(rxContext); usePhonetic = sal_False; } diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx b/i18npool/source/indexentry/indexentrysupplier_default.cxx index 022cead9f9e0..eba5beed2c33 100644 --- a/i18npool/source/indexentry/indexentrysupplier_default.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx @@ -29,11 +29,11 @@ using namespace ::rtl; namespace com { namespace sun { namespace star { namespace i18n { IndexEntrySupplier_Unicode::IndexEntrySupplier_Unicode( - const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : - IndexEntrySupplier_Common(rxMSF) + const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ) : + IndexEntrySupplier_Common(rxContext) { implementationName = "com.sun.star.i18n.IndexEntrySupplier_Unicode"; - index = new Index(rxMSF); + index = new Index(rxContext); } IndexEntrySupplier_Unicode::~IndexEntrySupplier_Unicode() @@ -106,9 +106,9 @@ void IndexTable::init(sal_Unicode start_, sal_Unicode end_, IndexKey *keys, sal_ } } -Index::Index(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF) +Index::Index(const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext) { - collator = new CollatorImpl(rxMSF); + collator = new CollatorImpl(rxContext); } Index::~Index() diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 44e00d328f38..5b9572abc2a6 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -132,12 +132,12 @@ IMPL_CREATEINSTANCE( NativeNumberSupplier ) IMPL_CREATEINSTANCE( LocaleData ) IMPL_CREATEINSTANCE_CTX( DefaultNumberingProvider ) IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_asian ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant ) -IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_Unicode ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_asian ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant ) +IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_Unicode ) IMPL_CREATEINSTANCE_MSF( CalendarImpl ) IMPL_CREATEINSTANCE( Calendar_gregorian ) IMPL_CREATEINSTANCE( Calendar_hanja ) @@ -153,8 +153,8 @@ IMPL_CREATEINSTANCE( BreakIterator_zh ) IMPL_CREATEINSTANCE( BreakIterator_zh_TW ) IMPL_CREATEINSTANCE( BreakIterator_ko ) IMPL_CREATEINSTANCE( BreakIterator_th ) -IMPL_CREATEINSTANCE_MSF( ChapterCollator ) -IMPL_CREATEINSTANCE_MSF( CollatorImpl ) +IMPL_CREATEINSTANCE_CTX( ChapterCollator ) +IMPL_CREATEINSTANCE_CTX( CollatorImpl ) IMPL_CREATEINSTANCE( Collator_Unicode ) IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl ) diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx index fc803fb3425b..53b26cbc1cb0 100644 --- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx @@ -27,7 +27,7 @@ ************************************************************************/ -#include +#include #include #include @@ -225,22 +225,15 @@ private: ImplStlEffectCategorySortHelper::ImplStlEffectCategorySortHelper() { - uno::Reference xFac( ::comphelper::getProcessServiceFactory() ); - if( xFac.is() ) - { - mxCollator.set( xFac->createInstance( "com.sun.star.i18n.Collator" ), uno::UNO_QUERY ); + mxCollator = i18n::Collator::create( ::comphelper::getProcessComponentContext() ); - if( mxCollator.is() ) - { - const lang::Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale(); - mxCollator->loadDefaultCollator(rLocale, 0); - } - } + const lang::Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale(); + mxCollator->loadDefaultCollator(rLocale, 0); } bool ImplStlEffectCategorySortHelper::operator()( const CustomAnimationPresetPtr& p1, const CustomAnimationPresetPtr& p2 ) { - return mxCollator.is() ? mxCollator->compareString(p1->getLabel(), p2->getLabel()) == -1 : false; + return mxCollator->compareString(p1->getLabel(), p2->getLabel()) == -1; } CustomAnimationCreateTabPage::CustomAnimationCreateTabPage( Window* pParent, CustomAnimationCreateDialog* pDialogParent, int nTabId, const PresetCategoryList& rCategoryList, bool bHasText ) diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index 5343050a3e95..aa874db94415 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -21,11 +21,12 @@ #include "sortablegriddatamodel.hxx" #include "toolkit/helper/servicenames.hxx" -#include +#include #include #include #include +#include #include #include #include @@ -52,12 +53,14 @@ namespace toolkit using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; + using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::lang::IndexOutOfBoundsException; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::awt::grid::XGridDataListener; using ::com::sun::star::beans::Pair; using ::com::sun::star::util::XCloneable; using ::com::sun::star::i18n::XCollator; + using ::com::sun::star::i18n::Collator; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::awt::grid::GridDataEvent; @@ -127,10 +130,10 @@ namespace toolkit //================================================================================================================== DBG_NAME( SortableGridDataModel ) //------------------------------------------------------------------------------------------------------------------ - SortableGridDataModel::SortableGridDataModel( Reference< XMultiServiceFactory > const & i_factory ) + SortableGridDataModel::SortableGridDataModel( Reference< XComponentContext > const & rxContext ) :SortableGridDataModel_Base( m_aMutex ) ,SortableGridDataModel_PrivateBase() - ,m_context( i_factory ) + ,m_xContext( rxContext ) ,m_isInitialized( false ) ,m_delegator() ,m_collator() @@ -147,7 +150,7 @@ namespace toolkit :cppu::BaseMutex() ,SortableGridDataModel_Base( m_aMutex ) ,SortableGridDataModel_PrivateBase() - ,m_context( i_copySource.m_context ) + ,m_xContext( i_copySource.m_xContext ) ,m_isInitialized( true ) ,m_delegator() ,m_collator( i_copySource.m_collator ) @@ -213,9 +216,9 @@ namespace toolkit //------------------------------------------------------------------------------------------------------------------ namespace { - Reference< XCollator > lcl_loadDefaultCollator_throw( ::comphelper::ComponentContext const & i_context ) + Reference< XCollator > lcl_loadDefaultCollator_throw( const Reference & rxContext ) { - Reference< XCollator > const xCollator( i_context.createComponent( "com.sun.star.i18n.Collator" ), UNO_QUERY_THROW ); + Reference< XCollator > const xCollator = Collator::create( rxContext ); xCollator->loadDefaultCollator( Application::GetSettings().GetLanguageTag().getLocale(), 0 ); return xCollator; } @@ -236,7 +239,7 @@ namespace toolkit { case 1: // SortableGridDataModel.create( XMutableGridDataModel ) xDelegator.set( i_arguments[0], UNO_QUERY ); - xCollator = lcl_loadDefaultCollator_throw( m_context ); + xCollator = lcl_loadDefaultCollator_throw( m_xContext ); break; case 2: // SortableGridDataModel.createWithCollator( XMutableGridDataModel, XCollator ) @@ -891,7 +894,7 @@ namespace toolkit ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory ) { - return *( new ::toolkit::SortableGridDataModel( i_factory ) ); + return *( new ::toolkit::SortableGridDataModel( comphelper::getComponentContext(i_factory) ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.hxx b/toolkit/source/controls/grid/sortablegriddatamodel.hxx index 71718c5500de..85c5abd56c19 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.hxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.hxx @@ -55,7 +55,7 @@ namespace toolkit ,public SortableGridDataModel_PrivateBase { public: - SortableGridDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory ); + SortableGridDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext ); SortableGridDataModel( SortableGridDataModel const & i_copySource ); bool isInitialized() const { return m_isInitialized; } @@ -183,7 +183,7 @@ namespace toolkit void impl_removeColumnSort_noBroadcast(); private: - ::comphelper::ComponentContext m_context; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; bool m_isInitialized; ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel > m_delegator; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_collator; diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index f9dfe9f1727e..6b2d68275c52 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "inputstream.hxx" #include @@ -628,10 +629,7 @@ Databases::getCollator( const rtl::OUString& Language, if( ! it->second.is() ) { - it->second = - Reference< XCollator > ( - m_xSMgr->createInstanceWithContext( rtl::OUString( "com.sun.star.i18n.Collator" ), - m_xContext ), UNO_QUERY ); + it->second = Collator::create(m_xContext); rtl::OUString langStr = processLang(Language); rtl::OUString countryStr = country(Language); if( countryStr.isEmpty() ) -- cgit v1.2.3