diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-13 02:54:05 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-13 11:55:16 +0200 |
commit | 358d1a99484bcc02900bd200a7606a7bf3298cac (patch) | |
tree | 031f808141dbc712553b8a4a029a354a2699a622 /linguistic | |
parent | added static convertTo...() methods (diff) | |
download | core-358d1a99484bcc02900bd200a7606a7bf3298cac.tar.gz core-358d1a99484bcc02900bd200a7606a7bf3298cac.zip |
use static LanguageTag::convertTo...() for standalone conversions
If no LanguageTag instance is at hand use the static methods to convert
between BCP 47 string, Locale and MS-LangID instead of creating
temporary instances.
Change-Id: I9597f768078eb81c840e84a5db5617f26bb7dc09
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/source/convdic.cxx | 2 | ||||
-rw-r--r-- | linguistic/source/convdicxml.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/dicimp.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/gciterator.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/hyphdsp.cxx | 2 | ||||
-rw-r--r-- | linguistic/source/hyphdta.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 30 | ||||
-rw-r--r-- | linguistic/source/misc.cxx | 4 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 14 | ||||
-rw-r--r-- | linguistic/source/spelldta.cxx | 2 | ||||
-rw-r--r-- | linguistic/source/thesdsp.cxx | 2 |
11 files changed, 36 insertions, 36 deletions
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index c21df30b5879..323422af4045 100644 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -357,7 +357,7 @@ Locale SAL_CALL ConvDic::getLocale( ) throw (RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return LanguageTag( nLanguage ).getLocale(); + return LanguageTag::convertToLocale( nLanguage ); } diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index efb73c810460..91a30d367bad 100644 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -223,7 +223,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement( OUString aValue = rxAttrList->getValueByIndex(i); if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" ) - nLanguage = LanguageTag( aValue ).getLanguageType(); + nLanguage = LanguageTag::convertToLanguageType( aValue ); else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" ) nConversionType = GetConversionTypeFromText( aValue ); } @@ -325,7 +325,7 @@ sal_uInt32 ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eCl _GetNamespaceMap().GetNameByKey( XML_NAMESPACE_TCD ) ); AddAttributeASCII( XML_NAMESPACE_TCD, "package", "org.openoffice.Office" ); - OUString aIsoLang( LanguageTag( rDic.nLanguage ).getBcp47() ); + OUString aIsoLang( LanguageTag::convertToBcp47( rDic.nLanguage ) ); AddAttribute( XML_NAMESPACE_TCD, "lang", aIsoLang ); OUString aConvType( ConversionTypeToText( rDic.nConversionType ) ); AddAttribute( XML_NAMESPACE_TCD, "conversion-type", aConvType ); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 5af73a82de33..ca490f469070 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -472,7 +472,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) else { OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("lang: ")); - aLine.append(OUStringToOString(LanguageTag(nLanguage).getBcp47(), eEnc)); + aLine.append(OUStringToOString(LanguageTag::convertToBcp47(nLanguage), eEnc)); pStream->WriteLine(aLine.makeStringAndClear()); } if (0 != (nErr = pStream->GetError())) @@ -818,7 +818,7 @@ Locale SAL_CALL DictionaryNeo::getLocale( ) throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return LanguageTag( nLanguage ).getLocale(); + return LanguageTag::convertToLocale( nLanguage ); } void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale ) diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 4c08a9eed79d..d701126f5c2c 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -444,7 +444,7 @@ uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarC m_bGCServicesChecked = sal_True; } - const LanguageType nLang = LanguageTag( rLocale ).getLanguageType( false); + const LanguageType nLang = LanguageTag::convertToLanguageType( rLocale, false); GCImplNames_t::const_iterator aLangIt( m_aGCImplNamesByLang.find( nLang ) ); if (aLangIt != m_aGCImplNamesByLang.end()) // matching configured language found? { @@ -1012,7 +1012,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl() { // only the first entry is used, there should be only one grammar checker per language const OUString aImplName( aImplNames[0] ); - const LanguageType nLang = LanguageTag( pElementNames[i] ).getLanguageType(); + const LanguageType nLang = LanguageTag::convertToLanguageType( pElementNames[i] ); aTmpGCImplNamesByLang[ nLang ] = aImplName; } } diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index 7b5c0a96a714..3e5c2609ab96 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -224,7 +224,7 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales() HyphSvcByLangMap_t::const_iterator aIt; for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt) { - *pLocales++ = LanguageTag( aIt->first ).getLocale(); + *pLocales++ = LanguageTag::convertToLocale( aIt->first ); } return aLocales; } diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx index 76d91ef5a2b1..f5ce5b157acd 100644 --- a/linguistic/source/hyphdta.cxx +++ b/linguistic/source/hyphdta.cxx @@ -83,7 +83,7 @@ Locale SAL_CALL HyphenatedWord::getLocale() { MutexGuard aGuard( GetLinguMutex() ); - return LanguageTag( nLanguage ).getLocale(); + return LanguageTag::convertToLocale( nLanguage ); } @@ -149,7 +149,7 @@ Locale SAL_CALL PossibleHyphens::getLocale() throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return LanguageTag( nLanguage ).getLocale(); + return LanguageTag::convertToLocale( nLanguage ); } diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 3cb177d72337..e3d4639b6e05 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -137,7 +137,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales( for (i = 0; aIt != aLanguages.end(); ++aIt, ++i) { LanguageType nLang = *aIt; - pRes[i] = LanguageTag( nLang ).getLocale(); + pRes[i] = LanguageTag::convertToLocale( nLang ); } } @@ -612,7 +612,7 @@ namespace { Sequence< OUString > aRes; - OUString aCfgLocaleStr( LanguageTag( rAvailLocale ).getBcp47() ); + OUString aCfgLocaleStr( LanguageTag::convertToBcp47( rAvailLocale ) ); Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) ); sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames); @@ -880,10 +880,10 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) LanguageType nLang = LANGUAGE_NONE; if (!aKeyText.isEmpty()) - nLang = LanguageTag( aKeyText ).getLanguageType(); + nLang = LanguageTag::convertToLanguageType( aKeyText ); GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below - pSpellDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames ); + pSpellDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames ); } } else if (rName.startsWith( aGrammarCheckerList )) @@ -905,12 +905,12 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) LanguageType nLang = LANGUAGE_NONE; if (!aKeyText.isEmpty()) - nLang = LanguageTag( aKeyText ).getLanguageType(); + nLang = LanguageTag::convertToLanguageType( aKeyText ); if (SvtLinguConfig().HasGrammarChecker()) { GetGrammarCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below - pGrammarDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames ); + pGrammarDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames ); } } } @@ -933,10 +933,10 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) LanguageType nLang = LANGUAGE_NONE; if (!aKeyText.isEmpty()) - nLang = LanguageTag( aKeyText ).getLanguageType(); + nLang = LanguageTag::convertToLanguageType( aKeyText ); GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below - pHyphDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames ); + pHyphDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames ); } } else if (rName.startsWith( aThesaurusList )) @@ -958,10 +958,10 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) LanguageType nLang = LANGUAGE_NONE; if (!aKeyText.isEmpty()) - nLang = LanguageTag( aKeyText ).getLanguageType(); + nLang = LanguageTag::convertToLanguageType( aKeyText ); GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below - pThesDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames ); + pThesDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames ); } } else @@ -1312,7 +1312,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp ) String aLocaleStr( pNames[i] ); xub_StrLen nSeparatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); aLocaleStr = aLocaleStr.Copy( nSeparatorPos + 1 ); - rSpellDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames ); + rSpellDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames ); } } } @@ -1354,7 +1354,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) String aLocaleStr( pNames[i] ); xub_StrLen nSeparatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); aLocaleStr = aLocaleStr.Copy( nSeparatorPos + 1 ); - rGrammarDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames ); + rGrammarDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames ); } } } @@ -1396,7 +1396,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) String aLocaleStr( pNames[i] ); xub_StrLen nSeparatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); aLocaleStr = aLocaleStr.Copy( nSeparatorPos + 1 ); - rHyphDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames ); + rHyphDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames ); } } } @@ -1434,7 +1434,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ) String aLocaleStr( pNames[i] ); xub_StrLen nSeparatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); aLocaleStr = aLocaleStr.Copy( nSeparatorPos + 1 ); - rThesDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames ); + rThesDsp.SetServiceList( LanguageTag::convertToLocale(aLocaleStr), aSvcImplNames ); } } } @@ -1904,7 +1904,7 @@ uno::Sequence< OUString > SAL_CALL uno::Sequence< OUString > aSvcImplNames; - OUString aCfgLocale( LanguageTag( rLocale).getBcp47() ); + OUString aCfgLocale( LanguageTag::convertToBcp47( rLocale) ); uno::Sequence< uno::Any > aValues; uno::Sequence< OUString > aNames( 1 ); diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 91c59b5bae7b..c2731756fcaa 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -88,7 +88,7 @@ LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocal { if ( rLocale.Language.isEmpty() ) return LANGUAGE_NONE; - return LanguageTag( rLocale ).getLanguageType(); + return LanguageTag::convertToLanguageType( rLocale ); } @@ -96,7 +96,7 @@ LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocal { if (nLanguage == LANGUAGE_NONE) return ::com::sun::star::lang::Locale(); - return LanguageTag( nLanguage).getLocale(); + return LanguageTag::convertToLocale( nLanguage); } diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index a1d697edff43..9a1ebca67220 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -167,7 +167,7 @@ sal_Bool SvcListHasLanguage( if (pRef[k].is()) { if (aTmpLocale.Language.isEmpty()) - aTmpLocale = LanguageTag( nLanguage ).getLocale(); + aTmpLocale = LanguageTag::convertToLocale( nLanguage ); bHasLanguage = pRef[k]->hasLocale( aTmpLocale ); } } @@ -209,7 +209,7 @@ Sequence< Locale > SAL_CALL SpellCheckerDispatcher::getLocales() SpellSvcByLangMap_t::const_iterator aIt; for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt) { - *pLocales++ = LanguageTag( aIt->first ).getLocale(); + *pLocales++ = LanguageTag::convertToLocale( aIt->first ); } return aLocales; } @@ -299,7 +299,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl( if (pEntry) { OUString aChkWord( rWord ); - Locale aLocale( LanguageTag( nLanguage ).getLocale() ); + Locale aLocale( LanguageTag::convertToLocale( nLanguage ) ); // replace typographical apostroph by ascii apostroph String aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() ); @@ -466,7 +466,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( if (pEntry) { OUString aChkWord( rWord ); - Locale aLocale( LanguageTag( nLanguage ).getLocale() ); + Locale aLocale( LanguageTag::convertToLocale( nLanguage ) ); // replace typographical apostroph by ascii apostroph String aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() ); @@ -728,7 +728,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage( throw (uno::RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return hasLocale( LanguageTag( nLanguage).getLocale() ); + return hasLocale( LanguageTag::convertToLocale( nLanguage) ); } @@ -739,7 +739,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::isValid( throw (lang::IllegalArgumentException, uno::RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return isValid( rWord, LanguageTag( nLanguage ).getLocale(), rProperties); + return isValid( rWord, LanguageTag::convertToLocale( nLanguage ), rProperties); } @@ -750,7 +750,7 @@ uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL SpellCheckerDispatche throw (lang::IllegalArgumentException, uno::RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return spell( rWord, LanguageTag( nLanguage).getLocale(), rProperties); + return spell( rWord, LanguageTag::convertToLocale( nLanguage), rProperties); } diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index 82178a3df94e..80c40a0cc6f4 100644 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -212,7 +212,7 @@ Locale SAL_CALL SpellAlternatives::getLocale() throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return LanguageTag( nLanguage ).getLocale(); + return LanguageTag::convertToLocale( nLanguage ); } diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index c8d31cadc5f2..49dfc316c8be 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -89,7 +89,7 @@ Sequence< Locale > SAL_CALL ThesSvcByLangMap_t::const_iterator aIt; for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt) { - *pLocales++ = LanguageTag( aIt->first ).getLocale(); + *pLocales++ = LanguageTag::convertToLocale( aIt->first ); } return aLocales; } |