diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-05 11:28:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-15 08:28:44 +0100 |
commit | d2f6a87ac7adb3f60f7eae7c5a8f8a9076b7a75c (patch) | |
tree | 0bcc19623fa6cda27b78df47c54192bd3e73ef41 /svl | |
parent | 5837402fb1daa437d9a1a37edc9ede57319944f1 (diff) |
fdo#46808, use service constructor for i18n::NumberFormatMapper
Also create a utility constructor for LocaleDataWrapper, which
simplifies many of the calling sites.
Change-Id: Ic8510b51c4201fa17fc0620e18d3e258e43636ba
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/ondemand.hxx | 30 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 12 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 2 |
3 files changed, 22 insertions, 22 deletions
diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx index 792eb0f58e22..f724cca95746 100644 --- a/svl/inc/svl/ondemand.hxx +++ b/svl/inc/svl/ondemand.hxx @@ -54,7 +54,7 @@ class OnDemandLocaleDataWrapper { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; SvtSysLocale aSysLocale; LanguageType eCurrentLanguage; LanguageType eLastAnyLanguage; @@ -75,7 +75,7 @@ public: eCurrentLanguage = LANGUAGE_SYSTEM; } OnDemandLocaleDataWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ) @@ -85,7 +85,7 @@ public: , bInitialized(false) { pSystem = aSysLocale.GetLocaleDataPtr(); - init( rxSMgr, rLocale, eLang ); + init( rxContext, rLocale, eLang ); } ~OnDemandLocaleDataWrapper() { @@ -98,12 +98,12 @@ public: bool is() const { return pCurrent != NULL; } void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ) { - xSMgr = rxSMgr; + m_xContext = rxContext; changeLocale( rLocale, eLang ); bInitialized = true; } @@ -117,13 +117,13 @@ public: break; case LANGUAGE_ENGLISH_US : if ( !pEnglish ) - pEnglish = new LocaleDataWrapper( xSMgr, rLocale ); + pEnglish = new LocaleDataWrapper( m_xContext, rLocale ); pCurrent = pEnglish; break; default: if ( !pAny ) { - pAny = new LocaleDataWrapper( xSMgr, rLocale ); + pAny = new LocaleDataWrapper( m_xContext, rLocale ); eLastAnyLanguage = eLang; } else if ( eLastAnyLanguage != eLang ) @@ -143,7 +143,7 @@ public: { if ( !pAny ) { - pAny = new LocaleDataWrapper( xSMgr, pCurrent->getLocale() ); + pAny = new LocaleDataWrapper( m_xContext, pCurrent->getLocale() ); eLastAnyLanguage = eCurrentLanguage; } else if ( pCurrent != pAny ) @@ -240,7 +240,7 @@ public: */ class OnDemandTransliterationWrapper { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; LanguageType eLanguage; ::com::sun::star::i18n::TransliterationModules nType; mutable ::utl::TransliterationWrapper* pPtr; @@ -255,14 +255,14 @@ public: , bInitialized(false) {} OnDemandTransliterationWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, LanguageType eLang, ::com::sun::star::i18n::TransliterationModules nTypeP ) : bValid(false) , bInitialized(false) { - init( rxSMgr, eLang, nTypeP ); + init( rxContext, eLang, nTypeP ); } ~OnDemandTransliterationWrapper() { @@ -274,12 +274,12 @@ public: bool is() const { return pPtr != NULL; } void init( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, LanguageType eLang, ::com::sun::star::i18n::TransliterationModules nTypeP ) { - xSMgr = rxSMgr; + m_xContext = rxContext; nType = nTypeP; changeLocale( eLang ); if ( pPtr ) @@ -301,7 +301,7 @@ public: if ( !bValid ) { if ( !pPtr ) - pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType ); + pPtr = new ::utl::TransliterationWrapper( m_xContext, nType ); pPtr->loadModuleIfNeeded( eLanguage ); bValid = true; } @@ -311,7 +311,7 @@ public: const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const { if ( !pPtr ) - pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType ); + pPtr = new ::utl::TransliterationWrapper( m_xContext, nType ); pPtr->loadModuleByImplName( rModule, eLang ); bValid = false; // reforce settings change in get() return pPtr; diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 8d73e68a19d5..106a37220a2e 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -235,9 +235,9 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang ) aLocale = MsLangId::convertLanguageToLocale( eLang ); pCharClass = new CharClass( comphelper::getComponentContext(xServiceManager), aLocale ); - xLocaleData.init( xServiceManager, aLocale, eLang ); + xLocaleData.init( comphelper::getComponentContext(xServiceManager), aLocale, eLang ); xCalendar.init( comphelper::getComponentContext(xServiceManager), aLocale ); - xTransliteration.init( xServiceManager, eLang, + xTransliteration.init( comphelper::getComponentContext(xServiceManager), eLang, ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ); xNatNum.init( xServiceManager ); @@ -449,7 +449,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset) ); // append new system additional formats - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, true ); } @@ -744,7 +744,7 @@ bool SvNumberFormatter::Load( SvStream& rStream ) // generate additional i18n standard formats for all used locales LanguageType eOldLanguage = ActLnge; - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); std::vector<sal_uInt16> aList; GetUsedLanguages( aList ); for ( std::vector<sal_uInt16>::const_iterator it(aList.begin()); it != aList.end(); ++it ) @@ -2163,7 +2163,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio if (bOldConvertMode) pFormatScanner->SetConvertMode(false); // switch off for this function - NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); xub_StrLen nCheckPos = 0; SvNumberformat* pNewFormat = NULL; @@ -3546,7 +3546,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() LanguageType eSysLang = SvtSysLocale().GetLanguage(); LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( - ::comphelper::getProcessServiceFactory(), + ::comphelper::getProcessComponentContext(), MsLangId::convertLanguageToLocale( eSysLang ) ); // get user configured currency String aConfiguredCurrencyAbbrev; diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index fb3649c424ea..243bd2a1affb 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -223,7 +223,7 @@ void ImpSvNumberformatScan::SetDependentKeywords() // requested Locale, otherwise number format codes might not match lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale(); LanguageType eLang = MsLangId::convertLocaleToLanguage( aLoadedLocale ); - NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(pFormatter->GetServiceManager()), aLoadedLocale ); i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD ); sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code); |