diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-13 02:54:05 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-13 11:55:16 +0200 |
commit | 358d1a99484bcc02900bd200a7606a7bf3298cac (patch) | |
tree | 031f808141dbc712553b8a4a029a354a2699a622 /sw | |
parent | 5d1a8e0d47b6d6e9e3e5735d0ee52fa0b4782202 (diff) |
use static LanguageTag::convertTo...() for standalone conversions
If no LanguageTag instance is at hand use the static methods to convert
between BCP 47 string, Locale and MS-LangID instead of creating
temporary instances.
Change-Id: I9597f768078eb81c840e84a5db5617f26bb7dc09
Diffstat (limited to 'sw')
26 files changed, 35 insertions, 35 deletions
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index e6af8f9b1f4c..009600c64268 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -816,7 +816,7 @@ void SwCalendarWrapper::LoadDefaultCalendar( sal_uInt16 eLang ) { sUniqueId.Erase(); if( eLang != nLang ) - loadDefaultCalendar( LanguageTag( nLang = eLang ).getLocale()); + loadDefaultCalendar( LanguageTag::convertToLocale( nLang = eLang )); } LanguageType GetAppLanguage() diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index ab89350ab04d..615ff3091a4d 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -82,7 +82,7 @@ void SwSortElement::Init( SwDoc* pD, const SwSortOptions& rOpt, nLang = GetAppLanguage(); break; } - pLocale = new lang::Locale( LanguageTag( nLang ).getLocale() ); + pLocale = new lang::Locale( LanguageTag::convertToLocale( nLang ) ); pSortCollator = new CollatorWrapper( ::comphelper::getProcessComponentContext() ); } diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index fb2e3b3d580a..d1fbe7965e7e 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -445,7 +445,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) { com::sun::star::lang::Locale aLocale; if( 0 != (bRet = rAny >>= aLocale )) - SetLanguage( LanguageTag( aLocale ).getLanguageType()); + SetLanguage( LanguageTag::convertToLanguageType( aLocale )); } break; diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 22e7091e00d4..20e4975f9ebe 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -75,7 +75,7 @@ void SwTOXInternational::Init() { pIndexWrapper = new IndexEntrySupplierWrapper(); - const lang::Locale aLcl( LanguageTag( eLang ).getLocale() ); + const lang::Locale aLcl( LanguageTag::convertToLocale( eLang ) ); pIndexWrapper->SetLocale( aLcl ); if(!sSortAlgorithm.Len()) diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index c1c2b92446a2..1f17df33dedf 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -191,7 +191,7 @@ lang::Locale SAL_CALL SwXFlatParagraph::getLanguageOfText(::sal_Int32 nPos, ::sa { SolarMutexGuard aGuard; if (!mpTxtNode) - return LanguageTag( LANGUAGE_NONE ).getLocale(); + return LanguageTag::convertToLocale( LANGUAGE_NONE ); const lang::Locale aLocale( SW_BREAKITER()->GetLocale( mpTxtNode->GetLang( static_cast<sal_uInt16>(nPos), static_cast<sal_uInt16>(nLen) ) ) ); return aLocale; @@ -204,7 +204,7 @@ lang::Locale SAL_CALL SwXFlatParagraph::getPrimaryLanguageOfText(::sal_Int32 nPo SolarMutexGuard aGuard; if (!mpTxtNode) - return LanguageTag( LANGUAGE_NONE ).getLocale(); + return LanguageTag::convertToLocale( LANGUAGE_NONE ); 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 cda70a19a7a9..411f5cc32947 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -638,7 +638,7 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, { throw lang::IllegalArgumentException(); } - rTOXBase.SetLanguage( LanguageTag(aLocale).getLanguageType()); + rTOXBase.SetLanguage( LanguageTag::convertToLanguageType(aLocale)); } break; case WID_IDX_SORT_ALGORITHM: diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index e03ad2729fe5..f4ac2b6dbad8 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -2808,7 +2808,7 @@ sal_Bool SwUnoCursorHelper::ConvertSortProperties( lang::Locale aLocale; if (aValue >>= aLocale) { - rSortOpt.nLanguage = LanguageTag( aLocale).getLanguageType(); + rSortOpt.nLanguage = LanguageTag::convertToLanguageType( aLocale); } else { @@ -2917,7 +2917,7 @@ sal_Bool SwUnoCursorHelper::ConvertSortProperties( { rSortOpt.bIgnoreCase = !pFields[i].IsCaseSensitive; rSortOpt.nLanguage = - LanguageTag( pFields[i].CollatorLocale ).getLanguageType(); + LanguageTag::convertToLanguageType( pFields[i].CollatorLocale ); aKeys[i]->sSortType = pFields[i].CollatorAlgorithm; aKeys[i]->nColumnId = static_cast<sal_uInt16>(pFields[i].Field); diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx index 6dccc831ecd5..963156e236d5 100644 --- a/sw/source/filter/basflt/fltini.cxx +++ b/sw/source/filter/basflt/fltini.cxx @@ -623,7 +623,7 @@ void SwAsciiOptions::ReadUserData( const String& rStr ) sFont = sToken; break; case 3: // Language - nLanguage = LanguageTag( sToken ).getLanguageType(); + nLanguage = LanguageTag::convertToLanguageType( sToken ); break; } } @@ -659,7 +659,7 @@ void SwAsciiOptions::WriteUserData( String& rStr ) // 4. Language if (nLanguage) { - OUString sTmp = LanguageTag( nLanguage ).getBcp47(); + OUString sTmp = LanguageTag::convertToBcp47( nLanguage ); rStr += (String)sTmp; } rStr += ','; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index effb4a80112b..155eaa6025bc 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2754,7 +2754,7 @@ static Writer& OutCSS1_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt ) if( LANGUAGE_DONTKNOW == eLang ) return rWrt; - String sOut = LanguageTag( eLang ).getBcp47(); + String sOut = LanguageTag::convertToBcp47( eLang ); rHTMLWrt.OutCSS1_Property( sCSS1_P_so_language, sOut ); diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index 6423ce55a1b9..3ac6243f6ad9 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -1942,7 +1942,7 @@ sal_Bool SwHTMLParser::ParseStyleOptions( const String &rStyle, if( pLang && pLang->Len() ) { - LanguageType eLang = LanguageTag( *pLang ).getLanguageType(); + LanguageType eLang = LanguageTag::convertToLanguageType( *pLang ); if( LANGUAGE_DONTKNOW != eLang ) { SvxLanguageItem aLang( eLang, RES_CHRATR_LANGUAGE ); diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index de89a5926d0c..aa4a93351feb 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -987,7 +987,7 @@ void SwHTMLParser::InsertBodyOptions() } if( aLang.Len() ) { - LanguageType eLang = LanguageTag( aLang ).getLanguageType(); + LanguageType eLang = LanguageTag::convertToLanguageType( aLang ); if( LANGUAGE_DONTKNOW != eLang ) { sal_uInt16 nWhich = 0; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 124e79f5cf9a..5df779fb17fe 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -1180,7 +1180,7 @@ void SwHTMLWriter::OutLanguage( LanguageType nLang ) sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_lang) .append("=\""); Strm() << sOut.makeStringAndClear().getStr(); - HTMLOutFuncs::Out_String( Strm(), LanguageTag(nLang).getBcp47(), + HTMLOutFuncs::Out_String( Strm(), LanguageTag::convertToBcp47(nLang), eDestEnc, &aNonConvertableCharacters ) << '"'; } } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index d7697ca0d749..1c0e257f35ce 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1199,7 +1199,7 @@ void DocxAttributeOutput::StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, co // lid lang::Locale aLocale( SwBreakIt::Get()->GetLocale( rNode.GetLang( nPos ) ) ); - OUString sLang( LanguageTag( aLocale).getBcp47() ); + OUString sLang( LanguageTag::convertToBcp47( aLocale) ); m_pSerializer->singleElementNS( XML_w, XML_lid, FSNS( XML_w, XML_val ), OUStringToOString( sLang, RTL_TEXTENCODING_UTF8 ).getStr( ), FSEND ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 32dc410f9f11..ce231d65fa78 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2424,7 +2424,7 @@ CharSet SwWW8ImplReader::GetCurrentCharSet() */ const SvxLanguageItem *pLang = (const SvxLanguageItem*)GetFmtAttr(RES_CHRATR_LANGUAGE); LanguageType eLang = pLang ? pLang->GetLanguage() : LANGUAGE_SYSTEM; - ::com::sun::star::lang::Locale aLocale(LanguageTag(eLang).getLocale()); + ::com::sun::star::lang::Locale aLocale(LanguageTag::convertToLocale(eLang)); eSrcCharSet = msfilter::util::getBestTextEncodingFromLocale(aLocale); } } diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index 4cb564cf899d..b3fb4af34387 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -154,17 +154,17 @@ SfxItemSet* SwModule::CreateItemSet( sal_uInt16 nId ) Any aLang = aLinguCfg.GetProperty(OUString("DefaultLocale")); aLang >>= aLocale; - nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), LATIN); + nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), LATIN); pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE)); aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CJK")); aLang >>= aLocale; - nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), ASIAN); + nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), ASIAN); pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE)); aLang = aLinguCfg.GetProperty(OUString("DefaultLocale_CTL")); aLang >>= aLocale; - nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag(aLocale).getLanguageType(false), COMPLEX); + nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aLocale, false), COMPLEX); pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE)); } if(bTextDialog) diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 58d77b9afbd3..5b373892e7d9 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -121,7 +121,7 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) { ForbiddenCharacters aForbidden; aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine); - LanguageType eLang = LanguageTag(pLocales[i]).getLanguageType(); + LanguageType eLang = LanguageTag::convertToLanguageType(pLocales[i]); pDoc->setForbiddenCharacters( eLang, aForbidden); } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index a237b50ab95b..d43b1328331a 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1670,7 +1670,7 @@ void SwInsertDBColAutoPilot::Commit() if( eLang != ePrevLang ) { - sPrevLang = LanguageTag( eLang ).getBcp47(); + sPrevLang = LanguageTag::convertToBcp47( eLang ); ePrevLang = eLang; } @@ -1761,7 +1761,7 @@ void SwInsertDBColAutoPilot::Load() * case-insensitive equal language/country combos that may have * worked, for all others not. FIXME if you need to read old * data that you were never able to read before. */ - pInsDBColumn->eUsrNumFmtLng = LanguageTag( sNumberFormatLocale ).getLanguageType(); + pInsDBColumn->eUsrNumFmtLng = LanguageTag::convertToLanguageType( sNumberFormatLocale ); pInsDBColumn->nUsrNumFmt = rNFmtr.GetEntryKey( pInsDBColumn->sUsrNumFmt, pInsDBColumn->eUsrNumFmtLng ); diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index e9cf706b5003..cab0acc72c4b 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -346,7 +346,7 @@ String SwIndexMarkPane::GetDefaultPhoneticReading( const String& rText ) if( !bIsPhoneticReadingEnabled ) return aEmptyStr; - return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, LanguageTag( nLangForPhoneticReading ).getLocale()); + return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, LanguageTag::convertToLocale( nLangForPhoneticReading )); } /* -------------------------------------------------- diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx index 5867e1207bd4..faa5e662bedd 100644 --- a/sw/source/ui/lingu/hhcwrp.cxx +++ b/sw/source/ui/lingu/hhcwrp.cxx @@ -95,8 +95,8 @@ SwHHCWrapper::SwHHCWrapper( bool bIsInteractive, bool bStart, bool bOther, bool bSelection ) : editeng::HangulHanjaConversion( &pSwView->GetEditWin(), rxContext, - LanguageTag( nSourceLanguage ).getLocale(), - LanguageTag( nTargetLanguage ).getLocale(), + LanguageTag::convertToLocale( nSourceLanguage ), + LanguageTag::convertToLocale( nTargetLanguage ), pTargetFont, nConvOptions, bIsInteractive ) diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index 43398e11e8ee..1909479b1b62 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -490,7 +490,7 @@ sExplanationLink( ), bGrammarResults( true ), aInfo16( SW_RES(IMG_INFO_16) ) { - nCheckedLanguage = LanguageTag( rResult.aLocale ).getLanguageType(); + nCheckedLanguage = LanguageTag::convertToLanguageType( rResult.aLocale ); nGrammarError = nErrorInResult; bool bUseImagesInMenus = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index ab95b129dbb7..f1c54f1870ca 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1324,7 +1324,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!bIsLookUpWord || - !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) rSet.DisableItem( SID_THES ); break; } @@ -1339,7 +1339,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || - !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) + !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) rSet.DisableItem( SID_THESAURUS ); } break; diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index b533ea1b5fa4..547ba2e2f1fb 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -604,7 +604,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) // disable "Thesaurus" context menu entry if there is nothing to look up uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!bIsLookUpWord || - !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) + !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) rSet.DisableItem( SID_THES ); //! avoid putting the same item as SfxBoolItem at the end of this function @@ -714,7 +714,7 @@ ASK_ESCAPE: LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); - if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag( nLang ).getLocale() )) + if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) rSet.DisableItem( SID_THESAURUS ); nSlotId = 0; } diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 98d0dfc306f9..fc497fd71c49 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -579,7 +579,7 @@ void SwView::StartThesaurus() Reference< XThesaurus > xThes( ::GetThesaurus() ); AbstractThesaurusDialog *pDlg = NULL; - if ( !xThes.is() || !xThes->hasLocale( LanguageTag( eLang ).getLocale() ) ) + if ( !xThes.is() || !xThes->hasLocale( LanguageTag::convertToLocale( eLang ) ) ) SpellError( eLang ); else { diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx index 21aa946afce2..91a3d4df07d3 100644 --- a/sw/source/ui/uiview/viewstat.cxx +++ b/sw/source/ui/uiview/viewstat.cxx @@ -299,7 +299,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( LanguageTag( nLang ).getLocale() )) + !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) rSet.DisableItem(nWhich); } } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index beefaf1e196d..ae06e5756771 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3329,7 +3329,7 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( break; if (LANGUAGE_NONE != *it) { - pLanguage[nCount] = LanguageTag( *it ).getLocale(); + pLanguage[nCount] = LanguageTag::convertToLocale( *it ); pLanguage[nCount].Language = aLangTab.GetString( *it ); nCount += 1; } diff --git a/sw/source/ui/vba/vbastyle.cxx b/sw/source/ui/vba/vbastyle.cxx index bcf6be337ed0..b96dc992028b 100644 --- a/sw/source/ui/vba/vbastyle.cxx +++ b/sw/source/ui/vba/vbastyle.cxx @@ -52,7 +52,7 @@ sal_Int32 SwVbaStyle::getLanguageID( const uno::Reference< beans::XPropertySet > { lang::Locale aLocale; xTCProps->getPropertyValue("CharLocale") >>= aLocale; - return LanguageTag( aLocale ).getLanguageType( false); + return LanguageTag::convertToLanguageType( aLocale, false); } void SwVbaStyle::setLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (uno::RuntimeException) |