diff options
-rw-r--r-- | sc/source/core/inc/cellkeytranslator.hxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/cellkeytranslator.cxx | 30 |
2 files changed, 15 insertions, 19 deletions
diff --git a/sc/source/core/inc/cellkeytranslator.hxx b/sc/source/core/inc/cellkeytranslator.hxx index 766a0689a071..892d65d6f6c9 100644 --- a/sc/source/core/inc/cellkeytranslator.hxx +++ b/sc/source/core/inc/cellkeytranslator.hxx @@ -23,7 +23,7 @@ #include <global.hxx> #include <formula/opcode.hxx> #include <unotools/transliterationwrapper.hxx> -#include <list> +#include <vector> #include <memory> #include <unordered_map> @@ -40,7 +40,7 @@ struct ScCellKeyword ScCellKeyword(const sal_Char* pName, OpCode eOpCode, const css::lang::Locale& rLocale); }; -typedef std::unordered_map< OUString, ::std::list<ScCellKeyword> > ScCellKeywordHashMap; +typedef std::unordered_map< OUString, ::std::vector<ScCellKeyword> > ScCellKeywordHashMap; /** Translate cell function keywords. diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx index effc7145970e..c34276ce76a9 100644 --- a/sc/source/core/tool/cellkeytranslator.cxx +++ b/sc/source/core/tool/cellkeytranslator.cxx @@ -27,7 +27,6 @@ #include <unotools/syslocale.hxx> using ::com::sun::star::uno::Sequence; -using ::std::list; using namespace ::com::sun::star; @@ -98,57 +97,55 @@ static void lclMatchKeyword(OUString& rName, const ScCellKeywordHashMap& aMap, LocaleMatch eLocaleMatchLevel = LOCALE_MATCH_NONE; bool bOpCodeMatched = false; - list<ScCellKeyword>::const_iterator itrListEnd = itr->second.end(); - list<ScCellKeyword>::const_iterator itrList = itr->second.begin(); - for ( ; itrList != itrListEnd; ++itrList ) + for (auto const& elem : itr->second) { if ( eOpCode != ocNone && pLocale ) { - if ( itrList->meOpCode == eOpCode ) + if (elem.meOpCode == eOpCode) { - LocaleMatch eLevel = lclLocaleCompare(itrList->mrLocale, aLanguageTag); + LocaleMatch eLevel = lclLocaleCompare(elem.mrLocale, aLanguageTag); if ( eLevel == LOCALE_MATCH_ALL ) { // Name with matching opcode and locale found. - rName = OUString::createFromAscii( itrList->mpName ); + rName = OUString::createFromAscii( elem.mpName ); return; } else if ( eLevel > eLocaleMatchLevel ) { // Name with a better matching locale. eLocaleMatchLevel = eLevel; - aBestMatchName = itrList->mpName; + aBestMatchName = elem.mpName; } else if ( !bOpCodeMatched ) // At least the opcode matches. - aBestMatchName = itrList->mpName; + aBestMatchName = elem.mpName; bOpCodeMatched = true; } } else if ( eOpCode != ocNone && !pLocale ) { - if ( itrList->meOpCode == eOpCode ) + if ( elem.meOpCode == eOpCode ) { // Name with a matching opcode preferred. - rName = OUString::createFromAscii( itrList->mpName ); + rName = OUString::createFromAscii( elem.mpName ); return; } } else if ( pLocale ) { - LocaleMatch eLevel = lclLocaleCompare(itrList->mrLocale, aLanguageTag); + LocaleMatch eLevel = lclLocaleCompare(elem.mrLocale, aLanguageTag); if ( eLevel == LOCALE_MATCH_ALL ) { // Name with matching locale preferred. - rName = OUString::createFromAscii( itrList->mpName ); + rName = OUString::createFromAscii( elem.mpName ); return; } else if ( eLevel > eLocaleMatchLevel ) { // Name with a better matching locale. eLocaleMatchLevel = eLevel; - aBestMatchName = itrList->mpName; + aBestMatchName = elem.mpName; } } } @@ -214,9 +211,8 @@ void ScCellKeywordTranslator::addToMap(const OUString& rKey, const sal_Char* pNa if ( itr == itrEnd ) { // New keyword. - list<ScCellKeyword> aList; - aList.push_back(aKeyItem); - maStringNameMap.emplace(rKey, aList); + std::vector<ScCellKeyword> aVector { aKeyItem }; + maStringNameMap.emplace(rKey, aVector); } else itr->second.push_back(aKeyItem); |