sc/inc/global.hxx | 2 +- sc/source/core/data/global.cxx | 10 +++++----- sc/source/core/data/table6.cxx | 2 +- sc/source/core/tool/formulaopt.cxx | 2 +- sc/source/core/tool/interpr1.cxx | 4 ++-- sc/source/core/tool/interpr5.cxx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-)
New commits: commit b6c5d2d2661256a7789043b133ded51c6fdad3ff Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 17 12:34:57 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 17 15:03:49 2021 +0200 rather return ref from GetLocale since we never return a nullptr. Change-Id: I459acd6a25b133da5fc8516aa5e1a982df80ae8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122242 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 5ebd8263eabb..38911878c437 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -544,7 +544,7 @@ public: /// case-sensitive collator static CollatorWrapper& GetCaseCollator(); static CollatorWrapper& GetCollator(bool bCaseSensitive); - static css::lang::Locale* GetLocale(); + static css::lang::Locale& GetLocale(); SC_DLLPUBLIC static ::utl::TransliterationWrapper& GetTransliteration(); static ::utl::TransliterationWrapper& GetCaseTransliteration(); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index b950cfe3003f..cbc2bcec709d 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -1028,7 +1028,7 @@ CalendarWrapper& ScGlobal::GetCalendar() if ( !oCalendar ) { oCalendar.emplace( ::comphelper::getProcessComponentContext() ); - oCalendar->loadDefaultCalendar( *GetLocale() ); + oCalendar->loadDefaultCalendar( GetLocale() ); } return *oCalendar; } @@ -1050,7 +1050,7 @@ CollatorWrapper& ScGlobal::GetCollator() []() { CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() ); - p->loadDefaultCollator( *GetLocale(), SC_COLLATOR_IGNORES ); + p->loadDefaultCollator( GetLocale(), SC_COLLATOR_IGNORES ); return p; }, GetMutex()); @@ -1061,7 +1061,7 @@ CollatorWrapper& ScGlobal::GetCaseCollator() []() { CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() ); - p->loadDefaultCollator( *GetLocale(), 0 ); + p->loadDefaultCollator( GetLocale(), 0 ); return p; }, GetMutex()); @@ -1070,9 +1070,9 @@ CollatorWrapper& ScGlobal::GetCollator(bool bCaseSensitive) { return bCaseSensitive ? GetCaseCollator() : GetCollator(); } -css::lang::Locale* ScGlobal::GetLocale() +css::lang::Locale& ScGlobal::GetLocale() { - return comphelper::doubleCheckedInit( pLocale, + return *comphelper::doubleCheckedInit( pLocale, []() { return new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale()); }); } diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index 6b3321d2440c..f0e82629573b 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -826,7 +826,7 @@ bool ScTable::SearchAndReplace( { // SearchParam no longer needed - SearchOptions contains all settings i18nutil::SearchOptions2 aSearchOptions = rSearchItem.GetSearchOptions(); - aSearchOptions.Locale = *ScGlobal::GetLocale(); + aSearchOptions.Locale = ScGlobal::GetLocale(); // reflect UseAsianOptions flag in SearchOptions // (use only ignore case and width if asian options are disabled). diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx index 63362984164e..6c9e790aa00b 100644 --- a/sc/source/core/tool/formulaopt.cxx +++ b/sc/source/core/tool/formulaopt.cxx @@ -54,7 +54,7 @@ void ScFormulaOptions::GetDefaultFormulaSeparators( rSepArrayCol = ";"; rSepArrayRow = "|"; - const lang::Locale& rLocale = *ScGlobal::GetLocale(); + const lang::Locale& rLocale = ScGlobal::GetLocale(); const OUString& rLang = rLocale.Language; if (rLang == "ru") // Don't do automatic guess for these languages, and fall back to diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 5923116be0d2..1477eaaab424 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -2273,7 +2273,7 @@ void ScInterpreter::ScCell() { ScRefCellValue aCell(mrDoc, aCellPos); - ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell); + ScCellKeywordTranslator::transKeyword(aInfoType, &ScGlobal::GetLocale(), ocCell); // *** ADDRESS INFO *** if( aInfoType == "COL" ) @@ -2453,7 +2453,7 @@ void ScInterpreter::ScCellExternal() } aRef.SetAbsTab(-1); // revert the value. - ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell); + ScCellKeywordTranslator::transKeyword(aInfoType, &ScGlobal::GetLocale(), ocCell); ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager(); if ( aInfoType == "COL" ) diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 5daca41f5e24..d8b58618a0c0 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -3297,7 +3297,7 @@ void ScInterpreter::ScInfo() return; OUString aStr = GetString().getString(); - ScCellKeywordTranslator::transKeyword(aStr, ScGlobal::GetLocale(), ocInfo); + ScCellKeywordTranslator::transKeyword(aStr, &ScGlobal::GetLocale(), ocInfo); if( aStr == "SYSTEM" ) PushString( SC_INFO_OSVERSION ); else if( aStr == "OSVERSION" )