formula/source/core/api/FormulaCompiler.cxx |   11 ++++++++++-
 sc/source/ui/docshell/docsh6.cxx            |    3 ++-
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 0a78f11fdd13d914d5f063007b2df9796e6dce9d
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Fri Aug 5 19:28:50 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sat Aug 6 19:37:38 2022 +0200

    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 <er...@redhat.com>
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 2b0db73d1a39..591b28744289 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 738c85110967..caefdfc0fed3 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);
             }

Reply via email to