diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-18 21:03:05 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-18 21:03:50 -0500 |
commit | 5ef856e975d7c0396984d588a43fd1a7c7085c55 (patch) | |
tree | 912d2dbd8ad1b34185ffb82a77627730a05816fd | |
parent | b2efe90c07baa45d2ee7e13138dd306a29738473 (diff) |
Use group area listeners during ODS import.
Change-Id: Id01f9021dda7f33255f8206174cd730507ab55ad
-rw-r--r-- | sc/source/core/data/document.cxx | 25 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 204fed38d500..a8a370786c66 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3676,6 +3676,25 @@ void ScDocument::CompileAll() SetAllFormulasDirty(aFormulaDirtyCxt); } +namespace { + +class CompileXMLHandler : std::unary_function<ScTable*, void> +{ + sc::CompileFormulaContext* mpCxt; + ScProgress* mpProgress; +public: + CompileXMLHandler( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ) : + mpCxt(&rCxt), mpProgress(&rProgress) {} // Take pointers to make it copyable. + + void operator() ( ScTable* pTab ) + { + if (pTab) + pTab->CompileXML(*mpCxt, *mpProgress); + } +}; + +} + void ScDocument::CompileXML() { bool bOldAutoCalc = GetAutoCalc(); @@ -3692,10 +3711,8 @@ void ScDocument::CompileXML() if (pRangeName) pRangeName->CompileUnresolvedXML(aCxt); - TableContainer::iterator it = maTabs.begin(); - for (; it != maTabs.end(); ++it) - if (*it) - (*it)->CompileXML(aCxt, aProgress); + std::for_each(maTabs.begin(), maTabs.end(), CompileXMLHandler(aCxt, aProgress)); + StartAllListeners(); DELETEZ( pAutoNameCache ); // valid only during CompileXML, where cell contents don't change diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 788cb73cf96d..9fe02a20b8e5 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1222,7 +1222,6 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr bSubTotal = pPreviousCell->bSubTotal; bChanged = true; bCompile = false; - StartListeningTo( pDocument ); if (bSubTotal) pDocument->AddSubTotalCell(this); @@ -1257,7 +1256,6 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr nFormatType = aComp.GetNumFormatType(); bChanged = true; bCompile = false; - StartListeningTo( pDocument ); } if (bSubTotal) |