summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/document.hxx12
-rw-r--r--sc/inc/global.hxx2
-rw-r--r--sc/source/core/data/column2.cxx2
-rw-r--r--sc/source/core/data/documen2.cxx11
-rw-r--r--sc/source/core/data/documen8.cxx4
-rw-r--r--sc/source/core/data/document.cxx2
-rw-r--r--sc/source/core/data/formulacell.cxx14
-rw-r--r--sc/source/core/data/global.cxx2
8 files changed, 26 insertions, 23 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ccade9f02c6f..813d388abb4d 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -435,8 +435,6 @@ private:
css::uno::Reference< css::script::vba::XVBAEventProcessor >
mxVbaEvents;
public:
- bool mbThreadedGroupCalcInProgress;
-
/// list of ScInterpreterTableOpParams currently in use
std::vector<std::unique_ptr<ScInterpreterTableOpParams>> m_TableOpList;
ScInterpreterTableOpParams aLastTableOpParams; // remember last params
@@ -575,6 +573,8 @@ public:
maInterpreterContext.mpFormatter = GetFormatTable();
return maInterpreterContext;
}
+ void SetThreadedGroupCalcInProgress( bool set ) { (void)this; ScGlobal::bThreadedGroupCalcInProgress = set; }
+ bool IsThreadedGroupCalcInProgress() const { (void)this; return ScGlobal::bThreadedGroupCalcInProgress; }
SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager();
SC_DLLPUBLIC const sfx2::LinkManager* GetLinkManager() const;
@@ -2216,26 +2216,26 @@ public:
void IncInterpretLevel()
{
- assert(!mbThreadedGroupCalcInProgress);
+ assert(!IsThreadedGroupCalcInProgress());
if ( nInterpretLevel < USHRT_MAX )
nInterpretLevel++;
}
void DecInterpretLevel()
{
- assert(!mbThreadedGroupCalcInProgress);
+ assert(!IsThreadedGroupCalcInProgress());
if ( nInterpretLevel )
nInterpretLevel--;
}
sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; }
void IncMacroInterpretLevel()
{
- assert(!mbThreadedGroupCalcInProgress);
+ assert(!IsThreadedGroupCalcInProgress());
if ( nMacroInterpretLevel < USHRT_MAX )
nMacroInterpretLevel++;
}
void DecMacroInterpretLevel()
{
- assert(!mbThreadedGroupCalcInProgress);
+ assert(!IsThreadedGroupCalcInProgress());
if ( nMacroInterpretLevel )
nMacroInterpretLevel--;
}
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 050e38250508..56fe91be4aca 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -801,6 +801,8 @@ public:
FormulaError & rError, FormulaError nStringNoValueError,
SvNumberFormatter* pFormatter, SvNumFormatType & rCurFmtType );
+ /// Calc's threaded group calculation is in progress.
+ static bool bThreadedGroupCalcInProgress;
};
// maybe move to dbdata.hxx (?):
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 79654808a14f..3c856fd161cd 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2912,7 +2912,7 @@ void ScColumn::SetFormulaResults( SCROW nRow, const formula::FormulaConstTokenRe
void ScColumn::CalculateInThread( ScInterpreterContext& rContext, SCROW nRow, size_t nLen, unsigned nThisThread, unsigned nThreadsTotal)
{
- assert(GetDoc()->mbThreadedGroupCalcInProgress);
+ assert(GetDoc()->IsThreadedGroupCalcInProgress());
sc::CellStoreType::position_type aPos = maCells.position(nRow);
sc::CellStoreType::iterator it = aPos.first;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index ba48bff57ced..dd807c3c24fd 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -169,7 +169,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
nUnoObjectId( 0 ),
nRangeOverflowType( 0 ),
aCurTextWidthCalcPos(MAXCOL,0,0),
- mbThreadedGroupCalcInProgress( false ),
nFormulaCodeInTree(0),
nXMLImportedFormulaCount( 0 ),
nInterpretLevel(0),
@@ -482,7 +481,7 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
SvNumberFormatter* ScDocument::GetFormatTable() const
{
- assert(!mbThreadedGroupCalcInProgress);
+ assert(!IsThreadedGroupCalcInProgress());
return mxPoolHelper->GetFormTable();
}
@@ -1199,7 +1198,7 @@ ScRecursionHelper* ScDocument::CreateRecursionHelperInstance()
ScLookupCache & ScDocument::GetLookupCache( const ScRange & rRange )
{
ScLookupCache* pCache = nullptr;
- if (!mbThreadedGroupCalcInProgress)
+ if (!IsThreadedGroupCalcInProgress())
{
if (!maNonThreaded.pLookupCacheMapImpl)
maNonThreaded.pLookupCacheMapImpl = new ScLookupCacheMapImpl;
@@ -1230,7 +1229,7 @@ ScLookupCache & ScDocument::GetLookupCache( const ScRange & rRange )
void ScDocument::AddLookupCache( ScLookupCache & rCache )
{
- if (!mbThreadedGroupCalcInProgress)
+ if (!IsThreadedGroupCalcInProgress())
{
if (!maNonThreaded.pLookupCacheMapImpl->aCacheMap.insert( ::std::pair< const ScRange,
ScLookupCache*>(rCache.getRange(), &rCache)).second)
@@ -1254,7 +1253,7 @@ void ScDocument::AddLookupCache( ScLookupCache & rCache )
void ScDocument::RemoveLookupCache( ScLookupCache & rCache )
{
- if (!mbThreadedGroupCalcInProgress)
+ if (!IsThreadedGroupCalcInProgress())
{
auto it(maNonThreaded.pLookupCacheMapImpl->aCacheMap.find(rCache.getRange()));
if (it == maNonThreaded.pLookupCacheMapImpl->aCacheMap.end())
@@ -1286,7 +1285,7 @@ void ScDocument::RemoveLookupCache( ScLookupCache & rCache )
void ScDocument::ClearLookupCaches()
{
- if (!mbThreadedGroupCalcInProgress)
+ if (!IsThreadedGroupCalcInProgress())
{
if (maNonThreaded.pLookupCacheMapImpl )
maNonThreaded.pLookupCacheMapImpl->clear();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 53866ade7701..293eb556d676 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -433,12 +433,12 @@ const ScDocumentThreadSpecific& ScDocument::CalculateInColumnInThread( ScInterpr
if (!pTab)
return maNonThreaded;
- assert(mbThreadedGroupCalcInProgress);
+ assert(IsThreadedGroupCalcInProgress());
maThreadSpecific.SetupFromNonThreadedData(maNonThreaded);
pTab->CalculateInColumnInThread(rContext, rTopPos.Col(), rTopPos.Row(), nLen, nThisThread, nThreadsTotal);
- assert(mbThreadedGroupCalcInProgress);
+ assert(IsThreadedGroupCalcInProgress());
return maThreadSpecific;
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 7d64e2a8068e..e550109a9df5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6729,7 +6729,7 @@ thread_local ScDocumentThreadSpecific ScDocument::maThreadSpecific;
ScRecursionHelper& ScDocument::GetRecursionHelper()
{
- if (!mbThreadedGroupCalcInProgress)
+ if (!IsThreadedGroupCalcInProgress())
{
if (!maNonThreaded.pRecursionHelper)
maNonThreaded.pRecursionHelper = CreateRecursionHelperInstance();
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index daaa80e5b921..1bec26aab99a 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1529,7 +1529,7 @@ void ScFormulaCell::Interpret()
{
pDocument->IncInterpretLevel();
- bool bCheckForFGCycle = mxGroup && !pDocument->mbThreadedGroupCalcInProgress &&
+ bool bCheckForFGCycle = mxGroup && !pDocument->IsThreadedGroupCalcInProgress() &&
mxGroup->meCalcState == sc::GroupCalcEnabled &&
ScCalcConfig::isThreadingEnabled();
bool bPopFormulaGroup = false;
@@ -2108,7 +2108,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
// a changed result must still reset the stream flag
pDocument->SetStreamValid(aPos.Tab(), false, true);
}
- if ( !pDocument->mbThreadedGroupCalcInProgress && !pCode->IsRecalcModeAlways() )
+ if ( !pDocument->IsThreadedGroupCalcInProgress() && !pCode->IsRecalcModeAlways() )
pDocument->RemoveFromFormulaTree( this );
// FORCED cells also immediately tested for validity (start macro possibly)
@@ -2127,7 +2127,7 @@ void ScFormulaCell::InterpretTail( ScInterpreterContext& rContext, ScInterpretTa
}
// Reschedule slows the whole thing down considerably, thus only execute on percent change
- if (!pDocument->mbThreadedGroupCalcInProgress)
+ if (!pDocument->IsThreadedGroupCalcInProgress())
{
ScProgress *pProgress = ScProgress::GetInterpretProgress();
if (pProgress && pProgress->Enabled())
@@ -2594,7 +2594,7 @@ void ScFormulaCell::MaybeInterpret()
{
if (NeedsInterpret())
{
- assert(!pDocument->mbThreadedGroupCalcInProgress);
+ assert(!pDocument->IsThreadedGroupCalcInProgress());
Interpret();
}
}
@@ -4478,8 +4478,8 @@ bool ScFormulaCell::InterpretFormulaGroup()
SAL_INFO("sc.threaded", "Running " << nThreadCount << " threads");
{
- assert(!pDocument->mbThreadedGroupCalcInProgress);
- pDocument->mbThreadedGroupCalcInProgress = true;
+ assert(!pDocument->IsThreadedGroupCalcInProgress());
+ pDocument->SetThreadedGroupCalcInProgress(true);
ScMutationDisable aGuard(pDocument, ScMutationGuardFlags::CORE);
@@ -4493,7 +4493,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
SAL_INFO("sc.threaded", "Joining threads");
rThreadPool.waitUntilDone(aTag);
- pDocument->mbThreadedGroupCalcInProgress = false;
+ pDocument->SetThreadedGroupCalcInProgress(false);
SAL_INFO("sc.threaded", "Done");
}
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 4ab08a7bc1bd..531619a101a5 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -125,6 +125,8 @@ SfxViewShell* pScActiveViewShell = nullptr; //FIXME: Make this a member
sal_uInt16 nScClickMouseModifier = 0; //FIXME: This too
sal_uInt16 nScFillModeMouseModifier = 0; //FIXME: And this
+bool ScGlobal::bThreadedGroupCalcInProgress = false;
+
// Thread-safe singleton creation. Ideally rtl_Instance should be used, but that one doesn't
// allow accessing the pointer (so ScGlobal::Clear() cannot free the objects). So this function
// is basically rtl_Instance::create() that uses a given pointer.