sc/source/filter/oox/workbookhelper.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit d7de73fa57c3a96fa8caf030f231e64a59616c2a
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Aug 29 10:52:32 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 4 11:35:42 2024 +0200

    Related: tdf#161599 pre-initialize ScCompiler ODFF and OOXML final OpCodeMap
    
    ... to avoid temporary maps through base class
    formula::FormulaCompiler::GetOpCodeMap().
    
    Change-Id: I372355b57326eab00d4ccde651df4d0fe69166c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172588
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>
    (cherry picked from commit 5755b5515b8e97b638f2fb1f7553130760f12e94)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172577
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/filter/oox/workbookhelper.cxx 
b/sc/source/filter/oox/workbookhelper.cxx
index b2a6859aa45f..4ac887c26c40 100644
--- a/sc/source/filter/oox/workbookhelper.cxx
+++ b/sc/source/filter/oox/workbookhelper.cxx
@@ -602,6 +602,18 @@ void WorkbookGlobals::initialize()
     mxEditEngine->EnableUndo( false );
     mxEditEngine->SetControlWord( mxEditEngine->GetControlWord() & 
~EEControlBits::ALLOWBIGOBJS );
 
+    // Initialize a final ODFF OpCodeMap once in case none was created yet, so
+    // the subsequent XFormulaOpCodeMapper::getAvailableMappings() via
+    // OpCodeProviderImpl::fillEntrySeq() do not have to recreate temporary
+    // mappings over and over again.
+    // Same for OOXML mapping that is accessed by some base class
+    // formula::FormulaCompiler::GetOpCodeMap() calls.
+    {
+        ScCompiler aCompiler( rDoc, ScAddress(), 
formula::FormulaGrammar::GRAM_ODFF);
+        aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::ODFF);
+        aCompiler.GetOpCodeMap(css::sheet::FormulaLanguage::OOXML);
+    }
+
     // set some document properties needed during import
     if( mrBaseFilter.isImportFilter() )
     {

Reply via email to