diff options
Diffstat (limited to 'sc/inc/dpobject.hxx')
-rw-r--r-- | sc/inc/dpobject.hxx | 80 |
1 files changed, 74 insertions, 6 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx index 59230d833491..d71040906443 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,67 @@ 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); + }; + + /** + * Data caches for range name based source data. + */ + class NameCaches + { + typedef ::boost::ptr_map<rtl::OUString, ScDPCache> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + NameCaches(ScDocument* pDoc); + const ScDPCache* getCache(const ::rtl::OUString& rName, const ScRange& rRange); + void removeCache(const ::rtl::OUString& rName); + }; + + /** + * 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); + + struct less : public ::std::binary_function<DBType, DBType, bool> + { + bool operator() (const DBType& left, const DBType& right) const; + }; + }; + + /** + * Data caches for external database sources. + */ + class DBCaches + { + typedef ::boost::ptr_map<DBType, ScDPCache, DBType::less> 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 +350,22 @@ public: SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj); bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const; + + SheetCaches& GetSheetCaches(); + NameCaches& GetNameCaches(); + DBCaches& GetDBCaches(); + +private: + typedef ::boost::ptr_vector<ScDPObject> TablesType; + + ScDocument* pDoc; + TablesType maTables; + SheetCaches maSheetCaches; + NameCaches maNameCaches; + DBCaches maDBCaches; }; +bool operator<(const ScDPCollection::DBType& left, const ScDPCollection::DBType& right); #endif |