diff options
author | Eike Rathke <erack@redhat.com> | 2012-11-22 12:26:52 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2012-11-22 12:34:59 +0100 |
commit | 9955dbebbdf1b7d36fec272dfea46f57fab47e19 (patch) | |
tree | 80705ccc2382e7440ea76f62a544d64d12d1ce4f /vcl | |
parent | 9c5d6ea5efb5f56a4ac96b4a8505ed84abbbc6bf (diff) |
AllSettings with LanguageTag
Change-Id: I710ae66e51139662eb442b681fdf9cc9d158551d
Diffstat (limited to 'vcl')
26 files changed, 112 insertions, 144 deletions
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx index 24278f3fe488..9949eae4b6c0 100644 --- a/vcl/generic/print/genprnpsp.cxx +++ b/vcl/generic/print/genprnpsp.cxx @@ -1104,7 +1104,7 @@ sal_Bool PspSalPrinter::StartJob( const rtl::OUString* i_pFileName, const rtl::O aContext.Version = vcl::PDFWriter::PDF_1_4; aContext.Tagged = false; aContext.EmbedStandardFonts = true; - aContext.DocumentLocale = Application::GetSettings().GetLocale(); + aContext.DocumentLocale = Application::GetSettings().GetLanguageTag().getLocale(); aContext.ColorMode = i_rController.getPrinter()->GetPrinterOptions().IsConvertToGreyscales() ? vcl::PDFWriter::DrawGreyscale : vcl::PDFWriter::DrawColor; diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx index d49515b42d0a..3365fbb569e0 100644 --- a/vcl/generic/print/genpspgraphics.cxx +++ b/vcl/generic/print/genpspgraphics.cxx @@ -1185,7 +1185,7 @@ namespace vcl const char* getLangBoost() { const char* pLangBoost; - const LanguageType eLang = Application::GetSettings().GetUILanguage(); + const LanguageType eLang = Application::GetSettings().GetUILanguageTag().getLanguageType(); if (eLang == LANGUAGE_JAPANESE) pLangBoost = "jan"; else if (MsLangId::isKorean(eLang)) diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx index 0b8009607925..3a18de34a705 100644 --- a/vcl/inc/vcl/settings.hxx +++ b/vcl/inc/vcl/settings.hxx @@ -26,7 +26,7 @@ #include "vcl/font.hxx" #include "vcl/accel.hxx" #include "vcl/wall.hxx" -#include "com/sun/star/lang/Locale.hpp" +#include <i18npool/languagetag.hxx> #include <unotools/syslocale.hxx> class CollatorWrapper; @@ -992,17 +992,15 @@ class ImplAllSettingsData ~ImplAllSettingsData(); private: - sal_uLong mnRefCount; + sal_uLong mnRefCount; MouseSettings maMouseSettings; StyleSettings maStyleSettings; MiscSettings maMiscSettings; HelpSettings maHelpSettings; - ::com::sun::star::lang::Locale maLocale; - sal_uLong mnSystemUpdate; - sal_uLong mnWindowUpdate; - ::com::sun::star::lang::Locale maUILocale; - LanguageType meLanguage; - LanguageType meUILanguage; + LanguageTag maLocale; + sal_uLong mnSystemUpdate; + sal_uLong mnWindowUpdate; + LanguageTag maUILocale; LocaleDataWrapper* mpLocaleDataWrapper; LocaleDataWrapper* mpUILocaleDataWrapper; vcl::I18nHelper* mpI18nHelper; @@ -1062,14 +1060,10 @@ public: const HelpSettings& GetHelpSettings() const { return mpData->maHelpSettings; } - void SetLocale( const ::com::sun::star::lang::Locale& rLocale ); - const ::com::sun::star::lang::Locale& GetLocale() const; - void SetUILocale( const ::com::sun::star::lang::Locale& rLocale ); - const ::com::sun::star::lang::Locale& GetUILocale() const; - void SetLanguage( LanguageType eLang ); - LanguageType GetLanguage() const; - void SetUILanguage( LanguageType eLang ); - LanguageType GetUILanguage() const; + void SetLanguageTag( const LanguageTag& rLanguageTag ); + const LanguageTag& GetLanguageTag() const; + void SetUILanguageTag( const LanguageTag& rLanguageTag ); + const LanguageTag& GetUILanguageTag() const; bool GetLayoutRTL() const; // returns true if UI language requires right-to-left UI const LocaleDataWrapper& GetLocaleDataWrapper() const; const LocaleDataWrapper& GetUILocaleDataWrapper() const; diff --git a/vcl/source/app/dbggui.cxx b/vcl/source/app/dbggui.cxx index b4601b5416d1..ee72e0201f9b 100644 --- a/vcl/source/app/dbggui.cxx +++ b/vcl/source/app/dbggui.cxx @@ -1257,7 +1257,7 @@ void DbgDialogTest( Window* pWindow ) nAccelPos = aText.Search( '~' ); if ( nAccelPos != STRING_NOTFOUND ) { - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = vcl::unohelper::CreateCharacterClassification(); XubString aUpperText = xCharClass->toUpper( aText, 0, aText.Len(), rLocale ); cAccel = aUpperText.GetChar( nAccelPos+1 ); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index aa42cb6c8ecd..cc89b324b986 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1195,12 +1195,13 @@ sal_Bool HelpSettings::operator ==( const HelpSettings& rSet ) const // ======================================================================= ImplAllSettingsData::ImplAllSettingsData() + : + maLocale( LANGUAGE_SYSTEM ), + maUILocale( LANGUAGE_SYSTEM ) { mnRefCount = 1; mnSystemUpdate = SETTINGS_ALLSETTINGS; mnWindowUpdate = SETTINGS_ALLSETTINGS; - meLanguage = LANGUAGE_SYSTEM; - meUILanguage = LANGUAGE_SYSTEM; mpLocaleDataWrapper = NULL; mpUILocaleDataWrapper = NULL; mpI18nHelper = NULL; @@ -1215,12 +1216,12 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : maStyleSettings( rData.maStyleSettings ), maMiscSettings( rData.maMiscSettings ), maHelpSettings( rData.maHelpSettings ), - maLocale( rData.maLocale ) + maLocale( rData.maLocale ), + maUILocale( rData.maUILocale ) { mnRefCount = 1; mnSystemUpdate = rData.mnSystemUpdate; mnWindowUpdate = rData.mnWindowUpdate; - meLanguage = rData.meLanguage; // Pointer couldn't shared and objects haven't a copy ctor // So we create the cache objects new, if the GetFunction is // called @@ -1363,9 +1364,9 @@ sal_uLong AllSettings::Update( sal_uLong nFlags, const AllSettings& rSet ) if ( nFlags & SETTINGS_LOCALE ) { - if ( mpData->meLanguage || rSet.mpData->meLanguage ) + if ( mpData->maLocale != rSet.mpData->maLocale ) { - SetLanguage( rSet.mpData->meLanguage ); + SetLanguageTag( rSet.mpData->maLocale ); nChangeFlags |= SETTINGS_LOCALE; } } @@ -1399,7 +1400,7 @@ sal_uLong AllSettings::GetChangeFlags( const AllSettings& rSet ) const if ( mpData->maHelpSettings != rSet.mpData->maHelpSettings ) nChangeFlags |= SETTINGS_HELP; - if ( mpData->meLanguage || rSet.mpData->meLanguage ) + if ( mpData->maLocale != rSet.mpData->maLocale ) nChangeFlags |= SETTINGS_LOCALE; return nChangeFlags; @@ -1431,45 +1432,14 @@ sal_Bool AllSettings::operator ==( const AllSettings& rSet ) const // ----------------------------------------------------------------------- -void AllSettings::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) +void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag ) { - CopyData(); - - mpData->maLocale = rLocale; - - if ( rLocale.Language.isEmpty() ) - mpData->meLanguage = LANGUAGE_SYSTEM; - else - mpData->meLanguage = LanguageTag( rLocale ).getLanguageType( false); - if ( mpData->mpLocaleDataWrapper ) - { - delete mpData->mpLocaleDataWrapper; - mpData->mpLocaleDataWrapper = NULL; - } - if ( mpData->mpI18nHelper ) - { - delete mpData->mpI18nHelper; - mpData->mpI18nHelper = NULL; - } -} - -// ----------------------------------------------------------------------- - -void AllSettings::SetUILocale( const ::com::sun::star::lang::Locale& ) -{ - // there is only one UILocale per process -} - -// ----------------------------------------------------------------------- - -void AllSettings::SetLanguage( LanguageType eLang ) -{ - if ( eLang != mpData->meLanguage ) + if (mpData->maLocale != rLanguageTag) { CopyData(); - mpData->meLanguage = eLang; - mpData->maLocale = LanguageTag( GetLanguage() ).getLocale(); + mpData->maLocale = rLanguageTag; + if ( mpData->mpLocaleDataWrapper ) { delete mpData->mpLocaleDataWrapper; @@ -1485,9 +1455,9 @@ void AllSettings::SetLanguage( LanguageType eLang ) // ----------------------------------------------------------------------- -void AllSettings::SetUILanguage( LanguageType ) +void AllSettings::SetUILanguageTag( const LanguageTag& ) { - // there is only one UILanguage per process + // there is only one UILocale per process } // ----------------------------------------------------------------------- @@ -1526,7 +1496,7 @@ bool AllSettings::GetLayoutRTL() const LanguageType aLang = LANGUAGE_DONTKNOW; ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maAppData.mpSettings ) - aLang = pSVData->maAppData.mpSettings->GetUILanguage(); + aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType(); bRTL = MsLangId::isRightToLeft( aLang ); } else @@ -1537,50 +1507,33 @@ bool AllSettings::GetLayoutRTL() const // ----------------------------------------------------------------------- -const ::com::sun::star::lang::Locale& AllSettings::GetLocale() const +const LanguageTag& AllSettings::GetLanguageTag() const { - if ( mpData->maLocale.Language.isEmpty() ) - mpData->maLocale = mpData->maSysLocale.GetLanguageTag().getLocale(); + // SYSTEM locale means: use settings from SvtSysLocale that is resolved + if ( mpData->maLocale.isSystemLocale() ) + mpData->maLocale = mpData->maSysLocale.GetLanguageTag(); return mpData->maLocale; } // ----------------------------------------------------------------------- -const ::com::sun::star::lang::Locale& AllSettings::GetUILocale() const +const LanguageTag& AllSettings::GetUILanguageTag() const { // the UILocale is never changed - if ( mpData->maUILocale.Language.isEmpty() ) - mpData->maUILocale = mpData->maSysLocale.GetUILanguageTag().getLocale(); + if ( mpData->maUILocale.isSystemLocale() ) + mpData->maUILocale = mpData->maSysLocale.GetUILanguageTag(); return mpData->maUILocale; } // ----------------------------------------------------------------------- -LanguageType AllSettings::GetLanguage() const -{ - // meLanguage == LANGUAGE_SYSTEM means: use settings from SvtSysLocale - if ( mpData->meLanguage == LANGUAGE_SYSTEM ) - return mpData->maSysLocale.GetLanguageTag().getLanguageType(); - - return mpData->meLanguage; -} - -// ----------------------------------------------------------------------- - -LanguageType AllSettings::GetUILanguage() const -{ - // the UILanguage is never changed - return mpData->maSysLocale.GetUILanguageTag().getLanguageType(); -} - -// ----------------------------------------------------------------------- - const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const { if ( !mpData->mpLocaleDataWrapper ) - ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetLocale() ); + ((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( + comphelper::getProcessComponentContext(), GetLanguageTag().getLocale() ); return *mpData->mpLocaleDataWrapper; } @@ -1589,7 +1542,8 @@ const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const { if ( !mpData->mpUILocaleDataWrapper ) - ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetUILocale() ); + ((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( + comphelper::getProcessComponentContext(), GetUILanguageTag().getLocale() ); return *mpData->mpUILocaleDataWrapper; } @@ -1598,7 +1552,8 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const { if ( !mpData->mpI18nHelper ) { - ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetLocale() ); + ((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( + comphelper::getProcessComponentContext(), GetLanguageTag().getLocale() ); } return *mpData->mpI18nHelper; } @@ -1608,7 +1563,8 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const { if ( !mpData->mpUII18nHelper ) { - ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetUILocale() ); + ((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( + comphelper::getProcessComponentContext(), GetUILanguageTag().getLocale() ); } return *mpData->mpUII18nHelper; } @@ -1628,7 +1584,7 @@ void AllSettings::LocaleSettingsChanged( sal_uInt32 nHint ) } if ( (nHint & SYSLOCALEOPTIONS_HINT_LOCALE) ) - aAllSettings.SetLocale( aAllSettings.mpData->maSysLocale.GetOptions().GetLanguageTag().getLocale() ); + aAllSettings.SetLanguageTag( aAllSettings.mpData->maSysLocale.GetOptions().GetLanguageTag() ); Application::SetSettings( aAllSettings ); } diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 5fee6d9f117d..45147d1d6105 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -619,17 +619,18 @@ void Application::SetSettings( const AllSettings& rSettings ) { GetSettings(); *pSVData->maAppData.mpSettings = rSettings; - ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); + ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag().getLocale() ); } else { AllSettings aOldSettings = *pSVData->maAppData.mpSettings; - if( aOldSettings.GetUILanguage() != rSettings.GetUILanguage() && pSVData->mpResMgr ) + if( aOldSettings.GetUILanguageTag().getLanguageType() != rSettings.GetUILanguageTag().getLanguageType() && + pSVData->mpResMgr ) { delete pSVData->mpResMgr; pSVData->mpResMgr = NULL; } - ResMgr::SetDefaultLocale( rSettings.GetUILocale() ); + ResMgr::SetDefaultLocale( rSettings.GetUILanguageTag().getLocale() ); *pSVData->maAppData.mpSettings = rSettings; sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( *pSVData->maAppData.mpSettings ); if ( nChangeFlags ) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index d9af0b698a50..b238497e3a00 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -181,7 +181,7 @@ ResMgr* ImplGetResMgr() ImplSVData* pSVData = ImplGetSVData(); if ( !pSVData->mpResMgr ) { - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); + ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); pSVData->mpResMgr = ResMgr::SearchCreateResMgr( VCL_CREATERESMGR_NAME( vcl ), aLocale ); static bool bMessageOnce = false; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index eed89146bd3b..0c1ae909cd4b 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -795,9 +795,11 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI { if ( nMode == EDIT_DELMODE_RESTOFWORD ) { - i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); + i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Min(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); if ( aBoundary.startPos == aSelection.Min() ) - aBoundary = xBI->previousWord( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + aBoundary = xBI->previousWord( maText, aSelection.Min(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); aSelection.Min() = aBoundary.startPos; } else if ( nMode == EDIT_DELMODE_RESTOFCONTENT ) @@ -807,14 +809,16 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI else { sal_Int32 nCount = 1; - aSelection.Min() = xBI->previousCharacters( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); + aSelection.Min() = xBI->previousCharacters( maText, aSelection.Min(), + GetSettings().GetLanguageTag().getLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } else { if ( nMode == EDIT_DELMODE_RESTOFWORD ) { - i18n::Boundary aBoundary = xBI->nextWord( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + i18n::Boundary aBoundary = xBI->nextWord( maText, aSelection.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); aSelection.Max() = aBoundary.startPos; } else if ( nMode == EDIT_DELMODE_RESTOFCONTENT ) @@ -824,7 +828,8 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI else { sal_Int32 nCount = 1; - aSelection.Max() = xBI->nextCharacters( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); + aSelection.Max() = xBI->nextCharacters( maText, aSelection.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } } @@ -1509,7 +1514,8 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt ) else if ( rMEvt.GetClicks() == 2 ) { uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator(); - i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); + i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); ImplSetSelection( Selection( aBoundary.startPos, aBoundary.endPos ) ); ImplCopyToSelectionClipboard(); } @@ -1742,28 +1748,33 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt ) { if ( bWord ) { - i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); + i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSel.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True ); if ( aBoundary.startPos == aSel.Max() ) - aBoundary = xBI->previousWord( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + aBoundary = xBI->previousWord( maText, aSel.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); aSel.Max() = aBoundary.startPos; } else { sal_Int32 nCount = 1; - aSel.Max() = xBI->previousCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); + aSel.Max() = xBI->previousCharacters( maText, aSel.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } else if ( bGoRight && ( aSel.Max() < maText.Len() ) ) { if ( bWord ) { - i18n::Boundary aBoundary = xBI->nextWord( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); + i18n::Boundary aBoundary = xBI->nextWord( maText, aSel.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES ); aSel.Max() = aBoundary.startPos; } else { sal_Int32 nCount = 1; - aSel.Max() = xBI->nextCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); + aSel.Max() = xBI->nextCharacters( maText, aSel.Max(), + GetSettings().GetLanguageTag().getLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount ); } } else if ( bGoHome ) diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 9600e447c9bb..28db0e2735b1 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -360,9 +360,9 @@ const lang::Locale& FormatterBase::GetLocale() const if ( !mpLocaleDataWrapper || mbDefaultLocale ) { if ( mpField ) - return mpField->GetSettings().GetLocale(); + return mpField->GetSettings().GetLanguageTag().getLocale(); else - return Application::GetSettings().GetLocale(); + return Application::GetSettings().GetLanguageTag().getLocale(); } return mpLocaleDataWrapper->getLocale(); @@ -885,7 +885,7 @@ void NumericField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -1043,7 +1043,7 @@ void NumericBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -1887,7 +1887,7 @@ void MetricField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2013,7 +2013,7 @@ void MetricBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2299,7 +2299,7 @@ void CurrencyField::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); String sNewDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sNewThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); ImplUpdateSeparators( sOldDecSep, sNewDecSep, sOldThSep, sNewThSep, this ); @@ -2401,7 +2401,7 @@ void CurrencyBox::DataChanged( const DataChangedEvent& rDCEvt ) String sOldDecSep = ImplGetLocaleDataWrapper().getNumDecimalSep(); String sOldThSep = ImplGetLocaleDataWrapper().getNumThousandSep(); if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); 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 eb7958658810..cc9061f89cbd 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -159,7 +159,8 @@ static int ImplIsPatternChar( sal_Unicode cChar, sal_Char cEditMask ) try { rtl::OUString aCharStr(cChar); - nType = ImplGetCharClass()->getStringType( aCharStr, 0, aCharStr.getLength(), Application::GetSettings().GetLocale() ); + nType = ImplGetCharClass()->getStringType( aCharStr, 0, aCharStr.getLength(), + Application::GetSettings().GetLanguageTag().getLocale() ); } catch (const ::com::sun::star::uno::Exception&) { @@ -208,7 +209,8 @@ static sal_Unicode ImplPatternChar( sal_Unicode cChar, sal_Char cEditMask ) (cEditMask == EDITMASK_UPPERALPHANUM) || ( cEditMask == EDITMASK_UPPERALLCHAR ) ) { - cChar = ImplGetCharClass()->toUpper(rtl::OUString(cChar), 0, 1, Application::GetSettings().GetLocale())[0]; + cChar = ImplGetCharClass()->toUpper(rtl::OUString(cChar), 0, 1, + Application::GetSettings().GetLanguageTag().getLocale())[0]; } return cChar; } @@ -2011,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().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); ReformatAll(); } } @@ -2096,7 +2098,7 @@ void DateBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); ReformatAll(); } } @@ -2957,7 +2959,7 @@ void TimeField::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); ReformatAll(); } } @@ -3109,7 +3111,7 @@ void TimeBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_LOCALE) ) { if ( IsDefaultLocale() ) - ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLocale() ); + ImplGetLocaleDataWrapper().setLocale( GetSettings().GetLanguageTag().getLocale() ); ReformatAll(); } } diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 6894675b8b29..34fd3fb053bb 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -146,7 +146,7 @@ namespace { return comphelper::string::NaturalStringSorter( ::comphelper::getProcessComponentContext(), - Application::GetSettings().GetLocale()); + Application::GetSettings().GetLanguageTag().getLocale()); } }; } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index b719b7eed54f..0c7d132f334e 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -2962,7 +2962,7 @@ void TextEngine::SetLocale( const ::com::sun::star::lang::Locale& rLocale ) { if ( maLocale.Language.isEmpty() ) { - maLocale = Application::GetSettings().GetUILocale(); + maLocale = Application::GetSettings().GetUILanguageTag().getLocale(); // XXX why UI locale? } return maLocale; } diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 10fadc705b90..05bc05532001 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -721,7 +721,7 @@ TextWindow::TextWindow( Window* pParent ) : Window( pParent ) mpExtTextEngine->SetMaxTextLen( STRING_MAXLEN ); if( pParent->GetStyle() & WB_BORDER ) mpExtTextEngine->SetLeftMargin( 2 ); - mpExtTextEngine->SetLocale( GetSettings().GetLocale() ); + mpExtTextEngine->SetLocale( GetSettings().GetLanguageTag().getLocale() ); mpExtTextView = new ExtTextView( mpExtTextEngine, this ); mpExtTextEngine->InsertView( mpExtTextView ); mpExtTextEngine->EnableUndo( sal_True ); diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx index 6b8744acd206..4fe25637a86e 100644 --- a/vcl/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -162,7 +162,7 @@ sal_Bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions& nStartNode = aStartPaM.GetPara(); util::SearchOptions aOptions( rSearchOptions ); - aOptions.Locale = Application::GetSettings().GetLocale(); + aOptions.Locale = Application::GetSettings().GetLanguageTag().getLocale(); utl::TextSearch aSearcher( rSearchOptions ); // ueber die Absaetze iterieren... diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx index 1f7a329da17e..a67e8f56f0cf 100644 --- a/vcl/source/gdi/impimagetree.cxx +++ b/vcl/source/gdi/impimagetree.cxx @@ -237,8 +237,9 @@ bool ImplImageTree::doLoadImage( if (localized) { sal_Int32 pos = name.lastIndexOf('/'); if (pos != -1) { + /* FIXME-BCP47: this needs to be changed for language tags! */ css::lang::Locale const & loc = - Application::GetSettings().GetUILocale(); + Application::GetSettings().GetUILanguageTag().getLocale(); paths.push_back(createPath(name, pos, loc.Language)); if (!loc.Country.isEmpty()) { rtl::OUStringBuffer b(loc.Language); diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 00b9cc34ab05..74519ad6c870 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -473,7 +473,7 @@ Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, com::sun::star::lang::Locale aLocale; if( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) { - aLocale = Application::GetSettings().GetUILocale(); + aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); } else { @@ -4945,7 +4945,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, if ( xBI.is() ) { - const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILocale()); + const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale()); xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); //aHyphOptions.hyphenIndex = nSoftBreak; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index e2fcca66d36c..463dad0187e4 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -132,7 +132,7 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri OUString sUri = sUIDir + sUIFile; - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); + com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); bool bEN_US = aLocale.Language == "en" && aLocale.Country == "US" && aLocale.Variant.isEmpty(); if (!bEN_US) loadTranslations(aLocale, sUri); diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 11194b453a94..26f730016a15 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -417,7 +417,7 @@ static Window* ImplFindAccelWindow( Window* pParent, sal_uInt16& rIndex, sal_Uni if ( !xCharClass.is() ) xCharClass = vcl::unohelper::CreateCharacterClassification(); - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale(); cCharCode = xCharClass->toUpper( rtl::OUString(cCharCode), 0, 1, rLocale )[0]; if ( i < nFormEnd ) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index b6606b365999..926438c17fc1 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -370,7 +370,8 @@ MenuItemData* MenuItemList::SearchItem( sal_Unicode mnUnicode = pData->aText.GetChar(n+1); Window* pDefWindow = ImplGetDefaultWindow(); if( ( pDefWindow - && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( mnUnicode, Application::GetSettings().GetUILanguage(), mnKeyCode ) + && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( mnUnicode, + Application::GetSettings().GetUILanguageTag().getLanguageType(), mnKeyCode ) && aKeyCode.GetCode() == mnKeyCode.GetCode() ) || ( ascii @@ -430,7 +431,8 @@ size_t MenuItemList::GetItemCount( KeyCode aKeyCode ) const // so we have working shortcuts when ascii mnemonics are used Window* pDefWindow = ImplGetDefaultWindow(); if( ( pDefWindow - && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( pData->aText.GetChar(n+1), Application::GetSettings().GetUILanguage(), mnKeyCode ) + && pDefWindow->ImplGetFrame()->MapUnicodeToKeyCode( pData->aText.GetChar(n+1), + Application::GetSettings().GetUILanguageTag().getLanguageType(), mnKeyCode ) && aKeyCode.GetCode() == mnKeyCode.GetCode() ) || ( ascii diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx index da6394df0afc..877e1dd9d2d3 100644 --- a/vcl/source/window/mnemonic.cxx +++ b/vcl/source/window/mnemonic.cxx @@ -82,7 +82,7 @@ sal_Unicode MnemonicGenerator::ImplFindMnemonic( const XubString& rKey ) void MnemonicGenerator::RegisterMnemonic( const XubString& rKey ) { - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); // Don't crash even when we don't have access to i18n service @@ -128,7 +128,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey ) if ( !rKey.Len() || ImplFindMnemonic( rKey ) ) return sal_False; - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale(); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILanguageTag().getLocale(); uno::Reference < i18n::XCharacterClassification > xCharClass = GetCharClass(); // Don't crash even when we don't have access to i18n service @@ -140,7 +140,7 @@ sal_Bool MnemonicGenerator::CreateMnemonic( XubString& rKey ) sal_Bool bChanged = sal_False; xub_StrLen nLen = aKey.Len(); - bool bCJK = MsLangId::isCJK(Application::GetSettings().GetUILanguage()); + bool bCJK = MsLangId::isCJK(Application::GetSettings().GetUILanguageTag().getLanguageType()); // #107889# in CJK versions ALL strings (even those that contain latin characters) // will get mnemonics in the form: xyz (M) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 22c35fa01282..db996f3e22c0 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -315,7 +315,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl if ( !bUseSystemFont ) { ImplInitFontList(); - String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILocale() ); + String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILanguageTag().getLocale() ); xub_StrLen nIndex = 0; while( nIndex != STRING_NOTFOUND ) { @@ -397,7 +397,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl // if the UI is korean, chinese or another locale // where the system font size is kown to be often too small to // generate readable fonts enforce a minimum font size of 9 points - bool bBrokenLangFontHeight = MsLangId::isCJK(Application::GetSettings().GetUILanguage()); + bool bBrokenLangFontHeight = MsLangId::isCJK(Application::GetSettings().GetUILanguageTag().getLanguageType()); if (bBrokenLangFontHeight) defFontheight = Max(9, defFontheight); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index c0d013d9c518..318534a5a2aa 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -894,7 +894,7 @@ void Window::SetZoomedPointFont( const Font& rFont ) nType = DEFAULTFONT_FIXED; else nType = DEFAULTFONT_UI_SANS; - Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguage(), 0 ); + Font aTempFont = GetDefaultFont( nType, GetSettings().GetLanguageTag().getLanguageType(), 0 ); aFont.SetName( aTempFont.GetName() ); SetPointFont( aFont ); } diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 3310e6da6f5d..725bd19f1d9f 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -739,7 +739,7 @@ sal_uInt16 SalDisplay::GetIndicatorState() const rtl::OUString SalDisplay::GetKeyNameFromKeySym( KeySym nKeySym ) const { - rtl::OUString aLang = Application::GetSettings().GetUILocale().Language; + rtl::OUString aLang = Application::GetSettings().GetUILanguageTag().getLanguage(); rtl::OUString aRet; // return an empty string for keysyms that are not bound to diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index d5951112e575..d746b726d70d 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -132,7 +132,7 @@ namespace psp if( bInsertDefault && aLoc.Language.isEmpty() ) { // empty locale requested, fill in application UI locale - aLoc = Application::GetSettings().GetUILocale(); + aLoc = Application::GetSettings().GetUILanguageTag().getLocale(); #if OSL_DEBUG_LEVEL > 1 static const char* pEnvLocale = getenv( "SAL_PPDPARSER_LOCALE" ); diff --git a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx index 15e29b10405e..2481e314c9d5 100644 --- a/vcl/unx/gtk/fpicker/SalGtkPicker.cxx +++ b/vcl/unx/gtk/fpicker/SalGtkPicker.cxx @@ -187,7 +187,8 @@ void SalGtkPicker::setGtkLanguage() if (bSet) return; - ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale(); + /* FIXME-BCP47: let LanguageTag create glibc locale string! */ + ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); rtl::OUStringBuffer aBuffer; aBuffer.append( aLocale.Language ); aBuffer.appendAscii( "_" ); diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx index 5a1d37693e22..839750d79ebd 100644 --- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx @@ -3911,7 +3911,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings ) #endif // match font to e.g. resolve "Sans" - psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILocale() ); + psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILanguageTag().getLocale() ); #if OSL_DEBUG_LEVEL > 1 std::fprintf( stderr, "font match %s, name AFTER: \"%s\"\n", |