summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/global.hxx5
-rw-r--r--sc/source/core/data/dpcache.cxx2
-rw-r--r--sc/source/core/data/global.cxx26
-rw-r--r--sc/source/core/data/table3.cxx2
-rw-r--r--sc/source/core/tool/cellkeytranslator.cxx2
-rw-r--r--sc/source/core/tool/compare.cxx2
-rw-r--r--sc/source/ui/app/inputwin.cxx2
7 files changed, 21 insertions, 20 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index f9a773c39b6f..7cf4d84b402f 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -35,6 +35,7 @@
#undef bool
#include <memory>
+#include <optional>
#include <string_view>
namespace com::sun::star::uno { template <typename > class Reference; }
@@ -521,7 +522,7 @@ class ScGlobal
static std::unique_ptr<SvNumberFormatter> xEnglishFormatter; // for UNO / XML export
static css::uno::Reference< css::i18n::XOrdinalSuffix> xOrdinalSuffix;
- static std::unique_ptr<CalendarWrapper> xCalendar;
+ static std::optional<CalendarWrapper> oCalendar;
static std::atomic<CollatorWrapper*> pCaseCollator;
static std::atomic<CollatorWrapper*> pCollator;
static std::atomic<::utl::TransliterationWrapper*> pTransliteration;
@@ -533,7 +534,7 @@ class ScGlobal
static void InitPPT();
public:
- static std::unique_ptr<SvtSysLocale> xSysLocale;
+ static std::optional<SvtSysLocale> oSysLocale;
SC_DLLPUBLIC static const LocaleDataWrapper* getLocaleDataPtr();
SC_DLLPUBLIC static const CharClass& getCharClass();
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#)