Related: tdf#135993 Use ScCompiler to create English OpCodeMap with AddIns
... instead of formula::FormulaCompiler base class that doesn't
know anything about AddIns, and copy AddIns along to new resulting
native map.
Change-Id: I9e4ece2f7450a561ac502ca1dbddaa5a697fa2fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137882
Tested-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 2b0db73..591b287 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1296,7 +1296,16 @@ void FormulaCompiler::OpCodeMap::copyFrom( const OpCodeMap& r )
}
}
// TODO: maybe copy the external maps too?
// This was meant to copy to native map that does not have AddIn symbols
// but needs them from the source map. It is unclear what should happen if
// the destination already had externals, so do it only if it doesn't.
if (!hasExternals())
{
maExternalHashMap = r.maExternalHashMap;
maReverseExternalHashMap = r.maReverseExternalHashMap;
mbCore = r.mbCore;
mbEnglish = r.mbEnglish;
}
}
diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx
index 738c8511..caefdfc 100644
--- a/sc/source/ui/docshell/docsh6.cxx
+++ b/sc/source/ui/docshell/docsh6.cxx
@@ -445,7 +445,8 @@ void ScDocShell::SetFormulaOptions( const ScFormulaOptions& rOpt, bool bForLoadi
if (rOpt.GetUseEnglishFuncName())
{
// switch native symbols to English.
formula::FormulaCompiler aComp;
ScAddress aAddress;
ScCompiler aComp( *m_pDocument, aAddress);
ScCompiler::OpCodeMapPtr xMap = aComp.GetOpCodeMap(css::sheet::FormulaLanguage::ENGLISH);
ScCompiler::SetNativeSymbols(xMap);
}