diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-04-27 17:21:25 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-04-28 15:35:54 -0400 |
commit | 60f355127fb93d574e30e590158fe867148762ea (patch) | |
tree | 16ab3e42b9789d8fd118458071fca42771c16372 /sc/source/ui | |
parent | ca844d3bfc4fc379608a4856a9750af84e620953 (diff) |
Centrally manage cached grid data for data pilot tables.
This prevents cached data from getting re-generated everytime ScDPObject
gets copied, which happens quite often. Without this, the performance
of datapilot would really really suffer.
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/cctrl/dpcontrol.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/dbgui/dapidata.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/dbfunc3.cxx | 24 |
3 files changed, 23 insertions, 4 deletions
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 2a5d415410dc..380cdf9cfeef 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -1032,6 +1032,7 @@ ScDPFieldPopupWindow::ScDPFieldPopupWindow(Window* pParent, ScDocument* pDoc) : maChkToggleAll.SetPosSizePixel(aPos, aSize); maChkToggleAll.SetFont(getLabelFont()); maChkToggleAll.SetText(ScRscStrLoader(RID_POPUP_FILTER, STR_BTN_TOGGLE_ALL).GetString()); + maChkToggleAll.SetTextColor(rStyle.GetMenuTextColor()); maChkToggleAll.SetControlBackground(rStyle.GetMenuColor()); maChkToggleAll.SetClickHdl( LINK(this, ScDPFieldPopupWindow, TriStateHdl) ); maChkToggleAll.Show(); diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 63d11e1141ae..c73d701a6eb9 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -130,7 +130,7 @@ void ScDataPilotDatabaseDlg::GetValues( ScImportSourceDesc& rDesc ) rDesc.aDBName = aLbDatabase.GetSelectEntry(); rDesc.aObject = aCbObject.GetText(); - if ( !rDesc.aDBName.Len() || !rDesc.aObject.Len() ) + if (rDesc.aDBName.isEmpty() || rDesc.aObject.isEmpty()) rDesc.nType = sheet::DataImportMode_NONE; else if ( nSelect == DP_TYPELIST_TABLE ) rDesc.nType = sheet::DataImportMode_TABLE; diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index d2e185d05b47..3ce6b978f1be 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -72,6 +72,8 @@ #include "dbdocfun.hxx" #include "dpoutput.hxx" #include "dptabsrc.hxx" +#include "dpshttab.hxx" +#include "dpsdbtab.hxx" #include "editable.hxx" #include "docpool.hxx" #include "patattr.hxx" @@ -697,13 +699,29 @@ void ScDBFunc::RecalcPivotTable() ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocument* pDoc = GetViewData()->GetDocument(); - // old pivot not used any more - + ScDPCollection* pDPs = pDoc->GetDPCollection(); ScDPObject* pDPObj = pDoc->GetDPAtCursor( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - if ( pDPObj ) + if (pDPs && pDPObj) { + // Remove existing data cache for the data that this datapilot uses, + // to force re-build data cache. + if (pDPObj->IsSheetData()) + { + // data source is internal sheet. + ScDPCollection::SheetCaches& rCaches = pDPs->GetSheetCaches(); + const ScSheetSourceDesc* pDesc = pDPObj->GetSheetDesc(); + rCaches.removeCache(pDesc->GetSourceRange()); + } + else if (pDPObj->IsImportData()) + { + // data source is external database. + ScDPCollection::DBCaches& rCaches = pDPs->GetDBCaches(); + const ScImportSourceDesc* pDesc = pDPObj->GetImportSourceDesc(); + rCaches.removeCache(pDesc->GetCommandType(), pDesc->aDBName, pDesc->aObject); + } + ScDBDocFunc aFunc( *pDocSh ); aFunc.DataPilotUpdate( pDPObj, pDPObj, true, false ); CursorPosChanged(); // shells may be switched |