[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Mar 14 08:28:49 PDT 2012


 sc/source/ui/docshell/dbdocfun.cxx |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit f6cba0dbb3819cf2e11f72bc0cdb10d5d90721de
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Mar 14 11:27:17 2012 -0400

    We need to manually clear the table data in presence of group fields.
    
    There was a hack that did this in ScDPObject, which I removed.  But we
    still need to do the same except this time it's outside of ScDPObject.

diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 2881e1d..c1464b1 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1460,6 +1460,11 @@ sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bApi)
     if (!pDPs)
         return 0;
 
+    bool bHasGroups = false;
+    ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+    if (pSaveData && pSaveData->GetExistingDimensionData())
+        bHasGroups = true;
+
     std::set<ScDPObject*> aRefs;
     sal_uLong nErrId = pDPs->ReloadCache(pDPObj, aRefs);
     if (nErrId)
@@ -1469,6 +1474,10 @@ sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bApi)
     for (; it != itEnd; ++it)
     {
         ScDPObject* pObj = *it;
+        if (bHasGroups)
+            // Re-build table data for each pivot table when the original contains group fields.
+            pObj->ClearTableData();
+
         // This action is intentionally not undoable since it modifies cache.
         DataPilotUpdate(pObj, pObj, false, bApi);
     }


More information about the Libreoffice-commits mailing list