summaryrefslogtreecommitdiff
path: root/sc/source/core/data/dpobject.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-07-14 18:38:16 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-07-14 18:45:43 -0400
commit4da044d0fbc45ad1de5ee8990bd7a5850d7a2fa2 (patch)
tree5c8e4a1d88767dad5676036ff86ae70ae8a2f002 /sc/source/core/data/dpobject.cxx
parentcdb8cf074c8536aa3ea30102bcb9b34feda21833 (diff)
fdo#37767: Fix broken refresh() from UNO API (and Basic).
We now need to clear the cache before running DataPilotUpdate() in order to re-populate the cache from the source data.
Diffstat (limited to 'sc/source/core/data/dpobject.cxx')
-rw-r--r--sc/source/core/data/dpobject.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index ec8644f07..f0b498c9b 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -2591,6 +2591,41 @@ public:
}
+bool ScDPCollection::ClearCache(ScDPObject* pDPObj)
+{
+ if (pDPObj->IsSheetData())
+ {
+ // data source is internal sheet.
+ const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc();
+ if (!pDesc)
+ return false;
+
+ if (pDesc->HasRangeName())
+ {
+ // cache by named range
+ ScDPCollection::NameCaches& rCaches = GetNameCaches();
+ rCaches.removeCache(pDesc->GetRangeName());
+ }
+ else
+ {
+ // cache by cell range
+ ScDPCollection::SheetCaches& rCaches = GetSheetCaches();
+ rCaches.removeCache(pDesc->GetSourceRange());
+ }
+ }
+ else if (pDPObj->IsImportData())
+ {
+ // data source is external database.
+ const ScImportSourceDesc* pDesc = pDPObj->GetImportSourceDesc();
+ if (!pDesc)
+ return false;
+
+ ScDPCollection::DBCaches& rCaches = GetDBCaches();
+ rCaches.removeCache(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject);
+ }
+ return true;
+}
+
void ScDPCollection::DeleteOnTab( SCTAB nTab )
{
maTables.erase(