diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 08:59:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 10:19:39 +0200 |
commit | fbad565fcb5ee8d20a1a83838e66b43aeb23bfa4 (patch) | |
tree | 28fc4618e92e815f2842ff97cf7b6420cb0153c7 /sc/source | |
parent | f2111a924ac7bf654e1bf30018007140deec9d78 (diff) |
use optional for some fields in ScGlobal
Change-Id: I715b771a9c09b7bcc536ce114080e27d75c2e91c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122230
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/dpcache.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 26 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/cellkeytranslator.cxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/compare.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/inputwin.cxx | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 9b572a810b94..2900dd318e77 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -811,7 +811,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const { OUString aQueryStr = rEntry.GetQueryItem().maString.getString(); css::uno::Sequence< sal_Int32 > xOff; - const LanguageType nLang = ScGlobal::xSysLocale->GetLanguageTag().getLanguageType(); + const LanguageType nLang = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); OUString aCell = pTransliteration->transliterate( aCellStr, nLang, 0, aCellStr.getLength(), &xOff); OUString aQuer = pTransliteration->transliterate( diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 3b3db8292df2..81da6d470fef 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -80,8 +80,8 @@ std::atomic<ScUnoAddInCollection*> ScGlobal::pAddInCollection(nullptr); std::unique_ptr<ScUserList> ScGlobal::xUserList; LanguageType ScGlobal::eLnge = LANGUAGE_SYSTEM; std::atomic<css::lang::Locale*> ScGlobal::pLocale(nullptr); -std::unique_ptr<SvtSysLocale> ScGlobal::xSysLocale; -std::unique_ptr<CalendarWrapper> ScGlobal::xCalendar; +std::optional<SvtSysLocale> ScGlobal::oSysLocale; +std::optional<CalendarWrapper> ScGlobal::oCalendar; std::atomic<CollatorWrapper*> ScGlobal::pCollator(nullptr); std::atomic<CollatorWrapper*> ScGlobal::pCaseCollator(nullptr); std::atomic<::utl::TransliterationWrapper*> ScGlobal::pTransliteration(nullptr); @@ -438,7 +438,7 @@ void ScGlobal::Init() // FIXME: So remove this variable? eLnge = LANGUAGE_SYSTEM; - xSysLocale = std::make_unique<SvtSysLocale>(); + oSysLocale.emplace(); xEmptyBrushItem = std::make_unique<SvxBrushItem>( COL_TRANSPARENT, ATTR_BACKGROUND ); xButtonBrushItem = std::make_unique<SvxBrushItem>( Color(), ATTR_BACKGROUND ); @@ -543,8 +543,8 @@ void ScGlobal::Clear() delete pTransliteration.load(); pTransliteration = nullptr; delete pCaseCollator.load(); pCaseCollator = nullptr; delete pCollator.load(); pCollator = nullptr; - xCalendar.reset(); - xSysLocale.reset(); + oCalendar.reset(); + oSysLocale.reset(); delete pLocale.load(); pLocale = nullptr; delete pUnitConverter.load(); pUnitConverter = nullptr; @@ -1003,30 +1003,30 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration() const LocaleDataWrapper* ScGlobal::getLocaleDataPtr() { OSL_ENSURE( - xSysLocale, + oSysLocale, "ScGlobal::getLocaleDataPtr() called before ScGlobal::Init()"); - return &xSysLocale->GetLocaleData(); + return &oSysLocale->GetLocaleData(); } const CharClass& ScGlobal::getCharClass() { OSL_ENSURE( - xSysLocale, + oSysLocale, "ScGlobal::getCharClassPtr() called before ScGlobal::Init()"); - return xSysLocale->GetCharClass(); + return oSysLocale->GetCharClass(); } CalendarWrapper* ScGlobal::GetCalendar() { assert(!bThreadedGroupCalcInProgress); - if ( !xCalendar ) + if ( !oCalendar ) { - xCalendar.reset( new CalendarWrapper( ::comphelper::getProcessComponentContext() ) ); - xCalendar->loadDefaultCalendar( *GetLocale() ); + oCalendar.emplace( ::comphelper::getProcessComponentContext() ); + oCalendar->loadDefaultCalendar( *GetLocale() ); } - return xCalendar.get(); + return &*oCalendar; } namespace { diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 4dfe006b4bc5..4bfc8f2665b8 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2733,7 +2733,7 @@ public: { const OUString & rValue = pValueSource1 ? pValueSource1->getString() : *pValueSource2; const OUString aQueryStr = rItem.maString.getString(); - const LanguageType nLang = ScGlobal::xSysLocale->GetLanguageTag().getLanguageType(); + const LanguageType nLang = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); setupTransliteratorIfNeeded(); const OUString aCell( mpTransliteration->transliterate( rValue, nLang, 0, rValue.getLength(), diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx index 833f57d45aff..1192e3c04f83 100644 --- a/sc/source/core/tool/cellkeytranslator.cxx +++ b/sc/source/core/tool/cellkeytranslator.cxx @@ -165,7 +165,7 @@ void ScCellKeywordTranslator::transKeyword(OUString& rName, const lang::Locale* spInstance.reset( new ScCellKeywordTranslator ); LanguageType nLang = pLocale ? - LanguageTag(*pLocale).makeFallback().getLanguageType() : ScGlobal::xSysLocale->GetLanguageTag().getLanguageType(); + LanguageTag(*pLocale).makeFallback().getLanguageType() : ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); Sequence<sal_Int32> aOffsets; rName = spInstance->maTransWrapper.transliterate(rName, nLang, 0, rName.getLength(), &aOffsets); lclMatchKeyword(rName, spInstance->maStringNameMap, eOpCode, pLocale); diff --git a/sc/source/core/tool/compare.cxx b/sc/source/core/tool/compare.cxx index b3462e74ac23..51491abcfd7f 100644 --- a/sc/source/core/tool/compare.cxx +++ b/sc/source/core/tool/compare.cxx @@ -164,7 +164,7 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) } else { - const LanguageType nLang = ScGlobal::xSysLocale->GetLanguageTag().getLanguageType(); + const LanguageType nLang = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); OUString aCell( pTransliteration->transliterate( rCell1.maStr.getString(), nLang, 0, rCell1.maStr.getLength(), nullptr)); diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 37dab304f3c9..e7c61fa0dfdc 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -286,7 +286,7 @@ ScInputWindow::~ScInputWindow() void ScInputWindow::dispose() { - bool bDown = !ScGlobal::xSysLocale; // after Clear? + bool bDown = !ScGlobal::oSysLocale; // after Clear? // if any view's input handler has a pointer to this input window, reset it // (may be several ones, #74522#) |