diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-20 12:57:26 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-30 13:59:46 +0100 |
commit | f96db7d0ddeb737cf0e14eea6120daab860c54b7 (patch) | |
tree | 6107a9464ff9fa889740a743255f543390791f22 /unotools | |
parent | there is nothing to localize in 'scripting' module (diff) | |
download | core-f96db7d0ddeb737cf0e14eea6120daab860c54b7.tar.gz core-f96db7d0ddeb737cf0e14eea6120daab860c54b7.zip |
fdo#46808, use service constructor for i18n::Collator
Change-Id: I15a360723e335345aad09e73fcb0f6815ed9e0d4
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/collatorwrapper.hxx | 8 | ||||
-rw-r--r-- | unotools/inc/unotools/intlwrapper.hxx | 7 | ||||
-rw-r--r-- | unotools/source/i18n/collatorwrapper.cxx | 12 | ||||
-rw-r--r-- | unotools/source/i18n/intlwrapper.cxx | 19 |
4 files changed, 26 insertions, 20 deletions
diff --git a/unotools/inc/unotools/collatorwrapper.hxx b/unotools/inc/unotools/collatorwrapper.hxx index 0752b653d8dc..c73be3518569 100644 --- a/unotools/inc/unotools/collatorwrapper.hxx +++ b/unotools/inc/unotools/collatorwrapper.hxx @@ -23,8 +23,8 @@ #include <com/sun/star/i18n/XCollator.hpp> -namespace com { namespace sun { namespace star { namespace lang { - class XMultiServiceFactory; +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; }}}} class UNOTOOLS_DLLPUBLIC CollatorWrapper @@ -32,7 +32,7 @@ class UNOTOOLS_DLLPUBLIC CollatorWrapper private: ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory + ::com::sun::star::uno::XComponentContext > mxServiceFactory; ::com::sun::star::uno::Reference< @@ -43,7 +43,7 @@ class UNOTOOLS_DLLPUBLIC CollatorWrapper CollatorWrapper ( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory > &xServiceFactoryIn); + ::com::sun::star::uno::XComponentContext > &rxContext); ~CollatorWrapper(); diff --git a/unotools/inc/unotools/intlwrapper.hxx b/unotools/inc/unotools/intlwrapper.hxx index 7d1665264d4d..0320d2a8204e 100644 --- a/unotools/inc/unotools/intlwrapper.hxx +++ b/unotools/inc/unotools/intlwrapper.hxx @@ -49,7 +49,7 @@ class UNOTOOLS_DLLPUBLIC IntlWrapper private: LanguageTag maLanguageTag; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; LocaleDataWrapper* pLocaleData; CollatorWrapper* pCollator; @@ -61,7 +61,10 @@ private: public: IntlWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext, + const LanguageTag& rLanguageTag + ); + IntlWrapper( const LanguageTag& rLanguageTag ); ~IntlWrapper(); diff --git a/unotools/source/i18n/collatorwrapper.cxx b/unotools/source/i18n/collatorwrapper.cxx index 5611ab7b2f39..b64268ffe2cc 100644 --- a/unotools/source/i18n/collatorwrapper.cxx +++ b/unotools/source/i18n/collatorwrapper.cxx @@ -19,19 +19,13 @@ #include <unotools/collatorwrapper.hxx> #include <tools/debug.hxx> - -#include "instance.hxx" +#include <com/sun/star/i18n/Collator.hpp> using namespace ::com::sun::star; -CollatorWrapper::CollatorWrapper ( - const uno::Reference< lang::XMultiServiceFactory > &xServiceFactory) - : mxServiceFactory (xServiceFactory) +CollatorWrapper::CollatorWrapper ( const uno::Reference< uno::XComponentContext > &rxContext ) { - mxInternationalCollator = uno::Reference< i18n::XCollator > ( - intl_createInstance( xServiceFactory, "com.sun.star.i18n.Collator", - "CollatorWrapper" ), uno::UNO_QUERY ); - DBG_ASSERT (mxInternationalCollator.is(), "CollatorWrapper: no i18n collator"); + mxInternationalCollator = i18n::Collator::create( rxContext ); } CollatorWrapper::~CollatorWrapper() diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx index 075604e92b9c..059f08d9c22a 100644 --- a/unotools/source/i18n/intlwrapper.cxx +++ b/unotools/source/i18n/intlwrapper.cxx @@ -24,17 +24,27 @@ #include <comphelper/processfactory.hxx> IntlWrapper::IntlWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext, const LanguageTag& rLanguageTag ) : maLanguageTag( rLanguageTag ), - xSMgr( xSF ), + m_xContext( rxContext ), pLocaleData( NULL ), pCollator( NULL ), pCaseCollator( NULL ) { } +IntlWrapper::IntlWrapper( + const LanguageTag& rLanguageTag ) + : + maLanguageTag( rLanguageTag ), + m_xContext( comphelper::getProcessComponentContext() ), + pLocaleData( NULL ), + pCollator( NULL ), + pCaseCollator( NULL ) +{ +} IntlWrapper::~IntlWrapper() { @@ -46,14 +56,13 @@ IntlWrapper::~IntlWrapper() void IntlWrapper::ImplNewLocaleData() const { - ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( - comphelper::getComponentContext(xSMgr), maLanguageTag ); + ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( m_xContext, maLanguageTag ); } void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const { - CollatorWrapper* p = new CollatorWrapper( xSMgr ); + CollatorWrapper* p = new CollatorWrapper( m_xContext ); if ( bCaseSensitive ) { p->loadDefaultCollator( maLanguageTag.getLocale(), 0 ); |