diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-01 20:09:57 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-04 13:59:18 -0500 |
commit | 20a359ea3669b0f33edf7b9d66e56343e0624a0d (patch) | |
tree | f5e8ffdcfafb44f36e4e0b0d4aebca99fbb4078d | |
parent | 488b1ea1b9e780930802f5e4eead37552d1c3f6c (diff) |
Have all formula cells start listening at once after the file load.
Rather than doing it individually.
Change-Id: I5ed55947b715bf6d7d61a1f8b751be7fdcf425fb
-rw-r--r-- | sc/source/core/data/documentimport.cxx | 20 | ||||
-rw-r--r-- | sc/source/filter/orcus/interface.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 3 |
3 files changed, 17 insertions, 8 deletions
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx index 323ccfb1d028..c2b951ab16ad 100644 --- a/sc/source/core/data/documentimport.cxx +++ b/sc/source/core/data/documentimport.cxx @@ -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(); diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index df2da17ce4b7..1372d7753b43 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -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( diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 31e5bea9521d..a3f3a0f058a5 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -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 |