formula/source/core/api/FormulaCompiler.cxx |    5 +++++
 include/formula/FormulaCompiler.hxx         |   23 +++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit 603f9ce4f39a59bd84b5c08e3d725e0ee664991f
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Sep 1 13:27:46 2022 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Thu Sep 1 15:17:20 2022 +0200

    Related: tdf#142293 Introduce a protected 
FormulaCompiler::GetFinalOpCodeMap()
    
    ... to prepare having GetOpCodeMap() return a temporary if a final
    doesn't exist yet. Currently just an alias.
    
    Change-Id: I6fc100ae6223010e149e4af01fc7c17630930de7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139162
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 55e65ae9fd7c..2f7128c0d8a6 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -816,6 +816,11 @@ FormulaCompiler::~FormulaCompiler()
 }
 
 FormulaCompiler::OpCodeMapPtr FormulaCompiler::GetOpCodeMap( const sal_Int32 
nLanguage ) const
+{
+    return GetFinalOpCodeMap(nLanguage);
+}
+
+FormulaCompiler::OpCodeMapPtr FormulaCompiler::GetFinalOpCodeMap( const 
sal_Int32 nLanguage ) const
 {
     FormulaCompiler::OpCodeMapPtr xMap;
     using namespace sheet;
diff --git a/include/formula/FormulaCompiler.hxx 
b/include/formula/FormulaCompiler.hxx
index 36632035602e..d94dbd40d399 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -196,7 +196,30 @@ public:
     typedef std::shared_ptr< const OpCodeMap >  OpCodeMapPtr;
     typedef std::shared_ptr< OpCodeMap >        NonConstOpCodeMapPtr;
 
+protected:
+    /** Get finalized OpCodeMap for formula language.
+
+        Creates/returns a singleton instance of an OpCodeMap that contains
+        external AddIn mappings if the derived class supports them. Do not call
+        at this base class as it results in a permanent mapping without AddIns
+        even for derived classes (unless it is for the implementation of the
+        temporary GetOpCodeMap()).
+
+        @param nLanguage
+            One of css::sheet::FormulaLanguage constants.
+        @return Map for nLanguage. If nLanguage is unknown, a NULL map is 
returned.
+     */
+    OpCodeMapPtr GetFinalOpCodeMap( const sal_Int32 nLanguage ) const;
+
+public:
     /** Get OpCodeMap for formula language.
+
+        Returns either the finalized OpCodeMap (created by GetFinalOpCodeMap()
+        of a derived class) for nLanguage if there is such, or if not then a
+        temporary map of which its singleton is reset immediately and the
+        temporary will get destroyed by the caller's scope. A temporary map
+        created at this base class does *not* contain AddIn mappings.
+
         @param nLanguage
             One of css::sheet::FormulaLanguage constants.
         @return Map for nLanguage. If nLanguage is unknown, a NULL map is 
returned.

Reply via email to