summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-03-13 11:57:08 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-03-14 00:35:28 -0400
commit9be40516455eef80d7c121455c08da41b27373bf (patch)
treefd3ec920a8bb3788d117f9ad29f0902d63d33a54
parentc18dc2e2047f07fb13ec5890db4dbd4357cfa7ce (diff)
Dedicated method for refreshing multiple linked pivot tables.
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx10
-rw-r--r--sc/source/ui/inc/dbdocfun.hxx10
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx7
-rw-r--r--sc/source/ui/view/dbfunc3.cxx7
4 files changed, 22 insertions, 12 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 145f457691ba..3a5e0fdc4386 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -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
diff --git a/sc/source/ui/inc/dbdocfun.hxx b/sc/source/ui/inc/dbdocfun.hxx
index 35ad8489c6e1..79956e573e4a 100644
--- a/sc/source/ui/inc/dbdocfun.hxx
+++ b/sc/source/ui/inc/dbdocfun.hxx
@@ -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);
};
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 9ff4cb9d03df..dbc3f50de01f 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -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);
}
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 41cebf1fbc14..08f3f3dac645 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -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
}