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 ...@@ -395,7 +395,7 @@ void ScDocumentImport::setTableOpCells(const ScRange& rRange, const ScTabOpParam
namespace { namespace {
class CellTextAttrInitializer class CellStoreInitializer
{ {
struct Impl struct Impl
{ {
...@@ -408,10 +408,12 @@ class CellTextAttrInitializer ...@@ -408,10 +408,12 @@ class CellTextAttrInitializer
{} {}
}; };
ScDocument& mrDoc;
boost::shared_ptr<Impl> mpImpl; boost::shared_ptr<Impl> mpImpl;
public: 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) void operator() (const sc::CellStoreType::value_type& node)
{ {
...@@ -424,6 +426,18 @@ public: ...@@ -424,6 +426,18 @@ public:
aDefault.mnScriptType = mpImpl->mnScriptNumeric; aDefault.mnScriptType = mpImpl->mnScriptNumeric;
std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault); std::vector<sc::CellTextAttr> aDefaults(node.size, aDefault);
mpImpl->miPos = mpImpl->maAttrs.set(mpImpl->miPos, node.position, aDefaults.begin(), aDefaults.end()); 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) void swap(sc::CellTextAttrStoreType& rAttrs)
...@@ -453,7 +467,7 @@ void ScDocumentImport::finalize() ...@@ -453,7 +467,7 @@ void ScDocumentImport::finalize()
void ScDocumentImport::initColumn(ScColumn& rCol) 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); std::for_each(rCol.maCells.begin(), rCol.maCells.end(), aFunc);
aFunc.swap(rCol.maCellTextAttrs); aFunc.swap(rCol.maCellTextAttrs);
rCol.RegroupFormulaCells(); rCol.RegroupFormulaCells();
......
...@@ -364,7 +364,6 @@ void ScOrcusSheet::set_shared_formula( ...@@ -364,7 +364,6 @@ void ScOrcusSheet::set_shared_formula(
// For now, orcus doesn't support setting cached result. Mark it for re-calculation. // For now, orcus doesn't support setting cached result. Mark it for re-calculation.
pCell->SetDirty(true); pCell->SetDirty(true);
pCell->StartListeningTo(&mrDoc.getDoc());
} }
void ScOrcusSheet::set_shared_formula( 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 ...@@ -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. // For now, orcus doesn't support setting cached result. Mark it for re-calculation.
pCell->SetDirty(true); pCell->SetDirty(true);
pCell->StartListeningTo(&mrDoc.getDoc());
} }
void ScOrcusSheet::set_array_formula( void ScOrcusSheet::set_array_formula(
......
...@@ -1027,7 +1027,6 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const ...@@ -1027,7 +1027,6 @@ void ScXMLTableRowCellContext::SetFormulaCell(ScFormulaCell* pFCell) const
pFCell->SetHybridDouble(fValue); pFCell->SetHybridDouble(fValue);
pFCell->ResetDirty(); pFCell->ResetDirty();
} }
pFCell->StartListeningTo(rXMLImport.GetDocument());
} }
} }
...@@ -1075,7 +1074,6 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos, ...@@ -1075,7 +1074,6 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
SAL_WARN("sc", "matrix cell without matrix"); SAL_WARN("sc", "matrix cell without matrix");
} }
} }
pFCell->StartListeningTo(rXMLImport.GetDocument());
} }
} }
else //regular text cells else //regular text cells
...@@ -1437,7 +1435,6 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos ) ...@@ -1437,7 +1435,6 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos )
nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue)); nMatrixCols, nMatrixRows, pMat, new formula::FormulaDoubleToken(fValue));
pFCell->ResetDirty(); pFCell->ResetDirty();
} }
pFCell->StartListeningTo(rXMLImport.GetDocument());
} }
} }
else 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