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 | |
parent | 6395c843710b59e391f10f3532442ae11fe64357 (diff) |
get rid of Svx...Locale...() double conversion nonsense
Change-Id: I21d14ff6087d1adb0ce769f2e8f8060a005250cc
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/unolingu.hxx | 8 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 4 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleImageBullet.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editview.cxx | 5 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 37 | ||||
-rw-r--r-- | editeng/source/items/numitem.cxx | 7 | ||||
-rw-r--r-- | editeng/source/items/svxfont.cxx | 6 | ||||
-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 | ||||
-rw-r--r-- | editeng/source/uno/UnoForbiddenCharsTable.cxx | 10 |
14 files changed, 57 insertions, 96 deletions
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(); } } |