diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2016-09-26 22:15:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2016-09-26 22:18:15 -0400 |
commit | dc99aa32becdd63c62db2cdb564b38a020fb6afa (patch) | |
tree | b0ed3a3a1fb1012bcbd3cdf08a79033a46131d35 /sc/source/ui/docshell | |
parent | a4c974293e84685aa055922b70b2470fcff2d844 (diff) |
Move up the less common case and reduce indentation for the main case.
Change-Id: Id30a849af718629515251cac39eead39a2d9e5e6
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 3b7cdbfeb74c..73d5840842b7 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); } } |