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 /editeng/source/misc | |
parent | 6395c843710b59e391f10f3532442ae11fe64357 (diff) |
get rid of Svx...Locale...() double conversion nonsense
Change-Id: I21d14ff6087d1adb0ce769f2e8f8060a005250cc
Diffstat (limited to 'editeng/source/misc')
-rw-r--r-- | editeng/source/misc/forbiddencharacterstable.cxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/hangulhanja.cxx | 4 | ||||
-rw-r--r-- | editeng/source/misc/splwrap.cxx | 8 | ||||
-rw-r--r-- | editeng/source/misc/svxacorr.cxx | 22 | ||||
-rw-r--r-- | editeng/source/misc/unolingu.cxx | 34 |
5 files changed, 21 insertions, 49 deletions
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: */ |