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/inc/dpobject.hxx | |
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/inc/dpobject.hxx')
-rw-r--r-- | sc/inc/dpobject.hxx | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 59230d833491..9972e0c1198f 100644 --- a/sc/inc/dpobject.hxx +++ b/sc/inc/dpobject.hxx @@ -39,6 +39,7 @@ #include <boost/ptr_container/ptr_list.hpp> #include <boost/ptr_container/ptr_vector.hpp> +#include <boost/ptr_container/ptr_map.hpp> #include <boost/shared_ptr.hpp> namespace com { namespace sun { namespace star { namespace sheet { @@ -117,7 +118,6 @@ private: SC_DLLPRIVATE void CreateObjects(); SC_DLLPRIVATE void CreateOutput(); sal_Bool bRefresh; - long mnCacheId; public: ScDPObject(ScDocument* pD); @@ -257,13 +257,48 @@ public: class ScDPCollection { -private: - typedef ::boost::ptr_vector<ScDPObject> TablesType; +public: - ScDocument* pDoc; - TablesType maTables; + /** + * Stores and manages all caches from internal sheets. + */ + class SheetCaches + { + typedef ::boost::ptr_map<ScRange, ScDPCache> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + SheetCaches(ScDocument* pDoc); + const ScDPCache* getCache(const ScRange& rRange); + void removeCache(const ScRange& rRange); + }; + + /** + * Defines connection type to external data source. Used as a key to look + * up database cache. + */ + struct DBType + { + sal_Int32 mnSdbType; + ::rtl::OUString maDBName; + ::rtl::OUString maCommand; + DBType(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + }; + + /** + * Data caches for external database sources. + */ + class DBCaches + { + typedef ::boost::ptr_map<DBType, ScDPCache> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + DBCaches(ScDocument* pDoc); + const ScDPCache* getCache(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + void removeCache(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + }; -public: ScDPCollection(ScDocument* pDocument); ScDPCollection(const ScDPCollection& r); ~ScDPCollection(); @@ -296,8 +331,20 @@ public: SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj); bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const; + + SheetCaches& GetSheetCaches(); + DBCaches& GetDBCaches(); + +private: + typedef ::boost::ptr_vector<ScDPObject> TablesType; + + ScDocument* pDoc; + TablesType maTables; + SheetCaches maSheetCaches; + DBCaches maDBCaches; }; +bool operator<(const ScDPCollection::DBType& left, const ScDPCollection::DBType& right); #endif |