Kaydet (Commit) b4af9a6a authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Let's just do the whole thing in the new method.

üst 9be40516
......@@ -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;
}
//==================================================================
......
......@@ -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);
};
......
......@@ -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);
}
}
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment