summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx8
-rw-r--r--lingucomponent/source/spellcheck/spell/sspellimp.cxx4
-rw-r--r--lingucomponent/source/thesaurus/libnth/nthesimp.cxx2
-rw-r--r--linguistic/inc/linguistic/misc.hxx9
-rw-r--r--linguistic/source/convdic.cxx2
-rw-r--r--linguistic/source/convdiclist.cxx2
-rw-r--r--linguistic/source/dicimp.cxx5
-rw-r--r--linguistic/source/dlistimp.cxx6
-rw-r--r--linguistic/source/gciterator.cxx4
-rw-r--r--linguistic/source/hyphdsp.cxx14
-rw-r--r--linguistic/source/hyphdta.cxx5
-rw-r--r--linguistic/source/lngsvcmgr.cxx41
-rw-r--r--linguistic/source/misc.cxx45
-rw-r--r--linguistic/source/spelldsp.cxx27
-rw-r--r--linguistic/source/spelldta.cxx4
-rw-r--r--linguistic/source/thesdsp.cxx10
16 files changed, 69 insertions, 119 deletions
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index 91bdfe42705a..e7fe7a4de971 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -485,13 +485,13 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const ::rtl::OUStri
sal_Int16 nPos = (sal_Int16) ((nHyphenationPosAltHyph < nHyphenationPos) ?
nHyphenationPosAltHyph : nHyphenationPos);
// dicretionary hyphenation
- xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LocaleToLanguage( aLocale ), nPos,
+ xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LanguageTag( aLocale ).getLanguageType(), nPos,
aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph),
(sal_Int16) nHyphenationPosAltHyph);
}
else
{
- xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LocaleToLanguage( aLocale ),
+ xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LanguageTag( aLocale ).getLanguageType(),
(sal_Int16)nHyphenationPos, aWord, (sal_Int16) nHyphenationPos);
}
}
@@ -542,7 +542,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
//well as "hyphenate"
if (aWord.getLength() < minLen)
{
- return PossibleHyphens::CreatePossibleHyphens( aWord, LocaleToLanguage( aLocale ),
+ return PossibleHyphens::CreatePossibleHyphens( aWord, LanguageTag( aLocale ).getLanguageType(),
aWord, Sequence< sal_Int16 >() );
}
@@ -689,7 +689,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const
OUString hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
Reference< XPossibleHyphens > xRes = PossibleHyphens::CreatePossibleHyphens(
- aWord, LocaleToLanguage( aLocale ), hyphenatedWord, aHyphPos);
+ aWord, LanguageTag( aLocale ).getLanguageType(), hyphenatedWord, aHyphPos);
delete[] hyphens;
delete[] lcword;
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index c7d3addb2963..160eed154c4f 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -375,7 +375,7 @@ sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rL
sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
if (nFailure != -1 && !rWord.match(A2OU(SPELLML_HEADER), 0))
{
- sal_Int16 nLang = LocaleToLanguage( rLocale );
+ sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
// postprocess result for errors that should be ignored
const bool bIgnoreError =
(!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang )) ||
@@ -418,7 +418,7 @@ Reference< XSpellAlternatives >
if (n)
{
- sal_Int16 nLang = LocaleToLanguage( rLocale );
+ sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
int numsug = 0;
Sequence< OUString > aStr( 0 );
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 5adc00702cf8..7f17e22255a1 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -308,7 +308,7 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes
sal_Int32 stem = 0;
sal_Int32 stem2 = 0;
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
if (nLanguage == LANGUAGE_NONE || rTerm.isEmpty())
return noMeanings;
diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx
index 984f0fee21ed..32637ab6c90c 100644
--- a/linguistic/inc/linguistic/misc.hxx
+++ b/linguistic/inc/linguistic/misc.hxx
@@ -90,15 +90,6 @@ LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang );
sal_Int32 LevDistance( const rtl::OUString &rTxt1, const rtl::OUString &rTxt2 );
-::com::sun::star::lang::Locale
- CreateLocale( LanguageType eLang );
-
-LNG_DLLPUBLIC LanguageType
- LocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale );
-
-::com::sun::star::lang::Locale&
- LanguageToLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang );
-
::com::sun::star::uno::Sequence< sal_Int16 >
LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence<
::com::sun::star::lang::Locale > &rLocaleSeq );
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 6824e9f11127..c497c8697b6a 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -362,7 +362,7 @@ Locale SAL_CALL ConvDic::getLocale( )
throw (RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return CreateLocale( nLanguage );
+ return LanguageTag( nLanguage ).getLocale();
}
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index 5683b263a4d9..52ea6211f1e0 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -483,7 +483,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLang = LocaleToLanguage( rLocale );
+ sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
if (GetNameContainer().hasByName( rName ))
throw ElementExistException();
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 40c51e3356e1..dafa95d7b6fa 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -766,15 +766,14 @@ Locale SAL_CALL DictionaryNeo::getLocale( )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- Locale aRes;
- return LanguageToLocale( aRes, nLanguage );
+ return LanguageTag( nLanguage ).getLocale();
}
void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguageP = LocaleToLanguage( aLocale );
+ sal_Int16 nLanguageP = LanguageTag( aLocale ).getLanguageType();
if (!bIsReadonly && nLanguage != nLanguageP)
{
nLanguage = nLanguageP;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index fd9f377057de..ed7a8a712576 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -566,7 +566,7 @@ uno::Reference< XDictionary > SAL_CALL
{
osl::MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
bool bIsWriteablePath = rURL.match( GetDictionaryWriteablePath(), 0 );
return new DictionaryNeo( rName, nLanguage, eDicType, rURL, bIsWriteablePath );
}
@@ -578,7 +578,7 @@ uno::Reference< XDictionaryEntry > SAL_CALL
throw(RuntimeException)
{
osl::MutexGuard aGuard( GetLinguMutex() );
- return SearchDicList( this, rWord, LocaleToLanguage( rLocale ),
+ return SearchDicList( this, rWord, LanguageTag( rLocale ).getLanguageType(),
bSearchPosDics, bSearchSpellEntry );
}
@@ -669,7 +669,7 @@ void DicList::_CreateDicList()
// and add it to list
rtl::OUString aDicName( A2OU( "IgnoreAllList" ) );
uno::Reference< XDictionary > xIgnAll(
- createDictionary( aDicName, CreateLocale( LANGUAGE_NONE ),
+ createDictionary( aDicName, LanguageTag( LANGUAGE_NONE ).getLocale(),
DictionaryType_POSITIVE, rtl::OUString() ) );
if (xIgnAll.is())
{
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 4af3ab045aa0..c9bafd409374 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1072,7 +1072,7 @@ void GrammarCheckingIterator::SetServiceList(
{
::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
- LanguageType nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
OUString aImplName;
if (rSvcImplNames.getLength() > 0)
aImplName = rSvcImplNames[0]; // there is only one grammar checker per language
@@ -1095,7 +1095,7 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
uno::Sequence< OUString > aRes(1);
OUString aImplName; // there is only one grammar checker per language
- LanguageType nLang = LocaleToLanguage( rLocale );
+ LanguageType nLang = LanguageTag( rLocale ).getLanguageType();
GCImplNames_t::const_iterator aIt( m_aGCImplNamesByLang.find( nLang ) );
if (aIt != m_aGCImplNamesByLang.end())
aImplName = aIt->second;
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index df06ef2bd0db..ac08631f9862 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -226,7 +226,7 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales()
HyphSvcByLangMap_t::const_iterator aIt;
for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
{
- *pLocales++ = CreateLocale( aIt->first );
+ *pLocales++ = LanguageTag( aIt->first ).getLocale();
}
return aLocales;
}
@@ -236,7 +236,7 @@ sal_Bool SAL_CALL HyphenatorDispatcher::hasLocale(const Locale& rLocale)
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
return aIt != aSvcMap.end();
}
@@ -252,7 +252,7 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
sal_Int32 nWordLen = rWord.getLength();
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
if (nLanguage == LANGUAGE_NONE || !nWordLen ||
nMaxLeading == 0 || nMaxLeading == nWordLen)
return xRes;
@@ -390,7 +390,7 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
sal_Int32 nWordLen = rWord.getLength();
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
if (nLanguage == LANGUAGE_NONE || !nWordLen)
return xRes;
@@ -521,7 +521,7 @@ Reference< XPossibleHyphens > SAL_CALL
Reference< XPossibleHyphens > xRes;
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
return xRes;
@@ -638,7 +638,7 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale,
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -673,7 +673,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this;
const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx
index c0c7a1f3551b..b43e6bc63ea6 100644
--- a/linguistic/source/hyphdta.cxx
+++ b/linguistic/source/hyphdta.cxx
@@ -84,8 +84,7 @@ Locale SAL_CALL HyphenatedWord::getLocale()
{
MutexGuard aGuard( GetLinguMutex() );
- Locale aRes;
- return LanguageToLocale( aRes, nLanguage );
+ return LanguageTag( nLanguage ).getLocale();
}
@@ -151,7 +150,7 @@ Locale SAL_CALL PossibleHyphens::getLocale()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return CreateLocale( nLanguage );
+ return LanguageTag( nLanguage ).getLocale();
}
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 427c3bf0b6c8..a6248ef94f6a 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -115,7 +115,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
for (sal_Int32 k = 0; k < nLoc; ++k)
{
const lang::Locale *pLoc = aLoc.getConstArray();
- LanguageType nLang = LocaleToLanguage( pLoc[k] );
+ LanguageType nLang = LanguageTag( pLoc[k] ).getLanguageType();
// language not already added?
if (aLanguages.find( nLang ) == aLanguages.end())
@@ -136,7 +136,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
for (i = 0; aIt != aLanguages.end(); ++aIt, ++i)
{
LanguageType nLang = *aIt;
- pRes[i] = CreateLocale( nLang );
+ pRes[i] = LanguageTag( nLang ).getLocale();
}
}
@@ -611,8 +611,7 @@ namespace
{
Sequence< OUString > aRes;
- OUString aCfgLocaleStr( LanguageTag(
- LocaleToLanguage( rAvailLocale ) ).getBcp47() );
+ OUString aCfgLocaleStr( LanguageTag( rAvailLocale ).getBcp47() );
Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) );
sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames);
@@ -745,7 +744,7 @@ void LngSvcMgr::UpdateAll()
const OUString *pNodeName = aNodeNames.getConstArray();
for (i = 0; i < nNodeNames; ++i)
{
- Locale aLocale( CreateLocale( LanguageTag( pNodeName[i]).getLanguageType() ) );
+ Locale aLocale( LanguageTag( pNodeName[i]).getLocale() );
Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale ));
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale ));
@@ -764,8 +763,7 @@ void LngSvcMgr::UpdateAll()
const Locale *pAvailLocale = aAvailLocales.getConstArray();
for (i = 0; i < nAvailLocales; ++i)
{
- OUString aCfgLocaleStr( LanguageTag(
- LocaleToLanguage( pAvailLocale[i] ) ).getBcp47() );
+ OUString aCfgLocaleStr( LanguageTag( pAvailLocale[i] ).getBcp47() );
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, pAvailLocale[i] ));
@@ -884,7 +882,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
nLang = LanguageTag( aKeyText ).getLanguageType();
GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
- pSpellDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
+ pSpellDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
}
}
else if (0 == rName.compareTo( aGrammarCheckerList, aGrammarCheckerList.getLength() ))
@@ -911,7 +909,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
if (SvtLinguConfig().HasGrammarChecker())
{
GetGrammarCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
- pGrammarDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
+ pGrammarDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
}
}
}
@@ -937,7 +935,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
nLang = LanguageTag( aKeyText ).getLanguageType();
GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below
- pHyphDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
+ pHyphDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
}
}
else if (0 == rName.compareTo( aThesaurusList, aThesaurusList.getLength() ))
@@ -962,7 +960,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
nLang = LanguageTag( aKeyText ).getLanguageType();
GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below
- pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
+ pThesDsp->SetServiceList( LanguageTag(nLang).getLocale(), aSvcImplNames );
}
}
else
@@ -1338,8 +1336,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
- rSpellDsp.SetServiceList( aLocale, aSvcImplNames );
+ rSpellDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames );
}
}
}
@@ -1381,8 +1378,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
- rGrammarDsp.SetServiceList( aLocale, aSvcImplNames );
+ rGrammarDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames );
}
}
}
@@ -1424,8 +1420,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
- rHyphDsp.SetServiceList( aLocale, aSvcImplNames );
+ rHyphDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames );
}
}
}
@@ -1463,8 +1458,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
- lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
- rThesDsp.SetServiceList( aLocale, aSvcImplNames );
+ rThesDsp.SetServiceList( LanguageTag(aLocaleStr).getLocale(), aSvcImplNames );
}
}
}
@@ -1608,7 +1602,7 @@ uno::Sequence< OUString > SAL_CALL
OUString *pImplName = aRes.getArray();
sal_uInt16 nCnt = 0;
- LanguageType nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
for (size_t i = 0; i < nMaxCnt; ++i)
{
const SvcInfo &rInfo = (*pInfoArray)[i];
@@ -1695,7 +1689,7 @@ void SAL_CALL
#if OSL_DEBUG_LEVEL > 1
#endif
- LanguageType nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
if (LANGUAGE_NONE != nLanguage)
{
if (0 == rServiceName.compareToAscii( SN_SPELLCHECKER ))
@@ -1846,8 +1840,7 @@ sal_Bool LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
aCfgAny <<= aSvcImplNames;
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
- OUString aCfgLocaleStr( LanguageTag(
- LocaleToLanguage( pLocale[i] ) ).getBcp47() );
+ OUString aCfgLocaleStr( LanguageTag( pLocale[i] ).getBcp47() );
pValue->Value = aCfgAny;
pValue->Name = aNodeName;
pValue->Name += OUString::valueOf( (sal_Unicode) '/' );
@@ -1935,7 +1928,7 @@ uno::Sequence< OUString > SAL_CALL
uno::Sequence< OUString > aSvcImplNames;
- LanguageType nLanguage = LocaleToLanguage( rLocale );
+ LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
OUString aCfgLocale( LanguageTag( nLanguage ).getBcp47() );
uno::Sequence< uno::Any > aValues;
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 542a82367d01..536daf4a933d 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -76,11 +76,10 @@ osl::Mutex & GetLinguMutex()
LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang )
{
- static LocaleDataWrapper aLclDtaWrp(
- LanguageTag( CreateLocale( SvtSysLocale().GetLanguageTag().getLanguageType() )) );
+ static LocaleDataWrapper aLclDtaWrp( SvtSysLocale().GetLanguageTag() );
const LanguageTag &rLcl = aLclDtaWrp.getLoadedLanguageTag();
- LanguageTag aLcl( CreateLocale( nLang ) );
+ LanguageTag aLcl( nLang );
if (aLcl != rLcl)
aLclDtaWrp.setLanguageTag( aLcl );
return aLclDtaWrp;
@@ -267,7 +266,7 @@ uno::Reference< XDictionaryEntry > SearchDicList(
uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY );
DictionaryType eType = axDic->getDictionaryType();
- sal_Int16 nLang = LocaleToLanguage( axDic->getLocale() );
+ sal_Int16 nLang = LanguageTag( axDic->getLocale() ).getLanguageType();
if ( axDic.is() && axDic->isActive()
&& (nLang == nLanguage || nLang == LANGUAGE_NONE) )
@@ -364,34 +363,6 @@ sal_uInt8 AddEntryToDic(
}
-
-LanguageType LocaleToLanguage( const Locale& rLocale )
-{
- // empty Locale -> LANGUAGE_NONE
- if ( rLocale.Language.isEmpty() )
- return LANGUAGE_NONE;
-
- return LanguageTag( rLocale ).getLanguageType();
-}
-
-
-Locale& LanguageToLocale( Locale& rLocale, LanguageType eLang )
-{
- if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
- rLocale = LanguageTag( eLang ).getLocale();
-
- return rLocale;
-}
-
-Locale CreateLocale( LanguageType eLang )
-{
- Locale aLocale;
- if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
- return LanguageTag( eLang ).getLocale();
-
- return aLocale;
-}
-
uno::Sequence< sal_Int16 >
LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq )
{
@@ -402,7 +373,7 @@ uno::Sequence< sal_Int16 >
sal_Int16 *pLang = aLangs.getArray();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- pLang[i] = LocaleToLanguage( pLocale[i] );
+ pLang[i] = LanguageTag( pLocale[i] ).getLanguageType();
}
return aLangs;
@@ -583,7 +554,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
}
else
{
- sal_Int16 nLang = LocaleToLanguage( rxHyphWord->getLocale() );
+ sal_Int16 nLang = LanguageTag( rxHyphWord->getLocale() ).getLanguageType();
xRes = new HyphenatedWord(
rOrigWord, nLang, nOrigHyphenationPos,
aOrigHyphenatedWord, nOrigHyphenPos );
@@ -598,7 +569,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
static CharClass & lcl_GetCharClass()
{
- static CharClass aCC( LanguageTag( CreateLocale( LANGUAGE_ENGLISH_US )) );
+ static CharClass aCC( LanguageTag( LANGUAGE_ENGLISH_US ));
return aCC;
}
@@ -615,7 +586,7 @@ sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int
MutexGuard aGuard( lcl_GetCharClassMutex() );
CharClass &rCC = lcl_GetCharClass();
- rCC.setLanguageTag( LanguageTag( CreateLocale( nLanguage )) );
+ rCC.setLanguageTag( LanguageTag( nLanguage ));
sal_Int32 nFlags = rCC.getStringType( rText, nPos, nLen );
return (nFlags & KCharacterType::UPPER)
&& !(nFlags & KCharacterType::LOWER);
@@ -627,7 +598,7 @@ String ToLower( const String &rText, sal_Int16 nLanguage )
MutexGuard aGuard( lcl_GetCharClassMutex() );
CharClass &rCC = lcl_GetCharClass();
- rCC.setLanguageTag( LanguageTag( CreateLocale( nLanguage )) );
+ rCC.setLanguageTag( LanguageTag( nLanguage ));
return rCC.lowercase( rText );
}
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index bc1939c2faca..03e156e74f63 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -168,7 +168,7 @@ sal_Bool SvcListHasLanguage(
if (pRef[k].is())
{
if (aTmpLocale.Language.isEmpty())
- aTmpLocale = CreateLocale( nLanguage );
+ aTmpLocale = LanguageTag( nLanguage ).getLocale();
bHasLanguage = pRef[k]->hasLocale( aTmpLocale );
}
}
@@ -208,7 +208,7 @@ Sequence< Locale > SAL_CALL SpellCheckerDispatcher::getLocales()
SpellSvcByLangMap_t::const_iterator aIt;
for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
{
- *pLocales++ = CreateLocale( aIt->first );
+ *pLocales++ = LanguageTag( aIt->first ).getLocale();
}
return aLocales;
}
@@ -218,7 +218,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLocale( const Locale& rLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
return aIt != aSvcMap.end();
}
@@ -229,7 +229,7 @@ sal_Bool SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return isValid_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, sal_True );
+ return isValid_Impl( rWord, LanguageTag( rLocale ).getLanguageType(), rProperties, sal_True );
}
@@ -239,7 +239,7 @@ Reference< XSpellAlternatives > SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return spell_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, sal_True );
+ return spell_Impl( rWord, LanguageTag( rLocale ).getLanguageType(), rProperties, sal_True );
}
@@ -298,7 +298,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl(
if (pEntry)
{
OUString aChkWord( rWord );
- Locale aLocale( CreateLocale( nLanguage ) );
+ Locale aLocale( LanguageTag( nLanguage ).getLocale() );
// replace typographical apostroph by ascii apostroph
String aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
@@ -458,7 +458,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
if (pEntry)
{
OUString aChkWord( rWord );
- Locale aLocale( CreateLocale( nLanguage ) );
+ Locale aLocale( LanguageTag( nLanguage ).getLocale() );
// replace typographical apostroph by ascii apostroph
String aSingleQuote( GetLocaleDataWrapper( nLanguage ).getQuotationMarkEnd() );
@@ -721,8 +721,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage(
throw (uno::RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- Locale aLocale( CreateLocale( nLanguage ) );
- return hasLocale( aLocale );
+ return hasLocale( LanguageTag( nLanguage).getLocale() );
}
@@ -733,8 +732,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::isValid(
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- Locale aLocale( CreateLocale( nLanguage ) );
- return isValid( rWord, aLocale, rProperties);
+ return isValid( rWord, LanguageTag( nLanguage ).getLocale(), rProperties);
}
@@ -745,8 +743,7 @@ uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL SpellCheckerDispatche
throw (lang::IllegalArgumentException, uno::RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- Locale aLocale( CreateLocale( nLanguage ) );
- return spell( rWord, aLocale, rProperties);
+ return spell( rWord, LanguageTag( nLanguage).getLocale(), rProperties);
}
@@ -758,7 +755,7 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale,
if (pCache)
pCache->Flush(); // new services may spell differently...
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -792,7 +789,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this;
const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index 9bbfb8b26af5..f135003e6fba 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -78,7 +78,7 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
{
Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
- sal_Int16 nLang = LocaleToLanguage( xDic->getLocale() );
+ sal_Int16 nLang = LanguageTag( xDic->getLocale() ).getLanguageType();
if ( xDic.is() && xDic->isActive()
&& (nLang == nLanguage || nLang == LANGUAGE_NONE) )
@@ -213,7 +213,7 @@ Locale SAL_CALL SpellAlternatives::getLocale()
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return CreateLocale( nLanguage );
+ return LanguageTag( nLanguage ).getLocale();
}
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index d9e5ce030668..e8656af3e914 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -90,7 +90,7 @@ Sequence< Locale > SAL_CALL
ThesSvcByLangMap_t::const_iterator aIt;
for (aIt = aSvcMap.begin(); aIt != aSvcMap.end(); ++aIt)
{
- *pLocales++ = CreateLocale( aIt->first );
+ *pLocales++ = LanguageTag( aIt->first ).getLocale();
}
return aLocales;
}
@@ -101,7 +101,7 @@ sal_Bool SAL_CALL
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LocaleToLanguage( rLocale ) ) );
+ ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
return aIt != aSvcMap.end();
}
@@ -116,7 +116,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
Sequence< Reference< XMeaning > > aMeanings;
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
if (nLanguage == LANGUAGE_NONE || rTerm.isEmpty())
return aMeanings;
@@ -210,7 +210,7 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale,
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -244,7 +244,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LocaleToLanguage( rLocale );
+ sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this;
const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;