Related: tdf#142293 Remove temporariness now implemented at GetOpCodeMap()
Change-Id: Ic61f45b1da286e2f4890bbc81dc5cd18c0d5bbe5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139202
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 2783670..7eb36d7 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -187,11 +187,7 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
{
OUStringBuffer result(256);
// If GetOpCodeMap() initializes the map at base class
// formula::FormulaCompiler before any ScCompiler did, all AddIn mapping
// would be missing also in future. So if it didn't exist destroy it again.
formula::FormulaCompiler aCompiler;
const bool bTemporary = !aCompiler.HasOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
for (auto i = rOpCodes->begin(); i != rOpCodes->end(); ++i)
@@ -201,18 +197,13 @@ OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
result.append(pOpCodeMap->getSymbol(*i));
}
if (bTemporary)
aCompiler.DestroyOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
return result.makeStringAndClear();
}
ScCalcConfig::OpCodeSet ScStringToOpCodeSet(std::u16string_view rOpCodes)
{
ScCalcConfig::OpCodeSet result = std::make_shared<o3tl::sorted_vector< OpCode >>();
// Same as above.
formula::FormulaCompiler aCompiler;
const bool bTemporary = !aCompiler.HasOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH));
const formula::OpCodeHashMap& rHashMap(pOpCodeMap->getHashMap());
@@ -244,9 +235,6 @@ ScCalcConfig::OpCodeSet ScStringToOpCodeSet(std::u16string_view rOpCodes)
if( result->find( ocSub ) != result->end())
result->insert( ocNegSub );
if (bTemporary)
aCompiler.DestroyOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
return result;
}