summaryrefslogtreecommitdiff
path: root/sc/source/core/data/column.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/data/column.cxx')
-rw-r--r--sc/source/core/data/column.cxx48
1 files changed, 29 insertions, 19 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 7771f0e065f8..0b1032873786 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2836,24 +2836,30 @@ struct CalcAllHandler
}
};
-struct CompileAllHandler
+class CompileAllHandler
{
+ sc::CompileFormulaContext& mrCxt;
+public:
+ CompileAllHandler( sc::CompileFormulaContext& rCxt ) : mrCxt(rCxt) {}
+
void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
{
// for unconditional compilation
// bCompile=true and pCode->nError=0
pCell->GetCode()->SetCodeError(0);
pCell->SetCompile(true);
- pCell->CompileTokenArray();
+ pCell->CompileTokenArray(mrCxt);
}
};
class CompileXMLHandler
{
+ sc::CompileFormulaContext& mrCxt;
ScProgress& mrProgress;
const ScColumn& mrCol;
public:
- CompileXMLHandler(ScProgress& rProgress, const ScColumn& rCol) :
+ CompileXMLHandler( sc::CompileFormulaContext& rCxt, ScProgress& rProgress, const ScColumn& rCol) :
+ mrCxt(rCxt),
mrProgress(rProgress),
mrCol(rCol) {}
@@ -2865,23 +2871,24 @@ public:
else
pCell->SetDirtyVar();
- pCell->CompileXML(mrProgress);
+ pCell->CompileXML(mrCxt, mrProgress);
}
};
class CompileErrorCellsHandler
{
+ sc::CompileFormulaContext& mrCxt;
ScColumn& mrColumn;
sc::CellStoreType::iterator miPos;
sal_uInt16 mnErrCode;
FormulaGrammar::Grammar meGram;
bool mbCompiled;
public:
- CompileErrorCellsHandler(ScColumn& rColumn, sal_uInt16 nErrCode, FormulaGrammar::Grammar eGram) :
+ CompileErrorCellsHandler( sc::CompileFormulaContext& rCxt, ScColumn& rColumn, sal_uInt16 nErrCode ) :
+ mrCxt(rCxt),
mrColumn(rColumn),
miPos(mrColumn.GetCellStore().begin()),
mnErrCode(nErrCode),
- meGram(eGram),
mbCompiled(false)
{
}
@@ -2901,9 +2908,8 @@ public:
miPos = aPos.first;
sc::SharedFormulaUtil::unshareFormulaCell(aPos, *pCell);
pCell->GetCode()->SetCodeError(0);
- OUStringBuffer aBuf;
- pCell->GetFormula(aBuf, meGram);
- pCell->Compile(aBuf.makeStringAndClear(), false, meGram);
+ OUString aFormula = pCell->GetFormula(mrCxt);
+ pCell->Compile(mrCxt, aFormula, false);
mrColumn.JoinNewFormulaCell(aPos, *pCell);
mbCompiled = true;
@@ -2912,11 +2918,15 @@ public:
bool isCompiled() const { return mbCompiled; }
};
-struct CalcAfterLoadHandler
+class CalcAfterLoadHandler
{
+ sc::CompileFormulaContext& mrCxt;
+public:
+ CalcAfterLoadHandler( sc::CompileFormulaContext& rCxt ) : mrCxt(rCxt) {}
+
void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
{
- pCell->CalcAfterLoad();
+ pCell->CalcAfterLoad(mrCxt);
}
};
@@ -3165,29 +3175,29 @@ void ScColumn::CalcAll()
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::CompileAll()
+void ScColumn::CompileAll( sc::CompileFormulaContext& rCxt )
{
- CompileAllHandler aFunc;
+ CompileAllHandler aFunc(rCxt);
sc::ProcessFormula(maCells, aFunc);
}
-void ScColumn::CompileXML( ScProgress& rProgress )
+void ScColumn::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress )
{
- CompileXMLHandler aFunc(rProgress, *this);
+ CompileXMLHandler aFunc(rCxt, rProgress, *this);
sc::ProcessFormula(maCells, aFunc);
RegroupFormulaCells();
}
-bool ScColumn::CompileErrorCells(sal_uInt16 nErrCode)
+bool ScColumn::CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode )
{
- CompileErrorCellsHandler aHdl(*this, nErrCode, pDocument->GetGrammar());
+ CompileErrorCellsHandler aHdl(rCxt, *this, nErrCode);
sc::ProcessFormula(maCells, aHdl);
return aHdl.isCompiled();
}
-void ScColumn::CalcAfterLoad()
+void ScColumn::CalcAfterLoad( sc::CompileFormulaContext& rCxt )
{
- CalcAfterLoadHandler aFunc;
+ CalcAfterLoadHandler aFunc(rCxt);
sc::ProcessFormula(maCells, aFunc);
}