diff options
author | Eike Rathke <erack@redhat.com> | 2012-11-24 18:54:09 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-11-24 18:56:43 +0100 |
commit | 41956321ceefb5836feb2c119b66de7bb557740f (patch) | |
tree | e756d740615881ceeea816e7ef15096f91d7cc1e | |
parent | 6395c843710b59e391f10f3532442ae11fe64357 (diff) |
get rid of Svx...Locale...() double conversion nonsense
Change-Id: I21d14ff6087d1adb0ce769f2e8f8060a005250cc
70 files changed, 205 insertions, 282 deletions
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index 5d278c2b86cf..5b6b39976a69 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -416,7 +416,7 @@ void LanguageBox::FillBox() { bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] ); bool bIsCurrent = localesAreEqual( aCurrentLocale, pLocale[i] ); - LanguageType eLangType = SvxLocaleToLanguage( pLocale[i] ); + LanguageType eLangType = LanguageTag( pLocale[i] ).getLanguageType(); String sLanguage = aLangTable.GetString( eLangType ); if ( bIsDefault ) { diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index b58b3266b178..1efc75e482ee 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -170,7 +170,7 @@ void ManageLanguageDialog::FillLanguageBox() for ( i = 0; i < nCount; ++i ) { bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] ); - LanguageType eLangType = SvxLocaleToLanguage( pLocale[i] ); + LanguageType eLangType = LanguageTag( pLocale[i] ).getLanguageType(); OUStringBuffer sLanguageBuf(aLangTable.GetString( eLangType )); if ( bIsDefault ) { @@ -325,7 +325,7 @@ void SetDefaultLanguageDialog::FillLanguageBox() const Locale* pLocale = aLocaleSeq.getConstArray(); sal_Int32 i, nCount = aLocaleSeq.getLength(); for ( i = 0; i < nCount; ++i ) - m_pLanguageLB->RemoveLanguage( SvxLocaleToLanguage( pLocale[i] ) ); + m_pLanguageLB->RemoveLanguage( LanguageTag( pLocale[i] ).getLanguageType() ); // fill checklistbox if not in default mode if ( m_pLocalizationMgr->isLibraryLocalized() ) @@ -379,9 +379,7 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const Sequence< Locale > aLocaleSeq( nSize ); if ( bNotLocalized ) { - Locale aLocale; - SvxLanguageToLocale( aLocale, m_pLanguageLB->GetSelectLanguage() ); - aLocaleSeq[0] = aLocale; + aLocaleSeq[0] = LanguageTag( m_pLanguageLB->GetSelectLanguage() ).getLocale(); } else { @@ -392,9 +390,7 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const if ( m_pCheckLangLB->IsChecked(i) ) { LanguageType eType = LanguageType( (sal_uLong)m_pCheckLangLB->GetEntryData(i) ); - Locale aLocale; - SvxLanguageToLocale( aLocale, eType ); - aLocaleSeq[j++] = aLocale; + aLocaleSeq[j++] = LanguageTag( eType ).getLocale(); } } DBG_ASSERT( nSize == j, "SetDefaultLanguageDialog::GetLocales(): invalid indexes" ); 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); } } diff --git a/editeng/inc/editeng/unolingu.hxx b/editeng/inc/editeng/unolingu.hxx index 658d0f021a3e..108510b8318f 100644 --- a/editeng/inc/editeng/unolingu.hxx +++ b/editeng/inc/editeng/unolingu.hxx @@ -23,7 +23,6 @@ #include <i18npool/lang.h> #include <tools/string.hxx> #include <com/sun/star/util/Language.hpp> -#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XHyphenator.hpp> @@ -183,13 +182,6 @@ EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< // misc functions // -EDITENG_DLLPUBLIC LanguageType SvxLocaleToLanguage( - const ::com::sun::star::lang::Locale& rLocale ); -EDITENG_DLLPUBLIC ::com::sun::star::lang::Locale& SvxLanguageToLocale( - ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ); -EDITENG_DLLPUBLIC ::com::sun::star::lang::Locale SvxCreateLocale( LanguageType eLang ); - - EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError ); diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 397777d4bdab..cb8252a4dc1f 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -178,13 +178,11 @@ namespace accessibility { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - lang::Locale aLocale; - DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleEditableTextPara::getLocale: paragraph index value overflow"); // return locale of first character in the paragraph - return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); + return LanguageTag(GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )).getLocale(); } void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) diff --git a/editeng/source/accessibility/AccessibleImageBullet.cxx b/editeng/source/accessibility/AccessibleImageBullet.cxx index 2514f0ea3e45..13510126203b 100644 --- a/editeng/source/accessibility/AccessibleImageBullet.cxx +++ b/editeng/source/accessibility/AccessibleImageBullet.cxx @@ -202,13 +202,11 @@ namespace accessibility SolarMutexGuard aGuard; - lang::Locale aLocale; - DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, "AccessibleImageBullet::getLocale: paragraph index value overflow"); // return locale of first character in the paragraph - return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); + return LanguageTag(GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )).getLocale(); } void SAL_CALL AccessibleImageBullet::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index f4301c9840fc..d40ac277c97a 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -95,9 +95,10 @@ static LanguageType lcl_CheckLanguage( // if the result from language guessing does not provide a 'Country' part // try to get it by looking up the locale setting of the office. + /* FIXME-BCP47: handle language tags */ if ( aLocale.Country.isEmpty( ) ) { - lang::Locale aTmpLocale = SvxCreateLocale( nTmpLang ); + lang::Locale aTmpLocale = LanguageTag( nTmpLang ).getLocale(); if (aTmpLocale.Language == aLocale.Language) nLang = nTmpLang; } @@ -1018,7 +1019,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack ) 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 && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage ) diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index b6c9f7fc4e44..1fbddb23ccb2 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1779,7 +1779,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, Sequence< PropertyValue >(), 1 ); i18n::LineBreakUserOptions aUserOptions; - const i18n::ForbiddenCharacters* pForbidden = GetForbiddenCharsTable()->GetForbiddenCharacters( SvxLocaleToLanguage( aLocale ), sal_True ); + const i18n::ForbiddenCharacters* pForbidden = GetForbiddenCharsTable()->GetForbiddenCharacters( LanguageTag( aLocale ).getLanguageType(), sal_True ); aUserOptions.forbiddenBeginCharacters = pForbidden->beginLine; aUserOptions.forbiddenEndCharacters = pForbidden->endLine; aUserOptions.applyForbiddenRules = ((const SfxBoolItem&)pNode->GetContentAttribs().GetItem( EE_PARA_FORBIDDENRULES )).GetValue(); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index f8fa62c7a107..d885d8dd4de7 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1405,7 +1405,7 @@ LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_uInt16* pEndPo ::com::sun::star::lang::Locale ImpEditEngine::GetLocale( const EditPaM& rPaM ) const { - return SvxCreateLocale( GetLanguage( rPaM ) ); + return LanguageTag( GetLanguage( rPaM ) ).getLocale(); } Reference< XSpellChecker1 > ImpEditEngine::GetSpeller() @@ -1565,7 +1565,8 @@ void ImpEditEngine::Convert( EditView* pEditView, TextConvWrapper aWrp( Application::GetDefDialogParent(), ::comphelper::getProcessComponentContext(), - SvxCreateLocale( nSrcLang ), SvxCreateLocale( nDestLang ), + LanguageTag( nSrcLang ).getLocale(), + LanguageTag( nDestLang ).getLocale(), pDestFont, nOptions, bIsInteractive, bIsStart, pEditView ); @@ -2737,11 +2738,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, i18n::Boundary aEndBndry; aSttBndry = _xBI->getWordBoundary( aNodeStr, nStartPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ), + GetLocale( EditPaM( pNode, nStartPos + 1 ) ), nWordType, true /*prefer forward direction*/); aEndBndry = _xBI->getWordBoundary( aNodeStr, nEndPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ), + GetLocale( EditPaM( pNode, nEndPos + 1 ) ), nWordType, false /*prefer backward direction*/); // prevent backtracking to the previous word if selection is at word boundary @@ -2749,7 +2750,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { aSttBndry = _xBI->nextWord( aNodeStr, aSttBndry.endPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, aSttBndry.endPos + 1 ) ) ), + GetLocale( EditPaM( pNode, aSttBndry.endPos + 1 ) ), nWordType); } // prevent advancing to the next word if selection is at word boundary @@ -2757,7 +2758,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, { aEndBndry = _xBI->previousWord( aNodeStr, aEndBndry.startPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, aEndBndry.startPos + 1 ) ) ), + GetLocale( EditPaM( pNode, aEndBndry.startPos + 1 ) ), nWordType); } @@ -2792,7 +2793,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, #endif aCurWordBndry = _xBI->nextWord(aNodeStr, nCurrentEnd, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + GetLocale( EditPaM( pNode, nCurrentEnd + 1 ) ), nWordType); } DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" ); @@ -2803,18 +2804,18 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, sal_Int32 nLastStart = _xBI->beginOfSentence( aNodeStr, nEndPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nEndPos + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nEndPos + 1 ) ) ); sal_Int32 nLastEnd = _xBI->endOfSentence( aNodeStr, nLastStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nLastStart + 1 ) ) ); // extend nCurrentStart, nCurrentEnd to the current sentence boundaries nCurrentStart = _xBI->beginOfSentence( aNodeStr, nStartPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nStartPos + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nStartPos + 1 ) ) ); nCurrentEnd = _xBI->endOfSentence( aNodeStr, nCurrentStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nCurrentStart + 1 ) ) ); // prevent backtracking to the previous sentence if selection starts at end of a sentence if (nCurrentEnd <= nStartPos) @@ -2824,16 +2825,16 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, // Thus to get the real sentence start we should locate the next real word, // that is one found by DICTIONARY_WORD i18n::Boundary aBndry = _xBI->nextWord( aNodeStr, nCurrentEnd, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + GetLocale( EditPaM( pNode, nCurrentEnd + 1 ) ), i18n::WordType::DICTIONARY_WORD); // now get new current sentence boundaries nCurrentStart = _xBI->beginOfSentence( aNodeStr, aBndry.startPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); + GetLocale( EditPaM( pNode, aBndry.startPos + 1 ) ) ); nCurrentEnd = _xBI->endOfSentence( aNodeStr, nCurrentStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nCurrentStart + 1 ) ) ); } // prevent advancing to the next sentence if selection ends at start of a sentence if (nLastStart >= nEndPos) @@ -2843,11 +2844,11 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, // Thus to get the real sentence start we should locate the previous real word, // that is one found by DICTIONARY_WORD i18n::Boundary aBndry = _xBI->previousWord( aNodeStr, nLastStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nLastStart + 1 ) ) ), + GetLocale( EditPaM( pNode, nLastStart + 1 ) ), i18n::WordType::DICTIONARY_WORD); nLastEnd = _xBI->endOfSentence( aNodeStr, aBndry.startPos, - SvxCreateLocale( GetLanguage( EditPaM( pNode, aBndry.startPos + 1 ) ) ) ); + GetLocale( EditPaM( pNode, aBndry.startPos + 1 ) ) ); if (nCurrentEnd > nLastEnd) nCurrentEnd = nLastEnd; } @@ -2878,12 +2879,12 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, i18n::Boundary aFirstWordBndry; aFirstWordBndry = _xBI->nextWord( aNodeStr, nCurrentEnd, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentEnd + 1 ) ) ), + GetLocale( EditPaM( pNode, nCurrentEnd + 1 ) ), nWordType); nCurrentStart = aFirstWordBndry.startPos; nCurrentEnd = _xBI->endOfSentence( aNodeStr, nCurrentStart, - SvxCreateLocale( GetLanguage( EditPaM( pNode, nCurrentStart + 1 ) ) ) ); + GetLocale( EditPaM( pNode, nCurrentStart + 1 ) ) ); } DBG_ASSERT( nCurrentEnd >= nLastEnd, "failed to reach end of transliteration" ); } diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index a8612478b19b..5cf1227c4238 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -100,9 +100,8 @@ SvxNumberType::~SvxNumberType() String SvxNumberType::GetNumStr( sal_uLong nNo ) const { - LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType(); - Locale aLocale = SvxCreateLocale(eLang); - return GetNumStr( nNo, aLocale ); + const LanguageTag& rLang = Application::GetSettings().GetLanguageTag(); + return GetNumStr( nNo, rLang.getLocale() ); } String SvxNumberType::GetNumStr( sal_uLong nNo, const Locale& rLocale ) const @@ -562,8 +561,6 @@ SvxNumRule::SvxNumRule( sal_uLong nFeatures, bContinuousNumbering(bCont) { ++nRefCount; - LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType(); - aLocale = SvxCreateLocale(eLang); for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) { if(i < nLevels) diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 61cf0db1d689..9bbddf4a74bd 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -110,7 +110,8 @@ OUString SvxFont::CalcCaseMap(const OUString &rTxt) const const LanguageType eLng = LANGUAGE_DONTKNOW == eLang ? LANGUAGE_SYSTEM : eLang; - CharClass aCharClass( LanguageTag( SvxCreateLocale( eLng )) ); + LanguageTag aLanguageTag( eLng); + CharClass aCharClass( aLanguageTag ); switch( eCaseMap ) { @@ -221,7 +222,8 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const LanguageType eLng = LANGUAGE_DONTKNOW == eLang ? LANGUAGE_SYSTEM : eLang; - CharClass aCharClass( LanguageTag( SvxCreateLocale( eLng )) ); + LanguageTag aLanguageTag( eLng ); + CharClass aCharClass( aLanguageTag ); String aCharString; while( nPos < nTxtLen ) diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index 8365f32fb704..44f51b2faaa4 100644 --- a/editeng/source/misc/forbiddencharacterstable.cxx +++ b/editeng/source/misc/forbiddencharacterstable.cxx @@ -38,7 +38,7 @@ const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::Ge pForbiddenCharacters = &(it->second); else if ( bGetDefault && m_xContext.is() ) { - LocaleDataWrapper aWrapper( m_xContext, LanguageTag( SvxCreateLocale( nLanguage )) ); + LocaleDataWrapper aWrapper( m_xContext, LanguageTag( nLanguage ) ); maMap[ nLanguage ] = aWrapper.getForbiddenCharacters(); pForbiddenCharacters = &maMap[ nLanguage ]; } diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index 4083d6bb5ca5..36e020ac4df3 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -244,8 +244,8 @@ namespace editeng , m_pUIParent( _pUIParent ) , m_xContext( rxContext ) , m_aSourceLocale( _rSourceLocale ) -, m_nSourceLang( SvxLocaleToLanguage( _rSourceLocale ) ) -, m_nTargetLang( SvxLocaleToLanguage( _rTargetLocale ) ) +, m_nSourceLang( LanguageTag( _rSourceLocale ).getLanguageType() ) +, m_nTargetLang( LanguageTag( _rTargetLocale ).getLanguageType() ) , m_pTargetFont( _pTargetFont ) , m_bIsInteractive( _bIsInteractive ) , m_pAntiImpl( _pAntiImpl ) diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index d4ae02a43857..42e83f1aecf6 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -231,7 +231,7 @@ sal_Int16 SvxSpellWrapper::CheckHyphLang( if (SVX_LANG_NEED_CHECK == ((nVal >> 8) & 0x00FF)) { sal_uInt16 nTmpVal = SVX_LANG_MISSING_DO_WARN; - if (xHyph.is() && xHyph->hasLocale( SvxCreateLocale( nLang ) )) + if (xHyph.is() && xHyph->hasLocale( LanguageTag( nLang ).getLocale() )) nTmpVal = SVX_LANG_OK; nVal &= 0x00FF; nVal |= nTmpVal << 8; @@ -391,7 +391,7 @@ void SvxSpellWrapper::SpellDocument( ) EditAbstractDialogFactory* pFact = EditAbstractDialogFactory::Create(); AbstractHyphenWordDialog* pDlg = pFact->CreateHyphenWordDialog( pWin, xHyphWord->getWord(), - SvxLocaleToLanguage( xHyphWord->getLocale() ), + LanguageTag( xHyphWord->getLocale() ).getLanguageType(), xHyph, this ); pWin = pDlg->GetWindow(); pDlg->Execute(); @@ -521,7 +521,7 @@ Reference< XDictionary > SvxSpellWrapper::GetAllRightDic() const { if ( xTmp->isActive() && xTmp->getDictionaryType() != DictionaryType_NEGATIVE && - SvxLocaleToLanguage( xTmp->getLocale() ) == LANGUAGE_NONE ) + LanguageTag( xTmp->getLocale() ).getLanguageType() == LANGUAGE_NONE ) { Reference< frame::XStorable > xStor( xTmp, UNO_QUERY ); if (xStor.is() && xStor->hasLocation() && !xStor->isReadonly()) @@ -585,7 +585,7 @@ sal_Bool SvxSpellWrapper::FindSpellError() { // replace word without asking ReplaceAll( xEntry->getReplacementText(), - SvxLocaleToLanguage( xAlt->getLocale() ) ); + LanguageTag( xAlt->getLocale() ).getLanguageType() ); } else bSpell = sal_False; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 7a322f33ed95..df6d2766262d 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -196,14 +196,14 @@ static ::com::sun::star::uno::Reference< return xMSF; } -static sal_uInt16 GetAppLang() +static const LanguageTag& GetAppLang() { - return Application::GetSettings().GetLanguageTag().getLanguageType(); + return Application::GetSettings().GetLanguageTag(); } static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang ) { - static LocaleDataWrapper aLclDtWrp( LanguageTag( SvxCreateLocale( GetAppLang() )) ); - LanguageTag aLcl( LanguageTag( SvxCreateLocale( nLang ))); + static LocaleDataWrapper aLclDtWrp( GetAppLang() ); + LanguageTag aLcl( nLang ); const LanguageTag& rLcl = aLclDtWrp.getLoadedLanguageTag(); if( aLcl != rLcl ) aLclDtWrp.setLanguageTag( aLcl ); @@ -217,7 +217,7 @@ static TransliterationWrapper& GetIgnoreTranslWrapper() ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ); if( !bIsInit ) { - aWrp.loadModuleIfNeeded( GetAppLang() ); + aWrp.loadModuleIfNeeded( GetAppLang().getLanguageType() ); bIsInit = 1; } return aWrp; @@ -228,7 +228,7 @@ static CollatorWrapper& GetCollatorWrapper() static CollatorWrapper aCollWrp( GetProcessFact() ); if( !bIsInit ) { - aCollWrp.loadDefaultCollator( SvxCreateLocale( GetAppLang() ), 0 ); + aCollWrp.loadDefaultCollator( GetAppLang().getLocale(), 0 ); bIsInit = 1; } return aCollWrp; @@ -276,7 +276,7 @@ long SvxAutoCorrect::GetDefaultFlags() | SaveWordCplSttLst | SaveWordWrdSttLst | CorrectCapsLock; - LanguageType eLang = GetAppLang(); + LanguageType eLang = GetAppLang().getLanguageType(); switch( eLang ) { case LANGUAGE_ENGLISH: @@ -337,7 +337,7 @@ SvxAutoCorrect::~SvxAutoCorrect() void SvxAutoCorrect::_GetCharClass( LanguageType eLang ) { delete pCharClass; - pCharClass = new CharClass( LanguageTag( SvxCreateLocale( eLang ))); + pCharClass = new CharClass( LanguageTag( eLang )); eCharClassLang = eLang; } @@ -501,7 +501,7 @@ sal_Bool SvxAutoCorrect::FnChgToEnEmDash( sal_Bool bRet = sal_False; CharClass& rCC = GetCharClass( eLang ); if (eLang == LANGUAGE_SYSTEM) - eLang = GetAppLang(); + eLang = GetAppLang().getLanguageType(); bool bAlwaysUseEmDash = (cEmDash && (eLang == LANGUAGE_RUSSIAN || eLang == LANGUAGE_UKRAINIAN)); // replace " - " or " --" with "enDash" @@ -1126,7 +1126,7 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, if( '\"' == cInsChar ) { if( LANGUAGE_SYSTEM == eLang ) - eLang = GetAppLang(); + eLang = GetAppLang().getLanguageType(); switch( eLang ) { case LANGUAGE_FRENCH: @@ -1161,7 +1161,7 @@ String SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos, if( '\"' == cInsChar ) { if( LANGUAGE_SYSTEM == eLang ) - eLang = GetAppLang(); + eLang = GetAppLang().getLanguageType(); switch( eLang ) { case LANGUAGE_FRENCH: diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 46486363fafb..5c78f076e036 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -130,8 +130,7 @@ void ThesDummy_Impl::GetCfgLocales() Locale *pLocale = pLocaleSeq->getArray(); for (sal_Int32 i = 0; i < nLen; ++i) { - pLocale[i] = SvxCreateLocale( - LanguageTag( pNodeNames[i] ).getLanguageType() ); + pLocale[i] = LanguageTag( pNodeNames[i] ).getLocale(); } } } @@ -694,7 +693,7 @@ uno::Reference< XDictionary > LinguMgr::GetChangeAll() xChangeAll = uno::Reference< XDictionary > ( _xDicList->createDictionary( A2OU("ChangeAllList"), - SvxCreateLocale( LANGUAGE_NONE ), + LanguageTag( LANGUAGE_NONE ).getLocale(), DictionaryType_NEGATIVE, String() ), UNO_QUERY ); } return xChangeAll; @@ -722,7 +721,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard() try { xTmp = xTmpDicList->createDictionary( aDicName, - SvxCreateLocale( LANGUAGE_NONE ), + LanguageTag( LANGUAGE_NONE ).getLocale(), DictionaryType_POSITIVE, linguistic::GetWritableDictionaryURL( aDicName ) ); } @@ -872,32 +871,5 @@ short SvxDicError( Window *pParent, sal_Int16 nError ) return nRes; } -LanguageType SvxLocaleToLanguage( const Locale& rLocale ) -{ - if ( rLocale.Language.isEmpty() ) - return LANGUAGE_NONE; - - return LanguageTag( rLocale ).getLanguageType(); -} - -Locale& SvxLanguageToLocale( Locale& rLocale, LanguageType eLang ) -{ - if ( eLang != LANGUAGE_NONE ) - rLocale = LanguageTag( eLang ).getLocale(); - else - rLocale = Locale(); - - return rLocale; -} - -Locale SvxCreateLocale( LanguageType eLang ) -{ - Locale aLocale; - if ( eLang != LANGUAGE_NONE ) - aLocale = LanguageTag( eLang ).getLocale(); - - return aLocale; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx index cee34d950507..12dcee9be9a0 100644 --- a/editeng/source/uno/UnoForbiddenCharsTable.cxx +++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx @@ -52,7 +52,7 @@ ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const Loc if(!mxForbiddenChars.is()) throw RuntimeException(); - const LanguageType eLang = SvxLocaleToLanguage( rLocale ); + const LanguageType eLang = LanguageTag( rLocale ).getLanguageType(); const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False ); if(!pForbidden) throw NoSuchElementException(); @@ -68,7 +68,7 @@ sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const Locale& rLocal if(!mxForbiddenChars.is()) return sal_False; - const LanguageType eLang = SvxLocaleToLanguage( rLocale ); + const LanguageType eLang = LanguageTag( rLocale ).getLanguageType(); const ForbiddenCharacters* pForbidden = mxForbiddenChars->GetForbiddenCharacters( eLang, sal_False ); return NULL != pForbidden; @@ -82,7 +82,7 @@ void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const Locale& rLocale, co if(!mxForbiddenChars.is()) throw RuntimeException(); - const LanguageType eLang = SvxLocaleToLanguage( rLocale ); + const LanguageType eLang = LanguageTag( rLocale ).getLanguageType(); mxForbiddenChars->SetForbiddenCharacters( eLang, rForbiddenCharacters ); onChange(); @@ -96,7 +96,7 @@ void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const Locale& rLocale if(!mxForbiddenChars.is()) throw RuntimeException(); - const LanguageType eLang = SvxLocaleToLanguage( rLocale ); + const LanguageType eLang = LanguageTag( rLocale ).getLanguageType(); mxForbiddenChars->ClearForbiddenCharacters( eLang ); onChange(); @@ -119,7 +119,7 @@ Sequence< Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales() it != mxForbiddenChars->GetMap().end(); ++it ) { const sal_uLong nLanguage = it->first; - SvxLanguageToLocale ( *pLocales++, static_cast < LanguageType > (nLanguage) ); + *pLocales++ = LanguageTag( static_cast < LanguageType > (nLanguage) ).getLocale(); } } diff --git a/sc/source/ui/app/scmod2.cxx b/sc/source/ui/app/scmod2.cxx index 191704e19fa1..a97bc80a625a 100644 --- a/sc/source/ui/app/scmod2.cxx +++ b/sc/source/ui/app/scmod2.cxx @@ -29,6 +29,7 @@ #include <editeng/unolingu.hxx> #include <unotools/lingucfg.hxx> #include <i18npool/mslangid.hxx> +#include <i18npool/languagetag.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/lang/Locale.hpp> @@ -77,15 +78,12 @@ sal_Bool ScModule::HasThesaurusLanguage( sal_uInt16 nLang ) if ( nLang == LANGUAGE_NONE ) return false; - lang::Locale aLocale; - SvxLanguageToLocale( aLocale, nLang ); - sal_Bool bHasLang = false; try { uno::Reference< linguistic2::XThesaurus > xThes(LinguMgr::GetThesaurus()); if ( xThes.is() ) - bHasLang = xThes->hasLocale( aLocale ); + bHasLang = xThes->hasLocale( LanguageTag( nLang ).getLocale() ); } catch( uno::Exception& ) { diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 777d5311ddb1..c6cb3feb3ff1 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -143,7 +143,7 @@ void ScDocShell::InitItems() { i18n::ForbiddenCharacters aForbidden; aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine ); - LanguageType eLang = SvxLocaleToLanguage(pLocales[i]); + LanguageType eLang = LanguageTag(pLocales[i]).getLanguageType(); xForbiddenTable->SetForbiddenCharacters( eLang, aForbidden ); } diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 28c6b1297189..7175fbf14420 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -1213,7 +1213,7 @@ void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyNam if(!(aValue >>= aLocale)) throw lang::IllegalArgumentException(); - mpDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE ); + mpDoc->SetLanguage( LanguageTag(aLocale).getLanguageType(), EE_CHAR_LANGUAGE ); break; } case WID_MODEL_TABSTOP: @@ -1285,9 +1285,7 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property case WID_MODEL_LANGUAGE: { LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE ); - lang::Locale aLocale; - SvxLanguageToLocale( aLocale, eLang ); - aAny <<= aLocale; + aAny <<= LanguageTag( eLang).getLocale(); break; } case WID_MODEL_TABSTOP: diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index e124fcc735e5..0ec0d9935896 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -382,10 +382,9 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) rSet.Put( SfxStringItem( SID_THES, aStatusVal ) ); // disable "Thesaurus" context menu entry if there is nothing to look up - lang::Locale aLocale( SvxCreateLocale( nLang ) ); uno::Reference< linguistic2::XThesaurus > xThes( LinguMgr::GetThesaurus() ); if (!bIsLookUpWord || - !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang). getLocale() )) rSet.DisableItem( SID_THES ); } else diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 530b1c5acfe9..af1eb659c1cf 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -571,11 +571,8 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) { LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ); Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() ); - Locale aLocale; - SvxLanguageToLocale( aLocale, eLang ); - - if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale) ) + if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale( LanguageTag( eLang).getLocale()) ) rSet.DisableItem( SID_THESAURUS ); } } diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 2b93ed6213b9..1497ad8becd7 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1105,11 +1105,8 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) { LanguageType eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ); Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() ); - Locale aLocale; - SvxLanguageToLocale( aLocale, eLang ); - - if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale)) + if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale( LanguageTag( eLang).getLocale())) rSet.DisableItem( SID_THESAURUS ); } } diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index fa7f9f186d43..dbd45052df42 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -2419,7 +2419,7 @@ void SmParser::Error(SmParseError eError) SmParser::SmParser() - : m_aDotLoc( SvxCreateLocale( LANGUAGE_ENGLISH_US ) ) + : m_aDotLoc( LanguageTag( LANGUAGE_ENGLISH_US ).getLocale() ) { m_eConversion = CONVERT_NONE; bImportSymNames = m_bExportSymNames = false; diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index a7be107782d8..9097c4c79e75 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -289,9 +289,7 @@ Reference< XAccessibleStateSet > AccFrameSelector::getAccessibleStateSet( ) Locale AccFrameSelector::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException) { - Locale aRet; - SvxLanguageToLocale( aRet, Application::GetSettings().GetUILanguageTag().getLanguageType() ); - return aRet; + return Application::GetSettings().GetUILanguageTag().getLocale(); } // ---------------------------------------------------------------------------- diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 46258ada77da..aed63641d380 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -89,7 +89,7 @@ static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( Sequence< Locale > &rSeq ) sal_Int16 *pLang = aLangs.getArray(); for (sal_Int32 i = 0; i < nCount; ++i) { - pLang[i] = SvxLocaleToLanguage( pLocale[i] ); + pLang[i] = LanguageTag( pLocale[i] ).getLanguageType(); } diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index 643ec11c6b5b..f56cd5d84f17 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -84,7 +84,7 @@ void SwBreakIt::_GetLocale( const LanguageType aLang ) { aLast = aLang; delete m_pLocale; - m_pLocale = new lang::Locale( SvxCreateLocale( aLast ) ); + m_pLocale = new lang::Locale( LanguageTag( aLast ).getLocale() ); } void SwBreakIt::_GetForbidden( const LanguageType aLang ) diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 27e664249bd2..d292cd5374d6 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -254,10 +254,10 @@ SwCalc::SwCalc( SwDoc& rD ) memset( VarTable, 0, sizeof(VarTable) ); LanguageType eLang = GetDocAppScriptLang( rDoc ); - if( eLang != SvxLocaleToLanguage( pLclData->getLanguageTag().getLocale() ) || - eLang != SvxLocaleToLanguage( pCharClass->getLanguageTag().getLocale() ) ) + if( eLang != pLclData->getLanguageTag().getLanguageType() || + eLang != pCharClass->getLanguageTag().getLanguageType() ) { - LanguageTag aLanguageTag( SvxCreateLocale( eLang )); + LanguageTag aLanguageTag( eLang ); pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLanguageTag ); pLclData = new LocaleDataWrapper( aLanguageTag ); } @@ -560,7 +560,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins ) rtl::OUString sResult; double nNumber = DBL_MAX; - long nLang = SvxLocaleToLanguage( pLclData->getLanguageTag().getLocale() ); + long nLang = pLclData->getLanguageTag().getLanguageType(); if(pMgr->GetColumnCnt( sSourceName, sTableName, sColumnName, nTmpRec, nLang, sResult, &nNumber )) { @@ -1538,10 +1538,9 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, if( pDoc ) { LanguageType eLang = GetDocAppScriptLang( *pDoc ); - if (eLang != - SvxLocaleToLanguage(aSysLocale.GetLanguageTag().getLocale())) + if (eLang != aSysLocale.GetLanguageTag().getLanguageType()) { - pLclD.reset( new LocaleDataWrapper( LanguageTag( SvxCreateLocale( eLang )) ) ); + pLclD.reset( new LocaleDataWrapper( LanguageTag( eLang )) ); } } diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 3f67271694ca..dcbf6a7ff135 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -819,7 +819,7 @@ void SwCalendarWrapper::LoadDefaultCalendar( sal_uInt16 eLang ) { sUniqueId.Erase(); if( eLang != nLang ) - loadDefaultCalendar( SvxCreateLocale( nLang = eLang )); + loadDefaultCalendar( LanguageTag( nLang = eLang ).getLocale()); } LanguageType GetAppLanguage() diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 6932f5b13288..dd4bf7952725 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -93,7 +93,7 @@ void SwSortElement::Init( SwDoc* pD, const SwSortOptions& rOpt, nLang = (LanguageType)GetAppLanguage(); break; } - pLocale = new lang::Locale( SvxCreateLocale( nLang ) ); + pLocale = new lang::Locale( LanguageTag( nLang ).getLocale() ); pSortCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index a1ed01e0b113..9b06d240140d 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -274,7 +274,7 @@ SwTxtFrm* SwAutoFormat::GetFrm( const SwTxtNode& rTxtNd ) const void SwAutoFormat::_GetCharClass( LanguageType eLang ) { delete pCharClass; - pCharClass = new CharClass( LanguageTag( SvxCreateLocale( eLang ))); + pCharClass = new CharClass( LanguageTag( eLang )); eCharClassLang = eLang; } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index faae4a342c92..0f10f11e15b1 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -374,7 +374,7 @@ void SwEditShell::ApplyAutoMark() SearchOptions aSearchOpt( SearchAlgorithms_ABSOLUTE, nSrchFlags, sEmpty, sEmpty, - SvxCreateLocale( LANGUAGE_SYSTEM ), + LanguageTag( LANGUAGE_SYSTEM ).getLocale(), nLEV_Other, nLEV_Longer, nLEV_Shorter, nTransliterationFlags ); diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index ff618c819bc1..0e31c09b561c 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -397,7 +397,7 @@ bool SwAuthorityFieldType::QueryValue( Any& rVal, sal_uInt16 nWhichId ) const break; case FIELD_PROP_LOCALE: - rVal <<= SvxCreateLocale(GetLanguage()); + rVal <<= LanguageTag(GetLanguage()).getLocale(); break; case FIELD_PROP_PROP_SEQ: @@ -457,7 +457,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) { com::sun::star::lang::Locale aLocale; if( 0 != (bRet = rAny >>= aLocale )) - SetLanguage( SvxLocaleToLanguage( aLocale )); + SetLanguage( LanguageTag( aLocale ).getLanguageType()); } break; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index d434a7a2f041..7047d153aa8b 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -893,9 +893,9 @@ static void lcl_GetLocalDataWrapper( sal_uLong nLang, SvtSysLocale aLocale; *ppAppLocalData = &aLocale.GetLocaleData(); *ppLocalData = *ppAppLocalData; - if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLanguageTag().getLocale() ) ) + if( nLang != (*ppLocalData)->getLanguageTag().getLanguageType() ) *ppLocalData = new LocaleDataWrapper( - LanguageTag( SvxCreateLocale( static_cast<LanguageType>(nLang) )) ); + LanguageTag( static_cast<LanguageType>(nLang) )); } String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat, diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index eb491ec1fb21..a79e4edf4c56 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -927,7 +927,8 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc { LanguageType eLang = ((SvxLanguageItem&)aSet.Get( GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt )) ).GetLanguage(); - CharClass aCC( LanguageTag( SvxCreateLocale( eLang ))); + LanguageTag aLanguageTag( eLang); + CharClass aCC( aLanguageTag); sal_Unicode c0 = sNodeText.GetChar(0); sal_Bool bIsAlphaNum = aCC.isAlphaNumeric( sNodeText, 0 ); if( !bIsAlphaNum || diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index be7934f0cb3a..b8cafaa6447d 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -597,7 +597,7 @@ SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType ) sal_uInt32 SwValueField::GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt) { const SvNumberformat* pEntry = pFormatter->GetEntry(nFmt); - sal_uInt16 nLng = SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); + sal_uInt16 nLng = SvtSysLocale().GetLanguageTag().getLanguageType(); if (pEntry && nLng != pEntry->GetLanguage()) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 4d68397ba7d0..77d38f11c9f8 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -470,7 +470,8 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) if( !pFldTxtAttr || !pFldTxtAttr->GetpTxtNode() ) break; - LocaleDataWrapper aLocaleData( LanguageTag( SvxCreateLocale( GetLanguage() )) ); + LanguageTag aLanguageTag( GetLanguage()); + LocaleDataWrapper aLocaleData( aLanguageTag ); // erstmal ein "Kurz" - Test - falls beide im selben // Node stehen! diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 0e2cb2ab3203..5ae086531b3f 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -85,7 +85,7 @@ void SwTOXInternational::Init() { pIndexWrapper = new IndexEntrySupplierWrapper(); - const lang::Locale aLcl( SvxCreateLocale( eLang ) ); + const lang::Locale aLcl( LanguageTag( eLang ).getLocale() ); pIndexWrapper->SetLocale( aLcl ); if(!sSortAlgorithm.Len()) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 1652f9c48d54..2ae7d5efa0ee 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -179,7 +179,7 @@ lang::Locale SAL_CALL SwXFlatParagraph::getLanguageOfText(::sal_Int32 nPos, ::sa { SolarMutexGuard aGuard; if (!mpTxtNode) - return SvxCreateLocale( LANGUAGE_NONE ); + return LanguageTag( LANGUAGE_NONE ).getLocale(); const lang::Locale aLocale( SW_BREAKITER()->GetLocale( mpTxtNode->GetLang( static_cast<sal_uInt16>(nPos), static_cast<sal_uInt16>(nLen) ) ) ); return aLocale; @@ -192,7 +192,7 @@ lang::Locale SAL_CALL SwXFlatParagraph::getPrimaryLanguageOfText(::sal_Int32 nPo SolarMutexGuard aGuard; if (!mpTxtNode) - return SvxCreateLocale( LANGUAGE_NONE ); + return LanguageTag( LANGUAGE_NONE ).getLocale(); const lang::Locale aLocale( SW_BREAKITER()->GetLocale( mpTxtNode->GetLang( static_cast<sal_uInt16>(nPos), static_cast<sal_uInt16>(nLen) ) ) ); return aLocale; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index d15b5cfc4a9e..7ef8e821c5c0 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -654,7 +654,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, { throw lang::IllegalArgumentException(); } - rTOXBase.SetLanguage(SvxLocaleToLanguage(aLocale)); + rTOXBase.SetLanguage( LanguageTag(aLocale).getLanguageType()); } break; case WID_IDX_SORT_ALGORITHM: @@ -970,7 +970,7 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, } break; case WID_IDX_LOCALE: - aRet <<= SvxCreateLocale(pTOXBase->GetLanguage()); + aRet <<= LanguageTag(pTOXBase->GetLanguage()).getLocale(); break; case WID_IDX_SORT_ALGORITHM: aRet <<= OUString(pTOXBase->GetSortAlgorithm()); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 5d8dc5d347ae..aea55c81b5aa 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -2518,7 +2518,7 @@ SwUnoCursorHelper::CreateSortDescriptor(const bool bFromTable) uno::Sequence< table::TableSortField > aFields(3); table::TableSortField* pFields = aFields.getArray(); - lang::Locale aLang( SvxCreateLocale( LANGUAGE_SYSTEM ) ); + lang::Locale aLang( LanguageTag( LANGUAGE_SYSTEM).getLocale()); // get collator algorithm to be used for the locale uno::Sequence< OUString > aSeq( GetAppCollator().listCollatorAlgorithms( aLang ) ); @@ -2664,7 +2664,7 @@ sal_Bool SwUnoCursorHelper::ConvertSortProperties( lang::Locale aLocale; if (aValue >>= aLocale) { - rSortOpt.nLanguage = SvxLocaleToLanguage( aLocale ); + rSortOpt.nLanguage = LanguageTag( aLocale).getLanguageType(); } else { @@ -2773,7 +2773,7 @@ sal_Bool SwUnoCursorHelper::ConvertSortProperties( { rSortOpt.bIgnoreCase = !pFields[i].IsCaseSensitive; rSortOpt.nLanguage = - SvxLocaleToLanguage( pFields[i].CollatorLocale ); + LanguageTag( pFields[i].CollatorLocale ).getLanguageType(); aKeys[i]->sSortType = pFields[i].CollatorAlgorithm; aKeys[i]->nColumnId = static_cast<sal_uInt16>(pFields[i].Field); diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 05b52397f19c..a738f4902b6a 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -730,7 +730,7 @@ void SwXTextSearch::FillSearchOptions( util::SearchOptions& rSearchOpt ) const else rSearchOpt.algorithmType = util::SearchAlgorithms_ABSOLUTE; - rSearchOpt.Locale = SvxCreateLocale( GetAppLanguage() ); + rSearchOpt.Locale = LanguageTag( GetAppLanguage() ).getLocale(); rSearchOpt.searchString = sSearchText; rSearchOpt.replaceString = sReplaceText; diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index c00338e81720..e48f7acfb545 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5588,8 +5588,7 @@ WW8Fib::WW8Fib(sal_uInt8 nVer) else lidFE = lid; - Locale aTempLocale; - LanguageTag aLanguageTag( SvxLanguageToLocale( aTempLocale, lid )); + LanguageTag aLanguageTag( lid ); LocaleDataWrapper aLocaleWrapper( aLanguageTag ); nNumDecimalSep = aLocaleWrapper.getNumDecimalSep()[0]; } diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index b92062a343fd..fec131228900 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -141,7 +141,7 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) { ForbiddenCharacters aForbidden; aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine); - LanguageType eLang = SvxLocaleToLanguage(pLocales[i]); + LanguageType eLang = LanguageTag(pLocales[i]).getLanguageType(); pDoc->setForbiddenCharacters( eLang, aForbidden); } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 713b587378f9..6b6511c293d3 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -256,7 +256,6 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, if(xColSupp.is()) { SwWrtShell& rSh = pView->GetWrtShell(); - lang::Locale aDocLocale( SvxCreateLocale( rSh.GetCurLang() )); SvNumberFormatter* pNumFmtr = rSh.GetNumberFormatter(); SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj( pNumFmtr ); Reference< util::XNumberFormatsSupplier > xDocNumFmtsSupplier = pNumFmt; @@ -341,7 +340,7 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView, else { pNew->nDBNumFmt = SwNewDBMgr::GetDbtoolsClient().getDefaultNumberFormat(xCol, - xDocNumberFormatTypes, aDocLocale); + xDocNumberFormatTypes, LanguageTag( rSh.GetCurLang() ).getLocale()); } } @@ -1247,7 +1246,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, } } } - aDBFormatData.aLocale = SvxCreateLocale( rSh.GetCurLang() ); + aDBFormatData.aLocale = LanguageTag( rSh.GetCurLang() ).getLocale(); SwDBNextSetField aNxtDBFld( (SwDBNextSetFieldType*)rSh. GetFldType( 0, RES_DBNEXTSETFLD ), rtl::OUString("1"), aEmptyStr, aDBData ); @@ -1679,8 +1678,10 @@ void SwInsertDBColAutoPilot::Commit() if( eLang != ePrevLang ) { - lang::Locale aLocale; - aLocale = SvxLanguageToLocale( aLocale, eLang ); + /* FIXME-BCP47: handle language tags! */ + lang::Locale aLocale( LanguageTag( eLang ).getLocale()); + /* umm.. what's this string anyway, "Country-Language" instead of + * "Language-Country" ??? */ (( sPrevLang = aLocale.Country ) += rtl::OUString( '-' )) += aLocale.Language; ePrevLang = eLang; } @@ -1767,7 +1768,7 @@ void SwInsertDBColAutoPilot::Load() lang::Locale aLocale; aLocale.Language = sNumberFormatLocale.copy(0, 2); aLocale.Country = sNumberFormatLocale.copy(3, 2); - pInsDBColumn->eUsrNumFmtLng = SvxLocaleToLanguage( aLocale ); + pInsDBColumn->eUsrNumFmtLng = LanguageTag( aLocale ).getLanguageType(); pInsDBColumn->nUsrNumFmt = rNFmtr.GetEntryKey( pInsDBColumn->sUsrNumFmt, pInsDBColumn->eUsrNumFmtLng ); diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index e5ad5db5eb60..6f226ad3d484 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -1605,7 +1605,7 @@ sal_uInt16 SwFldMgr::GetCurrLanguage() const SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell(); if( pSh ) return pSh->GetCurLang(); - return SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); + return SvtSysLocale().GetLanguageTag().getLanguageType(); } void SwFieldType::_GetFldName() diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index e71b64621847..2a6f26fdbba4 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -111,7 +111,7 @@ SwFldInputDlg::SwFldInputDlg( Window *pParent, SwWrtShell &rS, pSetFld = (SwSetExpField*)pField; String sFormula(pSetFld->GetFormula()); //values are formatted - formulas are not - CharClass aCC( LanguageTag( SvxCreateLocale( pSetFld->GetLanguage() ))); + CharClass aCC( LanguageTag( pSetFld->GetLanguage() )); if( aCC.isNumeric( sFormula )) { aStr = pSetFld->ExpandField(true); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index cb73fd4b5b1c..c7cd626e9acd 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -1502,7 +1502,7 @@ IMPL_LINK_NOARG(SwTOXSelectTabPage, RadioButtonHdl) IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox) { - lang::Locale aLcl( SvxCreateLocale( aLanguageLB.GetSelectLanguage() ) ); + lang::Locale aLcl( LanguageTag( aLanguageLB.GetSelectLanguage() ).getLocale() ); Sequence< OUString > aSeq = pIndexEntryWrapper->GetAlgorithmList( aLcl ); if( !pIndexRes ) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index b754eac9d5d4..22b186108a77 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -358,8 +358,7 @@ String SwIndexMarkPane::GetDefaultPhoneticReading( const String& rText ) if( !bIsPhoneticReadingEnabled ) return aEmptyStr; - lang::Locale aLocale( SvxCreateLocale( LanguageType( nLangForPhoneticReading ) ) ); - return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, aLocale); + return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, LanguageTag( nLangForPhoneticReading ).getLocale()); } /* -------------------------------------------------- @@ -451,7 +450,7 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, sal_Bool bWordOnly, sal_Bool SearchAlgorithms_ABSOLUTE, ( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ), rSh.GetSelTxt(), OUString(), - SvxCreateLocale( GetAppLanguage() ), + LanguageTag( GetAppLanguage() ).getLocale(), 0, 0, 0, (bCaseSensitive ? 0 diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx index 7592c1612b73..53f653ed3b19 100644 --- a/sw/source/ui/lingu/hhcwrp.cxx +++ b/sw/source/ui/lingu/hhcwrp.cxx @@ -107,8 +107,8 @@ SwHHCWrapper::SwHHCWrapper( sal_Bool bIsInteractive, sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection ) : editeng::HangulHanjaConversion( &pSwView->GetEditWin(), rxContext, - SvxCreateLocale( nSourceLanguage ), - SvxCreateLocale( nTargetLanguage ), + LanguageTag( nSourceLanguage ).getLocale(), + LanguageTag( nTargetLanguage ).getLocale(), pTargetFont, nConvOptions, bIsInteractive ), diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 9bc947ef4569..f5d24ca78dd5 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -122,9 +122,10 @@ static LanguageType lcl_CheckLanguage( // if the result from language guessing does not provide a 'Country' part // try to get it by looking up the locale setting of the office. + /* FIXME-BCP47: handle language tags */ if (aLocale.Country.isEmpty()) { - lang::Locale aTmpLocale = SvxCreateLocale( nTmpLang ); + lang::Locale aTmpLocale = LanguageTag( nTmpLang ).getLocale(); if (aTmpLocale.Language == aLocale.Language) nLang = nTmpLang; } @@ -384,7 +385,7 @@ SwSpellPopup::SwSpellPopup( nCheckedLanguage = LANGUAGE_NONE; if (xSpellAlt.is()) { - nCheckedLanguage = SvxLocaleToLanguage( xSpellAlt->getLocale() ); + nCheckedLanguage = LanguageTag( xSpellAlt->getLocale() ).getLanguageType(); aSuggestions = xSpellAlt->getAlternatives(); } sal_Int16 nStringCount = static_cast< sal_Int16 >( aSuggestions.getLength() ); @@ -479,7 +480,7 @@ SwSpellPopup::SwSpellPopup( 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 && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage ) @@ -574,7 +575,7 @@ sExplanationLink( ), bGrammarResults( true ), aInfo16( SW_RES(IMG_INFO_16) ) { - nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale ); + nCheckedLanguage = LanguageTag( rResult.aLocale ).getLanguageType(); nGrammarError = nErrorInResult; bool bUseImagesInMenus = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index e73dcff83c3a..92b5acb99833 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -438,9 +438,8 @@ IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck ) IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox ) { - lang::Locale aLcl( SvxCreateLocale( m_pLangLB->GetSelectLanguage() ) ); - Sequence < OUString > aSeq( - GetAppCollator().listCollatorAlgorithms( aLcl )); + Sequence < OUString > aSeq( GetAppCollator().listCollatorAlgorithms( + LanguageTag( m_pLangLB->GetSelectLanguage()).getLocale() )); if( !pColRes ) pColRes = new CollatorResource(); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 5e56906a7160..74d3c0b6e2c5 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1239,9 +1239,8 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - lang::Locale aLocale( SvxCreateLocale( nLang ) ); if (!bIsLookUpWord || - !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) rSet.DisableItem( SID_THES ); break; } @@ -1256,7 +1255,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( SvxCreateLocale( nLang ) )) + !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) rSet.DisableItem( SID_THESAURUS ); } break; diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index 37e0f49fbfac..3c6647a7626e 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -571,9 +571,8 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - lang::Locale aLocale( SvxCreateLocale( nLang ) ); if (!bIsLookUpWord || - !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale )) + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) rSet.DisableItem( SID_THES ); //! avoid puting the same item as SfxBoolItem at the end of this function @@ -641,7 +640,7 @@ ASK_ESCAPE: LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) )) + if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) rSet.DisableItem( SID_THESAURUS ); nSlotId = 0; } diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 1a6f28d07daf..e2faab997e8b 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1364,8 +1364,9 @@ void SwTextShell::GetState( SfxItemSet &rSet ) aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord(); LanguageType nLang = rSh.GetCurLang(); - lang::Locale aLocale = SvxCreateLocale( nLang ); - String aLangText( LanguageTag( nLang ).getBcp47() ); + LanguageTag aLanguageTag( nLang); + lang::Locale aLocale( aLanguageTag.getLocale()); + String aLangText( aLanguageTag.getBcp47() ); // set word and locale to look up as status value String aStatusVal( aText ); diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 9f0e4e61ba3b..ff7d51da0cdc 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -585,8 +585,8 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, } util::SearchOptions aSearchOpt( rSearchItem.GetSearchOptions() ); - aSearchOpt.Locale = SvxCreateLocale( - static_cast< LanguageType >( GetAppLanguage() ) ); + aSearchOpt.Locale = LanguageTag( + static_cast< LanguageType >( GetAppLanguage() ) ).getLocale(); sal_uInt16 nFound; sal_Bool bAll = sal_False; diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 225d63d31a11..88cade72cf52 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -1854,7 +1854,7 @@ bool SwView::JumpToSwMark( const String& rMark ) SearchOptions aSearchOpt( SearchAlgorithms_ABSOLUTE, 0, sName, rtl::OUString(), - SvxCreateLocale( LANGUAGE_SYSTEM ), + LanguageTag( LANGUAGE_SYSTEM ).getLocale(), 0,0,0, TransliterationModules_IGNORE_CASE ); diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 466fe5da8c4f..b8f9b7b00111 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -593,7 +593,7 @@ void SwView::StartThesaurus() Reference< XThesaurus > xThes( ::GetThesaurus() ); AbstractThesaurusDialog *pDlg = NULL; - if ( !xThes.is() || !xThes->hasLocale( SvxCreateLocale( eLang ) ) ) + if ( !xThes.is() || !xThes->hasLocale( LanguageTag( eLang ).getLocale() ) ) SpellError( eLang ); else { diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index 3dfbd450c838..37d9757bee8a 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -731,7 +731,7 @@ sal_uLong SwView::FUNC_Search( const SwSearchOptions& rOptions ) // build SearchOptions to be used // SearchOptions aSearchOpt( pSrchItem->GetSearchOptions() ); - aSearchOpt.Locale = SvxCreateLocale( (sal_uInt16)GetAppLanguage() ); + aSearchOpt.Locale = LanguageTag( (sal_uInt16)GetAppLanguage() ).getLocale(); if( !bDoReplace ) aSearchOpt.replaceString = aEmptyStr; diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 3aee693a3434..cfa97d377cbf 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -293,7 +293,7 @@ void SwView::GetState(SfxItemSet &rSet) // language is not supported (by default it is enabled) uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( SvxCreateLocale( nLang ) )) + !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) rSet.DisableItem(nWhich); } } diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index 430ab33d66a1..a04a8a05ed90 100644 --- a/sw/source/ui/utlui/numfmtlb.cxx +++ b/sw/source/ui/utlui/numfmtlb.cxx @@ -103,7 +103,7 @@ void NumFormatListBox::Init(short nFormatType, sal_Bool bUsrFmts) if (pView) eCurLanguage = pView->GetWrtShell().GetCurLang(); else - eCurLanguage = SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); + eCurLanguage = SvtSysLocale().GetLanguageTag().getLanguageType(); if (bUsrFmts == sal_False) { |