Kaydet (Commit) 20a359ea authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Have all formula cells start listening at once after the file load.

Rather than doing it individually.

Change-Id: I5ed55947b715bf6d7d61a1f8b751be7fdcf425fb
üst 488b1ea1
......@@ -395,7 +395,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
namespace {
class CellTextAttrInitializer
class CellStoreInitializer
{
struct Impl
{
......@@ -408,10 +408,12 @@ class CellTextAttrInitializer
{}
};
ScDocument& mrDoc;
boost::shared_ptr<Impl> mpImpl;
public:
CellTextAttrInitializer(sal_uInt16 nScriptNumeric) : mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric)) {}
CellStoreInitializer(ScDocument& rDoc, sal_uInt16 nScriptNumeric) :
mrDoc(rDoc), mpImpl(new Impl(MAXROWCOUNT, nScriptNumeric)) {}
void operator() (const sc::CellStoreType::value_type& node)
{
......@@ -424,6 +426,18 @@ public:
aDefault.mnScriptType = mpImpl->mnScriptNumeric;
std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end());
if (node.type == sc::element_type_formula)
{
// Have all formula cells start listening to the document.
sc::formula_block::iterator it = sc::formula_block::begin(*node.data);
sc::formula_block::iterator itEnd = sc::formula_block::end(*node.data);
for (; it != itEnd; ++it)
{
ScFormulaCell& rFC = **it;
rFC.StartListeningTo(&mrDoc);
}
}
}
void swap(sc::CellTextAttrStoreType& rAttrs)
......@@ -453,7 +467,7 @@ void ScDocumentImport::finalize()
void ScDocumentImport::initColumn(ScColumn& rCol)
{
CellTextAttrInitializer aFunc(mpImpl->mnDefaultScriptNumeric);
CellStoreInitializer aFunc(mpImpl->mrDoc, mpImpl->mnDefaultScriptNumeric);
std::for_each(rCol.maCells.begin(), rCol.maCells.end(), aFunc);
aFunc.swap(rCol.maCellTextAttrs);
rCol.RegroupFormulaCells();
......
......@@ -364,7 +364,6 @@ void ScOrcusSheet::set_shared_formula(
// For now, orcus doesn't support setting cached result. Mark it for re-calculation.
pCell->SetDirty(true);
pCell->StartListeningTo(&mrDoc.getDoc());
}
void ScOrcusSheet::set_shared_formula(
......@@ -388,7 +387,6 @@ void ScOrcusSheet::set_shared_formula(os::row_t row, os::col_t col, size_t sinde
// For now, orcus doesn't support setting cached result. Mark it for re-calculation.
pCell->SetDirty(true);
pCell->StartListeningTo(&mrDoc.getDoc());
}
void ScOrcusSheet::set_array_formula(
......
......@@ -1027,7 +1027,6 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
pFCell->SetHybridDouble(fValue);
pFCell->ResetDirty();
}
pFCell->StartListeningTo(rXMLImport.GetDocument());
}
}
......@@ -1075,7 +1074,6 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
SAL_WARN("sc", "matrix cell without matrix");
}
}
pFCell->StartListeningTo(rXMLImport.GetDocument());
}
}
else //regular text cells
......@@ -1437,7 +1435,6 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue));
pFCell->ResetDirty();
}
pFCell->StartListeningTo(rXMLImport.GetDocument());
}
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment