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

Dedicated method for refreshing multiple linked pivot tables.

üst c18dc2e2
......@@ -1451,6 +1451,16 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
return bDone;
}
void ScDBDocFunc::RefreshPivotTables(std::set<ScDPObject*>& rRefs, bool bRecord, bool bApi)
{
std::set<ScDPObject*>::iterator it = rRefs.begin(), itEnd = rRefs.end();
for (; it != itEnd; ++it)
{
ScDPObject* pObj = *it;
DataPilotUpdate(pObj, pObj, bRecord, bApi);
}
}
//==================================================================
//
// database import
......
......@@ -33,6 +33,8 @@
#include <tools/solar.h>
#include <com/sun/star/uno/Sequence.hxx>
#include <set>
class String;
struct ScImportParam;
......@@ -100,6 +102,14 @@ public:
bool DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewObj,
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.
*/
void RefreshPivotTables(std::set<ScDPObject*>& rRefs, bool bRecord, bool bApi);
};
......
......@@ -1278,12 +1278,7 @@ void SAL_CALL ScDataPilotTableObj::refresh() throw(RuntimeException)
ScDBDocFunc aFunc(*GetDocShell());
std::set<ScDPObject*> aRefs;
GetDocShell()->GetDocument()->GetDPCollection()->ReloadCache(pDPObj, aRefs);
std::set<ScDPObject*>::iterator it = aRefs.begin(), itEnd = aRefs.end();
for (; it != itEnd; ++it)
{
ScDPObject* pObj = *it;
aFunc.DataPilotUpdate(pObj, pObj, true, true);
}
aFunc.RefreshPivotTables(aRefs, true, true);
}
}
......
......@@ -716,12 +716,7 @@ void ScDBFunc::RecalcPivotTable()
}
ScDBDocFunc aFunc( *pDocSh );
std::set<ScDPObject*>::iterator it = aRefs.begin(), itEnd = aRefs.end();
for (; it != itEnd; ++it)
{
ScDPObject* pObj = *it;
aFunc.DataPilotUpdate(pObj, pObj, true, false);
}
aFunc.RefreshPivotTables(aRefs, 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