diff options
author | Eike Rathke <erack@redhat.com> | 2012-11-23 23:06:10 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-11-23 23:09:16 +0100 |
commit | af60316514f3ae3d4c475819bf86f2af837171e3 (patch) | |
tree | ccfbd673bd4a53047a04dad6457d09c7eea1566c | |
parent | prepend module local include (diff) | |
download | core-af60316514f3ae3d4c475819bf86f2af837171e3.tar.gz core-af60316514f3ae3d4c475819bf86f2af837171e3.zip |
some i18n wrappers with LanguageTag
Change-Id: I2ceaa3159e8669c2c569fa8559c1e061dcad399d
102 files changed, 373 insertions, 374 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index c95ac09bbf5f..7d0e7b4433b3 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -279,7 +279,7 @@ String EditorWindow::GetWordAtCursor() const TextPaM& rSelStart = rSelection.GetStart(); const TextPaM& rSelEnd = rSelection.GetEnd(); String aText = pTextEngine->GetText( rSelEnd.GetPara() ); - CharClass aClass( ::comphelper::getProcessComponentContext() , Application::GetSettings().GetLanguageTag().getLocale() ); + CharClass aClass( ::comphelper::getProcessComponentContext() , Application::GetSettings().GetLanguageTag() ); xub_StrLen nSelStart = static_cast< xub_StrLen >( rSelStart.GetIndex() ); xub_StrLen nSelEnd = static_cast< xub_StrLen >( rSelEnd.GetIndex() ); xub_StrLen nLength = static_cast< xub_StrLen >( aText.Len() ); diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index 3826f5a31783..644b816e2219 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -1194,7 +1194,7 @@ namespace basctl if ( _eListType == DocumentsSorted ) { CollatorWrapper aCollator( ::comphelper::getProcessServiceFactory() ); - aCollator.loadDefaultCollator( SvtSysLocale().GetLocaleData().getLocale(), 0 ); + aCollator.loadDefaultCollator( SvtSysLocale().GetLanguageTag().getLocale(), 0 ); ::std::sort( aScriptDocs.begin(), aScriptDocs.end(), DocumentTitleLess( aCollator ) ); } diff --git a/basic/source/comp/basiccharclass.cxx b/basic/source/comp/basiccharclass.cxx index 4b905d79bd50..23d814409de7 100644 --- a/basic/source/comp/basiccharclass.cxx +++ b/basic/source/comp/basiccharclass.cxx @@ -100,7 +100,7 @@ bool BasicCharClass::isLetterUnicode( sal_Unicode c ) { static CharClass* pCharClass = NULL; if( pCharClass == NULL ) - pCharClass = new CharClass( Application::GetSettings().GetLanguageTag().getLocale() ); + pCharClass = new CharClass( Application::GetSettings().GetLanguageTag() ); // can we get pCharClass to accept a sal_Unicode instead of this waste? return pCharClass->isLetter( rtl::OUString(c), 0 ); } diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 27ba48faa523..8f1ac5d90f05 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -133,13 +133,13 @@ static long GetDayDiff( const Date& rDate ); static const CharClass& GetCharClass( void ) { static bool bNeedsInit = true; - static lang::Locale aLocale; + static LanguageTag aLanguageTag( LANGUAGE_SYSTEM); if( bNeedsInit ) { bNeedsInit = false; - aLocale = Application::GetSettings().GetLanguageTag().getLocale(); + aLanguageTag = Application::GetSettings().GetLanguageTag(); } - static CharClass aCharClass( aLocale ); + static CharClass aCharClass( aLanguageTag ); return aCharClass; } diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index a30e6aafc77b..6d2fcb82b74c 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1081,7 +1081,7 @@ void lcl_switchToDateCategories( const Reference< XChartDocument >& xChartDoc, c //set a date format to the axis sal_Bool bCreate = sal_True; const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); - Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLocaleDataWrapper.getLocale(), bCreate ); + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLocaleDataWrapper.getLanguageTag().getLocale(), bCreate ); if( aKeySeq.getLength() ) { xAxisProps->setPropertyValue( C2U("NumberFormat"), uno::makeAny(aKeySeq[0]) ); @@ -1176,7 +1176,7 @@ sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberForm sal_Bool bCreate = sal_True; const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, - rLocaleDataWrapper.getLocale(), bCreate ); + rLocaleDataWrapper.getLanguageTag().getLocale(), bCreate ); if( aKeySeq.getLength() ) { nRet = aKeySeq[0]; @@ -1204,7 +1204,7 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF sal_Bool bCreate = sal_True; const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT, - rLocaleDataWrapper.getLocale(), bCreate ); + rLocaleDataWrapper.getLanguageTag().getLocale(), bCreate ); if( aKeySeq.getLength() ) { nRet = aKeySeq[0]; diff --git a/connectivity/Library_flat.mk b/connectivity/Library_flat.mk index 32e46440dc66..23e91174431b 100644 --- a/connectivity/Library_flat.mk +++ b/connectivity/Library_flat.mk @@ -43,6 +43,7 @@ $(eval $(call gb_Library_use_libraries,flat,\ tl \ svl \ utl \ + i18nisolang1 \ sal \ salhelper \ dbtools \ diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 0d57cb18b971..9fe48f0abe24 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/util/NumberFormat.hpp> #include <com/sun/star/util/NumberFormatter.hpp> #include <unotools/configmgr.hxx> -#include <i18npool/mslangid.hxx> +#include <i18npool/languagetag.hxx> #include "connectivity/dbconversion.hxx" #include "file/quotedstring.hxx" #include <unotools/syslocale.hxx> @@ -109,7 +109,7 @@ void OFlatTable::fillColumns(const ::com::sun::star::lang::Locale& _aLocale) m_aScales.assign(nFieldCount+1,-1); const sal_Bool bCase = m_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(); - CharClass aCharClass( comphelper::getComponentContext(pConnection->getDriver()->getFactory()), _aLocale); + CharClass aCharClass( comphelper::getComponentContext(pConnection->getDriver()->getFactory()), LanguageTag( _aLocale)); // read description const sal_Unicode cDecimalDelimiter = pConnection->getDecimalDelimiter(); const sal_Unicode cThousandDelimiter = pConnection->getThousandDelimiter(); @@ -418,7 +418,7 @@ void OFlatTable::construct() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "flat", "Ocke.Janssen@sun.com", "OFlatTable::construct" ); SvtSysLocale aLocale; - ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLocaleDataPtr()->getLocale()); + ::com::sun::star::lang::Locale aAppLocale(aLocale.GetLanguageTag().getLocale()); Sequence< ::com::sun::star::uno::Any > aArg(1); aArg[0] <<= aAppLocale; diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index ed20545e12fe..9a0819d0893a 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -306,6 +306,7 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl) Locale aLocale; LanguageType eSelectLanguage = aLanguageLB.GetSelectLanguage(); SvxLanguageToLocale(aLocale, eSelectLanguage ); + LanguageTag aLanguageTag( aLocale); OUString sStart, sEnd; sal_Bool bAvail; @@ -349,7 +350,7 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl) } if(!bAvail) { - LocaleDataWrapper aWrap( aLocale ); + LocaleDataWrapper aWrap( aLanguageTag ); ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters(); sStart = aForbidden.beginLine; sEnd = aForbidden.endLine; diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 091e166d7710..b18c8bbbe6ea 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -376,7 +376,7 @@ sal_uInt16 SvxEditDictionaryDialog::GetLBInsertPos(const String &rDicWord) { sal_uInt16 nPos = USHRT_MAX; - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ); + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ); const CollatorWrapper* pCollator = aIntlWrapper.getCollator(); sal_uInt16 j; for( j = 0; j < aWordsLB.GetEntryCount(); j++ ) diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index f4d8abab76d7..eeb29f1d8c70 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -1893,7 +1893,8 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox ) // obtain corresponding locale data Locale aTempLocale; SvxLanguageToLocale( aTempLocale, eLang ); - LocaleDataWrapper aLocaleWrapper( aTempLocale ); + LanguageTag aLanguageTag( aTempLocale); + LocaleDataWrapper aLocaleWrapper( aLanguageTag ); // update the decimal separator key of the related CheckBox String sTempLabel(sDecimalSeparatorLabel); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 3aa711228ea2..e5d53eac962b 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -884,10 +884,10 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, SfxModule *pMod = *(SfxModule**)GetAppData(SHL_WRITER); bSWriter = pMod == SfxModule::GetActiveModule(); - ::com::sun::star::lang::Locale aLocale( SvxCreateLocale(eLastDialogLanguage )); + LanguageTag aLanguageTag( SvxCreateLocale(eLastDialogLanguage )); pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLocale, 0 ); - pCharClass = new CharClass( aLocale ); + pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 ); + pCharClass = new CharClass( aLanguageTag ); static long nTabs[] = { 2 /* Tab-Count */, 1, 61 }; aReplaceTLB.SetTabs( &nTabs[0], MAP_APPFONT ); @@ -1087,10 +1087,10 @@ void OfaAutocorrReplacePage::SetLanguage(LanguageType eSet) delete pCompareClass; delete pCharClass; - ::com::sun::star::lang::Locale aLocale( SvxCreateLocale(eLastDialogLanguage )); + LanguageTag aLanguageTag( SvxCreateLocale(eLastDialogLanguage )); pCompareClass = new CollatorWrapper( GetProcessFact() ); - pCompareClass->loadDefaultCollator( aLocale, 0 ); - pCharClass = new CharClass( aLocale ); + pCompareClass->loadDefaultCollator( aLanguageTag.getLocale(), 0 ); + pCharClass = new CharClass( aLanguageTag ); ModifyHdl(&aShortED); } } diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 1042d84531bc..04c531e4bbb7 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -1714,7 +1714,7 @@ void ORowSet::impl_initializeColumnSettings_nothrow( const Reference< XPropertyS bHaveAnyColumnSetting = true; } if ( !nFormatKey && m_xNumberFormatTypes.is() ) - nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLocaleData().getLocale() ); + nFormatKey = ::dbtools::getDefaultNumberFormat( _rxTemplateColumn, m_xNumberFormatTypes, SvtSysLocale().GetLanguageTag().getLocale() ); _rxRowSetColumn->setPropertyValue( PROPERTY_NUMBERFORMAT, makeAny( nFormatKey ) ); } catch(Exception&) @@ -1809,7 +1809,7 @@ void ORowSet::execute_NoApprove_NoNewConn(ResettableMutexGuard& _rClearForNotifi } // get the locale - Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); + Locale aLocale = SvtSysLocale().GetLanguageTag().getLocale(); // get the numberformatTypes OSL_ENSURE(m_xActiveConnection.is(),"No ActiveConnection"); @@ -2746,7 +2746,7 @@ ORowSetClone::ORowSetClone( const ::comphelper::ComponentContext& _rContext, ORo ::std::vector< ::rtl::OUString> aNames; ::rtl::OUString aDescription; - Locale aLocale = SvtSysLocale().GetLocaleData().getLocale(); + Locale aLocale = SvtSysLocale().GetLanguageTag().getLocale(); if ( rParent.m_pColumns ) { diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index e078e1e28c4c..837836d311f9 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -256,7 +256,7 @@ OSingleSelectQueryComposer::OSingleSelectQueryComposer(const Reference< XNameAcc m_aCurrentColumns.resize(4); - m_aLocale = SvtSysLocale().GetLocaleData().getLocale(); + m_aLocale = SvtSysLocale().GetLanguageTag().getLocale(); m_xNumberFormatsSupplier = dbtools::getNumberFormats( m_xConnection, sal_True, m_aContext.getLegacyServiceFactory() ); Reference< XLocaleData4 > xLocaleData( LocaleData::create(m_aContext.getUNOContext()) ); LocaleDataItem aData = xLocaleData->getLocaleItem(m_aLocale); diff --git a/dbaccess/source/ui/app/AppView.cxx b/dbaccess/source/ui/app/AppView.cxx index 3e3469d7ce11..a57b03dd30d9 100644 --- a/dbaccess/source/ui/app/AppView.cxx +++ b/dbaccess/source/ui/app/AppView.cxx @@ -212,7 +212,7 @@ OApplicationView::OApplicationView( Window* pParent try { - m_aLocale = SvtSysLocale().GetLocaleData().getLocale(); + m_aLocale = SvtSysLocale().GetLanguageTag().getLocale(); } catch(Exception&) { diff --git a/dbaccess/source/ui/control/ColumnControlWindow.cxx b/dbaccess/source/ui/control/ColumnControlWindow.cxx index ca661bceaa08..2c12e84d07ba 100644 --- a/dbaccess/source/ui/control/ColumnControlWindow.cxx +++ b/dbaccess/source/ui/control/ColumnControlWindow.cxx @@ -50,7 +50,7 @@ OColumnControlWindow::OColumnControlWindow(Window* pParent DBG_CTOR(OColumnControlWindow,NULL); setRightAligned(); - m_aLocale = SvtSysLocale().GetLocaleData().getLocale(); + m_aLocale = SvtSysLocale().GetLanguageTag().getLocale(); } // ----------------------------------------------------------------------------- OColumnControlWindow::~OColumnControlWindow() diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx index 09092f23d22d..eb3a755d7115 100644 --- a/dbaccess/source/ui/misc/DExport.cxx +++ b/dbaccess/source/ui/misc/DExport.cxx @@ -135,7 +135,7 @@ ODatabaseExport::ODatabaseExport(sal_Int32 nRows, try { SvtSysLocale aSysLocale; - m_aLocale = aSysLocale.GetLocaleData().getLocale(); + m_aLocale = aSysLocale.GetLanguageTag().getLocale(); } catch(Exception&) { @@ -177,7 +177,7 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection, try { SvtSysLocale aSysLocale; - m_aLocale = aSysLocale.GetLocaleData().getLocale(); + m_aLocale = aSysLocale.GetLanguageTag().getLocale(); } catch(Exception&) { diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index e414c9cebf59..ab1db7fae207 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -142,7 +142,7 @@ ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& try { SvtSysLocale aSysLocale; - m_aLocale = aSysLocale.GetLocaleData().getLocale(); + m_aLocale = aSysLocale.GetLanguageTag().getLocale(); } catch(Exception&) { @@ -260,7 +260,7 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor try { SvtSysLocale aSysLocale; - m_aLocale = aSysLocale.GetLocaleData().getLocale(); + m_aLocale = aSysLocale.GetLanguageTag().getLocale(); } catch(Exception&) { diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 13446b2d9c53..cf4fc38d123e 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2514,7 +2514,7 @@ OQueryDesignView::OQueryDesignView( OQueryContainerWindow* _pParent, try { SvtSysLocale aSysLocale; - m_aLocale = aSysLocale.GetLocaleData().getLocale(); + m_aLocale = aSysLocale.GetLanguageTag().getLocale(); m_sDecimalSep = aSysLocale.GetLocaleData().getNumDecimalSep(); } catch(Exception&) diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index f6b3124c4e1e..499d2149c594 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -198,7 +198,7 @@ OTableDesignView::OTableDesignView( Window* pParent, try { - m_aLocale = SvtSysLocale().GetLocaleData().getLocale(); + m_aLocale = SvtSysLocale().GetLanguageTag().getLocale(); } catch(Exception&) { diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 8b191ea116fb..6a42c910ee67 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1362,12 +1362,12 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie String aComplete; LanguageType eLang = pImpEditEngine->GetLanguage( EditPaM( aStart.GetNode(), aStart.GetIndex()+1)); - lang::Locale aLocale( LanguageTag( eLang).getLocale()); + LanguageTag aLanguageTag( eLang); if (!pImpEditEngine->xLocaleDataWrapper.isInitialized()) - pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), aLocale, eLang); + pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), aLanguageTag); else - pImpEditEngine->xLocaleDataWrapper.changeLocale( aLocale, eLang); + pImpEditEngine->xLocaleDataWrapper.changeLocale( aLanguageTag); if (!pImpEditEngine->xTransliterationWrapper.isInitialized()) pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), eLang, i18n::TransliterationModules_IGNORE_CASE); diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 7077905f2aa0..61cf0db1d689 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -110,7 +110,7 @@ OUString SvxFont::CalcCaseMap(const OUString &rTxt) const const LanguageType eLng = LANGUAGE_DONTKNOW == eLang ? LANGUAGE_SYSTEM : eLang; - CharClass aCharClass( SvxCreateLocale( eLng ) ); + CharClass aCharClass( LanguageTag( SvxCreateLocale( eLng )) ); switch( eCaseMap ) { @@ -221,7 +221,7 @@ void SvxFont::DoOnCapitals(SvxDoCapitals &rDo, const xub_StrLen nPartLen) const const LanguageType eLng = LANGUAGE_DONTKNOW == eLang ? LANGUAGE_SYSTEM : eLang; - CharClass aCharClass( SvxCreateLocale( eLng ) ); + CharClass aCharClass( LanguageTag( SvxCreateLocale( eLng )) ); String aCharString; while( nPos < nTxtLen ) diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index 5c4f3c8a0ff8..8365f32fb704 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, SvxCreateLocale( nLanguage ) ); + LocaleDataWrapper aWrapper( m_xContext, LanguageTag( SvxCreateLocale( nLanguage )) ); maMap[ nLanguage ] = aWrapper.getForbiddenCharacters(); pForbiddenCharacters = &maMap[ nLanguage ]; } diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index c51519626153..4083d6bb5ca5 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -607,7 +607,7 @@ namespace editeng { // found asian text // determine if it's Hangul - CharClass aCharClassificaton( m_xContext, m_aSourceLocale ); + CharClass aCharClassificaton( m_xContext, LanguageTag( m_aSourceLocale) ); sal_Int16 nScript = aCharClassificaton.getScript( m_sCurrentPortion, sal::static_int_cast< sal_uInt16 >(nNextAsianScript) ); if ( ( UnicodeScript_kHangulJamo == nScript ) || ( UnicodeScript_kHangulCompatibilityJamo == nScript ) diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 9bce44939317..7a322f33ed95 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -202,13 +202,11 @@ static sal_uInt16 GetAppLang() } static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang ) { - static LocaleDataWrapper aLclDtWrp( SvxCreateLocale( GetAppLang() ) ); - ::com::sun::star::lang::Locale aLcl( SvxCreateLocale( nLang )); - const ::com::sun::star::lang::Locale& rLcl = aLclDtWrp.getLoadedLocale(); - if( aLcl.Language != rLcl.Language || - aLcl.Country != rLcl.Country || - aLcl.Variant != rLcl.Variant ) - aLclDtWrp.setLocale( aLcl ); + static LocaleDataWrapper aLclDtWrp( LanguageTag( SvxCreateLocale( GetAppLang() )) ); + LanguageTag aLcl( LanguageTag( SvxCreateLocale( nLang ))); + const LanguageTag& rLcl = aLclDtWrp.getLoadedLanguageTag(); + if( aLcl != rLcl ) + aLclDtWrp.setLanguageTag( aLcl ); return aLclDtWrp; } static TransliterationWrapper& GetIgnoreTranslWrapper() @@ -339,7 +337,7 @@ SvxAutoCorrect::~SvxAutoCorrect() void SvxAutoCorrect::_GetCharClass( LanguageType eLang ) { delete pCharClass; - pCharClass = new CharClass( SvxCreateLocale( eLang )); + pCharClass = new CharClass( LanguageTag( SvxCreateLocale( eLang ))); eCharClassLang = eLang; } @@ -468,7 +466,7 @@ sal_Bool SvxAutoCorrect::FnChgOrdinalNumber( if ( xOrdSuffix.is( ) ) { - uno::Sequence< rtl::OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLocale( ) ); + uno::Sequence< rtl::OUString > aSuffixes = xOrdSuffix->getOrdinalSuffix( nNum, rCC.getLanguageTag().getLocale( ) ); for ( sal_Int32 nSuff = 0; nSuff < aSuffixes.getLength(); nSuff++ ) { String sSuffix( aSuffixes[ nSuff ] ); @@ -611,7 +609,7 @@ sal_Bool SvxAutoCorrect::FnAddNonBrkSpace( bool bRet = false; CharClass& rCC = GetCharClass( eLang ); - const lang::Locale rLocale = rCC.getLocale( ); + const lang::Locale rLocale = rCC.getLanguageTag().getLocale( ); if ( rLocale.Language == OUString( "fr" ) ) { diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 8d57aebd4253..a9f6f9bca84c 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -261,8 +261,7 @@ namespace pcr getTypedControlWindow()->EnableEmptyField( sal_True ); // determine a default format - Locale aSysLocale = SvtSysLocale().GetLocaleData().getLocale(); - LanguageType eSysLanguage = LanguageTag( aSysLocale ).getLanguageType( false); + LanguageType eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false); getTypedControlWindow()->SetFormatter( getTypedControlWindow()->StandardFormatter() ); SvNumberFormatter* pFormatter = getTypedControlWindow()->GetFormatter(); diff --git a/extensions/source/propctrlr/xsdvalidationhelper.cxx b/extensions/source/propctrlr/xsdvalidationhelper.cxx index 26137db4b935..bca2aee38bb4 100644 --- a/extensions/source/propctrlr/xsdvalidationhelper.cxx +++ b/extensions/source/propctrlr/xsdvalidationhelper.cxx @@ -353,7 +353,7 @@ namespace pcr return; // and the standard format for the given NumberFormat type - sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLocaleData().getLocale() ); + sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLanguageTag().getLocale() ); // set this at the introspectee m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, makeAny( nDesiredFormat ) ); diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index b66a3971dce3..e6d598a97e1c 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -148,9 +148,7 @@ Reference< XNumberFormatsSupplier > StandardFormatsSupplier::get( const Referenc return xSupplier; // get the Office's locale - const Locale& rSysLocale = SvtSysLocale().GetLocaleData().getLocale(); - // translate - eSysLanguage = LanguageTag( rSysLocale ).getLanguageType( false); + eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false); } StandardFormatsSupplier* pSupplier = new StandardFormatsSupplier( _rxORB, eSysLanguage ); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index b95af5f80936..2a6a9d8ed05f 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -141,7 +141,7 @@ ToolbarsMenuController::ToolbarsMenuController( const ::com::sun::star::uno::Ref m_aPropResourceURL( "ResourceURL" ), m_bModuleIdentified( sal_False ), m_bResetActive( sal_False ), - m_aIntlWrapper( xServiceManager, Application::GetSettings().GetLanguageTag().getLocale() ) + m_aIntlWrapper( xServiceManager, Application::GetSettings().GetLanguageTag() ) { } diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index 4582a663867a..91bdfe42705a 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -202,10 +202,11 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() // Once for each of it's supported locales. for (sal_Int32 i = 0; i < nLocales; ++i) { + LanguageTag aLanguageTag( aDictIt->aLocaleNames[i] ); aDicts[k].aPtr = NULL; aDicts[k].eEnc = RTL_TEXTENCODING_DONTKNOW; - aDicts[k].aLoc = LanguageTag( aDictIt->aLocaleNames[i] ).getLocale(); - aDicts[k].apCC = new CharClass( aDicts[k].aLoc ); + aDicts[k].aLoc = aLanguageTag.getLocale(); + aDicts[k].apCC = new CharClass( aLanguageTag ); // also both files have to be in the same directory and the // file names must only differ in the extension (.aff/.dic). // Thus we use the first location only and strip the extension part. diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index 22c96229c916..5adc00702cf8 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -231,10 +231,11 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales() // Once for each of it's supported locales. for (sal_Int32 i = 0; i < nLocales; ++i) { + LanguageTag aLanguageTag( aDictIt->aLocaleNames[i] ); aThes[k] = NULL; aTEncs[k] = RTL_TEXTENCODING_DONTKNOW; - aTLocs[k] = LanguageTag( aDictIt->aLocaleNames[i] ).getLocale(); - aCharSetInfo[k] = new CharClass( aTLocs[k] ); + aTLocs[k] = aLanguageTag.getLocale(); + aCharSetInfo[k] = new CharClass( aLanguageTag ); // also both files have to be in the same directory and the // file names must only differ in the extension (.aff/.dic). // Thus we use the first location only and strip the extension part. diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 53afb419e952..542a82367d01 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -77,14 +77,12 @@ osl::Mutex & GetLinguMutex() LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ) { static LocaleDataWrapper aLclDtaWrp( - CreateLocale( SvtSysLocale().GetLanguageTag().getLanguageType() ) ); - - const Locale &rLcl = aLclDtaWrp.getLoadedLocale(); - Locale aLcl( CreateLocale( nLang ) ); - if (aLcl.Language != rLcl.Language || - aLcl.Country != rLcl.Country || - aLcl.Variant != rLcl.Variant) - aLclDtaWrp.setLocale( aLcl ); + LanguageTag( CreateLocale( SvtSysLocale().GetLanguageTag().getLanguageType() )) ); + + const LanguageTag &rLcl = aLclDtaWrp.getLoadedLanguageTag(); + LanguageTag aLcl( CreateLocale( nLang ) ); + if (aLcl != rLcl) + aLclDtaWrp.setLanguageTag( aLcl ); return aLclDtaWrp; } @@ -600,7 +598,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( static CharClass & lcl_GetCharClass() { - static CharClass aCC( CreateLocale( LANGUAGE_ENGLISH_US ) ); + static CharClass aCC( LanguageTag( CreateLocale( LANGUAGE_ENGLISH_US )) ); return aCC; } @@ -617,7 +615,7 @@ sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int MutexGuard aGuard( lcl_GetCharClassMutex() ); CharClass &rCC = lcl_GetCharClass(); - rCC.setLocale( CreateLocale( nLanguage ) ); + rCC.setLanguageTag( LanguageTag( CreateLocale( nLanguage )) ); sal_Int32 nFlags = rCC.getStringType( rText, nPos, nLen ); return (nFlags & KCharacterType::UPPER) && !(nFlags & KCharacterType::LOWER); @@ -629,7 +627,7 @@ String ToLower( const String &rText, sal_Int16 nLanguage ) MutexGuard aGuard( lcl_GetCharClassMutex() ); CharClass &rCC = lcl_GetCharClass(); - rCC.setLocale( CreateLocale( nLanguage ) ); + rCC.setLanguageTag( LanguageTag( CreateLocale( nLanguage )) ); return rCC.lowercase( rText ); } diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx index b4258e7334c5..118ef5012a5b 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -251,7 +251,7 @@ namespace rptui Reference< XNumberFormatTypes > xNumFmtTypes( xSuppNumFmts->getNumberFormats(), UNO_QUERY_THROW ); nFormatKey = ::dbtools::getDefaultNumberFormat( field->nDataType, field->nScale, field->bIsCurrency, xNumFmtTypes, - SvtSysLocale().GetLocaleData().getLocale() ); + SvtSysLocale().GetLanguageTag().getLocale() ); _rxFormatted->setFormatKey( nFormatKey ); } catch( const Exception& ) diff --git a/reportdesign/source/ui/dlg/DateTime.cxx b/reportdesign/source/ui/dlg/DateTime.cxx index 22aaa324732e..38e2ec561268 100644 --- a/reportdesign/source/ui/dlg/DateTime.cxx +++ b/reportdesign/source/ui/dlg/DateTime.cxx @@ -74,7 +74,7 @@ ODateTimeDialog::ODateTimeDialog( Window* _pParent try { SvtSysLocale aSysLocale; - m_nLocale = aSysLocale.GetLocaleData().getLocale(); + m_nLocale = aSysLocale.GetLanguageTag().getLocale(); // Fill listbox with all well known date types InsertEntry(util::NumberFormat::DATE); InsertEntry(util::NumberFormat::TIME); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 3b6e40ceed73..4d314ce1098a 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -1174,7 +1174,7 @@ IntlWrapper* ScGlobal::GetScIntlWrapper() { if ( !pScIntlWrapper ) { - pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *GetLocale() ); + pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), LanguageTag( *GetLocale()) ); } return pScIntlWrapper; } diff --git a/sc/source/core/data/globalx.cxx b/sc/source/core/data/globalx.cxx index 5c00e72d893f..c081f1c4818a 100644 --- a/sc/source/core/data/globalx.cxx +++ b/sc/source/core/data/globalx.cxx @@ -153,7 +153,7 @@ String ScGlobal::GetOrdinalSuffix( sal_Int32 nNumber) try { uno::Sequence< rtl::OUString > aSuffixes = xOrdinalSuffix->getOrdinalSuffix( nNumber, - ScGlobal::pLocaleData->getLocale()); + ScGlobal::pLocaleData->getLanguageTag().getLocale()); if ( aSuffixes.getLength() > 0 ) return aSuffixes[0]; else diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 9771136c5512..026486233e42 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -211,12 +211,9 @@ bool ScCompiler::IsEnglishSymbol( const String& rName ) void ScCompiler::InitCharClassEnglish() { - ::com::sun::star::lang::Locale aLocale( - OUString( RTL_CONSTASCII_USTRINGPARAM( "en")), - OUString( RTL_CONSTASCII_USTRINGPARAM( "US")), - OUString()); + ::com::sun::star::lang::Locale aLocale( "en", "US", ""); pCharClassEnglish = new CharClass( - ::comphelper::getProcessComponentContext(), aLocale); + ::comphelper::getProcessComponentContext(), LanguageTag( aLocale)); } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index b16dba405d84..8f5a24e5cd90 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2301,7 +2301,7 @@ void ScXMLImport::ExamineDefaultStyle() else { LocaleDataWrapper aLocaleData( comphelper::getComponentContext(pDoc->GetServiceManager()), - LanguageTag( nFormatLang ).getLocale() ); + LanguageTag( nFormatLang ) ); aDecSep = aLocaleData.getNumDecimalSep(); } @@ -2520,7 +2520,7 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const rtl::OUStri { { ScXMLImport::MutexGuard aGuard(*this); - LocaleDataWrapper aLocaleData( comphelper::getComponentContext(GetDocument()->GetServiceManager()), aLocale ); + LocaleDataWrapper aLocaleData( comphelper::getComponentContext(GetDocument()->GetServiceManager()), LanguageTag( aLocale) ); rtl::OUStringBuffer aBuffer(15); aBuffer.appendAscii("#"); aBuffer.append( aLocaleData.getNumThousandSep() ); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index c35464fa9d10..387d15618e25 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -232,8 +232,9 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) } LanguageType eRealLanguage = MsLangId::getRealLanguage( meLanguage ); - mpLocale = new ::com::sun::star::lang::Locale( LanguageTag( eRealLanguage ).getLocale()); - mpCharClass = new CharClass( *mpLocale ); + LanguageTag aLanguageTag( eRealLanguage); + mpLocale = new ::com::sun::star::lang::Locale( aLanguageTag.getLocale()); + mpCharClass = new CharClass( aLanguageTag ); // If the current application language is a language that uses right-to-left text... LanguageType eRealCTLLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 4f8a7a28b512..08ff451ae243 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -608,8 +608,7 @@ sal_Bool SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) { // first only loop over the DocumentShells the shells and find those // with the name: - com::sun::star::lang::Locale aLocale( LanguageTag( LANGUAGE_SYSTEM).getLocale()); - CharClass aCC( aLocale ); + CharClass aCC( LanguageTag( LANGUAGE_SYSTEM) ); TypeId aType( TYPE(SfxObjectShell) ); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 86002c53a37c..daf2ed4aaa2b 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -537,7 +537,7 @@ sal_Bool StyleTreeListBox_Impl::NotifyMoving(SvTreeListEntry* pTarget, const sal_Bool bRet = (sal_Bool)aDropLink.Call(this); rpNewParent = pTarget; lPos=0; - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ); + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ); const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator(); for(SvTreeListEntry *pTmpEntry=FirstChild(pTarget); pTmpEntry && COMPARE_LESS==pCollator->compareString( diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx index 4ba59d686ab6..3b3f8ed472fc 100644 --- a/sfx2/source/view/orgmgr.cxx +++ b/sfx2/source/view/orgmgr.cxx @@ -217,7 +217,7 @@ SfxOrganizeMgr::SfxOrganizeMgr( SfxOrganizeListBox_Impl *pLeft, */ { pImpl->pDocList = new SfxObjectList; - pImpl->pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ); + pImpl->pIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ); const CollatorWrapper* pCollator = pImpl->pIntlWrapper->getCaseCollator(); for ( SfxObjectShell* pTmp = SfxObjectShell::GetFirst(); pTmp; pTmp = SfxObjectShell::GetNext(*pTmp) ) { diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk index 36b4e19fbf61..dd0723cb70ea 100644 --- a/sot/Library_sot.mk +++ b/sot/Library_sot.mk @@ -47,6 +47,7 @@ $(eval $(call gb_Library_use_libraries,sot,\ cppu \ cppuhelper \ sal \ + i18nisolang1 \ tl \ ucbhelper \ utl \ diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index d36eb2fd3de8..66734bcfc273 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -283,14 +283,7 @@ sal_Bool StgEntry::Init() static String ToUpperUnicode( const String & rStr ) { // I don't know the locale, so en_US is hopefully fine - /* - com.sun.star.lang.Locale aLocale; - aLocale.Language = OUString("en"); - aLocale.Country = OUString("US"); - */ - static rtl::OUString aEN("en"); - static rtl::OUString aUS("US"); - static CharClass aCC( com::sun::star::lang::Locale( aEN, aUS, rtl::OUString() ) ); + static CharClass aCC( LanguageTag( com::sun::star::lang::Locale( "en", "US", "" )) ); return aCC.uppercase( rStr ); } diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index e8aecc11a07a..fa7f9f186d43 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -416,7 +416,7 @@ void SmParser::NextToken() xub_StrLen nRealStart; bool bCont; bool bNumStart = false; - CharClass aCC(SM_MOD()->GetSysLocale().GetCharClass().getLocale()); + CharClass aCC(SM_MOD()->GetSysLocale().GetLanguageTag()); do { // skip white spaces @@ -437,14 +437,14 @@ void SmParser::NextToken() if ((aRes.TokenType & KParseType::IDENTNAME) && IsDigit( cFirstChar )) { ParseResult aTmpRes; - lang::Locale aOldLoc( aCC.getLocale() ); - aCC.setLocale( m_aDotLoc ); + LanguageTag aOldLoc( aCC.getLanguageTag() ); + aCC.setLanguageTag( LanguageTag( m_aDotLoc )); aTmpRes = aCC.parsePredefinedToken( KParseType::ASC_NUMBER, m_aBufferString, m_nBufferIndex, KParseTokens::ASC_DIGIT, aEmptyStr, KParseTokens::ASC_DIGIT | KParseTokens::ASC_DOT, aEmptyStr ); - aCC.setLocale( aOldLoc ); + aCC.setLanguageTag( aOldLoc ); if (aTmpRes.TokenType & KParseType::ASC_NUMBER) aRes.TokenType = aTmpRes.TokenType; } diff --git a/svl/inc/svl/ondemand.hxx b/svl/inc/svl/ondemand.hxx index f724cca95746..70c028f2ef52 100644 --- a/svl/inc/svl/ondemand.hxx +++ b/svl/inc/svl/ondemand.hxx @@ -76,8 +76,7 @@ public: } OnDemandLocaleDataWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - ::com::sun::star::lang::Locale& rLocale, - LanguageType eLang + const LanguageTag& rLanguageTag ) : pEnglish(0) , pAny(0) @@ -85,7 +84,7 @@ public: , bInitialized(false) { pSystem = aSysLocale.GetLocaleDataPtr(); - init( rxContext, rLocale, eLang ); + init( rxContext, rLanguageTag ); } ~OnDemandLocaleDataWrapper() { @@ -99,17 +98,17 @@ public: void init( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - ::com::sun::star::lang::Locale& rLocale, - LanguageType eLang + const LanguageTag& rLanguageTag ) { m_xContext = rxContext; - changeLocale( rLocale, eLang ); + changeLocale( rLanguageTag ); bInitialized = true; } - void changeLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ) + void changeLocale( const LanguageTag& rLanguageTag ) { + LanguageType eLang = rLanguageTag.getLanguageType( false); switch ( eLang ) { case LANGUAGE_SYSTEM : @@ -117,18 +116,18 @@ public: break; case LANGUAGE_ENGLISH_US : if ( !pEnglish ) - pEnglish = new LocaleDataWrapper( m_xContext, rLocale ); + pEnglish = new LocaleDataWrapper( m_xContext, rLanguageTag ); pCurrent = pEnglish; break; default: if ( !pAny ) { - pAny = new LocaleDataWrapper( m_xContext, rLocale ); + pAny = new LocaleDataWrapper( m_xContext, rLanguageTag ); eLastAnyLanguage = eLang; } else if ( eLastAnyLanguage != eLang ) { - pAny->setLocale( rLocale ); + pAny->setLanguageTag( rLanguageTag ); eLastAnyLanguage = eLang; } pCurrent = pAny; @@ -143,12 +142,12 @@ public: { if ( !pAny ) { - pAny = new LocaleDataWrapper( m_xContext, pCurrent->getLocale() ); + pAny = new LocaleDataWrapper( m_xContext, pCurrent->getLanguageTag() ); eLastAnyLanguage = eCurrentLanguage; } else if ( pCurrent != pAny ) { - pAny->setLocale( pCurrent->getLocale() ); + pAny->setLanguageTag( pCurrent->getLanguageTag() ); eLastAnyLanguage = eCurrentLanguage; } return pAny; @@ -198,7 +197,7 @@ public: void init( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, - ::com::sun::star::lang::Locale& rLocale + const ::com::sun::star::lang::Locale& rLocale ) { m_xContext = rxContext; @@ -211,7 +210,7 @@ public: bInitialized = true; } - void changeLocale( ::com::sun::star::lang::Locale& rLocale ) + void changeLocale( const ::com::sun::star::lang::Locale& rLocale ) { bValid = false; aLocale = rLocale; diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 71e6bbabf6ab..175e4040109f 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -795,7 +795,7 @@ public: private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; - ::com::sun::star::lang::Locale aLocale; + LanguageTag maLanguageTag; SvNumberFormatTable aFTable; // Table of format keys to format entries typedef std::map<sal_uInt32, sal_uInt32> DefaultFormatKeysMap; DefaultFormatKeysMap aDefaultFormatKeys; // Table of default standard to format keys @@ -965,7 +965,7 @@ public: //! public for the InputScanner and FormatScanner. // return current (!) Locale - inline const ::com::sun::star::lang::Locale& GetLocale() const { return aLocale; } + inline const LanguageTag& GetLanguageTag() const { return maLanguageTag; } // return corresponding Transliteration wrapper inline const ::utl::TransliterationWrapper* GetTransliteration() const diff --git a/svl/source/items/ctypeitm.cxx b/svl/source/items/ctypeitm.cxx index dc15162418df..32944b50e0d4 100644 --- a/svl/source/items/ctypeitm.cxx +++ b/svl/source/items/ctypeitm.cxx @@ -157,8 +157,7 @@ SfxItemPresentation CntContentTypeItem::GetPresentation( if (pIntlWrapper) (const_cast< CntContentTypeItem * >(this))->_aPresentation = INetContentTypes::GetPresentation(GetEnumValue(), - pIntlWrapper-> - getLocale()); + pIntlWrapper->getLanguageTag().getLocale()); } if (!_aPresentation.isEmpty()) { diff --git a/svl/source/items/dateitem.cxx b/svl/source/items/dateitem.cxx index a4fd0d8ea8c2..bbe8e38b249d 100644 --- a/svl/source/items/dateitem.cxx +++ b/svl/source/items/dateitem.cxx @@ -139,7 +139,7 @@ SfxItemPresentation SfxDateTimeItem::GetPresentation DBG_WARNING("SfxDateTimeItem::GetPresentation():" " Using default en_US IntlWrapper"); const IntlWrapper aIntlWrapper( - ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US ); + ::comphelper::getProcessServiceFactory(), LanguageTag( LANGUAGE_ENGLISH_US) ); rText = aIntlWrapper.getLocaleData()->getDate(aDateTime); rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", ")); rText += aIntlWrapper.getLocaleData()->getTime(aDateTime); diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 1bc6d17e050c..2eb0b8325cce 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -334,7 +334,7 @@ XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric ) const SfxPoolItem* pItem = aIter.FirstItem(); IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(), - SvtSysLocale().GetLanguageTag().getLocale()); + SvtSysLocale().GetLanguageTag()); while ( pItem ) { XubString aItemPresentation; diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 1edfbdfb6919..905f2a09b15b 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -206,7 +206,7 @@ void SvNumberFormatsSupplierServiceObject::implEnsureFormatter() { // get the office's UI locale SvtSysLocale aSysLocale; - Locale aOfficeLocale = aSysLocale.GetLocaleData().getLocale(); + Locale aOfficeLocale = aSysLocale.GetLocaleData().getLanguageTag().getLocale(); // initi with this locale Sequence< Any > aFakedInitProps( 1 ); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 9c2239873582..250b89b30bf4 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -166,7 +166,7 @@ void ImpSvNumberInputScan::TransformInput( String& rStr ) } if ( nPos < nLen ) rStr = pFormatter->GetNatNum()->getNativeNumberString( rStr, - pFormatter->GetLocale(), 0 ); + pFormatter->GetLanguageTag().getLocale(), 0 ); } @@ -1751,7 +1751,7 @@ input for the following reasons: res = false; if ( aOrgCalendar.Len() ) - pCal->loadCalendar( aOrgCalendar, pLoc->getLocale() ); // restore calendar + pCal->loadCalendar( aOrgCalendar, pLoc->getLanguageTag().getLocale() ); // restore calendar #if NF_TEST_CALENDAR { diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 608206795f36..a8bc1ca2bf30 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -193,7 +193,8 @@ SvNumberFormatter::SvNumberFormatter( const Reference< XMultiServiceFactory >& xSMgr, LanguageType eLang ) : - xServiceManager( xSMgr ) + xServiceManager( xSMgr ), + maLanguageTag( eLang) { ImpConstruct( eLang ); } @@ -233,10 +234,10 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang ) eEvalDateFormat = NF_EVALDATEFORMAT_INTL; nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; - aLocale = LanguageTag( eLang ).getLocale(); - pCharClass = new CharClass( comphelper::getComponentContext(xServiceManager), aLocale ); - xLocaleData.init( comphelper::getComponentContext(xServiceManager), aLocale, eLang ); - xCalendar.init( comphelper::getComponentContext(xServiceManager), aLocale ); + maLanguageTag.reset( eLang ); + pCharClass = new CharClass( comphelper::getComponentContext(xServiceManager), maLanguageTag ); + xLocaleData.init( comphelper::getComponentContext(xServiceManager), maLanguageTag ); + xCalendar.init( comphelper::getComponentContext(xServiceManager), maLanguageTag.getLocale() ); xTransliteration.init( comphelper::getComponentContext(xServiceManager), eLang, ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ); xNatNum.init( xServiceManager ); @@ -266,10 +267,10 @@ void SvNumberFormatter::ChangeIntl(LanguageType eLnge) { ActLnge = eLnge; - aLocale = LanguageTag( eLnge ).getLocale(); - pCharClass->setLocale( aLocale ); - xLocaleData.changeLocale( aLocale, eLnge ); - xCalendar.changeLocale( aLocale ); + maLanguageTag.reset( eLnge ); + pCharClass->setLanguageTag( maLanguageTag ); + xLocaleData.changeLocale( maLanguageTag ); + xCalendar.changeLocale( maLanguageTag.getLocale() ); xTransliteration.changeLocale( eLnge ); // cached locale data items, initialize BEFORE calling ChangeIntl below @@ -459,7 +460,8 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset) ); // append new system additional formats - NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), + GetLanguageTag().getLocale() ); ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, true ); } @@ -781,7 +783,8 @@ bool SvNumberFormatter::Load( SvStream& rStream ) // generate additional i18n standard formats for all used locales LanguageType eOldLanguage = ActLnge; - NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), + GetLanguageTag().getLocale() ); std::vector<sal_uInt16> aList; GetUsedLanguages( aList ); for ( std::vector<sal_uInt16>::const_iterator it(aList.begin()); it != aList.end(); ++it ) @@ -962,9 +965,8 @@ sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, bool bNoAdditio { // new CL combination if (LocaleDataWrapper::areChecksEnabled()) { - Locale aLoadedLocale = xLocaleData->getLoadedLocale(); - if ( aLoadedLocale.Language != aLocale.Language || - aLoadedLocale.Country != aLocale.Country ) + const LanguageTag& rLoadedLocale = xLocaleData->getLoadedLanguageTag(); + if ( rLoadedLocale != maLanguageTag ) { OUString aMsg("SvNumerFormatter::ImpGenerateCL: locales don't match:"); LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg )); @@ -1963,11 +1965,10 @@ String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const aRet = xLocaleData->getNumDecimalSep(); else { - ::com::sun::star::lang::Locale aSaveLocale( xLocaleData->getLocale() ); - ::com::sun::star::lang::Locale aTmpLocale( LanguageTag( pFormat->GetLanguage()).getLocale()); - ((SvNumberFormatter*)this)->xLocaleData.changeLocale(aTmpLocale, pFormat->GetLanguage() ); + LanguageTag aSaveLocale( xLocaleData->getLanguageTag() ); + ((SvNumberFormatter*)this)->xLocaleData.changeLocale( LanguageTag( pFormat->GetLanguage()) ); aRet = xLocaleData->getNumDecimalSep(); - ((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale, eSaveLang ); + ((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale ); } return aRet; } @@ -2214,7 +2215,8 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio pFormatScanner->SetConvertMode(false); // switch off for this function } - NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), + GetLanguageTag().getLocale() ); SvNumberformat* pNewFormat = NULL; sal_Int32 nIdx; bool bDefault; @@ -2665,7 +2667,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, return ; } sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); - rNumberFormatCode.setLocale( GetLocale() ); + rNumberFormatCode.setLocale( GetLanguageTag().getLocale() ); sal_Int32 j; // All currencies, this time with [$...] which was stripped in @@ -3604,7 +3606,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() LanguageType eSysLang = SvtSysLocale().GetLanguageTag().getLanguageType(); LocaleDataWrapper* pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessComponentContext(), - SvtSysLocale().GetLanguageTag().getLocale() ); + SvtSysLocale().GetLanguageTag() ); // get user configured currency String aConfiguredCurrencyAbbrev; LanguageType eConfiguredCurrencyLanguage = LANGUAGE_SYSTEM; @@ -3632,7 +3634,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() { LanguageType eLang = LanguageTag( pLocales[nLocale]).getLanguageType( false); rInstalledLocales.insert( eLang); - pLocaleData->setLocale( pLocales[nLocale] ); + pLocaleData->setLanguageTag( LanguageTag( pLocales[nLocale]) ); Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies(); sal_Int32 nCurrencyCount = aCurrSeq.getLength(); Currency2 const * const pCurrencies = aCurrSeq.getConstArray(); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b7facc031d44..3ca66ef17e9b 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3341,7 +3341,8 @@ void SvNumberformat::SwitchToOtherCalendar( OUString& rOrgCalendar, if ( rCal.getUniqueID() == rGregorian ) { using namespace ::com::sun::star::i18n; - ::com::sun::star::uno::Sequence< ::rtl::OUString > xCals = rCal.getAllCalendars( rLoc().getLocale() ); + ::com::sun::star::uno::Sequence< ::rtl::OUString > xCals = rCal.getAllCalendars( + rLoc().getLanguageTag().getLocale() ); sal_Int32 nCnt = xCals.getLength(); if ( nCnt > 1 ) { @@ -3354,7 +3355,7 @@ void SvNumberformat::SwitchToOtherCalendar( OUString& rOrgCalendar, rOrgCalendar = rCal.getUniqueID(); fOrgDateTime = rCal.getDateTime(); } - rCal.loadCalendar( xCals[j], rLoc().getLocale() ); + rCal.loadCalendar( xCals[j], rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); break; // for } @@ -3370,7 +3371,7 @@ void SvNumberformat::SwitchToGregorianCalendar( const OUString& rOrgCalendar, const rtl::OUString &rGregorian = Gregorian::get(); if ( rOrgCalendar.getLength() && rCal.getUniqueID() != rGregorian ) { - rCal.loadCalendar( rGregorian, rLoc().getLocale() ); + rCal.loadCalendar( rGregorian, rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); } } @@ -3394,7 +3395,7 @@ bool SvNumberformat::ImpFallBackToGregorianCalendar( OUString& rOrgCalendar, dou { rOrgCalendar = ""; } - rCal.loadCalendar( rGregorian, rLoc().getLocale() ); + rCal.loadCalendar( rGregorian, rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); return true; } @@ -3596,7 +3597,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, aOrgCalendar = rCal.getUniqueID(); fOrgDateTime = rCal.getDateTime(); } - rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); + rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); break; @@ -3746,7 +3747,7 @@ bool SvNumberformat::ImpGetDateOutput(double fNumber, } if ( aOrgCalendar.getLength() ) { - rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar + rCal.loadCalendar( aOrgCalendar, rLoc().getLanguageTag().getLocale() ); // restore calendar } return bRes; } @@ -3889,7 +3890,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, aOrgCalendar = rCal.getUniqueID(); fOrgDateTime = rCal.getDateTime(); } - rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() ); + rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLanguageTag().getLocale() ); rCal.setDateTime( fOrgDateTime ); ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ); break; @@ -4092,7 +4093,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, } if ( aOrgCalendar.getLength() ) { - rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar + rCal.loadCalendar( aOrgCalendar, rLoc().getLanguageTag().getLocale() ); // restore calendar } return bRes; } diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index e82eaa01547e..0b8812946c58 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -223,9 +223,10 @@ void ImpSvNumberformatScan::SetDependentKeywords() const LocaleDataWrapper* pLocaleData = pFormatter->GetLocaleData(); // #80023# be sure to generate keywords for the loaded Locale, not for the // requested Locale, otherwise number format codes might not match - lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale(); - LanguageType eLang = LanguageTag( aLoadedLocale ).getLanguageType( false); - NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(pFormatter->GetServiceManager()), aLoadedLocale ); + const LanguageTag& rLoadedLocale = pLocaleData->getLoadedLanguageTag(); + LanguageType eLang = rLoadedLocale.getLanguageType( false); + NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(pFormatter->GetServiceManager()), + rLoadedLocale.getLocale() ); i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD ); sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code); diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 1f02aff742a3..988827772174 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1710,7 +1710,7 @@ SvtFileView_Impl::SvtFileView_Impl( SvtFileView* pAntiImpl, Reference < XCommand ,mbReplaceNames ( sal_False ) ,mnSuspendSelectCallback ( 0 ) ,mbIsFirstResort ( sal_True ) - ,aIntlWrapper ( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ) + ,aIntlWrapper ( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ) ,maFolderImage ( SvtResId( IMG_SVT_FOLDER ) ) ,mxCmdEnv ( xEnv ) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 907ff5bc2b5e..2712871324e6 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -195,24 +195,18 @@ void Calendar::ImplInit( WinBits nWinStyle ) ::rtl::OUString aGregorian( RTL_CONSTASCII_USTRINGPARAM( "gregorian")); maCalendarWrapper.loadCalendar( aGregorian, - Application::GetAppLocaleDataWrapper().getLocale()); + Application::GetAppLocaleDataWrapper().getLanguageTag().getLocale()); if (maCalendarWrapper.getUniqueID() != aGregorian) { -#ifdef SAL_LOG_WARN - lang::Locale aLoc( Application::GetAppLocaleDataWrapper().getLocale() ); SAL_WARN( "svtools.control", "Calendar::ImplInit: No ``gregorian'' calendar available for locale ``" - << aLoc.Language << "-" << aLoc.Country + << Application::GetAppLocaleDataWrapper().getLanguageTag().getBcp47() << "'' and other calendars aren't supported. Using en-US fallback." ); -#endif /* If we ever wanted to support other calendars than Gregorian a lot of * rewrite would be necessary to internally replace use of class Date * with proper class CalendarWrapper methods, get rid of fixed 12 * months, fixed 7 days, ... */ - maCalendarWrapper.loadCalendar( aGregorian, lang::Locale( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "en")), - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "US")), - ::rtl::OUString())); + maCalendarWrapper.loadCalendar( aGregorian, lang::Locale( "en", "US", "")); } SetFirstDate( maCurDate ); diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 4a2c156e2d91..017422f0ea75 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1460,7 +1460,7 @@ void FontStyleBox::LoseFocus() void FontStyleBox::Modify() { CharClass aChrCls( ::comphelper::getProcessComponentContext(), - GetSettings().GetLanguageTag().getLocale() ); + GetSettings().GetLanguageTag() ); XubString aStr = GetText(); sal_uInt16 nEntryCount = GetEntryCount(); diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index cf73f480ccfe..375a3f6edc46 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -284,8 +284,7 @@ SvNumberFormatter* FormattedField::StaticFormatter::GetFormatter() if (!s_cFormatter) { // get the Office's locale and translate - LanguageType eSysLanguage = LanguageTag( - SvtSysLocale().GetLocaleData().getLocale()).getLanguageType( false); + LanguageType eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false); s_cFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), eSysLanguage); @@ -618,8 +617,7 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset if ( m_pFormatter ) { // get the Office's locale and translate - LanguageType eSysLanguage = LanguageTag( - SvtSysLocale().GetLocaleData().getLocale()).getLanguageType( false); + LanguageType eSysLanguage = SvtSysLocale().GetLanguageTag().getLanguageType( false); // get the standard numeric format for this language m_nFormatKey = m_pFormatter->GetStandardFormat( NUMBERFORMAT_NUMBER, eSysLanguage ); } @@ -1152,8 +1150,7 @@ void DoubleNumericField::ResetConformanceTester() sal_Unicode cSeparatorDecimal = '.'; if (pFormatEntry) { - Locale aLocale( LanguageTag( pFormatEntry->GetLanguage()).getLocale()); - LocaleDataWrapper aLocaleInfo( aLocale ); + LocaleDataWrapper aLocaleInfo( LanguageTag( pFormatEntry->GetLanguage()) ); String sSeparator = aLocaleInfo.getNumThousandSep(); if (sSeparator.Len()) @@ -1243,8 +1240,13 @@ void DoubleCurrencyField::UpdateCurrencyFormat() sal_uInt16 nDigits = GetDecimalDigits(); // build a new format string with the base class' and my own settings - Locale aLocale( LanguageTag( eLanguage).getLocale()); - LocaleDataWrapper aLocaleInfo( aLocale ); + + /* Strangely with gcc 4.6.3 this needs a temporary LanguageTag, otherwise + * there's + * error: request for member ‘getNumThousandSep’ in ‘aLocaleInfo’, which is + * of non-class type ‘LocaleDataWrapper(LanguageTag)’ */ + LanguageTag aLanguageTag( eLanguage); + LocaleDataWrapper aLocaleInfo( aLanguageTag ); XubString sNewFormat; if (bThSep) diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx index 2efa5a96d93f..7db7b722b660 100644 --- a/svtools/source/edit/syntaxhighlight.cxx +++ b/svtools/source/edit/syntaxhighlight.cxx @@ -330,7 +330,7 @@ bool LetterTable::isLetterUnicode( sal_Unicode c ) { static CharClass* pCharClass = NULL; if( pCharClass == NULL ) - pCharClass = new CharClass( Application::GetSettings().GetLanguageTag().getLocale() ); + pCharClass = new CharClass( Application::GetSettings().GetLanguageTag() ); rtl::OUString aStr( c ); bool bRet = pCharClass->isLetter( aStr, 0 ); return bRet; diff --git a/svx/source/dialog/simptabl.cxx b/svx/source/dialog/simptabl.cxx index bb20aee77d82..544074230a0f 100644 --- a/svx/source/dialog/simptabl.cxx +++ b/svx/source/dialog/simptabl.cxx @@ -458,7 +458,7 @@ StringCompare SvxSimpleTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* if(nRightKind == SV_ITEM_ID_LBOXSTRING && nLeftKind == SV_ITEM_ID_LBOXSTRING ) { - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ); + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ); const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator(); eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(), diff --git a/svx/source/form/ParseContext.cxx b/svx/source/form/ParseContext.cxx index 44552338f22b..0456a44d7595 100644 --- a/svx/source/form/ParseContext.cxx +++ b/svx/source/form/ParseContext.cxx @@ -64,7 +64,7 @@ OSystemParseContext::~OSystemParseContext() //----------------------------------------------------------------------------- ::com::sun::star::lang::Locale OSystemParseContext::getPreferredLocale( ) const { - return SvtSysLocale().GetLocaleData().getLocale(); + return SvtSysLocale().GetLanguageTag().getLocale(); } //----------------------------------------------------------------------------- diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 06e34f9bc0d0..05292acf8063 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -143,7 +143,7 @@ namespace svxform // determine the script type associated with the system locale const SvtSysLocale aSysLocale; const LocaleDataWrapper& rSysLocaleData = aSysLocale.GetLocaleData(); - const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( LanguageTag( rSysLocaleData.getLocale() ).getLanguageType() ); + const sal_Int16 eSysLocaleScriptType = MsLangId::getScriptType( rSysLocaleData.getLanguageTag().getLanguageType() ); // depending on this script type, use the right property from the document's style which controls the // default locale for document content @@ -182,7 +182,7 @@ namespace svxform // fall back to the system locale if ( aDocumentCharLocale.Language.isEmpty() ) { - aDocumentCharLocale = rSysLocaleData.getLocale(); + aDocumentCharLocale = rSysLocaleData.getLanguageTag().getLocale(); } // retrieve a default font for this locale, and set it at the control diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 14fb1fca3639..006a6dee101c 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -585,7 +585,7 @@ FmSearchEngine::SEARCH_RESULT FmSearchEngine::SearchRegularApprox(const ::rtl::O aParam.insertedChars = m_nLevLonger; } aParam.searchString = strExpression; - aParam.Locale = SvtSysLocale().GetLocaleData().getLocale(); + aParam.Locale = SvtSysLocale().GetLanguageTag().getLocale(); ::utl::TextSearch aLocalEngine(aParam); // -------------------------------------------------------------- @@ -686,7 +686,7 @@ FmSearchEngine::FmSearchEngine(const Reference< XMultiServiceFactory >& _rxORB, :m_xSearchCursor(xCursor) ,m_xFormatSupplier(xFormatSupplier) - ,m_aCharacterClassficator( comphelper::getComponentContext(_rxORB), SvtSysLocale().GetLocaleData().getLocale() ) + ,m_aCharacterClassficator( comphelper::getComponentContext(_rxORB), SvtSysLocale().GetLanguageTag() ) ,m_aStringCompare( _rxORB ) ,m_nCurrentFieldIndex(-2) // -1 hat schon eine Bedeutung, also nehme ich -2 fuer 'ungueltig' ,m_bUsingTextComponents(sal_False) @@ -723,7 +723,7 @@ FmSearchEngine::FmSearchEngine(const Reference< XMultiServiceFactory >& _rxORB, const Reference< XResultSet > & xCursor, const ::rtl::OUString& sVisibleFields, const InterfaceArray& arrFields, FMSEARCH_MODE eMode) :m_xSearchCursor(xCursor) - ,m_aCharacterClassficator( comphelper::getComponentContext(_rxORB), SvtSysLocale().GetLocaleData().getLocale() ) + ,m_aCharacterClassficator( comphelper::getComponentContext(_rxORB), SvtSysLocale().GetLanguageTag() ) ,m_aStringCompare( _rxORB ) ,m_nCurrentFieldIndex(-2) // -1 hat schon eine Bedeutung, also nehme ich -2 fuer 'ungueltig' ,m_bUsingTextComponents(sal_True) @@ -872,7 +872,7 @@ void FmSearchEngine::Init(const ::rtl::OUString& sVisibleFields) bCaseSensitiveIdentifiers = xMeta->supportsMixedCaseQuotedIdentifiers(); // now that we have this information, we need a collator which is able to case (in)sentively compare strings - m_aStringCompare.loadDefaultCollator( SvtSysLocale().GetLocaleData().getLocale(), + m_aStringCompare.loadDefaultCollator( SvtSysLocale().GetLanguageTag().getLocale(), bCaseSensitiveIdentifiers ? 0 : ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); try diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index 5cf18fe9e8a3..f47cf3310913 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -586,7 +586,7 @@ namespace svxform nFormatKey = OStaticDataAccessTools().getDefaultNumberFormat( _rxDatabaseField, Reference< XNumberFormatTypes >( _rxNumberFormats, UNO_QUERY ), - SvtSysLocale().GetLocaleData().getLocale() + SvtSysLocale().GetLanguageTag().getLocale() ); } diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 8e711f0988fc..9c3ebf9eadd8 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -878,7 +878,7 @@ SfxItemPresentation SdrAngleItem::GetPresentation( if(!pIntlWrapper) pIntlWrapper = pMyIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), - Application::GetSettings().GetLanguageTag().getLanguageType() ); + Application::GetSettings().GetLanguageTag() ); if(pIntlWrapper->getLocaleData()->isNumLeadingZero()) nAnz++; diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx index c4710abcf4d8..03da42e329fd 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.cxx @@ -396,7 +396,7 @@ StringCompare DictionaryList::ColumnCompare( SvTreeListEntry* pLeft, SvTreeListE if(nRightKind == SV_ITEM_ID_LBOXSTRING && nLeftKind == SV_ITEM_ID_LBOXSTRING ) { - IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag().getLocale() ); + IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLanguageTag() ); const CollatorWrapper* pCollator = aIntlWrapper.getCaseCollator(); eCompare=(StringCompare)pCollator->compareString( ((SvLBoxString*)pLeftItem)->GetText(), diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index b4c42753ef55..643ec11c6b5b 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -89,7 +89,7 @@ void SwBreakIt::_GetLocale( const LanguageType aLang ) void SwBreakIt::_GetForbidden( const LanguageType aLang ) { - LocaleDataWrapper aWrap( m_xContext, GetLocale( aLang ) ); + LocaleDataWrapper aWrap( m_xContext, LanguageTag( GetLocale( aLang )) ); aForbiddenLang = aLang; delete m_pForbidden; diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index b484381ec38e..27e664249bd2 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -254,12 +254,12 @@ SwCalc::SwCalc( SwDoc& rD ) memset( VarTable, 0, sizeof(VarTable) ); LanguageType eLang = GetDocAppScriptLang( rDoc ); - if( eLang != SvxLocaleToLanguage( pLclData->getLocale() ) || - eLang != SvxLocaleToLanguage( pCharClass->getLocale() ) ) + if( eLang != SvxLocaleToLanguage( pLclData->getLanguageTag().getLocale() ) || + eLang != SvxLocaleToLanguage( pCharClass->getLanguageTag().getLocale() ) ) { - ::com::sun::star::lang::Locale aLocale( SvxCreateLocale( eLang )); - pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLocale ); - pLclData = new LocaleDataWrapper( aLocale ); + LanguageTag aLanguageTag( SvxCreateLocale( eLang )); + pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLanguageTag ); + pLclData = new LocaleDataWrapper( aLanguageTag ); } sCurrSym = comphelper::string::strip(pLclData->getCurrSymbol(), ' '); @@ -560,7 +560,7 @@ SwCalcExp* SwCalc::VarLook( const String& rStr, sal_uInt16 ins ) rtl::OUString sResult; double nNumber = DBL_MAX; - long nLang = SvxLocaleToLanguage( pLclData->getLocale() ); + long nLang = SvxLocaleToLanguage( pLclData->getLanguageTag().getLocale() ); if(pMgr->GetColumnCnt( sSourceName, sTableName, sColumnName, nTmpRec, nLang, sResult, &nNumber )) { @@ -1539,9 +1539,9 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos, { LanguageType eLang = GetDocAppScriptLang( *pDoc ); if (eLang != - SvxLocaleToLanguage(aSysLocale.GetLocaleData().getLocale())) + SvxLocaleToLanguage(aSysLocale.GetLanguageTag().getLocale())) { - pLclD.reset( new LocaleDataWrapper( SvxCreateLocale( eLang ) ) ); + pLclD.reset( new LocaleDataWrapper( LanguageTag( SvxCreateLocale( eLang )) ) ); } } diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 678e074a6c3d..3f67271694ca 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -810,7 +810,7 @@ CharClass& GetAppCharClass() { pAppCharClass = new CharClass( ::comphelper::getProcessComponentContext(), - SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() )); + LanguageTag( SwBreakIt::Get()->GetLocale( (LanguageType)GetAppLanguage() ))); } return *pAppCharClass; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 363594b42fa6..6932f5b13288 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -117,7 +117,7 @@ SwSortElement::~SwSortElement() double SwSortElement::StrToDouble( const String& rStr ) const { if( !pLclData ) - pLclData = new LocaleDataWrapper( *pLocale ); + pLclData = new LocaleDataWrapper( LanguageTag( *pLocale )); rtl_math_ConversionStatus eStatus; sal_Int32 nEnd; diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 8c3096b11bd1..a1ed01e0b113 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( SvxCreateLocale( eLang )); + pCharClass = new CharClass( LanguageTag( SvxCreateLocale( eLang ))); eCharClassLang = eLang; } diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index c0c88e9c3225..d434a7a2f041 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)->getLocale() ) ) + if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLanguageTag().getLocale() ) ) *ppLocalData = new LocaleDataWrapper( - SvxCreateLocale( static_cast<LanguageType>(nLang) ) ); + LanguageTag( SvxCreateLocale( 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 0e11e2769104..eb491ec1fb21 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -927,7 +927,7 @@ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc { LanguageType eLang = ((SvxLanguageItem&)aSet.Get( GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt )) ).GetLanguage(); - CharClass aCC( SvxCreateLocale( eLang )); + CharClass aCC( LanguageTag( SvxCreateLocale( eLang ))); 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 f2439f1f49f4..be7934f0cb3a 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().GetLocaleData().getLocale() ); + sal_uInt16 nLng = SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); if (pEntry && nLng != pEntry->GetLanguage()) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 6690cead08fc..bec55fb60430 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -470,7 +470,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr ) if( !pFldTxtAttr || !pFldTxtAttr->GetpTxtNode() ) break; - LocaleDataWrapper aLocaleData( SvxCreateLocale( GetLanguage() ) ); + LocaleDataWrapper aLocaleData( LanguageTag( SvxCreateLocale( GetLanguage() )) ); // 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 135572f0e10d..0e2cb2ab3203 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -100,7 +100,7 @@ void SwTOXInternational::Init() else pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, SW_COLLATOR_IGNORES ); - pCharClass = new CharClass( aLcl ); + pCharClass = new CharClass( LanguageTag( aLcl )); } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index f0d6980d3a9b..c9a13b376659 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -750,7 +750,7 @@ sal_Bool SwScanner::NextWord() Boundary aBound; CharClass& rCC = GetAppCharClass(); - lang::Locale aOldLocale = rCC.getLocale(); + LanguageTag aOldLanguageTag = rCC.getLanguageTag(); while ( true ) { @@ -769,7 +769,7 @@ sal_Bool SwScanner::NextWord() if ( nWordType != i18n::WordType::WORD_COUNT ) { - rCC.setLocale( pBreakIt->GetLocale( aCurrLang ) ); + rCC.setLanguageTag( LanguageTag( pBreakIt->GetLocale( aCurrLang )) ); if ( rCC.isLetterNumeric(rtl::OUString(aText[nBegin])) ) break; } @@ -802,7 +802,7 @@ sal_Bool SwScanner::NextWord() break; } // end while( true ) - rCC.setLocale( aOldLocale ); + rCC.setLanguageTag( aOldLanguageTag ); // #i89042, as discussed with HDU: don't evaluate script changes for word count. Use whole word. if ( nWordType == i18n::WordType::WORD_COUNT ) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 1c520aaf5185..632a56964c10 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2343,7 +2343,7 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr) { sal_uInt16 nLng = rFld.GetLanguage(); LocaleDataWrapper aLocDat(comphelper::getComponentContext(pNFmtr->GetServiceManager()), - LanguageTag(nLng).getLocale()); + LanguageTag(nLng)); String sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(), aLocDat)); diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 925543b3acfd..c00338e81720 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -5589,8 +5589,8 @@ WW8Fib::WW8Fib(sal_uInt8 nVer) lidFE = lid; Locale aTempLocale; - SvxLanguageToLocale( aTempLocale, lid ); - LocaleDataWrapper aLocaleWrapper( aTempLocale ); + LanguageTag aLanguageTag( SvxLanguageToLocale( aTempLocale, lid )); + LocaleDataWrapper aLocaleWrapper( aLanguageTag ); nNumDecimalSep = aLocaleWrapper.getNumDecimalSep()[0]; } diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index ca7e2ac3fbed..e86b6ddb165c 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -584,7 +584,7 @@ String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) { IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), - SvtSysLocale().GetLocaleData().getLocale()); + SvtSysLocale().GetLanguageTag()); rtl::OUString sPlus(" + "); if ( SFX_STYLE_FAMILY_PAGE == nFamily ) diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index bd5df73d0ecf..e5ad5db5eb60 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().GetLocaleData().getLocale() ); + return SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); } void SwFieldType::_GetFldName() diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 171620696d1e..e71b64621847 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( SvxCreateLocale( pSetFld->GetLanguage() )); + CharClass aCC( LanguageTag( SvxCreateLocale( pSetFld->GetLanguage() ))); if( aCC.isNumeric( sFormula )) { aStr = pSetFld->ExpandField(true); diff --git a/sw/source/ui/utlui/attrdesc.cxx b/sw/source/ui/utlui/attrdesc.cxx index 2bcc85248634..ef379077073e 100644 --- a/sw/source/ui/utlui/attrdesc.cxx +++ b/sw/source/ui/utlui/attrdesc.cxx @@ -83,7 +83,7 @@ void SwAttrSet::GetPresentation( { SfxItemIter aIter( *this ); const IntlWrapper rInt( ::comphelper::getProcessServiceFactory(), - GetAppLanguage() ); + LanguageTag( GetAppLanguage()) ); while( sal_True ) { aIter.GetCurItem()->GetPresentation( ePres, eCoreMetric, diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx index 71def9e92e66..430ab33d66a1 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().GetLocaleData().getLocale() ); + eCurLanguage = SvxLocaleToLanguage( SvtSysLocale().GetLanguageTag().getLocale() ); if (bUsrFmts == sal_False) { diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 94ad6cb4ce81..4bff90152583 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -328,17 +328,9 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const sDefaultCurrency = sDefaultCurrency.copy( nSepPos + 1 ); } - // the remaming is the locale - /* FIXME-BCP47: handle language tags! */ - Locale aLocale; - nSepPos = sDefaultCurrency.indexOf( '-' ); - if ( nSepPos >= 0 ) - { - aLocale.Language = sDefaultCurrency.copy( 0, nSepPos ); - aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 ); - } - - LocaleDataWrapper aLocaleInfo( maContext.getUNOContext(), aLocale ); + // the remaining is the locale + LanguageTag aLanguageTag( sDefaultCurrency); + LocaleDataWrapper aLocaleInfo( maContext.getUNOContext(), aLanguageTag ); if ( sBankSymbol.isEmpty() ) sBankSymbol = aLocaleInfo.getCurrBankSymbol(); diff --git a/unotools/inc/unotools/charclass.hxx b/unotools/inc/unotools/charclass.hxx index 744321091230..c08e84c7d0a4 100644 --- a/unotools/inc/unotools/charclass.hxx +++ b/unotools/inc/unotools/charclass.hxx @@ -23,6 +23,7 @@ #include <ctype.h> // isdigit(), isalpha() #include <boost/noncopyable.hpp> +#include <i18npool/languagetag.hxx> #include <tools/string.hxx> #include <tools/solar.h> #include <com/sun/star/i18n/KCharacterType.hpp> @@ -68,7 +69,7 @@ const sal_Int32 nCharClassNumericTypeMask = class UNOTOOLS_DLLPUBLIC CharClass : private boost::noncopyable { - ::com::sun::star::lang::Locale aLocale; + LanguageTag maLanguageTag; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification > xCC; mutable ::osl::Mutex aMutex; @@ -76,19 +77,19 @@ public: /// Preferred ctor with service manager specified CharClass( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext, - const ::com::sun::star::lang::Locale& rLocale); + const LanguageTag& rLanguageTag ); /// Depricated ctor, tries to get a process service manager or to load the /// library directly. - CharClass(const ::com::sun::star::lang::Locale& rLocale); + CharClass( const LanguageTag& rLanguageTag ); ~CharClass(); /// set a new Locale - void setLocale( const ::com::sun::star::lang::Locale& rLocale ); + void setLanguageTag( const LanguageTag& rLanguageTag ); /// get current Locale - const ::com::sun::star::lang::Locale& getLocale() const; + const LanguageTag& getLanguageTag() const; /// isdigit() on ascii values @@ -213,6 +214,10 @@ public: sal_Bool isNumeric( const String& rStr ) const; sal_Bool isAlphaNumeric( const String& rStr ) const; sal_Bool isLetterNumeric( const String& rStr ) const; + +private: + + const ::com::sun::star::lang::Locale & getMyLocale() const; }; #endif // _UNOTOOLS_CHARCLASS_HXX diff --git a/unotools/inc/unotools/intlwrapper.hxx b/unotools/inc/unotools/intlwrapper.hxx index fa2625057d24..7d1665264d4d 100644 --- a/unotools/inc/unotools/intlwrapper.hxx +++ b/unotools/inc/unotools/intlwrapper.hxx @@ -48,7 +48,7 @@ class UNOTOOLS_DLLPUBLIC IntlWrapper { private: - LanguageTag aLanguageTag; + LanguageTag maLanguageTag; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr; LocaleDataWrapper* pLocaleData; @@ -62,16 +62,11 @@ private: public: IntlWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, - const ::com::sun::star::lang::Locale& rLocale - ); - IntlWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, - LanguageType eLang + const LanguageTag& rLanguageTag ); ~IntlWrapper(); - LanguageType getLanguage() const { return aLanguageTag.getLanguageType(); } - const ::com::sun::star::lang::Locale& getLocale() const { return aLanguageTag.getLocale(); } + const LanguageTag& getLanguageTag() const { return maLanguageTag; } const LocaleDataWrapper* getLocaleData() const { diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx index 1198895753d9..1db497abcd3f 100644 --- a/unotools/inc/unotools/localedatawrapper.hxx +++ b/unotools/inc/unotools/localedatawrapper.hxx @@ -26,6 +26,7 @@ #include <com/sun/star/i18n/LocaleItem.hpp> #include <com/sun/star/i18n/reservedWords.hpp> #include <rtl/ustring.hxx> +#include <i18npool/languagetag.hxx> #include <unotools/readwritemutexguard.hxx> #include "unotools/unotoolsdllapi.h" @@ -58,7 +59,7 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 > xLD; - ::com::sun::star::lang::Locale aLocale; + LanguageTag maLanguageTag; ::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > xDefaultCalendar; ::com::sun::star::i18n::LocaleDataItem aLocaleDataItem; ::com::sun::star::uno::Sequence< ::rtl::OUString > aReservedWordSeq; @@ -112,10 +113,10 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable public: LocaleDataWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext, - const ::com::sun::star::lang::Locale& rLocale + const LanguageTag& rLanguageTag ); LocaleDataWrapper( - const ::com::sun::star::lang::Locale& rLocale + const LanguageTag& rLanguageTag ); ~LocaleDataWrapper(); @@ -129,13 +130,13 @@ public: const { return m_xContext; } /// set a new Locale to request - void setLocale( const ::com::sun::star::lang::Locale& rLocale ); + void setLanguageTag( const LanguageTag& rLanguageTag ); /// get current requested Locale - const ::com::sun::star::lang::Locale& getLocale() const; + const LanguageTag& getLanguageTag() const; /// get current loaded Locale, which might differ from the requested Locale - ::com::sun::star::lang::Locale getLoadedLocale() const; + LanguageTag getLoadedLanguageTag() const; // Wrapper implementations of service LocaleData @@ -349,6 +350,9 @@ public: static void outputCheckMessage( const char* pStr); private: + + const ::com::sun::star::lang::Locale & getMyLocale() const; + static void evaluateLocaleDataChecking(); }; diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx index fa718cb119d3..bfa85dc81734 100644 --- a/unotools/source/i18n/charclass.cxx +++ b/unotools/source/i18n/charclass.cxx @@ -32,18 +32,20 @@ using namespace ::com::sun::star::uno; CharClass::CharClass( const Reference< uno::XComponentContext > & rxContext, - const lang::Locale& rLocale + const LanguageTag& rLanguageTag ) + : + maLanguageTag( rLanguageTag) { - setLocale( rLocale ); xCC = CharacterClassification::create( rxContext ); } CharClass::CharClass( - const ::com::sun::star::lang::Locale& rLocale ) + const LanguageTag& rLanguageTag ) + : + maLanguageTag( rLanguageTag) { - setLocale( rLocale ); xCC = CharacterClassification::create( comphelper::getProcessComponentContext() ); } @@ -53,19 +55,24 @@ CharClass::~CharClass() } -void CharClass::setLocale( const ::com::sun::star::lang::Locale& rLocale ) +void CharClass::setLanguageTag( const LanguageTag& rLanguageTag ) { ::osl::MutexGuard aGuard( aMutex ); - aLocale.Language = rLocale.Language; - aLocale.Country = rLocale.Country; - aLocale.Variant = rLocale.Variant; + maLanguageTag = rLanguageTag; } -const ::com::sun::star::lang::Locale& CharClass::getLocale() const +const LanguageTag& CharClass::getLanguageTag() const { ::osl::MutexGuard aGuard( aMutex ); - return aLocale; + return maLanguageTag; +} + + +const ::com::sun::star::lang::Locale& CharClass::getMyLocale() const +{ + ::osl::MutexGuard aGuard( aMutex ); + return maLanguageTag.getLocale(); } @@ -111,7 +118,7 @@ sal_Bool CharClass::isAlpha( const String& rStr, xub_StrLen nPos ) const try { if ( xCC.is() ) - return (xCC->getCharacterType( rStr, nPos, getLocale() ) & + return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) & nCharClassAlphaType) != 0; else return sal_False; @@ -134,7 +141,7 @@ sal_Bool CharClass::isLetter( const String& rStr, xub_StrLen nPos ) const try { if ( xCC.is() ) - return (xCC->getCharacterType( rStr, nPos, getLocale() ) & + return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) & nCharClassLetterType) != 0; else return sal_False; @@ -152,7 +159,7 @@ sal_Bool CharClass::isLetter( const String& rStr ) const try { if ( xCC.is() ) - return isLetterType( xCC->getStringType( rStr, 0, rStr.Len(), getLocale() ) ); + return isLetterType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) ); else return sal_False; } @@ -173,7 +180,7 @@ sal_Bool CharClass::isDigit( const String& rStr, xub_StrLen nPos ) const try { if ( xCC.is() ) - return (xCC->getCharacterType( rStr, nPos, getLocale() ) & + return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) & KCharacterType::DIGIT) != 0; else return sal_False; @@ -191,7 +198,7 @@ sal_Bool CharClass::isNumeric( const String& rStr ) const try { if ( xCC.is() ) - return isNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getLocale() ) ); + return isNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) ); else return sal_False; } @@ -212,7 +219,7 @@ sal_Bool CharClass::isAlphaNumeric( const String& rStr, xub_StrLen nPos ) const try { if ( xCC.is() ) - return (xCC->getCharacterType( rStr, nPos, getLocale() ) & + return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) & (nCharClassAlphaType | KCharacterType::DIGIT)) != 0; else return sal_False; @@ -234,7 +241,7 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr, xub_StrLen nPos ) const try { if ( xCC.is() ) - return (xCC->getCharacterType( rStr, nPos, getLocale() ) & + return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) & (nCharClassLetterType | KCharacterType::DIGIT)) != 0; else return sal_False; @@ -252,7 +259,7 @@ sal_Bool CharClass::isLetterNumeric( const String& rStr ) const try { if ( xCC.is() ) - return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getLocale() ) ); + return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.Len(), getMyLocale() ) ); else return sal_False; } @@ -268,7 +275,7 @@ rtl::OUString CharClass::titlecase(const rtl::OUString& rStr, sal_Int32 nPos, sa try { if ( xCC.is() ) - return xCC->toTitle( rStr, nPos, nCount, getLocale() ); + return xCC->toTitle( rStr, nPos, nCount, getMyLocale() ); else return rStr.copy( nPos, nCount ); } @@ -284,7 +291,7 @@ rtl::OUString CharClass::titlecase(const rtl::OUString& rStr, sal_Int32 nPos, sa try { if ( xCC.is() ) - return xCC->toUpper( rStr, nPos, nCount, getLocale() ); + return xCC->toUpper( rStr, nPos, nCount, getMyLocale() ); else return rStr.copy( nPos, nCount ); } @@ -300,7 +307,7 @@ rtl::OUString CharClass::titlecase(const rtl::OUString& rStr, sal_Int32 nPos, sa try { if ( xCC.is() ) - return xCC->toLower( rStr, nPos, nCount, getLocale() ); + return xCC->toLower( rStr, nPos, nCount, getMyLocale() ); else return rStr.copy( nPos, nCount ); } @@ -367,7 +374,7 @@ sal_Int32 CharClass::getCharacterType( const String& rStr, xub_StrLen nPos ) con try { if ( xCC.is() ) - return xCC->getCharacterType( rStr, nPos, getLocale() ); + return xCC->getCharacterType( rStr, nPos, getMyLocale() ); else return 0; } @@ -384,7 +391,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str try { if ( xCC.is() ) - return xCC->getStringType( rStr, nPos, nCount, getLocale() ); + return xCC->getStringType( rStr, nPos, nCount, getMyLocale() ); else return 0; } @@ -407,7 +414,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str try { if ( xCC.is() ) - return xCC->parseAnyToken( rStr, nPos, getLocale(), + return xCC->parseAnyToken( rStr, nPos, getMyLocale(), nStartCharFlags, userDefinedCharactersStart, nContCharFlags, userDefinedCharactersCont ); else @@ -433,7 +440,7 @@ sal_Int32 CharClass::getStringType( const String& rStr, xub_StrLen nPos, xub_Str try { if ( xCC.is() ) - return xCC->parsePredefinedToken( nTokenType, rStr, nPos, getLocale(), + return xCC->parsePredefinedToken( nTokenType, rStr, nPos, getMyLocale(), nStartCharFlags, userDefinedCharactersStart, nContCharFlags, userDefinedCharactersCont ); else diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx index 9536798d3b60..075604e92b9c 100644 --- a/unotools/source/i18n/intlwrapper.cxx +++ b/unotools/source/i18n/intlwrapper.cxx @@ -25,22 +25,9 @@ IntlWrapper::IntlWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, - const ::com::sun::star::lang::Locale& rLocale ) + const LanguageTag& rLanguageTag ) : - aLanguageTag( rLocale ), - xSMgr( xSF ), - pLocaleData( NULL ), - pCollator( NULL ), - pCaseCollator( NULL ) -{ -} - - -IntlWrapper::IntlWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF, - LanguageType eLang ) - : - aLanguageTag( eLang ), + maLanguageTag( rLanguageTag ), xSMgr( xSF ), pLocaleData( NULL ), pCollator( NULL ), @@ -60,7 +47,7 @@ IntlWrapper::~IntlWrapper() void IntlWrapper::ImplNewLocaleData() const { ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( - comphelper::getComponentContext(xSMgr), aLanguageTag.getLocale() ); + comphelper::getComponentContext(xSMgr), maLanguageTag ); } @@ -69,12 +56,12 @@ void IntlWrapper::ImplNewCollator( sal_Bool bCaseSensitive ) const CollatorWrapper* p = new CollatorWrapper( xSMgr ); if ( bCaseSensitive ) { - p->loadDefaultCollator( aLanguageTag.getLocale(), 0 ); + p->loadDefaultCollator( maLanguageTag.getLocale(), 0 ); ((IntlWrapper*)this)->pCaseCollator = p; } else { - p->loadDefaultCollator( aLanguageTag.getLocale(), + p->loadDefaultCollator( maLanguageTag.getLocale(), ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); ((IntlWrapper*)this)->pCollator = p; } diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index c31672b03f21..ceffc85fd9fd 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -67,27 +67,29 @@ sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0; LocaleDataWrapper::LocaleDataWrapper( const Reference< uno::XComponentContext > & rxContext, - const lang::Locale& rLocale + const LanguageTag& rLanguageTag ) : m_xContext( rxContext ), xLD( LocaleData::create(rxContext) ), + maLanguageTag( rLanguageTag ), bLocaleDataItemValid( sal_False ), bReservedWordValid( sal_False ) { - setLocale( rLocale ); + invalidateData(); } LocaleDataWrapper::LocaleDataWrapper( - const lang::Locale& rLocale + const LanguageTag& rLanguageTag ) : m_xContext( comphelper::getProcessComponentContext() ), xLD( LocaleData::create(m_xContext) ), + maLanguageTag( rLanguageTag ), bLocaleDataItemValid( sal_False ), bReservedWordValid( sal_False ) { - setLocale( rLocale ); + invalidateData(); } LocaleDataWrapper::~LocaleDataWrapper() @@ -95,18 +97,25 @@ LocaleDataWrapper::~LocaleDataWrapper() } -void LocaleDataWrapper::setLocale( const ::com::sun::star::lang::Locale& rLocale ) +void LocaleDataWrapper::setLanguageTag( const LanguageTag& rLanguageTag ) { ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nCriticalChange ); - aLocale = rLocale; + maLanguageTag = rLanguageTag; invalidateData(); } -const ::com::sun::star::lang::Locale& LocaleDataWrapper::getLocale() const +const LanguageTag& LocaleDataWrapper::getLanguageTag() const +{ + ::utl::ReadWriteGuard aGuard( aMutex ); + return maLanguageTag; +} + + +const ::com::sun::star::lang::Locale& LocaleDataWrapper::getMyLocale() const { ::utl::ReadWriteGuard aGuard( aMutex ); - return aLocale; + return maLanguageTag.getLocale(); } @@ -142,7 +151,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getLanguageCountryInfo( getLocale() ); + return xLD->getLanguageCountryInfo( getMyLocale() ); } catch (const Exception& e) { @@ -156,7 +165,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getLocaleItem( getLocale() ); + return xLD->getLocaleItem( getMyLocale() ); } catch (const Exception& e) { @@ -170,7 +179,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getAllCurrencies2( getLocale() ); + return xLD->getAllCurrencies2( getMyLocale() ); } catch (const Exception& e) { @@ -184,7 +193,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getAllFormats( getLocale() ); + return xLD->getAllFormats( getMyLocale() ); } catch (const Exception& e) { @@ -198,7 +207,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getForbiddenCharacters( getLocale() ); + return xLD->getForbiddenCharacters( getMyLocale() ); } catch (const Exception& e) { @@ -212,7 +221,7 @@ void LocaleDataWrapper::invalidateData() { try { - return xLD->getReservedWord( getLocale() ); + return xLD->getReservedWord( getMyLocale() ); } catch ( const Exception& e ) { @@ -251,7 +260,7 @@ void LocaleDataWrapper::invalidateData() if ( !rInstalledLocales.getLength() ) { - LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), lang::Locale() ); + LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), LanguageTag( lang::Locale()) ); aLDW.getAllInstalledLocaleNames(); } return rInstalledLocales; @@ -279,11 +288,11 @@ void LocaleDataWrapper::invalidateData() aDebugLocale = xLoc[i].Language; if ( !xLoc[i].Country.isEmpty() ) { - aDebugLocale += '_'; + aDebugLocale += '-'; aDebugLocale += String( xLoc[i].Country); if ( !xLoc[i].Variant.isEmpty() ) { - aDebugLocale += '_'; + aDebugLocale += '-'; aDebugLocale += String( xLoc[i].Variant); } } @@ -299,7 +308,8 @@ void LocaleDataWrapper::invalidateData() } continue; } - LanguageType eLang = LanguageTag( xLoc[i] ).getLanguageType(); + LanguageTag aLanguageTag( xLoc[i] ); + LanguageType eLang = aLanguageTag.getLanguageType(); // In checks, exclude known problems because no MS-LCID defined. if (areChecksEnabled() && eLang == LANGUAGE_DONTKNOW) @@ -317,10 +327,8 @@ void LocaleDataWrapper::invalidateData() } if ( eLang != LANGUAGE_DONTKNOW ) { - LanguageTag aLanguageTag( eLang); - lang::Locale aLocale = aLanguageTag.getLocale(); - if ( xLoc[i].Language != aLocale.Language || - xLoc[i].Country != aLocale.Country ) + LanguageTag aBackLanguageTag( eLang); + if ( aLanguageTag != aBackLanguageTag ) { // In checks, exclude known problems because no MS-LCID defined // and default for Language found. @@ -338,7 +346,7 @@ void LocaleDataWrapper::invalidateData() aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> 0x")); aMsg.append(static_cast<sal_Int32>(eLang), 16); aMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM( " -> ")); - aMsg.append(aLanguageTag.getBcp47()); + aMsg.append(aBackLanguageTag.getBcp47()); outputCheckMessage( aMsg.makeStringAndClear() ); } eLang = LANGUAGE_DONTKNOW; @@ -704,7 +712,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const rtl::OUString& rCode, void LocaleDataWrapper::getCurrFormatsImpl() { - NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getMyLocale() ); uno::Sequence< NumberFormatCode > aFormatSeq = aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::CURRENCY ); sal_Int32 nCnt = aFormatSeq.getLength(); @@ -961,7 +969,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const rtl::OUString& rCode ) void LocaleDataWrapper::getDateFormatsImpl() { - NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getLocale() ); + NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getMyLocale() ); uno::Sequence< NumberFormatCode > aFormatSeq = aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::DATE ); sal_Int32 nCnt = aFormatSeq.getLength(); @@ -1751,10 +1759,10 @@ rtl::OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimal // --- mixed ---------------------------------------------------------- -::com::sun::star::lang::Locale LocaleDataWrapper::getLoadedLocale() const +LanguageTag LocaleDataWrapper::getLoadedLanguageTag() const { LanguageCountryInfo aLCInfo = getLanguageCountryInfo(); - return lang::Locale( aLCInfo.Language, aLCInfo.Country, aLCInfo.Variant ); + return LanguageTag( lang::Locale( aLCInfo.Language, aLCInfo.Country, aLCInfo.Variant )); } @@ -1763,14 +1771,10 @@ rtl::OUString LocaleDataWrapper::appendLocaleInfo(const rtl::OUString& rDebugMsg ::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical ); rtl::OUStringBuffer aDebugMsg(rDebugMsg); aDebugMsg.append(static_cast<sal_Unicode>('\n')); - aDebugMsg.append(aLocale.Language); - aDebugMsg.append(static_cast<sal_Unicode>('_')); - aDebugMsg.append(aLocale.Country); + aDebugMsg.append(maLanguageTag.getBcp47()); aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" requested\n")); - lang::Locale aLoaded = getLoadedLocale(); - aDebugMsg.append(aLoaded.Language); - aDebugMsg.append(static_cast<sal_Unicode>('_')); - aDebugMsg.append(aLoaded.Country); + LanguageTag aLoaded = getLoadedLanguageTag(); + aDebugMsg.append(aLoaded.getBcp47()); aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" loaded")); return aDebugMsg.makeStringAndClear(); } @@ -1831,7 +1835,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() { try { - return xLD->getAllCalendars2( getLocale() ); + return xLD->getAllCalendars2( getMyLocale() ); } catch (const Exception& e) { @@ -1855,7 +1859,7 @@ void LocaleDataWrapper::evaluateLocaleDataChecking() try { const_cast<LocaleDataWrapper*>(this)->aDateAcceptancePatterns = - xLD->getDateAcceptancePatterns( getLocale() ); + xLD->getDateAcceptancePatterns( getMyLocale() ); return aDateAcceptancePatterns; } catch (const Exception& e) @@ -1876,7 +1880,7 @@ void LocaleDataWrapper::setDateAcceptancePatterns( { try { - aDateAcceptancePatterns = xLD->getDateAcceptancePatterns( getLocale() ); + aDateAcceptancePatterns = xLD->getDateAcceptancePatterns( getMyLocale() ); } catch (const Exception& e) { diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx index 4d1d68aad316..a6f851230858 100644 --- a/unotools/source/i18n/textsearch.cxx +++ b/unotools/source/i18n/textsearch.cxx @@ -132,7 +132,7 @@ TextSearch::TextSearch(const SearchParam & rParam, LanguageType eLang ) TextSearch::TextSearch(const SearchParam & rParam, const CharClass& rCClass ) { - Init( rParam, rCClass.getLocale() ); + Init( rParam, rCClass.getLanguageTag().getLocale() ); } TextSearch::TextSearch( const SearchOptions& rPara ) diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index c8b0fe10e0af..d850dd73aab2 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -55,7 +55,7 @@ private: SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { - pLocaleData = new LocaleDataWrapper( aSysLocaleOptions.GetRealLanguageTag().getLocale() ); + pLocaleData = new LocaleDataWrapper( aSysLocaleOptions.GetRealLanguageTag() ); setDateAcceptancePatternsConfig(); // listen for further changes @@ -73,7 +73,7 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() CharClass* SvtSysLocale_Impl::GetCharClass() { if ( !pCharClass ) - pCharClass = new CharClass( aSysLocaleOptions.GetRealLanguageTag().getLocale() ); + pCharClass = new CharClass( aSysLocaleOptions.GetRealLanguageTag() ); return pCharClass; } @@ -83,9 +83,9 @@ void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sa if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { - com::sun::star::lang::Locale aLocale( aSysLocaleOptions.GetRealLanguageTag().getLocale() ); - pLocaleData->setLocale( aLocale ); - GetCharClass()->setLocale( aLocale ); + const LanguageTag& rLanguageTag = aSysLocaleOptions.GetRealLanguageTag(); + pLocaleData->setLanguageTag( rLanguageTag ); + GetCharClass()->setLanguageTag( rLanguageTag ); } if ( nHint & SYSLOCALEOPTIONS_HINT_DATEPATTERNS ) { diff --git a/vcl/inc/vcl/field.hxx b/vcl/inc/vcl/field.hxx index f2d63b0dbdd0..741656fa7015 100644 --- a/vcl/inc/vcl/field.hxx +++ b/vcl/inc/vcl/field.hxx @@ -32,6 +32,7 @@ namespace com { namespace sun { namespace star { namespace lang { struct Locale; class CalendarWrapper; class LocaleDataWrapper; +class LanguageTag; // ----------------- // - FormatterBase - @@ -78,6 +79,7 @@ public: virtual void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); const ::com::sun::star::lang::Locale& GetLocale() const; + const LanguageTag& GetLanguageTag() const; const AllSettings& GetFieldSettings() const; diff --git a/vcl/inc/vcl/i18nhelp.hxx b/vcl/inc/vcl/i18nhelp.hxx index 54b05743cc10..98351ea630cc 100644 --- a/vcl/inc/vcl/i18nhelp.hxx +++ b/vcl/inc/vcl/i18nhelp.hxx @@ -21,8 +21,8 @@ #define _VCL_I18NHELP_HXX #include <com/sun/star/uno/Reference.h> -#include <com/sun/star/lang/Locale.hpp> #include <osl/mutex.hxx> +#include <i18npool/languagetag.hxx> #include <tools/string.hxx> #include <vcl/dllapi.h> @@ -49,7 +49,7 @@ class VCL_DLLPUBLIC I18nHelper { private: ::osl::Mutex maMutex; - ::com::sun::star::lang::Locale maLocale; + LanguageTag maLanguageTag; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; LocaleDataWrapper* mpLocaleDataWrapper; @@ -67,7 +67,7 @@ protected: public: - I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& rLocale ); + I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const LanguageTag& rLanguageTag ); ~I18nHelper(); sal_Int32 CompareString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const; diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index 895e86213101..bdec4bb2d3c4 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -33,10 +33,11 @@ using namespace ::com::sun::star; -vcl::I18nHelper::I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& rLocale ) +vcl::I18nHelper::I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const LanguageTag& rLanguageTag ) + : + maLanguageTag( rLanguageTag) { m_xContext = rxContext; - maLocale = rLocale; mpLocaleDataWrapper = NULL; mpTransliterationWrapper= NULL; mbTransliterateIgnoreCase = sal_False; @@ -65,7 +66,7 @@ utl::TransliterationWrapper& vcl::I18nHelper::ImplGetTransliterationWrapper() co nModules |= i18n::TransliterationModules_IGNORE_CASE; ((vcl::I18nHelper*)this)->mpTransliterationWrapper = new utl::TransliterationWrapper( m_xContext, (i18n::TransliterationModules)nModules ); - ((vcl::I18nHelper*)this)->mpTransliterationWrapper->loadModuleIfNeeded( LanguageTag( maLocale ).getLanguageType() ); + ((vcl::I18nHelper*)this)->mpTransliterationWrapper->loadModuleIfNeeded( maLanguageTag.getLanguageType() ); } return *mpTransliterationWrapper; } @@ -74,7 +75,7 @@ LocaleDataWrapper& vcl::I18nHelper::ImplGetLocaleDataWrapper() const { if ( !mpLocaleDataWrapper ) { - ((vcl::I18nHelper*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( m_xContext, maLocale ); + ((vcl::I18nHelper*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( m_xContext, maLanguageTag ); } return *mpLocaleDataWrapper; } diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index cc89b324b986..5370f1cc647a 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1533,7 +1533,7 @@ const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const { if ( !mpData->mpLocaleDataWrapper ) ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( - comphelper::getProcessComponentContext(), GetLanguageTag().getLocale() ); + comphelper::getProcessComponentContext(), GetLanguageTag() ); return *mpData->mpLocaleDataWrapper; } @@ -1543,7 +1543,7 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const { if ( !mpData->mpUILocaleDataWrapper ) ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( - comphelper::getProcessComponentContext(), GetUILanguageTag().getLocale() ); + comphelper::getProcessComponentContext(), GetUILanguageTag() ); return *mpData->mpUILocaleDataWrapper; } @@ -1553,7 +1553,7 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const { if ( !mpData->mpI18nHelper ) { ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( - comphelper::getProcessComponentContext(), GetLanguageTag().getLocale() ); + comphelper::getProcessComponentContext(), GetLanguageTag() ); } return *mpData->mpI18nHelper; } @@ -1564,7 +1564,7 @@ const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const { if ( !mpData->mpUII18nHelper ) { ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( - comphelper::getProcessComponentContext(), GetUILanguageTag().getLocale() ); + comphelper::getProcessComponentContext(), GetUILanguageTag() ); } return *mpData->mpUII18nHelper; } diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 28db0e2735b1..7350d3078e92 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -309,7 +309,7 @@ LocaleDataWrapper& FormatterBase::ImplGetLocaleDataWrapper() const { if ( !mpLocaleDataWrapper ) { - ((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( GetLocale() ); + ((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( GetLanguageTag() ); } return *mpLocaleDataWrapper; } @@ -348,7 +348,7 @@ void FormatterBase::SetStrictFormat( sal_Bool bStrict ) void FormatterBase::SetLocale( const lang::Locale& rLocale ) { - ImplGetLocaleDataWrapper().setLocale( rLocale ); + ImplGetLocaleDataWrapper().setLanguageTag( LanguageTag( rLocale) ); mbDefaultLocale = sal_False; ReformatAll(); } @@ -365,7 +365,22 @@ const lang::Locale& FormatterBase::GetLocale() const return Application::GetSettings().GetLanguageTag().getLocale(); } - return mpLocaleDataWrapper->getLocale(); + return mpLocaleDataWrapper->getLanguageTag().getLocale(); +} + +// ----------------------------------------------------------------------- + +const LanguageTag& FormatterBase::GetLanguageTag() const +{ + if ( !mpLocaleDataWrapper || mbDefaultLocale ) + { + if ( mpField ) + return mpField->GetSettings().GetLanguageTag(); + else + return Application::GetSettings().GetLanguageTag(); + } + + return mpLocaleDataWrapper->getLanguageTag(); } // ----------------------------------------------------------------------- @@ -885,7 +900,7 @@ void NumericField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -1043,7 +1058,7 @@ void NumericBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -1887,7 +1902,7 @@ void MetricField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2013,7 +2028,7 @@ void MetricBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2299,7 +2314,7 @@ void CurrencyField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2401,7 +2416,7 @@ void CurrencyBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index cc9061f89cbd..725f697411b4 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -2013,7 +2013,7 @@ void DateField::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & (SETTINGS_LOCALE|SETTINGS_MISC)) ) { if ( IsDefaultLocale() && ( rDCEvt.GetFlags() & SETTINGS_LOCALE ) ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); ReformatAll(); } } @@ -2098,7 +2098,7 @@ void DateBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); ReformatAll(); } } @@ -2959,7 +2959,7 @@ void TimeField::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); ReformatAll(); } } @@ -3111,7 +3111,7 @@ void TimeBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); + ImplGetLocaleDataWrapper().setLanguageTag( GetSettings().GetLanguageTag() ); ReformatAll(); } } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 0c7d132f334e..5d326452c40a 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2970,7 +2970,7 @@ void TextEngine::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) LocaleDataWrapper* TextEngine::ImpGetLocaleDataWrapper() { if ( !mpLocaleDataWrapper ) - mpLocaleDataWrapper = new LocaleDataWrapper( GetLocale() ); + mpLocaleDataWrapper = new LocaleDataWrapper( LanguageTag( GetLocale()) ); return mpLocaleDataWrapper; } diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 2d06b91b9c81..d33b2b77e5e4 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -238,16 +238,16 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( pFormatter ) { pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()), - pFormatter->GetLocale() ); + pFormatter->GetLanguageTag() ); pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(pFormatter->GetServiceManager()), - pFormatter->GetLocale() ); + pFormatter->GetLanguageTag() ); } else { - lang::Locale aLocale( LanguageTag( MsLangId::getSystemLanguage() ).getLocale() ); + LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale ); + pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; @@ -273,16 +273,16 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( pFormatter ) { pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()), - pFormatter->GetLocale() ); + pFormatter->GetLanguageTag() ); pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(pFormatter->GetServiceManager()), - pFormatter->GetLocale() ); + pFormatter->GetLanguageTag() ); } else { - lang::Locale aLocale( LanguageTag( MsLangId::getSystemLanguage() ).getLocale() ); + LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale ); + pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; @@ -803,12 +803,12 @@ sal_Bool SvXMLNumFmtExport::WriteTextWithCurrency_Impl( const OUString& rString, sal_Bool bRet = sal_False; - LanguageType nLang = LanguageTag( rLocale ).getLanguageType( false); - pFormatter->ChangeIntl( nLang ); + LanguageTag aLanguageTag( rLocale ); + pFormatter->ChangeIntl( aLanguageTag.getLanguageType( false) ); OUString sCurString, sDummy; pFormatter->GetCompatibilityCurrency( sCurString, sDummy ); - pCharClass->setLocale( rLocale ); + pCharClass->setLanguageTag( aLanguageTag ); OUString sUpperStr = pCharClass->uppercase(rString); sal_Int32 nPos = lcl_FindSymbol( sUpperStr, sCurString ); if ( nPos >= 0 ) @@ -1496,7 +1496,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt if ( nElemType == NF_KEY_NNNN ) { // write additional text element for separator - pLocaleData->setLocale( LanguageTag( nLang ).getLocale() ); + pLocaleData->setLanguageTag( LanguageTag( nLang ) ); AddToTextElement_Impl( pLocaleData->getLongDateDayOfWeekSep() ); } } diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index de3d238d2013..b9a105d6a5dc 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -602,9 +602,9 @@ const LocaleDataWrapper& SvXMLNumImpData::GetLocaleData( LanguageType nLang ) pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext( pFormatter ? pFormatter->GetServiceManager() : mxServiceFactory), - LanguageTag( nLang ).getLocale() ); + LanguageTag( nLang ) ); else - pLocaleData->setLocale( LanguageTag( nLang ).getLocale() ); + pLocaleData->setLanguageTag( LanguageTag( nLang ) ); return *pLocaleData; } |