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

Kohei Yoshida kohei.yoshida at gmail.com
Tue Sep 27 02:21:16 UTC 2016


 sc/source/ui/docshell/dbdocfun.cxx |   47 ++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

New commits:
commit dc99aa32becdd63c62db2cdb564b38a020fb6afa
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Sep 26 22:15:55 2016 -0400

    Move up the less common case and reduce indentation for the main case.
    
    Change-Id: Id30a849af718629515251cac39eead39a2d9e5e6

diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 3b7cdbf..73d5840 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1580,34 +1580,33 @@ void ScDBDocFunc::RefreshPivotTableGroups(ScDPObject* pDPObj)
     if (!pSaveData)
         return;
 
+    if (!pDPs->HasTable(pDPObj))
+    {
+        // This table is under construction so no need for a whole update (UpdatePivotTable()).
+        pDPObj->ReloadGroupTableData();
+        return;
+    }
+
     // Update all linked tables, if this table is part of the cache (ScDPCollection)
-    if (pDPs->HasTable(pDPObj))
+    std::set<ScDPObject*> aRefs;
+    if (!pDPs->ReloadGroupsInCache(pDPObj, aRefs))
+        return;
+
+    // We allow pDimData being NULL.
+    const ScDPDimensionSaveData* pDimData = pSaveData->GetExistingDimensionData();
+    std::set<ScDPObject*>::iterator it = aRefs.begin(), itEnd = aRefs.end();
+    for (; it != itEnd; ++it)
     {
-        std::set<ScDPObject*> aRefs;
-        if (!pDPs->ReloadGroupsInCache(pDPObj, aRefs))
-            return;
-
-        // We allow pDimData being NULL.
-        const ScDPDimensionSaveData* pDimData = pSaveData->GetExistingDimensionData();
-        std::set<ScDPObject*>::iterator it = aRefs.begin(), itEnd = aRefs.end();
-        for (; it != itEnd; ++it)
+        ScDPObject* pObj = *it;
+        if (pObj != pDPObj)
         {
-            ScDPObject* pObj = *it;
-            if (pObj != pDPObj)
-            {
-                pSaveData = pObj->GetSaveData();
-                if (pSaveData)
-                    pSaveData->SetDimensionData(pDimData);
-            }
-
-            // This action is intentionally not undoable since it modifies cache.
-            UpdatePivotTable(*pObj, false, false);
+            pSaveData = pObj->GetSaveData();
+            if (pSaveData)
+                pSaveData->SetDimensionData(pDimData);
         }
-    }
-    else // Otherwise update only this single table
-    {
-        // This table is under construction so no need for a whole update (UpdatePivotTable()).
-        pDPObj->ReloadGroupTableData();
+
+        // This action is intentionally not undoable since it modifies cache.
+        UpdatePivotTable(*pObj, false, false);
     }
 }
 


More information about the Libreoffice-commits mailing list