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 <erack@redhat.com>
Tested-by: Jenkins
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 55e65ae..2f7128c 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -817,6 +817,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;
switch (nLanguage)
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 3663203..d94dbd4 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.