sc/inc/global.hxx | 12 ++++++++---- sc/qa/unit/ucalc.cxx | 3 +-- sc/source/core/data/autonamecache.cxx | 2 +- sc/source/core/data/conditio.cxx | 10 +++++----- sc/source/core/data/dociter.cxx | 14 ++++++-------- sc/source/core/data/document.cxx | 2 +- sc/source/core/data/dpcache.cxx | 14 ++++++-------- sc/source/core/data/dpitemdata.cxx | 4 ++-- sc/source/core/data/dpobject.cxx | 12 ++++++------ sc/source/core/data/funcdesc.cxx | 2 +- sc/source/core/data/global.cxx | 24 ++++++++++++++++-------- sc/source/core/data/table3.cxx | 11 +++++------ sc/source/core/tool/autoform.cxx | 8 ++++---- sc/source/core/tool/compare.cxx | 17 ++++++++--------- sc/source/core/tool/compiler.cxx | 6 +++--- sc/source/core/tool/dbdata.cxx | 4 ++-- sc/source/core/tool/doubleref.cxx | 2 +- sc/source/core/tool/interpr1.cxx | 8 ++++---- sc/source/core/tool/rangelst.cxx | 4 ++-- sc/source/core/tool/rangenam.cxx | 2 +- sc/source/core/tool/typedstrdata.cxx | 8 ++++---- sc/source/core/tool/userlist.cxx | 4 ++-- sc/source/filter/excel/xelink.cxx | 2 +- sc/source/ui/app/inputhdl.cxx | 10 +++++----- sc/source/ui/dbgui/scuiasciiopt.cxx | 2 +- sc/source/ui/docshell/externalrefmgr.cxx | 12 ++++++------ sc/source/ui/docshell/tablink.cxx | 2 +- sc/source/ui/miscdlgs/acredlin.cxx | 2 +- sc/source/ui/miscdlgs/solveroptions.cxx | 2 +- sc/source/ui/view/dbfunc3.cxx | 2 +- 30 files changed, 106 insertions(+), 101 deletions(-)
New commits: commit f9e09ba0513bbd0eaf872a60e6824a5b20229dfa Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 17 11:24:25 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 17 15:03:09 2021 +0200 rather return ref from GetTransliteration since we never return a nullptr. Also add a new utility method to simplify the call sites that need to pick the right collator Change-Id: I0ecf3ad32a0bf22d9e760620524f41bc18b54fff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122238 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 a8b939114201..5ebd8263eabb 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -546,8 +546,9 @@ public: static CollatorWrapper& GetCollator(bool bCaseSensitive); static css::lang::Locale* GetLocale(); - SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); - static ::utl::TransliterationWrapper* GetCaseTransliteration(); + SC_DLLPUBLIC static ::utl::TransliterationWrapper& GetTransliteration(); + static ::utl::TransliterationWrapper& GetCaseTransliteration(); + static ::utl::TransliterationWrapper& GetTransliteration(bool bCaseSensitive); SC_DLLPUBLIC static LanguageType eLnge; static constexpr sal_Unicode cListDelimiter = ','; diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx index a2be03c25796..f74219baf706 100644 --- a/sc/source/core/data/autonamecache.cxx +++ b/sc/source/core/data/autonamecache.cxx @@ -77,7 +77,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurrences( const OUString& ; // nothing, prevent compiler warning break; } - if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rName ) ) + if ( ScGlobal::GetTransliteration().isEqual( aStr, rName ) ) { rAddresses.push_back(aIter.GetPos()); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3f5d4aefdbb6..10bf90b7d275 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -866,7 +866,7 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc if (maTabs[i] && (i != nTab)) { OUString aOldName = maTabs[i]->GetName(); - bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName ); + bValid = !ScGlobal::GetTransliteration().isEqual( rName, aOldName ); } if (bValid) { diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 2867c6616fa5..d544fb884d9c 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -695,8 +695,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const tools::Long nPos = -1; CollatorWrapper& rCollator = ScGlobal::GetCollator(rParam.bCaseSens); - ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ? - ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration()); + ::utl::TransliterationWrapper& rTransliteration = ScGlobal::GetTransliteration(rParam.bCaseSens); for (size_t i = 0; i < nEntryCount && rParam.GetEntry(i).bDoQuery; ++i) { @@ -785,7 +784,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const { // TODO: Use shared string for fast equality check. OUString aStr = rEntry.GetQueryItem().maString.getString(); - bOk = pTransliteration->isEqual(aCellStr, aStr); + bOk = rTransliteration.isEqual(aCellStr, aStr); bool bHasStar = false; sal_Int32 nIndex; if (( nIndex = aStr.indexOf('*') ) != -1) @@ -811,9 +810,9 @@ 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::oSysLocale->GetLanguageTag().getLanguageType(); - OUString aCell = pTransliteration->transliterate( + OUString aCell = rTransliteration.transliterate( aCellStr, nLang, 0, aCellStr.getLength(), &xOff); - OUString aQuer = pTransliteration->transliterate( + OUString aQuer = rTransliteration.transliterate( aQueryStr, nLang, 0, aQueryStr.getLength(), &xOff); bOk = (aCell.indexOf( aQuer ) != -1); } diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx index 7247d2165541..e4efe75ee935 100644 --- a/sc/source/core/data/dpitemdata.cxx +++ b/sc/source/core/data/dpitemdata.cxx @@ -205,7 +205,7 @@ bool ScDPItemData::IsCaseInsEqual(const ScDPItemData& r) const // Fast equality check for interned strings. return true; - return ScGlobal::GetpTransliteration()->isEqual(GetString(), r.GetString()); + return ScGlobal::GetTransliteration().isEqual(GetString(), r.GetString()); } bool ScDPItemData::operator== (const ScDPItemData& r) const diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index bd80ce3b4765..0e4d583b9391 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1670,7 +1670,7 @@ bool isAtStart( { OUString aDequoted; bool bParsed = extractAtStart( rList, rMatched, bAllowBracket, pFunc, aDequoted); - if ( bParsed && ScGlobal::GetpTransliteration()->isEqual( aDequoted, rSearch ) ) + if ( bParsed && ScGlobal::GetTransliteration().isEqual( aDequoted, rSearch ) ) { nMatchList = rMatched; // match count in the list string, including quotes nMatchSearch = rSearch.getLength(); @@ -1679,7 +1679,7 @@ bool isAtStart( else { // otherwise look for search string at the start of rList - ScGlobal::GetpTransliteration()->equals( + ScGlobal::GetTransliteration().equals( rList, 0, rList.getLength(), nMatchList, rSearch, 0, rSearch.getLength(), nMatchSearch); } @@ -1904,10 +1904,10 @@ bool ScDPObject::ParseFilters( if (bHasQuery) { // First check given value name against both. - bThisItemFound = ScGlobal::GetpTransliteration()->isEqual( + bThisItemFound = ScGlobal::GetTransliteration().isEqual( aQueryValueName, pItemNamesArr[nItem]); if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem]) - bThisItemFound = ScGlobal::GetpTransliteration()->isEqual( + bThisItemFound = ScGlobal::GetTransliteration().isEqual( aQueryValueName, pItemValuesArr[nItem]); if (!bThisItemFound && aQueryValueName != aQueryValue) { @@ -1915,10 +1915,10 @@ bool ScDPObject::ParseFilters( // against both. /* TODO: or check only value string against * value string, not against the value name? */ - bThisItemFound = ScGlobal::GetpTransliteration()->isEqual( + bThisItemFound = ScGlobal::GetTransliteration().isEqual( aQueryValue, pItemNamesArr[nItem]); if (!bThisItemFound && pItemValuesArr[nItem] != pItemNamesArr[nItem]) - bThisItemFound = ScGlobal::GetpTransliteration()->isEqual( + bThisItemFound = ScGlobal::GetTransliteration().isEqual( aQueryValue, pItemValuesArr[nItem]); } } diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 6166b3f3ec80..b950cfe3003f 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -975,9 +975,9 @@ void ScGlobal::AddLanguage( SfxItemSet& rSet, const SvNumberFormatter& rFormatte rSet.Put( SvxLanguageItem( pHardFormat->GetLanguage(), ATTR_LANGUAGE_FORMAT ) ); } -utl::TransliterationWrapper* ScGlobal::GetpTransliteration() +utl::TransliterationWrapper& ScGlobal::GetTransliteration() { - return comphelper::doubleCheckedInit( pTransliteration, + return *comphelper::doubleCheckedInit( pTransliteration, []() { const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); @@ -987,9 +987,9 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration() return p; }); } -::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration() +::utl::TransliterationWrapper& ScGlobal::GetCaseTransliteration() { - return comphelper::doubleCheckedInit( pCaseTransliteration, + return *comphelper::doubleCheckedInit( pCaseTransliteration, []() { const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType(); @@ -999,6 +999,10 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration() return p; }); } +utl::TransliterationWrapper& ScGlobal::GetTransliteration(bool bCaseSensitive) +{ + return bCaseSensitive ? GetCaseTransliteration() : GetTransliteration(); +} const LocaleDataWrapper& ScGlobal::getLocaleData() { diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index e90adbeb5c42..7e1f05450c99 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2386,7 +2386,7 @@ class QueryEvaluator void setupTransliteratorIfNeeded() { if (!mpTransliteration) - mpTransliteration = mrParam.bCaseSens ? ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration(); + mpTransliteration = &ScGlobal::GetTransliteration(mrParam.bCaseSens); } void setupCollatorIfNeeded() diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index e4ab89221632..631747e5667c 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -744,11 +744,11 @@ ScAutoFormat::ScAutoFormat() : bool DefaultFirstEntry::operator() (const OUString& left, const OUString& right) const { OUString aStrStandard(ScResId(STR_STYLENAME_STANDARD)); - if (ScGlobal::GetpTransliteration()->isEqual( left, right ) ) + if (ScGlobal::GetTransliteration().isEqual( left, right ) ) return false; - if ( ScGlobal::GetpTransliteration()->isEqual( left, aStrStandard ) ) + if ( ScGlobal::GetTransliteration().isEqual( left, aStrStandard ) ) return true; - if ( ScGlobal::GetpTransliteration()->isEqual( right, aStrStandard ) ) + if ( ScGlobal::GetTransliteration().isEqual( right, aStrStandard ) ) return false; return ScGlobal::GetCollator().compareString( left, right) < 0; } diff --git a/sc/source/core/tool/compare.cxx b/sc/source/core/tool/compare.cxx index ac931d2c1982..48bf4642fe05 100644 --- a/sc/source/core/tool/compare.cxx +++ b/sc/source/core/tool/compare.cxx @@ -151,9 +151,8 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) } else if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL) { - ::utl::TransliterationWrapper* pTransliteration = - (rComp.mbIgnoreCase ? ScGlobal::GetpTransliteration() : - ScGlobal::GetCaseTransliteration()); + ::utl::TransliterationWrapper& rTransliteration = + ScGlobal::GetTransliteration(!rComp.mbIgnoreCase); bool bMatch = false; if (pOptions->bMatchWholeCell) { @@ -165,10 +164,10 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) else { const LanguageType nLang = ScGlobal::oSysLocale->GetLanguageTag().getLanguageType(); - OUString aCell( pTransliteration->transliterate( + OUString aCell( rTransliteration.transliterate( rCell1.maStr.getString(), nLang, 0, rCell1.maStr.getLength(), nullptr)); - OUString aQuer( pTransliteration->transliterate( + OUString aQuer( rTransliteration.transliterate( rCell2.maStr.getString(), nLang, 0, rCell2.maStr.getLength(), nullptr)); bMatch = (aCell.indexOf( aQuer ) != -1); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 311993e6ff88..fd9c0ab51fe8 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3707,7 +3707,7 @@ bool ScCompiler::IsColRowName( const OUString& rName ) if (bOk && aIter.hasString()) { OUString aStr = aIter.getString(); - if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) ) + if ( ScGlobal::GetTransliteration().isEqual( aStr, aName ) ) { aRef.InitFlags(); if ( !jRow ) @@ -3815,7 +3815,7 @@ bool ScCompiler::IsColRowName( const OUString& rName ) if (bOk && aIter.hasString()) { OUString aStr = aIter.getString(); - if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) ) + if ( ScGlobal::GetTransliteration().isEqual( aStr, aName ) ) { SCCOL nCol = aIter.GetPos().Col(); SCROW nRow = aIter.GetPos().Row(); @@ -4065,7 +4065,7 @@ bool ScCompiler::IsTableRefColumn( const OUString& rName ) const if (bOk && aIter.hasString()) { OUString aStr = aIter.getString(); - if (ScGlobal::GetpTransliteration()->isEqual( aStr, aName)) + if (ScGlobal::GetTransliteration().isEqual( aStr, aName)) { // If this is successful and the internal column name // lookup was not, it may be worth a warning. diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index a5af4404e47d..f95d1e94b681 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -50,7 +50,7 @@ using ::std::pair; bool ScDBData::less::operator() (const std::unique_ptr<ScDBData>& left, const std::unique_ptr<ScDBData>& right) const { - return ScGlobal::GetpTransliteration()->compareString(left->GetUpperName(), right->GetUpperName()) < 0; + return ScGlobal::GetTransliteration().compareString(left->GetUpperName(), right->GetUpperName()) < 0; } ScDBData::ScDBData( const OUString& rName, @@ -767,7 +767,7 @@ public: bool operator()( const OUString& rName ) const { - return ScGlobal::GetpTransliteration()->isEqual( maSearchName, rName); + return ScGlobal::GetTransliteration().isEqual( maSearchName, rName); } private: diff --git a/sc/source/core/tool/doubleref.cxx b/sc/source/core/tool/doubleref.cxx index db5cda5f4fdb..165f9a228cd3 100644 --- a/sc/source/core/tool/doubleref.cxx +++ b/sc/source/core/tool/doubleref.cxx @@ -350,7 +350,7 @@ SCCOL ScDBInternalRange::findFieldColumn(const OUString& rStr, FormulaError* pEr if (pErr) *pErr = nErr; lcl_uppercase(aCellStr); - bFound = ScGlobal::GetpTransliteration()->isEqual(aCellStr, aUpper); + bFound = ScGlobal::GetTransliteration().isEqual(aCellStr, aUpper); if (!bFound) aLook.IncCol(); } diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx index fb9dc97e6236..10a4de328f87 100644 --- a/sc/source/core/tool/userlist.cxx +++ b/sc/source/core/tool/userlist.cxx @@ -168,7 +168,7 @@ sal_Int32 ScUserListData::Compare(const OUString& rSubStr1, const OUString& rSub else if (bFound2) return 1; else - return ScGlobal::GetCaseTransliteration()->compareString( rSubStr1, rSubStr2 ); + return ScGlobal::GetCaseTransliteration().compareString( rSubStr1, rSubStr2 ); } sal_Int32 ScUserListData::ICompare(const OUString& rSubStr1, const OUString& rSubStr2) const @@ -194,7 +194,7 @@ sal_Int32 ScUserListData::ICompare(const OUString& rSubStr1, const OUString& rSu else if (bFound2) return 1; else - return ScGlobal::GetpTransliteration()->compareString( rSubStr1, rSubStr2 ); + return ScGlobal::GetTransliteration().compareString( rSubStr1, rSubStr2 ); } ScUserList::ScUserList() diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c55c97dac444..9779b6e9692a 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -111,7 +111,7 @@ ScTypedCaseStrSet::const_iterator findText( const OUString& rStart, OUString& rResult, bool bBack) { auto lIsMatch = [&rStart](const ScTypedStrData& rData) { - return (rData.GetStringType() != ScTypedStrData::Value) && ScGlobal::GetpTransliteration()->isMatch(rStart, rData.GetString()); }; + return (rData.GetStringType() != ScTypedStrData::Value) && ScGlobal::GetTransliteration().isMatch(rStart, rData.GetString()); }; if (bBack) // Backwards { @@ -155,7 +155,7 @@ OUString getExactMatch(const ScTypedCaseStrSet& rDataSet, const OUString& rStrin auto it = std::find_if(rDataSet.begin(), rDataSet.end(), [&rString](const ScTypedStrData& rData) { return (rData.GetStringType() != ScTypedStrData::Value) - && ScGlobal::GetpTransliteration()->isEqual(rData.GetString(), rString); + && ScGlobal::GetTransliteration().isEqual(rData.GetString(), rString); }); if (it != rDataSet.end()) return it->GetString(); @@ -207,7 +207,7 @@ ScTypedCaseStrSet::const_iterator findTextAll( // skip values continue; - if ( !ScGlobal::GetpTransliteration()->isMatch(rStart, rData.GetString()) ) + if ( !ScGlobal::GetTransliteration().isMatch(rStart, rData.GetString()) ) // not a match continue; @@ -247,7 +247,7 @@ ScTypedCaseStrSet::const_iterator findTextAll( // skip values continue; - if ( !ScGlobal::GetpTransliteration()->isMatch(rStart, rData.GetString()) ) + if ( !ScGlobal::GetTransliteration().isMatch(rStart, rData.GetString()) ) // not a match continue; @@ -1607,7 +1607,7 @@ void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInser for (sal_Int32 n = aAll.getLength(); n >= nMinLen && aMatch.isEmpty(); --n) { const OUString aTest = aAll.copy(aAll.getLength() - n); // n trailing chars - if (ScGlobal::GetpTransliteration()->isMatch(aTest, rInsert)) + if (ScGlobal::GetTransliteration().isMatch(aTest, rInsert)) aMatch = aTest; // Found => break the loop } diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 0a951b928c5d..2daa4af97f0c 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -144,7 +144,7 @@ static sal_Unicode lcl_CharFromCombo(const weld::ComboBox& rCombo, const OUStrin OUString sToken {rList.getToken(0, '\t', nIdx)}; while (nIdx>0) { - if ( ScGlobal::GetpTransliteration()->isEqual( aStr, sToken ) ) + if ( ScGlobal::GetTransliteration().isEqual( aStr, sToken ) ) { sal_Int32 nTmpIdx {nIdx}; c = static_cast<sal_Unicode>(rList.getToken(0, '\t', nTmpIdx).toInt32()); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index fc955975bc70..cff9b7e758ca 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -962,9 +962,9 @@ void ScExternalRefCache::initializeDoc(sal_uInt16 nFileId, const vector<OUString // If the one and only table name matches exactly, carry on the base // file name for further alias use. If instead the table name matches // the base name, carry on the sheet name as alias. - if (ScGlobal::GetpTransliteration()->isEqual( pDoc->maTableNames[0].maRealName, aSheetName)) + if (ScGlobal::GetTransliteration().isEqual( pDoc->maTableNames[0].maRealName, aSheetName)) pDoc->maSingleTableNameAlias = rBaseName; - else if (ScGlobal::GetpTransliteration()->isEqual( pDoc->maTableNames[0].maRealName, rBaseName)) + else if (ScGlobal::GetTransliteration().isEqual( pDoc->maTableNames[0].maRealName, rBaseName)) pDoc->maSingleTableNameAlias = aSheetName; } @@ -998,12 +998,12 @@ bool ScExternalRefCache::DocItem::getSingleTableNameAlternative( OUString& rTabN { if (maSingleTableNameAlias.isEmpty() || maTableNames.size() != 1) return false; - if (ScGlobal::GetpTransliteration()->isEqual( rTabName, maTableNames[0].maRealName)) + if (ScGlobal::GetTransliteration().isEqual( rTabName, maTableNames[0].maRealName)) { rTabName = maSingleTableNameAlias; return true; } - if (ScGlobal::GetpTransliteration()->isEqual( rTabName, maSingleTableNameAlias)) + if (ScGlobal::GetTransliteration().isEqual( rTabName, maSingleTableNameAlias)) { rTabName = maTableNames[0].maRealName; return true; @@ -1338,9 +1338,9 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF { const OUString aBaseName( INetURLObject( *pExtUrl).GetBase()); const OUString aSheetName( getFirstSheetName()); - if (ScGlobal::GetpTransliteration()->isEqual( rTabName, aSheetName)) + if (ScGlobal::GetTransliteration().isEqual( rTabName, aSheetName)) pDoc->maSingleTableNameAlias = aBaseName; - else if (ScGlobal::GetpTransliteration()->isEqual( rTabName, aBaseName)) + else if (ScGlobal::GetTransliteration().isEqual( rTabName, aBaseName)) pDoc->maSingleTableNameAlias = aSheetName; } } diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index ca0fdb98c591..f9d2c3207e39 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -254,7 +254,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, { OUString aName; rDoc.GetName( nTab, aName ); - if ( ScGlobal::GetpTransliteration()->isEqual( + if ( ScGlobal::GetTransliteration().isEqual( ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) ) { rDoc.RenameTab( nTab, commit ce707fc2d3420be9423bb5e8d0300dbb71a5db6e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 17 10:59:51 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 17 15:02:55 2021 +0200 rather return ref from GetCollator since we never return a nullptr. Also add a new utility method to simplify the call sites that need to pick the right collator Change-Id: I5deb009cb5144fd182bbc6470ae30ea05e6979c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122237 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 6a3eab0d837d..a8b939114201 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -539,8 +539,11 @@ public: SC_DLLPUBLIC static const CharClass& getCharClass(); static CalendarWrapper& GetCalendar(); - SC_DLLPUBLIC static CollatorWrapper* GetCollator(); - static CollatorWrapper* GetCaseCollator(); + /// case-insensitive collator + SC_DLLPUBLIC static CollatorWrapper& GetCollator(); + /// case-sensitive collator + static CollatorWrapper& GetCaseCollator(); + static CollatorWrapper& GetCollator(bool bCaseSensitive); static css::lang::Locale* GetLocale(); SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 2655ee68428c..87c5d297002a 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -383,8 +383,7 @@ void Test::tearDown() void Test::testCollator() { - CollatorWrapper* p = ScGlobal::GetCollator(); - sal_Int32 nRes = p->compareString("A", "B"); + sal_Int32 nRes = ScGlobal::GetCollator().compareString("A", "B"); CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", nRes != 0); } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 0bede8f8b336..008592410a75 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1138,7 +1138,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) OUString aUpVal2( aStrVal2 ); if ( eOp == ScConditionMode::Between || eOp == ScConditionMode::NotBetween ) - if (ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 ) > 0) + if (ScGlobal::GetCollator().compareString( aUpVal1, aUpVal2 ) > 0) { // Right order for value range OUString aTemp( aUpVal1 ); aUpVal1 = aUpVal2; aUpVal2 = aTemp; @@ -1147,11 +1147,11 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) switch ( eOp ) { case ScConditionMode::Equal: - bValid = (ScGlobal::GetCollator()->compareString( + bValid = (ScGlobal::GetCollator().compareString( rArg, aUpVal1 ) == 0); break; case ScConditionMode::NotEqual: - bValid = (ScGlobal::GetCollator()->compareString( + bValid = (ScGlobal::GetCollator().compareString( rArg, aUpVal1 ) != 0); break; case ScConditionMode::TopPercent: @@ -1181,7 +1181,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) break; default: { - sal_Int32 nCompare = ScGlobal::GetCollator()->compareString( + sal_Int32 nCompare = ScGlobal::GetCollator().compareString( rArg, aUpVal1 ); switch ( eOp ) { @@ -1201,7 +1201,7 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) case ScConditionMode::NotBetween: // Test for NOTBETWEEN: bValid = ( nCompare < 0 || - ScGlobal::GetCollator()->compareString( rArg, + ScGlobal::GetCollator().compareString( rArg, aUpVal2 ) > 0 ); if ( eOp == ScConditionMode::Between ) bValid = !bValid; diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 1a0f8b645382..9c6d7773ba6f 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -620,8 +620,7 @@ bool ScDBQueryDataIterator::DataAccessMatrix::isValidQuery(SCROW nRow, const ScM vector<bool> aResults; aResults.reserve(nEntryCount); - const CollatorWrapper& rCollator = - mpParam->bCaseSens ? *ScGlobal::GetCaseCollator() : *ScGlobal::GetCollator(); + const CollatorWrapper& rCollator = ScGlobal::GetCollator(mpParam->bCaseSens); for (SCSIZE i = 0; i < nEntryCount; ++i) { @@ -1809,8 +1808,7 @@ bool ScQueryCellIterator::BinarySearch() if (pCol->IsEmptyData()) return false; - CollatorWrapper* pCollator = (maParam.bCaseSens ? ScGlobal::GetCaseCollator() : - ScGlobal::GetCollator()); + CollatorWrapper& rCollator = ScGlobal::GetCollator(maParam.bCaseSens); SvNumberFormatter& rFormatter = *(mrContext.GetFormatTable()); const ScQueryEntry& rEntry = maParam.GetEntry(0); const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); @@ -1834,7 +1832,7 @@ bool ScQueryCellIterator::BinarySearch() sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, nRow); OUString aCellStr; ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, rDoc); - sal_Int32 nTmp = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); + sal_Int32 nTmp = rCollator.compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); if ((rEntry.eOp == SC_LESS_EQUAL && nTmp > 0) || (rEntry.eOp == SC_GREATER_EQUAL && nTmp < 0) || (rEntry.eOp == SC_EQUAL && nTmp != 0)) @@ -1959,10 +1957,10 @@ bool ScQueryCellIterator::BinarySearch() sal_uInt32 nFormat = pCol->GetNumberFormat(mrContext, aCellData.second); ScCellFormat::GetInputString(aCell, nFormat, aCellStr, rFormatter, rDoc); - nRes = pCollator->compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); + nRes = rCollator.compareString(aCellStr, rEntry.GetQueryItem().maString.getString()); if (nRes < 0 && bLessEqual) { - sal_Int32 nTmp = pCollator->compareString( aLastInRangeString, + sal_Int32 nTmp = rCollator.compareString( aLastInRangeString, aCellStr); if (nTmp < 0) { @@ -1978,7 +1976,7 @@ bool ScQueryCellIterator::BinarySearch() } else if (nRes > 0 && !bLessEqual) { - sal_Int32 nTmp = pCollator->compareString( aLastInRangeString, + sal_Int32 nTmp = rCollator.compareString( aLastInRangeString, aCellStr); if (nTmp > 0) { diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 7054fef3ba14..2867c6616fa5 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -694,8 +694,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const std::vector<bool> aPassed(nEntryCount, false); tools::Long nPos = -1; - CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() : - ScGlobal::GetCollator() ); + CollatorWrapper& rCollator = ScGlobal::GetCollator(rParam.bCaseSens); ::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ? ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration()); @@ -823,7 +822,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const } else { // use collator here because data was probably sorted - sal_Int32 nCompare = pCollator->compareString( + sal_Int32 nCompare = rCollator.compareString( aCellStr, rEntry.GetQueryItem().maString.getString()); switch (rEntry.eOp) { diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx index da3293d7c2be..7247d2165541 100644 --- a/sc/source/core/data/dpitemdata.cxx +++ b/sc/source/core/data/dpitemdata.cxx @@ -64,7 +64,7 @@ sal_Int32 ScDPItemData::Compare(const ScDPItemData& rA, const ScDPItemData& rB) // strings may be interned. return 0; - return ScGlobal::GetCollator()->compareString(rA.GetString(), rB.GetString()); + return ScGlobal::GetCollator().compareString(rA.GetString(), rB.GetString()); default: ; } diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index 741b785e0869..51f03a4e4bf4 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -392,7 +392,7 @@ bool ScFuncDesc::isParameterOptional(sal_uInt32 _nPos) const bool ScFuncDesc::compareByName(const ScFuncDesc* a, const ScFuncDesc* b) { - return (ScGlobal::GetCaseCollator()->compareString(*a->mxFuncName, *b->mxFuncName ) < 0); + return (ScGlobal::GetCaseCollator().compareString(*a->mxFuncName, *b->mxFuncName ) < 0); } #define ENTRY(CODE) CODE, SAL_N_ELEMENTS(CODE) diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index be6711849c02..6166b3f3ec80 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -1040,9 +1040,9 @@ struct GetMutex { } -CollatorWrapper* ScGlobal::GetCollator() +CollatorWrapper& ScGlobal::GetCollator() { - return comphelper::doubleCheckedInit( pCollator, + return *comphelper::doubleCheckedInit( pCollator, []() { CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() ); @@ -1051,9 +1051,9 @@ CollatorWrapper* ScGlobal::GetCollator() }, GetMutex()); } -CollatorWrapper* ScGlobal::GetCaseCollator() +CollatorWrapper& ScGlobal::GetCaseCollator() { - return comphelper::doubleCheckedInit( pCaseCollator, + return *comphelper::doubleCheckedInit( pCaseCollator, []() { CollatorWrapper* p = new CollatorWrapper( ::comphelper::getProcessComponentContext() ); @@ -1062,6 +1062,10 @@ CollatorWrapper* ScGlobal::GetCaseCollator() }, GetMutex()); } +CollatorWrapper& ScGlobal::GetCollator(bool bCaseSensitive) +{ + return bCaseSensitive ? GetCaseCollator() : GetCollator(); +} css::lang::Locale* ScGlobal::GetLocale() { return comphelper::doubleCheckedInit( pLocale, diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 852e4a36f2f0..e90adbeb5c42 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -626,8 +626,8 @@ struct PatternSpan bool ScTable::IsSortCollatorGlobal() const { - return pSortCollator == ScGlobal::GetCollator() || - pSortCollator == ScGlobal::GetCaseCollator(); + return pSortCollator == &ScGlobal::GetCollator() || + pSortCollator == &ScGlobal::GetCaseCollator(); } void ScTable::InitSortCollator( const ScSortParam& rPar ) @@ -642,8 +642,7 @@ void ScTable::InitSortCollator( const ScSortParam& rPar ) else { // SYSTEM DestroySortCollator(); - pSortCollator = (rPar.bCaseSens ? ScGlobal::GetCaseCollator() : - ScGlobal::GetCollator()); + pSortCollator = &ScGlobal::GetCollator(rPar.bCaseSens); } } @@ -2393,7 +2392,7 @@ class QueryEvaluator void setupCollatorIfNeeded() { if (!mpCollator) - mpCollator = mrParam.bCaseSens ? ScGlobal::GetCaseCollator() : ScGlobal::GetCollator(); + mpCollator = &ScGlobal::GetCollator(mrParam.bCaseSens); } public: diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 20c18d1b3f93..e4ab89221632 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -750,7 +750,7 @@ bool DefaultFirstEntry::operator() (const OUString& left, const OUString& right) return true; if ( ScGlobal::GetpTransliteration()->isEqual( right, aStrStandard ) ) return false; - return ScGlobal::GetCollator()->compareString( left, right) < 0; + return ScGlobal::GetCollator().compareString( left, right) < 0; } void ScAutoFormat::SetSaveLater( bool bSet ) diff --git a/sc/source/core/tool/compare.cxx b/sc/source/core/tool/compare.cxx index 51491abcfd7f..ac931d2c1982 100644 --- a/sc/source/core/tool/compare.cxx +++ b/sc/source/core/tool/compare.cxx @@ -176,10 +176,10 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) fRes = (bMatch ? 0 : 1); } else if (rComp.mbIgnoreCase) - fRes = static_cast<double>(ScGlobal::GetCollator()->compareString( + fRes = static_cast<double>(ScGlobal::GetCollator().compareString( rCell1.maStr.getString(), rCell2.maStr.getString())); else - fRes = static_cast<double>(ScGlobal::GetCaseCollator()->compareString( + fRes = static_cast<double>(ScGlobal::GetCaseCollator().compareString( rCell1.maStr.getString(), rCell2.maStr.getString())); } else if (rComp.meOp == SC_EQUAL || rComp.meOp == SC_NOT_EQUAL) @@ -190,10 +190,10 @@ double CompareFunc( const Compare& rComp, CompareOptions* pOptions ) fRes = (rCell1.maStr.getData() == rCell2.maStr.getData()) ? 0 : 1; } else if (rComp.mbIgnoreCase) - fRes = static_cast<double>(ScGlobal::GetCollator()->compareString( + fRes = static_cast<double>(ScGlobal::GetCollator().compareString( rCell1.maStr.getString(), rCell2.maStr.getString())); else - fRes = static_cast<double>(ScGlobal::GetCaseCollator()->compareString( + fRes = static_cast<double>(ScGlobal::GetCaseCollator().compareString( rCell1.maStr.getString(), rCell2.maStr.getString())); } diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 8d2d81fe850a..5923116be0d2 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -4722,7 +4722,7 @@ sal_Int32 lcl_CompareMatrix2Query( OUString aStr1 = rMat.GetString(i); OUString aStr2 = rEntry.GetQueryItem().maString.getString(); - return ScGlobal::GetCollator()->compareString(aStr1, aStr2); // case-insensitive + return ScGlobal::GetCollator().compareString(aStr1, aStr2); // case-insensitive } /** returns the last item with the identical value as the original item @@ -6720,7 +6720,7 @@ void ScInterpreter::ScLookup() if (rItem.meType != ScQueryEntry::ByString) bFound = false; else - bFound = (ScGlobal::GetCollator()->compareString(aDataStr.getString(), rItem.maString.getString()) <= 0); + bFound = (ScGlobal::GetCollator().compareString(aDataStr.getString(), rItem.maString.getString()) <= 0); } if (!bFound) @@ -7306,13 +7306,13 @@ void ScInterpreter::CalculateLookup(bool bHLookup) svl::SharedString aParamStr = rItem.maString; if ( bSorted ) { - CollatorWrapper* pCollator = ScGlobal::GetCollator(); + CollatorWrapper& rCollator = ScGlobal::GetCollator(); for (SCSIZE i = 0; i < nMatCount; i++) { if (bHLookup ? pMat->IsStringOrEmpty(i, 0) : pMat->IsStringOrEmpty(0, i)) { sal_Int32 nRes = - pCollator->compareString( + rCollator.compareString( bHLookup ? pMat->GetString(i,0).getString() : pMat->GetString(0,i).getString(), aParamStr.getString()); if (nRes <= 0) nDelta = i; diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 8b1059e3b15e..d1b7e598c67e 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -1329,7 +1329,7 @@ public: { mrDoc.GetName( rStartPos1.Tab(), aStr1 ); mrDoc.GetName( rStartPos2.Tab(), aStr2 ); - nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); + nComp = ScGlobal::GetCollator().compareString( aStr1, aStr2 ); } if (nComp < 0) { @@ -1360,7 +1360,7 @@ public: { mrDoc.GetName( rEndPos1.Tab(), aStr1 ); mrDoc.GetName( rEndPos2.Tab(), aStr2 ); - nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 ); + nComp = ScGlobal::GetCollator().compareString( aStr1, aStr2 ); } if (nComp < 0) { diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index debd75c30d44..e554597ce819 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -626,7 +626,7 @@ void ScRangeData::InitCode() extern "C" int ScRangeData_QsortNameCompare( const void* p1, const void* p2 ) { - return static_cast<int>(ScGlobal::GetCollator()->compareString( + return static_cast<int>(ScGlobal::GetCollator().compareString( (*static_cast<const ScRangeData* const *>(p1))->GetName(), (*static_cast<const ScRangeData* const *>(p2))->GetName() )); } diff --git a/sc/source/core/tool/typedstrdata.cxx b/sc/source/core/tool/typedstrdata.cxx index 59831dac7271..83ecdfa64053 100644 --- a/sc/source/core/tool/typedstrdata.cxx +++ b/sc/source/core/tool/typedstrdata.cxx @@ -23,7 +23,7 @@ bool ScTypedStrData::LessCaseSensitive::operator() (const ScTypedStrData& left, if (left.mbIsDate != right.mbIsDate) return left.mbIsDate < right.mbIsDate; - return ScGlobal::GetCaseCollator()->compareString( + return ScGlobal::GetCaseCollator().compareString( left.maStrValue, right.maStrValue) < 0; } @@ -38,7 +38,7 @@ bool ScTypedStrData::LessCaseInsensitive::operator() (const ScTypedStrData& left if (left.mbIsDate != right.mbIsDate) return left.mbIsDate < right.mbIsDate; - return ScGlobal::GetCollator()->compareString( + return ScGlobal::GetCollator().compareString( left.maStrValue, right.maStrValue) < 0; } @@ -53,7 +53,7 @@ bool ScTypedStrData::EqualCaseSensitive::operator() (const ScTypedStrData& left, if (left.mbIsDate != right.mbIsDate ) return false; - return ScGlobal::GetCaseCollator()->compareString( + return ScGlobal::GetCaseCollator().compareString( left.maStrValue, right.maStrValue) == 0; } @@ -68,7 +68,7 @@ bool ScTypedStrData::EqualCaseInsensitive::operator() (const ScTypedStrData& lef if (left.mbIsDate != right.mbIsDate ) return false; - return ScGlobal::GetCollator()->compareString( + return ScGlobal::GetCollator().compareString( left.maStrValue, right.maStrValue) == 0; } diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index ef922401f3c0..4e30a29e9867 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -879,7 +879,7 @@ struct XclExpTabNameSort { bool operator ()( const XclExpTabName& rArg1, const XclExpTabName& rArg2 ) { // compare the sheet names only - return ScGlobal::GetCollator()->compareString( rArg1.first, rArg2.first ) < 0; + return ScGlobal::GetCollator().compareString( rArg1.first, rArg2.first ) < 0; } }; diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 9cdc8a14cd81..06d4ef3a7b57 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -1806,7 +1806,7 @@ int ScAcceptChgDlg::ColCompareHdl(const weld::TreeIter& rLeft, const weld::TreeI } } - return ScGlobal::GetCaseCollator()->compareString(rTreeView.get_text(rLeft, nSortCol), + return ScGlobal::GetCaseCollator().compareString(rTreeView.get_text(rLeft, nSortCol), rTreeView.get_text(rRight, nSortCol)); } diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index b449d741eeb8..4c849959399a 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -48,7 +48,7 @@ struct ScSolverOptionsEntry bool operator< (const ScSolverOptionsEntry& rOther) const { - return (ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) < 0); + return (ScGlobal::GetCollator().compareString( aDescription, rOther.aDescription ) < 0); } }; diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 94102611fdfd..29479c7ef78f 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1730,7 +1730,7 @@ void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, tools::Long nDimIndex, bool bAs } // Sort the member list in ascending order. - ScOUStringCollate aCollate( ScGlobal::GetCollator() ); + ScOUStringCollate aCollate( &ScGlobal::GetCollator() ); std::stable_sort(aMembers.begin(), aMembers.end(), aCollate); // Collect and rank those custom sort strings that also exist in the member name list.