summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-10-01 17:07:36 +0300
committerTor Lillqvist <tml@collabora.com>2015-10-02 08:05:31 +0300
commitab092bdc0f8c45e174cad403de9d2342adc01fb6 (patch)
treebf6857f609aec0d6bbe87b72bdf120d14f682ec2 /sc
parent419549b095a1bb95ce23bf3fc8866e6b582e6dde (diff)
Make fewer calls to officecfg::...::UseOpenCL::get()
Change-Id: I5f7f52b6f2fb92c46e2b24e0edf95b4ccd17671d
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/formulacell.hxx2
-rw-r--r--sc/source/core/data/colorscale.cxx2
-rw-r--r--sc/source/core/data/column.cxx23
-rw-r--r--sc/source/core/data/column3.cxx9
-rw-r--r--sc/source/core/data/documen4.cxx11
-rw-r--r--sc/source/core/data/documen7.cxx5
-rw-r--r--sc/source/core/data/formulacell.cxx11
-rw-r--r--sc/source/core/data/validat.cxx2
-rw-r--r--sc/source/core/tool/detfunc.cxx10
-rw-r--r--sc/source/ui/docshell/docfunc.cxx2
10 files changed, 48 insertions, 29 deletions
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 3deb9e30583d..df13660e7daa 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -228,7 +228,7 @@ public:
void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens
void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
bool MarkUsedExternalReferences();
- void Interpret();
+ void Interpret(bool bUseOpenCL);
bool IsIterCell() const { return bIsIterCell; }
sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; }
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 897737ec5b65..acbdf29720b1 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -219,7 +219,7 @@ double ScColorScaleEntry::GetValue() const
{
if(mpCell)
{
- mpCell->Interpret();
+ mpCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
if(mpCell->IsValue())
return mpCell->GetValue();
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 04eedf75b24b..f6d659b68be7 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -867,6 +867,7 @@ class CopyToClipHandler
sc::ColumnBlockPosition maDestPos;
sc::ColumnBlockPosition* mpDestPos;
bool mbCopyNotes;
+ bool mbUseOpenCL;
void setDefaultAttrsToDest(size_t nRow, size_t nSize)
{
@@ -882,7 +883,11 @@ class CopyToClipHandler
public:
CopyToClipHandler(const ScColumn& rSrcCol, ScColumn& rDestCol, sc::ColumnBlockPosition* pDestPos, bool bCopyNotes) :
- mrSrcCol(rSrcCol), mrDestCol(rDestCol), mpDestPos(pDestPos), mbCopyNotes(bCopyNotes)
+ mrSrcCol(rSrcCol),
+ mrDestCol(rDestCol),
+ mpDestPos(pDestPos),
+ mbCopyNotes(bCopyNotes),
+ mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get())
{
if (mpDestPos)
maDestPos = *mpDestPos;
@@ -953,7 +958,7 @@ public:
{
const ScFormulaCell& rOld = **it;
if (rOld.GetDirty() && mrSrcCol.GetDoc().GetAutoCalc())
- const_cast<ScFormulaCell&>(rOld).Interpret();
+ const_cast<ScFormulaCell&>(rOld).Interpret(mbUseOpenCL);
aCloned.push_back(new ScFormulaCell(rOld, mrDestCol.GetDoc(), aDestPos));
}
@@ -1057,6 +1062,7 @@ void ScColumn::CopyStaticToDocument(
size_t nOffset = aPos.second;
size_t nDataSize = 0;
size_t nCurRow = nRow1;
+ const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get());
for (; it != maCells.end() && nCurRow <= static_cast<size_t>(nRow2); ++it, nOffset = 0, nCurRow += nDataSize)
{
@@ -1122,7 +1128,7 @@ void ScColumn::CopyStaticToDocument(
ScFormulaCell& rFC = const_cast<ScFormulaCell&>(**itData);
if (rFC.GetDirty() && pDocument->GetAutoCalc())
- rFC.Interpret();
+ rFC.Interpret(bUseOpenCL);
if (rFC.GetErrCode())
// Skip cells with error.
@@ -1187,7 +1193,7 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes
{
ScFormulaCell* p = sc::formula_block::at(*it->data, aPos.second);
if (p->GetDirty() && pDocument->GetAutoCalc())
- p->Interpret();
+ p->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
ScAddress aDestPos = p->aPos;
aDestPos.SetRow(nDestRow);
@@ -2777,6 +2783,13 @@ struct SetDirtyIfPostponedHandler
struct CalcAllHandler
{
+ bool mbUseOpenCL;
+
+ CalcAllHandler() :
+ mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get())
+ {
+ }
+
void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
{
#if OSL_DEBUG_LEVEL > 1
@@ -2784,7 +2797,7 @@ struct CalcAllHandler
double nOldVal, nNewVal;
nOldVal = pCell->GetValue();
#endif
- pCell->Interpret();
+ pCell->Interpret(mbUseOpenCL);
#if OSL_DEBUG_LEVEL > 1
if (pCell->GetCode()->IsRecalcModeNormal())
nNewVal = pCell->GetValue();
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c4d2e4ef3061..0c28aa1740ef 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -92,10 +92,17 @@ void ScColumn::BroadcastCells( const std::vector<SCROW>& rRows, sal_uLong nHint
struct DirtyCellInterpreter
{
+ bool mbUseOpenCL;
+
+ DirtyCellInterpreter() :
+ mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get())
+ {
+ }
+
void operator() (size_t, ScFormulaCell* p)
{
if (p->GetDirty())
- p->Interpret();
+ p->Interpret(mbUseOpenCL);
}
};
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 48319bad94a8..41aee998ea42 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -85,6 +85,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
ScFormulaCell* pFormula = NULL;
double fTargetVal = 0.0;
sal_uInt32 nFIndex = 0;
+ const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get());
if ( eFType == CELLTYPE_FORMULA && eVType == CELLTYPE_VALUE &&
GetFormatTable()->IsNumberFormat( sValStr, nFIndex, fTargetVal ) )
{
@@ -109,7 +110,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
double fBestF, fFPrev;
fBestX = fXPrev = fSaveVal;
- pFormula->Interpret();
+ pFormula->Interpret( bUseOpenCL );
bool bError = ( pFormula->GetErrCode() != 0 );
// bError always corresponds with fF
@@ -131,7 +132,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
{
*pVCell = fX;
SetDirty( aVRange, false );
- pFormula->Interpret();
+ pFormula->Interpret( bUseOpenCL );
bError = ( pFormula->GetErrCode() != 0 );
fF = pFormula->GetValue() - fTargetVal;
@@ -165,7 +166,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
*pVCell = fHorX;
SetDirty( aVRange, false );
- pFormula->Interpret();
+ pFormula->Interpret( bUseOpenCL );
bHorMoveError = ( pFormula->GetErrCode() != 0 );
if ( bHorMoveError )
break;
@@ -229,7 +230,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
{
*pVCell = nX;
SetDirty( aVRange, false );
- pFormula->Interpret();
+ pFormula->Interpret( bUseOpenCL );
if ( fabs( pFormula->GetValue() - fTargetVal ) > fabs( fF ) )
nX = fBestX;
bRet = true;
@@ -240,7 +241,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab,
}
*pVCell = fSaveVal;
SetDirty( aVRange, false );
- pFormula->Interpret();
+ pFormula->Interpret( bUseOpenCL );
if ( !bDoneIteration )
{
SetError( nVCol, nVRow, nVTab, NOTAVAILABLE );
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 864a77b757b6..54335c9e239a 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -456,6 +456,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
pCell = pFormulaTree;
ScFormulaCell* pLastNoGood = 0;
+ const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get());
while ( pCell )
{
// Interpret resets bDirty and calls Remove, also the referenced!
@@ -463,11 +464,11 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
if ( bOnlyForced )
{
if ( pCell->GetCode()->IsRecalcModeForced() )
- pCell->Interpret();
+ pCell->Interpret( bUseOpenCL );
}
else
{
- pCell->Interpret();
+ pCell->Interpret( bUseOpenCL );
}
if ( pCell->GetPrevious() || pCell == pFormulaTree )
{ // (IsInFormulaTree(pCell)) no Remove was called => next
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 06f6439fafc3..90b4adca3359 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1485,7 +1485,7 @@ bool ScFormulaCell::MarkUsedExternalReferences()
return pCode && pDocument->MarkUsedExternalReferences(*pCode, aPos);
}
-void ScFormulaCell::Interpret()
+void ScFormulaCell::Interpret(bool bUseOpenCL)
{
#if DEBUG_CALCULATION
static bool bDebugCalculationInit = true;
@@ -1541,7 +1541,7 @@ void ScFormulaCell::Interpret()
}
else
{
- if ( ! InterpretFormulaGroup() )
+ if ( !bUseOpenCL || !InterpretFormulaGroup() )
InterpretTail( SCITP_NORMAL);
}
@@ -2435,7 +2435,7 @@ bool ScFormulaCell::NeedsInterpret() const
void ScFormulaCell::MaybeInterpret()
{
if (NeedsInterpret())
- Interpret();
+ Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
}
bool ScFormulaCell::IsHyperLinkCell() const
@@ -2522,7 +2522,7 @@ const ScMatrix* ScFormulaCell::GetMatrix()
if( IsDirtyOrInTableOpDirty()
// Was stored !bDirty but an accompanying matrix cell was bDirty?
|| (!bDirty && cMatrixFlag == MM_FORMULA && !aResult.GetMatrix()))
- Interpret();
+ Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
}
return aResult.GetMatrix().get();
}
@@ -3891,9 +3891,6 @@ bool ScFormulaCell::InterpretFormulaGroup()
return false;
}
- if (!officecfg::Office::Common::Misc::UseOpenCL::get())
- return false;
-
// TODO : Disable invariant formula group interpretation for now in order
// to get implicit intersection to work.
if (mxGroup->mbInvariant && false)
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index e168ec6110f1..491213cc9d55 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -633,7 +633,7 @@ bool ScValidationData::GetSelectionFromFormula(
// Make sure the formula gets interpreted and a result is delivered,
// regardless of the AutoCalc setting.
- aValidationSrc.Interpret();
+ aValidationSrc.Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
ScMatrixRef xMatRef;
const ScMatrix *pValues = aValidationSrc.GetMatrix();
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index be0c53cf5c7b..7d72fc16ea12 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -811,7 +811,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetective
return DET_INS_CIRCULAR;
if (pFCell->GetDirty())
- pFCell->Interpret(); // can't be called after SetRunning
+ pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning
pFCell->SetRunning(true);
sal_uInt16 nResult = DET_INS_EMPTY;
@@ -900,7 +900,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL
return nLevel;
if (pFCell->GetDirty())
- pFCell->Interpret(); // can't be called after SetRunning
+ pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning
pFCell->SetRunning(true);
sal_uInt16 nResult = nLevel;
@@ -958,7 +958,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiv
return DET_INS_CIRCULAR;
if (pFCell->GetDirty())
- pFCell->Interpret(); // can't be called after SetRunning
+ pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning
pFCell->SetRunning(true);
sal_uInt16 nResult = DET_INS_EMPTY;
@@ -1010,7 +1010,7 @@ sal_uInt16 ScDetectiveFunc::InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCo
bool bRunning = pFCell->IsRunning();
if (pFCell->GetDirty())
- pFCell->Interpret(); // can't be called after SetRunning
+ pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning
pFCell->SetRunning(true);
ScDetectiveRefIter aIter(pFCell);
@@ -1098,7 +1098,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2
bool bRunning = pFCell->IsRunning();
if (pFCell->GetDirty())
- pFCell->Interpret(); // can't be called after SetRunning
+ pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning
pFCell->SetRunning(true);
ScDetectiveRefIter aIter(pFCell);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 15fa0ece667a..7b532e86d301 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1008,7 +1008,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
if (bInteraction && !rDoc.GetAutoCalc() && pCell)
{
// calculate just the cell once and set Dirty again
- pCell->Interpret();
+ pCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get());
pCell->SetDirtyVar();
rDoc.PutInFormulaTree( pCell);
}