From 89cfb604124278b0d51166597607d1a40bd40a3d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 29 Sep 2017 16:00:18 +0300 Subject: Move nMacroInterpretLevel back to ScDocument Change-Id: I48748434c845af963af160f8bbd75e4ab7ce95bd --- sc/inc/document.hxx | 19 ++++++++++++++----- sc/source/core/data/documen2.cxx | 1 + sc/source/core/data/document.cxx | 26 -------------------------- 3 files changed, 15 insertions(+), 31 deletions(-) (limited to 'sc') diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index a497bf3f178c..7b0bc83f141f 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -276,7 +276,6 @@ const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() // During threaded calculation fields being mutated are kept in this struct struct ScDocumentThreadSpecific { - sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter sal_uInt16 nInterpreterTableOpLevel; // >0 if in interpreter TableOp ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas @@ -284,7 +283,6 @@ struct ScDocumentThreadSpecific ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH ScDocumentThreadSpecific() : - nMacroInterpretLevel(0), nInterpreterTableOpLevel(0), pRecursionHelper(nullptr), pLookupCacheMapImpl(nullptr) @@ -453,6 +451,7 @@ private: sal_uLong nFormulaCodeInTree; // formula RPN in the formula tree sal_uLong nXMLImportedFormulaCount; // progress count during XML import sal_uInt16 nInterpretLevel; // >0 if in interpreter + sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter ScDocumentThreadSpecific maNonThreaded; @@ -2192,9 +2191,19 @@ public: if ( nInterpretLevel ) nInterpretLevel--; } - sal_uInt16 GetMacroInterpretLevel(); - void IncMacroInterpretLevel(); - void DecMacroInterpretLevel(); + sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; } + void IncMacroInterpretLevel() + { + assert(!mbThreadedGroupCalcInProgress); + if ( nMacroInterpretLevel < USHRT_MAX ) + nMacroInterpretLevel++; + } + void DecMacroInterpretLevel() + { + assert(!mbThreadedGroupCalcInProgress); + if ( nMacroInterpretLevel ) + nMacroInterpretLevel--; + } bool IsInInterpreterTableOp() const; void IncInterpreterTableOpLevel(); void DecInterpreterTableOpLevel(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index c5d0c7e8cea2..9fab88f4e910 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -175,6 +175,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : nFormulaCodeInTree(0), nXMLImportedFormulaCount( 0 ), nInterpretLevel(0), + nMacroInterpretLevel(0), nSrcVer( SC_CURRENT_VERSION ), nFormulaTrackCount(0), eHardRecalcState(HardRecalcState::OFF), diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 2df3f8e10a8b..1706342ccd36 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6771,30 +6771,6 @@ ScMutationGuard::~ScMutationGuard() thread_local ScDocumentThreadSpecific ScDocument::maThreadSpecific; -sal_uInt16 ScDocument::GetMacroInterpretLevel() -{ - if (!mbThreadedGroupCalcInProgress) - return maNonThreaded.nMacroInterpretLevel; - else - return maThreadSpecific.nMacroInterpretLevel; -} - -void ScDocument::IncMacroInterpretLevel() -{ - if (!mbThreadedGroupCalcInProgress) - maNonThreaded.nMacroInterpretLevel++; - else - maThreadSpecific.nMacroInterpretLevel++; -} - -void ScDocument::DecMacroInterpretLevel() -{ - if (!mbThreadedGroupCalcInProgress) - maNonThreaded.nMacroInterpretLevel--; - else - maThreadSpecific.nMacroInterpretLevel--; -} - bool ScDocument::IsInInterpreterTableOp() const { if (!mbThreadedGroupCalcInProgress) @@ -6849,7 +6825,6 @@ ScRecursionHelper& ScDocument::GetRecursionHelper() void ScDocumentThreadSpecific::SetupFromNonThreadedData(const ScDocumentThreadSpecific& rNonThreadedData) { - nMacroInterpretLevel = rNonThreadedData.nMacroInterpretLevel; nInterpreterTableOpLevel = rNonThreadedData.nInterpreterTableOpLevel; // What about the recursion helper? @@ -6858,7 +6833,6 @@ void ScDocumentThreadSpecific::SetupFromNonThreadedData(const ScDocumentThreadSp void ScDocumentThreadSpecific::MergeBackIntoNonThreadedData(ScDocumentThreadSpecific& rNonThreadedData) { - assert(nMacroInterpretLevel == rNonThreadedData.nMacroInterpretLevel); assert(nInterpreterTableOpLevel == rNonThreadedData.nInterpreterTableOpLevel); // What about recursion helper and lookup cache? -- cgit