summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/column.cxx34
-rw-r--r--sc/source/core/data/document.cxx16
-rw-r--r--sc/source/core/data/table2.cxx12
3 files changed, 62 insertions, 0 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 462abe7c5561..5fb98a2b2f1c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2149,6 +2149,40 @@ void ScColumn::CompileXML( ScProgress& rProgress )
}
}
+bool ScColumn::CompileErrorCells(sal_uInt16 nErrCode)
+{
+ if (maItems.empty())
+ return false;
+
+ bool bCompiled = false;
+ std::vector<ColEntry>::iterator it = maItems.begin(), itEnd = maItems.end();
+ for (; it != itEnd; ++it)
+ {
+ ScBaseCell* pCell = it->pCell;
+ if (pCell->GetCellType() != CELLTYPE_FORMULA)
+ // Not a formula cell. Skip it.
+ continue;
+
+ ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell);
+ sal_uInt16 nCurError = pFCell->GetRawError();
+ if (!nCurError)
+ // It's not an error cell. Skip it.
+ continue;
+
+ if (nErrCode && nCurError != nErrCode)
+ // Error code is specified, and it doesn't match. Skip it.
+ continue;
+
+ pFCell->GetCode()->SetCodeError(0);
+ OUStringBuffer aBuf;
+ pFCell->GetFormula(aBuf, pDocument->GetGrammar());
+ pFCell->Compile(aBuf.makeStringAndClear(), false, pDocument->GetGrammar());
+
+ bCompiled = true;
+ }
+
+ return bCompiled;
+}
void ScColumn::CalcAfterLoad()
{
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 95018d741a2f..8cc171324084 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3377,6 +3377,22 @@ void ScDocument::CompileXML()
SetAutoCalc( bOldAutoCalc );
}
+bool ScDocument::CompileErrorCells(sal_uInt16 nErrCode)
+{
+ bool bCompiled = false;
+ TableContainer::iterator it = maTabs.begin(), itEnd = maTabs.end();
+ for (; it != itEnd; ++it)
+ {
+ ScTable* pTab = *it;
+ if (!pTab)
+ continue;
+
+ if (pTab->CompileErrorCells(nErrCode))
+ bCompiled = true;
+ }
+
+ return bCompiled;
+}
void ScDocument::CalcAfterLoad()
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f0bd119a0cc7..918a60233128 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1539,6 +1539,18 @@ void ScTable::CompileXML( ScProgress& rProgress )
mpCondFormatList->CompileXML();
}
+bool ScTable::CompileErrorCells(sal_uInt16 nErrCode)
+{
+ bool bCompiled = false;
+ for (SCCOL i = 0; i <= MAXCOL; ++i)
+ {
+ if (aCol[i].CompileErrorCells(nErrCode))
+ bCompiled = true;
+ }
+
+ return bCompiled;
+}
+
void ScTable::CalcAfterLoad()
{
for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].CalcAfterLoad();