[Libreoffice-commits] core.git: sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Tue Nov 18 18:04:59 PST 2014
sc/source/core/data/document.cxx | 25 +++++++++++++++++++++----
sc/source/core/data/formulacell.cxx | 2 --
2 files changed, 21 insertions(+), 6 deletions(-)
New commits:
commit 5ef856e975d7c0396984d588a43fd1a7c7085c55
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Nov 18 21:03:05 2014 -0500
Use group area listeners during ODS import.
Change-Id: Id01f9021dda7f33255f8206174cd730507ab55ad
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 204fed3..a8a3707 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 788cb73..9fe02a2 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)
More information about the Libreoffice-commits
mailing list