[Libreoffice-commits] core.git: sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Oct 3 11:43:57 UTC 2016


 sc/source/core/data/document.cxx |   27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

New commits:
commit e86e96a32dcf551f2f103d149214306d26ea0238
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Sun Oct 2 20:31:48 2016 -0400

    Use closure to simplify use of for_each.
    
    Change-Id: I4bca7bec32e194418b811244cbfb8a3ab4c0cdfa
    Reviewed-on: https://gerrit.libreoffice.org/29465
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
    Tested-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 415c3e6..b5083ab 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3898,25 +3898,6 @@ void ScDocument::CompileAll()
     SetAllFormulasDirty(aFormulaDirtyCxt);
 }
 
-namespace {
-
-class CompileXMLHandler : public 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();
@@ -3933,7 +3914,13 @@ void ScDocument::CompileXML()
     if (pRangeName)
         pRangeName->CompileUnresolvedXML(aCxt);
 
-    std::for_each(maTabs.begin(), maTabs.end(), CompileXMLHandler(aCxt, aProgress));
+    std::for_each(maTabs.begin(), maTabs.end(),
+        [&](ScTable* pTab)
+        {
+            if (pTab)
+                pTab->CompileXML(aCxt, aProgress);
+        }
+    );
     StartAllListeners();
 
     DELETEZ( pAutoNameCache );  // valid only during CompileXML, where cell contents don't change


More information about the Libreoffice-commits mailing list