diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-09-14 15:19:12 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-09-14 16:05:57 -0400 |
commit | 2f654141fbb81f4dce7953bb1721bf94a5bc67bd (patch) | |
tree | d94de26da2da4265399decb24ae1985a6f79244f /sc | |
parent | Introduced CHECK_PARALLELISM (and poshed the code up). (diff) | |
download | core-2f654141fbb81f4dce7953bb1721bf94a5bc67bd.tar.gz core-2f654141fbb81f4dce7953bb1721bf94a5bc67bd.zip |
Check the source range when refreshing, and abort refresh if invalid.
This avoids refreshing on an invalid source range which causes an
empty pivot table output.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/dpobject.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dpobject.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc3.cxx | 5 |
3 files changed, 12 insertions, 7 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index dc0831eb95a4..f34b0426f641 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -313,7 +313,7 @@ public: ScDPCollection(const ScDPCollection& r); ~ScDPCollection(); - bool ClearCache(ScDPObject* pDPObj); + sal_uLong ClearCache(ScDPObject* pDPObj); SC_DLLPUBLIC size_t GetCount() const; SC_DLLPUBLIC ScDPObject* operator[](size_t nIndex); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 500c5ac039c4..126e220c0303 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2590,14 +2590,18 @@ public: } -bool ScDPCollection::ClearCache(ScDPObject* pDPObj) +sal_uLong ScDPCollection::ClearCache(ScDPObject* pDPObj) { if (pDPObj->IsSheetData()) { // data source is internal sheet. const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc(); if (!pDesc) - return false; + return STR_ERR_DATAPILOTSOURCE; + + sal_uLong nErrId = pDesc->CheckSourceRange(); + if (nErrId) + return nErrId; if (pDesc->HasRangeName()) { @@ -2617,12 +2621,12 @@ bool ScDPCollection::ClearCache(ScDPObject* pDPObj) // data source is external database. const ScImportSourceDesc* pDesc = pDPObj->GetImportSourceDesc(); if (!pDesc) - return false; + return STR_ERR_DATAPILOTSOURCE; ScDPCollection::DBCaches& rCaches = GetDBCaches(); rCaches.removeCache(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject); } - return true; + return 0; } void ScDPCollection::DeleteOnTab( SCTAB nTab ) diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index 9bacc3960866..1d26fd070167 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -707,9 +707,10 @@ void ScDBFunc::RecalcPivotTable() { // Remove existing data cache for the data that this datapilot uses, // to force re-build data cache. - if (!pDPs->ClearCache(pDPObj)) + sal_uLong nErrId = pDPs->ClearCache(pDPObj); + if (nErrId) { - ErrorMessage(STR_PIVOT_NOTFOUND); + ErrorMessage(nErrId); return; } |