diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2019-02-05 16:55:08 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2019-02-11 10:54:08 +0100 |
commit | 4aea832ffebefd62e5f9a3b34dca493b21a16bb0 (patch) | |
tree | f5cc1a40fbf6dae1b8658796ca05c10b7161888d /sc/source/core | |
parent | c04eb27affb8f6284d01dbd9f8b3c92a7979087a (diff) |
tdf#121388 : Disable threading and dep evaluation for IF...
IFS/SWITCH if the call did not originate from
ScDocShell::DoRecalc()/ScDocShell::DoHardRecalc()
Change-Id: Ifdb3a496276dc841fc42a1bad1876cfb1057baf6
Reviewed-on: https://gerrit.libreoffice.org/67414
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/data/documen2.cxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 50ccf9735889..a97dbc389a90 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -159,6 +159,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : mbEmbedFontScriptComplex(true), mbTrackFormulasPending(false), mbFinalTrackFormulas(false), + mbDocShellRecalc(false), mnMutationGuardFlags(0) { SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT); diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 52c0cf5e3f7c..1af4729634f8 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -4381,9 +4381,26 @@ struct ScDependantsCalculator // Self references should be checked by considering the entire formula-group not just the provided span. bool bHasSelfReferences = false; + bool bInDocShellRecalc = mrDoc.IsInDocShellRecalc(); - for (auto p: mrCode.RPNTokens()) + FormulaToken** pRPNArray = mrCode.GetCode(); + sal_uInt16 nCodeLen = mrCode.GetCodeLen(); + for (sal_Int32 nTokenIdx = nCodeLen-1; nTokenIdx >= 0; --nTokenIdx) { + auto p = pRPNArray[nTokenIdx]; + if (!bInDocShellRecalc) + { + // The dependency evaluator evaluates all arguments of IF/IFS/SWITCH irrespective + // of the result of the condition expression. + // This is a perf problem if we *don't* intent on recalc'ing all dirty cells + // in the document. So lets disable threading and stop dependency evaluation if + // the call did not originate from ScDocShell::DoRecalc()/ScDocShell::DoHardRecalc() + // for formulae with IF/IFS/SWITCH + OpCode nOpCode = p->GetOpCode(); + if (nOpCode == ocIf || nOpCode == ocIfs_MS || nOpCode == ocSwitch_MS) + return false; + } + switch (p->GetType()) { case svSingleRef: |