diff options
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/inc/dbdocfun.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/unoobj/dapiuno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc3.cxx | 15 |
4 files changed, 22 insertions, 24 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 3a5e0fdc4386..e560741a8785 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -61,6 +61,8 @@ #include "queryentry.hxx" #include "markdata.hxx" +#include <set> + using namespace ::com::sun::star; // ----------------------------------------------------------------- @@ -1451,14 +1453,25 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb return bDone; } -void ScDBDocFunc::RefreshPivotTables(std::set<ScDPObject*>& rRefs, bool bRecord, bool bApi) +sal_uLong ScDBDocFunc::RefreshPivotTables(ScDPObject* pDPObj, bool bRecord, bool bApi) { - std::set<ScDPObject*>::iterator it = rRefs.begin(), itEnd = rRefs.end(); + ScDPCollection* pDPs = rDocShell.GetDocument()->GetDPCollection(); + if (!pDPs) + return 0; + + std::set<ScDPObject*> aRefs; + sal_uLong nErrId = pDPs->ReloadCache(pDPObj, aRefs); + if (nErrId) + return nErrId; + + std::set<ScDPObject*>::iterator it = aRefs.begin(), itEnd = aRefs.end(); for (; it != itEnd; ++it) { ScDPObject* pObj = *it; DataPilotUpdate(pObj, pObj, bRecord, bApi); } + + return 0; } //================================================================== diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx index 79956e573e4a..b7beda90392c 100644 --- a/sc/source/ui/inc/dbdocfun.hxx +++ b/sc/source/ui/inc/dbdocfun.hxx @@ -33,8 +33,6 @@ #include <tools/solar.h> #include <com/sun/star/uno/Sequence.hxx> -#include <set> - class String; struct ScImportParam; @@ -104,12 +102,10 @@ public: bool bRecord, bool bApi, bool bAllowMove = false ); /** - * Refresh multiple pivot tables that reference the same pivot cache. - * Before calling this method, the caller must take care of reloading the - * cache and providing the correct pivot table objects referencing the - * cache. + * Reload the referenced pivot cache, and refresh all pivot tables that + * reference the cache. */ - void RefreshPivotTables(std::set<ScDPObject*>& rRefs, bool bRecord, bool bApi); + sal_uLong RefreshPivotTables(ScDPObject* pDPObj, bool bRecord, bool bApi); }; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index dbc3f50de01f..85e249534cee 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1276,9 +1276,7 @@ void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException) if (pDPObj) { ScDBDocFunc aFunc(*GetDocShell()); - std::set<ScDPObject*> aRefs; - GetDocShell()->GetDocument()->GetDPCollection()->ReloadCache(pDPObj, aRefs); - aFunc.RefreshPivotTables(aRefs, true, true); + aFunc.RefreshPivotTables(pDPObj, true, true); } } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 08f3f3dac645..7cbd71c8982f 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -699,24 +699,15 @@ void ScDBFunc::RecalcPivotTable() ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocument* pDoc = GetViewData()->GetDocument(); - ScDPCollection* pDPs = pDoc->GetDPCollection(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - if (pDPs && pDPObj) + if (pDPObj) { // Remove existing data cache for the data that this datapilot uses, // to force re-build data cache. - std::set<ScDPObject*> aRefs; - sal_uLong nErrId = pDPs->ReloadCache(pDPObj, aRefs); - if (nErrId) - { - ErrorMessage(nErrId); - return; - } - - ScDBDocFunc aFunc( *pDocSh ); - aFunc.RefreshPivotTables(aRefs, true, false); + ScDBDocFunc aFunc(*pDocSh); + aFunc.RefreshPivotTables(pDPObj, true, false); CursorPosChanged(); // shells may be switched } |