summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-11-24 18:54:09 +0100
committerEike Rathke <erack@redhat.com>2012-11-24 18:56:43 +0100
commit41956321ceefb5836feb2c119b66de7bb557740f (patch)
treee756d740615881ceeea816e7ef15096f91d7cc1e /cui
parent6395c843710b59e391f10f3532442ae11fe64357 (diff)
get rid of Svx...Locale...() double conversion nonsense
Change-Id: I21d14ff6087d1adb0ce769f2e8f8060a005250cc
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/SpellDialog.cxx12
-rw-r--r--cui/source/dialogs/hangulhanjadlg.cxx4
-rw-r--r--cui/source/dialogs/hyphen.cxx6
-rw-r--r--cui/source/dialogs/thesdlg.cxx6
-rw-r--r--cui/source/options/optasian.cxx15
-rw-r--r--cui/source/options/optdict.cxx18
-rw-r--r--cui/source/options/optgdlg.cxx17
-rw-r--r--cui/source/options/optlingu.cxx46
-rw-r--r--cui/source/tabpages/autocdlg.cxx14
-rw-r--r--cui/source/tabpages/numpages.cxx14
10 files changed, 66 insertions, 86 deletions
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index b5ba38030d2e..b110231999bb 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -341,7 +341,7 @@ void SpellDialog::UpdateBoxes_Impl()
bool bIsGrammarError = false;
if( pSpellErrorDescription )
{
- nAltLanguage = SvxLocaleToLanguage( pSpellErrorDescription->aLocale );
+ nAltLanguage = LanguageTag( pSpellErrorDescription->aLocale ).getLanguageType();
aNewWords = pSpellErrorDescription->aSuggestions;
bIsGrammarError = pSpellErrorDescription->bIsGrammarError;
aExplainLink.SetURL( pSpellErrorDescription->sExplanationURL );
@@ -985,7 +985,7 @@ int SpellDialog::InitUserDicts()
continue;
uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
- LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() );
+ LanguageType nActLanguage = LanguageTag( xDicTmp->getLocale() ).getLanguageType();
if( xDicTmp->isActive()
&& xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
&& (nLang == nActLanguage || LANGUAGE_NONE == nActLanguage )
@@ -1266,7 +1266,7 @@ bool SpellDialog::GetNextSentence_Impl(bool bUseSavedSentence, bool bRecheck)
uno::Reference< lang::XServiceInfo > xInfo( aStart->xGrammarChecker, uno::UNO_QUERY );
SpellErrorDescription aDesc( true,
aStart->sText,
- SvxCreateLocale( aStart->eLanguage ),
+ LanguageTag( aStart->eLanguage ).getLocale(),
aStart->aGrammarError.aSuggestions,
aStart->xGrammarChecker,
xInfo->getImplementationName(),
@@ -1732,7 +1732,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
String sReplacement(getDotReplacementString(GetErrorText(), xEntry->getReplacementText()));
- ChangeMarkedWord(sReplacement, SvxLocaleToLanguage( pSpellErrorDescription->aLocale ));
+ ChangeMarkedWord(sReplacement, LanguageTag( pSpellErrorDescription->aLocale ).getLanguageType());
aCursor.GetIndex() = aCursor.GetIndex() + (sal_uInt16)(xEntry->getReplacementText().getLength());
}
@@ -1754,7 +1754,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError )
const SpellErrorAttrib* pOldAttrib = static_cast<const SpellErrorAttrib*>(
pTextEngine->FindAttrib( TextPaM(0, nOldErrorStart), TEXTATTR_SPELL_ERROR ));
pAction->SetErrorLanguageSelected(pOldAttrib && pOldAttrib->GetErrorDescription().aSuggestions.getLength() &&
- SvxLocaleToLanguage( pOldAttrib->GetErrorDescription().aLocale) ==
+ LanguageTag( pOldAttrib->GetErrorDescription().aLocale).getLanguageType() ==
GetSpellDialog()->aLanguageLB.GetSelectLanguage());
AddUndoAction(pAction);
}
@@ -1871,7 +1871,7 @@ void SentenceEditWindow_Impl::RestoreCurrentError()
{
const SpellErrorDescription& rDesc = pAttrib->GetErrorDescription();
if( !rDesc.sErrorText.equals( GetErrorText() ) )
- ChangeMarkedWord(rDesc.sErrorText, SvxLocaleToLanguage( rDesc.aLocale ));
+ ChangeMarkedWord(rDesc.sErrorText, LanguageTag( rDesc.aLocale ).getLanguageType());
}
}
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 688a8203cec6..6e8337723efa 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -962,7 +962,7 @@ namespace svx
Reference< XConversionDictionary > xDic;
if( ( aAny >>= xDic ) && xDic.is() )
{
- if( LANGUAGE_KOREAN == SvxLocaleToLanguage( xDic->getLocale() ) )
+ if( LANGUAGE_KOREAN == LanguageTag( xDic->getLocale() ).getLanguageType() )
{
m_aDictList.push_back( xDic );
AddDict( xDic->getName(), xDic->isActive() );
@@ -1049,7 +1049,7 @@ namespace svx
try
{
Reference< XConversionDictionary > xDic =
- m_xConversionDictionaryList->addNewDictionary( aName, SvxCreateLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA );
+ m_xConversionDictionaryList->addNewDictionary( aName, LanguageTag( LANGUAGE_KOREAN ).getLocale(), ConversionDictionaryType::HANGUL_HANJA );
if( xDic.is() )
{
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index cd0f7756e182..de16810aeff1 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -207,7 +207,7 @@ void SvxHyphenWordDialog::InitControls_Impl()
xPossHyph = NULL;
if (xHyphenator.is())
{
- lang::Locale aLocale( SvxCreateLocale(nActLanguage) );
+ lang::Locale aLocale( LanguageTag(nActLanguage).getLocale() );
xPossHyph = xHyphenator->createPossibleHyphens( aActWord, aLocale,
uno::Sequence< beans::PropertyValue >() );
if (xPossHyph.is())
@@ -265,7 +265,7 @@ void SvxHyphenWordDialog::ContinueHyph_Impl( sal_uInt16 nInsPos )
if(xHyphWord.is())
{
aActWord = String( xHyphWord->getWord() );
- nActLanguage = SvxLocaleToLanguage( xHyphWord->getLocale() );
+ nActLanguage = LanguageTag( xHyphWord->getLocale() ).getLanguageType();
nMaxHyphenationPos = xHyphWord->getHyphenationPos();
InitControls_Impl();
SetWindowTitle( nActLanguage );
@@ -489,7 +489,7 @@ SvxHyphenWordDialog::SvxHyphenWordDialog(
if (xHyphWord.is())
{
DBG_ASSERT( aActWord == String( xHyphWord->getWord() ), "word mismatch" );
- DBG_ASSERT( nActLanguage == SvxLocaleToLanguage( xHyphWord->getLocale() ), "language mismatch" );
+ DBG_ASSERT( nActLanguage == LanguageTag( xHyphWord->getLocale() ).getLanguageType(), "language mismatch" );
nMaxHyphenationPos = xHyphWord->getHyphenationPos();
}
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index e428bedabca0..b222b19efa1b 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -291,7 +291,7 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SvxThesaurusDialog::que
bool SvxThesaurusDialog::UpdateAlternativesBox_Impl()
{
- lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) );
+ lang::Locale aLocale( LanguageTag( nLookUpLanguage ).getLocale() );
uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl(
aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() );
const sal_Int32 nMeanings = aMeanings.getLength();
@@ -350,7 +350,7 @@ IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton*, pBtn )
String aLangText( pMenu->GetItemText( nItem ) );
LanguageType nLang = SvtLanguageTable().GetType( aLangText );
DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
- if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) ))
+ if (xThesaurus->hasLocale( LanguageTag( nLang ).getLocale() ))
nLookUpLanguage = nLang;
SetWindowTitle( nLang );
LookUp_Impl();
@@ -505,7 +505,7 @@ SvxThesaurusDialog::SvxThesaurusDialog(
std::vector< OUString > aLangVec;
for (sal_Int32 i = 0; i < nLocales; ++i)
{
- const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] );
+ const LanguageType nLang = LanguageTag( pLocales[i] ).getLanguageType();
DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
aLangVec.push_back( aLangTab.GetString( nLang ) );
}
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 9a0819d0893a..50bfe4da92a5 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -202,8 +202,7 @@ sal_Bool SvxAsianLayoutPage::FillItemSet( SfxItemSet& )
for( itElem = pImpl->aChangedLanguagesMap.begin();
itElem != pImpl->aChangedLanguagesMap.end(); ++itElem )
{
- Locale aLocale;
- SvxLanguageToLocale( aLocale, itElem->first );
+ Locale aLocale( LanguageTag( itElem->first ).getLocale());
if(itElem->second->bRemoved)
pImpl->xForbidden->removeForbiddenCharacters( aLocale );
else if(itElem->second->pCharacters)
@@ -289,8 +288,8 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet& )
//preselect the system language in the box - if available
if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters)
{
- eLastUsedLanguageTypeForForbiddenCharacters = SvxLocaleToLanguage(
- Application::GetSettings().GetLanguageTag().getLocale() );
+ eLastUsedLanguageTypeForForbiddenCharacters =
+ Application::GetSettings().GetLanguageTag().getLanguageType();
if (MsLangId::isSimplifiedChinese(eLastUsedLanguageTypeForForbiddenCharacters))
eLastUsedLanguageTypeForForbiddenCharacters = LANGUAGE_CHINESE_SIMPLIFIED;
else if (MsLangId::isTraditionalChinese(eLastUsedLanguageTypeForForbiddenCharacters))
@@ -303,10 +302,9 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet& )
IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl)
{
//set current value
- Locale aLocale;
LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
- SvxLanguageToLocale(aLocale, eSelectLanguage );
- LanguageTag aLanguageTag( aLocale);
+ LanguageTag aLanguageTag( eSelectLanguage);
+ Locale aLocale( aLanguageTag.getLocale());
OUString sStart, sEnd;
sal_Bool bAvail;
@@ -380,9 +378,8 @@ IMPL_LINK(SvxAsianLayoutPage, ChangeStandardHdl, CheckBox*, pBox)
IMPL_LINK(SvxAsianLayoutPage, ModifyHdl, Edit*, pEdit)
{
- Locale aLocale;
LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage();
- SvxLanguageToLocale(aLocale, eSelectLanguage );
+ Locale aLocale( LanguageTag( eSelectLanguage ).getLocale());
OUString sStart = aStartED.GetText();
OUString sEnd = aEndED.GetText();
sal_Bool bEnable = pEdit->IsEnabled();
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index b18c8bbbe6ea..97c21fd733df 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -153,7 +153,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl)
DictionaryType_NEGATIVE : DictionaryType_POSITIVE;
if (xDicList.is())
{
- lang::Locale aLocale( SvxCreateLocale(nLang) );
+ lang::Locale aLocale( LanguageTag(nLang).getLocale() );
String aURL( linguistic::GetWritableDictionaryURL( sDict ) );
xNewDic = Reference< XDictionary > (
xDicList->createDictionary( sDict, aLocale, eType, aURL ) , UNO_QUERY );
@@ -279,8 +279,8 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(
sal_Bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE ?
sal_True : sal_False;
String aDicName( xDic->getName() );
- const String aTxt( ::GetDicInfoStr( aDicName, SvxLocaleToLanguage( xDic->getLocale() ),
- bNegative ) );
+ const String aTxt( ::GetDicInfoStr( aDicName,
+ LanguageTag( xDic->getLocale() ).getLanguageType(), bNegative ) );
aAllDictsLB.InsertEntry( aTxt );
if (rName == aDicName)
@@ -307,7 +307,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(
if (nPos != LISTBOX_ENTRY_NOTFOUND)
xDic = Reference< XDictionary > ( aDics.getConstArray()[ nPos ], UNO_QUERY );
if (xDic.is())
- SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+ SetLanguage_Impl( LanguageTag( xDic->getLocale() ).getLanguageType() );
// check if dictionary is read-only
SetDicReadonly_Impl(xDic);
@@ -426,7 +426,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl)
// enable or disable new and delete button according to file attributes
Reference< XDictionary > xDic( aDics.getConstArray()[ nPos ], UNO_QUERY );
if (xDic.is())
- SetLanguage_Impl( SvxLocaleToLanguage( xDic->getLocale() ) );
+ SetLanguage_Impl( LanguageTag( xDic->getLocale() ).getLanguageType() );
SetDicReadonly_Impl(xDic);
sal_Bool bEnable = !IsDicReadonly_Impl();
@@ -443,7 +443,7 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl)
sal_uInt16 nDicPos = aAllDictsLB.GetSelectEntryPos();
sal_uInt16 nLang = aLangLB.GetSelectLanguage();
Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
- sal_Int16 nOldLang = SvxLocaleToLanguage( xDic->getLocale() );
+ sal_Int16 nOldLang = LanguageTag( xDic->getLocale() ).getLanguageType();
if ( nLang != nOldLang )
{
@@ -454,12 +454,12 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl)
if ( aBox.Execute() == RET_YES )
{
- xDic->setLocale( SvxCreateLocale( nLang ) );
+ xDic->setLocale( LanguageTag( nLang ).getLocale() );
sal_Bool bNegativ = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
const String sName(
::GetDicInfoStr( xDic->getName(),
- SvxLocaleToLanguage( xDic->getLocale() ),
+ LanguageTag( xDic->getLocale() ).getLanguageType(),
bNegativ ) );
aAllDictsLB.RemoveEntry( nDicPos );
aAllDictsLB.InsertEntry( sName, nDicPos );
@@ -619,7 +619,7 @@ IMPL_LINK(SvxEditDictionaryDialog, NewDelHdl, PushButton*, pBtn)
Reference<XDictionary> aXDictionary(xDic, UNO_QUERY);
nAddRes = linguistic::AddEntryToDic( aXDictionary,
aNewWord, bIsNegEntry,
- aRplcText, SvxLocaleToLanguage( xDic->getLocale() ), sal_False );
+ aRplcText, LanguageTag( xDic->getLocale() ).getLanguageType(), sal_False );
}
}
if (DIC_ERR_NONE != nAddRes)
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index eeb29f1d8c70..1e1a48b556ce 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1375,7 +1375,7 @@ static LanguageType lcl_LangStringToLangType(const OUString& rLang)
if (nSep < rLang.getLength())
aLocale.Country = rLang.copy(nSep+1, rLang.getLength() - (nSep+1));
}
- LanguageType eLangType = SvxLocaleToLanguage( aLocale );
+ LanguageType eLangType = LanguageTag( aLocale ).getLanguageType();
return eLangType;
}
@@ -1492,16 +1492,7 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
// an empty string denotes SYSTEM locale
OUString sNewLang;
if ( eNewLocale != LANGUAGE_SYSTEM )
- {
- Locale aLocale;
- SvxLanguageToLocale( aLocale, eNewLocale );
- sNewLang = aLocale.Language;
- if ( !aLocale.Country.isEmpty() )
- {
- sNewLang += "-";
- sNewLang += aLocale.Country;
- }
- }
+ sNewLang = LanguageTag( eNewLocale).getBcp47();
// locale nowadays get to AppSettings via notification
// this will happen after releasing the lock on the ConfigurationBroadcaster at
@@ -1891,9 +1882,7 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
aCurrencyLB.SelectEntryPos( nPos );
// obtain corresponding locale data
- Locale aTempLocale;
- SvxLanguageToLocale( aTempLocale, eLang );
- LanguageTag aLanguageTag( aTempLocale);
+ LanguageTag aLanguageTag( eLang);
LocaleDataWrapper aLocaleWrapper( aLanguageTag );
// update the decimal separator key of the related CheckBox
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 24a94433d05a..65af919beee8 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -100,7 +100,7 @@ static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &r
const Locale *pSeq = rSeq.getConstArray();
for (sal_Int32 i = 0; i < nLen; ++i)
{
- pRes[i] = SvxLocaleToLanguage( pSeq[i] );
+ pRes[i] = LanguageTag( pSeq[i] ).getLanguageType();
}
return aRes;
}
@@ -734,9 +734,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
xMSF = ::comphelper::getProcessServiceFactory();
xLinguSrvcMgr = LinguServiceManager::create(comphelper::getComponentContext(xMSF));
- Locale aCurrentLocale;
- LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
- SvxLanguageToLocale(aCurrentLocale, eLang);
+ const Locale& rCurrentLocale = Application::GetSettings().GetLanguageTag().getLocale();
Sequence<Any> aArgs(2);//second arguments has to be empty!
aArgs.getArray()[0] <<= SvxGetLinguPropertySet();
@@ -755,7 +753,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference<XServiceDisplayName> xDispName(aInfo.xSpell, UNO_QUERY);
if(xDispName.is())
- aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
const Sequence< Locale > aLocales( aInfo.xSpell->getLocales() );
//! suppress display of entries with no supported languages (see feature 110994)
@@ -779,7 +777,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference<XServiceDisplayName> xDispName(aInfo.xGrammar, UNO_QUERY);
if(xDispName.is())
- aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
const Sequence< Locale > aLocales( aInfo.xGrammar->getLocales() );
//! suppress display of entries with no supported languages (see feature 110994)
@@ -803,7 +801,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference<XServiceDisplayName> xDispName(aInfo.xHyph, UNO_QUERY);
if(xDispName.is())
- aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
const Sequence< Locale > aLocales( aInfo.xHyph->getLocales() );
//! suppress display of entries with no supported languages (see feature 110994)
@@ -827,7 +825,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
uno::Reference<XServiceDisplayName> xDispName(aInfo.xThes, UNO_QUERY);
if(xDispName.is())
- aInfo.sDisplayName = xDispName->getServiceDisplayName( aCurrentLocale );
+ aInfo.sDisplayName = xDispName->getServiceDisplayName( rCurrentLocale );
const Sequence< Locale > aLocales( aInfo.xThes->getLocales() );
//! suppress display of entries with no supported languages (see feature 110994)
@@ -842,7 +840,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
const Locale* pAllLocales = aAllServiceLocales.getConstArray();
for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[nLocale] );
+ sal_Int16 nLang = LanguageTag( pAllLocales[nLocale] ).getLanguageType();
aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cSpell, pAllLocales[nLocale]);
SetChecked( aCfgSvcs );
@@ -985,7 +983,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, sal_Bool bEna
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ sal_Int16 nLang = LanguageTag( pLocale[i] ).getLanguageType();
if (!aCfgSpellTable.count( nLang ) && bEnable)
aCfgSpellTable[ nLang ] = Sequence< OUString >();
if (aCfgSpellTable.count( nLang ))
@@ -1001,7 +999,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, sal_Bool bEna
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ sal_Int16 nLang = LanguageTag( pLocale[i] ).getLanguageType();
if (!aCfgGrammarTable.count( nLang ) && bEnable)
aCfgGrammarTable[ nLang ] = Sequence< OUString >();
if (aCfgGrammarTable.count( nLang ))
@@ -1017,7 +1015,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, sal_Bool bEna
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ sal_Int16 nLang = LanguageTag( pLocale[i] ).getLanguageType();
if (!aCfgHyphTable.count( nLang ) && bEnable)
aCfgHyphTable[ nLang ] = Sequence< OUString >();
if (aCfgHyphTable.count( nLang ))
@@ -1033,7 +1031,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, sal_Bool bEna
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pLocale[i] );
+ sal_Int16 nLang = LanguageTag( pLocale[i] ).getLanguageType();
if (!aCfgThesTable.count( nLang ) && bEnable)
aCfgThesTable[ nLang ] = Sequence< OUString >();
if (aCfgThesTable.count( nLang ))
@@ -1210,7 +1208,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
sal_Int16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
- Locale aLocale( SvxCreateLocale(nLang) );
+ Locale aLocale( LanguageTag(nLang).getLocale() );
if (xMgr.is())
xMgr->setConfiguredServices( cSpell, aLocale, aImplNames );
}
@@ -1222,7 +1220,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
sal_Int16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
- Locale aLocale( SvxCreateLocale(nLang) );
+ Locale aLocale( LanguageTag(nLang).getLocale() );
if (xMgr.is())
xMgr->setConfiguredServices( cGrammar, aLocale, aImplNames );
}
@@ -1234,7 +1232,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
sal_Int16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
- Locale aLocale( SvxCreateLocale(nLang) );
+ Locale aLocale( LanguageTag(nLang).getLocale() );
if (xMgr.is())
xMgr->setConfiguredServices( cHyph, aLocale, aImplNames );
}
@@ -1246,7 +1244,7 @@ sal_Bool SvxLinguTabPage::FillItemSet( SfxItemSet& rCoreSet )
sal_Int16 nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
- Locale aLocale( SvxCreateLocale(nLang) );
+ Locale aLocale( LanguageTag(nLang).getLocale() );
if (xMgr.is())
xMgr->setConfiguredServices( cThes, aLocale, aImplNames );
}
@@ -1381,7 +1379,7 @@ void SvxLinguTabPage::AddDicBoxEntry(
aLinguDicsCLB.SetUpdateMode(sal_False);
String aTxt( ::GetDicInfoStr( rxDic->getName(),
- SvxLocaleToLanguage( rxDic->getLocale() ),
+ LanguageTag( rxDic->getLocale() ).getLanguageType(),
DictionaryType_NEGATIVE == rxDic->getDictionaryType() ) );
aLinguDicsCLB.InsertEntry( aTxt, (sal_uInt16)LISTBOX_APPEND ); // append at end
SvTreeListEntry* pEntry = aLinguDicsCLB.GetEntry( aLinguDicsCLB.GetEntryCount() - 1 );
@@ -1638,7 +1636,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, PushButton *, pBtn )
sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
for (sal_Int32 k = 0; k < nLocales; ++k)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pAllLocales[k] );
+ sal_Int16 nLang = LanguageTag( pAllLocales[k] ).getLanguageType();
if (pLinguData->GetSpellTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
if (pLinguData->GetGrammarTable().count( nLang ))
@@ -1990,7 +1988,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(Window* pParent, SvxLinguData_Impl& rData)
aLanguageLB.Clear();
for(long i = 0; i < rLoc.getLength(); i++)
{
- sal_Int16 nLang = SvxLocaleToLanguage( pLocales[i] );
+ sal_Int16 nLang = LanguageTag( pLocales[i] ).getLanguageType();
aLanguageLB.InsertLanguage( nLang, lcl_SeqHasLang( aAvailLang, nLang ) );
}
LanguageType eSysLang = MsLangId::getSystemLanguage();
@@ -2099,8 +2097,7 @@ IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
{
LanguageType eCurLanguage = aLanguageLB.GetSelectLanguage();
static Locale aLastLocale;
- Locale aCurLocale;
- SvxLanguageToLocale(aCurLocale, eCurLanguage);
+ Locale aCurLocale( LanguageTag( eCurLanguage).getLocale());
SvTreeList *pModel = aModulesCLB.GetModel();
if (pBox)
@@ -2108,7 +2105,7 @@ IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
// save old probably changed settings
// before switching to new language entries
- sal_Int16 nLang = SvxLocaleToLanguage( aLastLocale );
+ sal_Int16 nLang = LanguageTag( aLastLocale ).getLanguageType();
sal_Int32 nStart = 0, nLocalIndex = 0;
Sequence< OUString > aChange;
@@ -2347,8 +2344,7 @@ IMPL_LINK( SvxEditModulesDlg, LangSelectHdl_Impl, ListBox *, pBox )
}
}
}
- aLastLocale.Language = aCurLocale.Language;
- aLastLocale.Country = aCurLocale.Country;
+ aLastLocale = aCurLocale;
return 0;
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index e5d53eac962b..e0d3a05eef16 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -884,7 +884,7 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent,
SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER);
bSWriter = pMod == SfxModule::GetActiveModule();
- LanguageTag aLanguageTag( SvxCreateLocale(eLastDialogLanguage ));
+ LanguageTag aLanguageTag( eLastDialogLanguage );
pCompareClass = new CollatorWrapper( GetProcessFact() );
pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
pCharClass = new CharClass( aLanguageTag );
@@ -1087,7 +1087,7 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet)
delete pCompareClass;
delete pCharClass;
- LanguageTag aLanguageTag( SvxCreateLocale(eLastDialogLanguage ));
+ LanguageTag aLanguageTag( eLastDialogLanguage );
pCompareClass = new CollatorWrapper( GetProcessFact() );
pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 );
pCharClass = new CharClass( aLanguageTag );
@@ -1378,7 +1378,7 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage( Window* pParent,
FreeResource();
- ::com::sun::star::lang::Locale aLcl( SvxCreateLocale(eLastDialogLanguage ));
+ ::com::sun::star::lang::Locale aLcl( LanguageTag(eLastDialogLanguage ).getLocale());
pCompareClass = new CollatorWrapper( GetProcessFact() );
pCompareClass->loadDefaultCollator( aLcl, 0 );
@@ -1554,7 +1554,7 @@ void OfaAutocorrExceptPage::SetLanguage(LanguageType eSet)
eLastDialogLanguage = eSet;
delete pCompareClass;
pCompareClass = new CollatorWrapper( GetProcessFact() );
- pCompareClass->loadDefaultCollator( SvxCreateLocale( eLastDialogLanguage ), 0 );
+ pCompareClass->loadDefaultCollator( LanguageTag( eLastDialogLanguage ).getLocale(), 0 );
ModifyHdl(&aAbbrevED);
ModifyHdl(&aDoubleCapsED);
}
@@ -2436,7 +2436,7 @@ void OfaSmartTagOptionsTabPage::FillListBox( const SmartTagMgr& rSmartTagMgr )
// fill list box:
const sal_uInt32 nNumberOfRecognizers = rSmartTagMgr.NumberOfRecognizers();
- const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ const lang::Locale aLocale( LanguageTag( eLastDialogLanguage ).getLocale() );
for ( sal_uInt32 i = 0; i < nNumberOfRecognizers; ++i )
{
@@ -2480,7 +2480,7 @@ IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, ClickHdl)
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
- const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ const lang::Locale aLocale( LanguageTag( eLastDialogLanguage ).getLocale() );
if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
xRec->displayPropertyPage( nSmartTagIdx, aLocale );
@@ -2519,7 +2519,7 @@ IMPL_LINK_NOARG(OfaSmartTagOptionsTabPage, SelectHdl)
uno::Reference< smarttags::XSmartTagRecognizer > xRec = pUserData->mxRec;
const sal_Int32 nSmartTagIdx = pUserData->mnSmartTagIdx;
- const lang::Locale aLocale( SvxCreateLocale( eLastDialogLanguage ) );
+ const lang::Locale aLocale( LanguageTag( eLastDialogLanguage ).getLocale() );
if ( xRec->hasPropertyPage( nSmartTagIdx, aLocale ) )
m_aPropertiesPB.Enable( sal_True );
else
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index d09b1845b27c..3747402eb398 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -206,12 +206,11 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
if(xDefNum.is())
{
Sequence< Sequence< PropertyValue > > aNumberings;
- LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
- Locale aLocale = SvxCreateLocale(eLang);
+ const Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale();
try
{
aNumberings =
- xDefNum->getDefaultContinuousNumberingLevels( aLocale );
+ xDefNum->getDefaultContinuousNumberingLevels( rLocale );
sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength();
@@ -227,7 +226,7 @@ SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
{
}
Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
- pExamplesVS->SetNumberingSettings(aNumberings, xFormat, aLocale);
+ pExamplesVS->SetNumberingSettings(aNumberings, xFormat, rLocale);
}
}
@@ -568,11 +567,10 @@ SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
if(xDefNum.is())
{
Sequence<Reference<XIndexAccess> > aOutlineAccess;
- LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType();
- Locale aLocale = SvxCreateLocale(eLang);
+ const Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale();
try
{
- aOutlineAccess = xDefNum->getDefaultOutlineNumberings( aLocale );
+ aOutlineAccess = xDefNum->getDefaultOutlineNumberings( rLocale );
for(sal_Int32 nItem = 0;
nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
@@ -595,7 +593,7 @@ SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
{
}
Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
- pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, aLocale);
+ pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, rLocale);
}
}