LibreOffice Module sc (master)  1
xepivotxml.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_SC_FILTER_XEPIVOTXML_HXX
11 #define INCLUDED_SC_FILTER_XEPIVOTXML_HXX
12 
13 #include "xerecord.hxx"
14 #include "xeroot.hxx"
15 
16 #include <memory>
17 #include <map>
18 #include <unordered_map>
19 
20 class ScDPCache;
21 class ScDPObject;
22 
24 {
25 public:
26  struct Entry
27  {
30  };
31 
32  XclExpXmlPivotCaches(const XclExpRoot& rRoot);
33  virtual void SaveXml(XclExpXmlStream& rStrm) override;
34 
35  void SetCaches(const std::vector<Entry>& rCaches);
36  bool HasCaches() const;
37  const Entry* GetCache(sal_Int32 nCacheId) const;
38 
39 private:
40  void SavePivotCacheXml(XclExpXmlStream& rStrm, const Entry& rEntry, sal_Int32 nCacheId);
41 
42 private:
43  std::vector<Entry> maCaches;
44 };
45 
47 {
48  struct Entry
49  {
51  sal_Int32 mnCacheId;
52  sal_Int32 mnPivotId;
53 
54  Entry(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
55  };
56 
58  typedef std::vector<Entry> TablesType;
59  TablesType maTables;
60 
61 public:
62  XclExpXmlPivotTables(const XclExpRoot& rRoot, const XclExpXmlPivotCaches& rCaches);
63 
64  virtual void SaveXml(XclExpXmlStream& rStrm) override;
65 
66  void AppendTable(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
67 
68 private:
69  void SavePivotTableXml(XclExpXmlStream& rStrm, const ScDPObject& rObj, sal_Int32 nCacheId);
70 };
71 
73 {
74  typedef std::map<SCTAB, std::unique_ptr<XclExpXmlPivotTables>> TablesType;
75  typedef std::unordered_map<const ScDPObject*, sal_Int32> CacheIdMapType;
76 
77 public:
79 
80  void Initialize();
81 
84 
85 private:
87  TablesType m_Tables;
88  CacheIdMapType maCacheIdMap;
89 };
90 
91 #endif
92 
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool HasCaches() const
Definition: xepivotxml.cxx:167
CacheIdMapType maCacheIdMap
Definition: xepivotxml.hxx:88
XclExpXmlPivotTableManager(const XclExpRoot &rRoot)
Definition: xepivotxml.cxx:545
void SetCaches(const std::vector< Entry > &rCaches)
Definition: xepivotxml.cxx:162
This class represents the cached data part of the datapilot cache table implementation.
Definition: dpcache.hxx:48
std::map< SCTAB, std::unique_ptr< XclExpXmlPivotTables > > TablesType
Definition: xepivotxml.hxx:74
Access to global data from other classes.
Definition: xeroot.hxx:113
const XclExpXmlPivotCaches & mrCaches
Definition: xepivotxml.hxx:57
void AppendTable(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
std::vector< Entry > maCaches
Definition: xepivotxml.hxx:43
Base class for all Excel records.
Definition: xerecord.hxx:38
void SavePivotCacheXml(XclExpXmlStream &rStrm, const Entry &rEntry, sal_Int32 nCacheId)
Definition: xepivotxml.cxx:243
const Entry * GetCache(sal_Int32 nCacheId) const
Definition: xepivotxml.cxx:172
Entry(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
used as [n] in pivotTable[n].xml part name.
Definition: xepivotxml.cxx:632
const ScDPCache * mpCache
Definition: xepivotxml.hxx:28
XclExpXmlPivotCaches(const XclExpRoot &rRoot)
Definition: xepivotxml.cxx:128
XclExpXmlPivotCaches & GetCaches()
Definition: xepivotxml.cxx:621
std::unordered_map< const ScDPObject *, sal_Int32 > CacheIdMapType
Definition: xepivotxml.hxx:75
XclExpXmlPivotTables(const XclExpRoot &rRoot, const XclExpXmlPivotCaches &rCaches)
Definition: xepivotxml.cxx:635
XclExpXmlPivotCaches maCaches
Definition: xepivotxml.hxx:86
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepivotxml.cxx:638
void SavePivotTableXml(XclExpXmlStream &rStrm, const ScDPObject &rObj, sal_Int32 nCacheId)
Definition: xepivotxml.cxx:746
std::vector< Entry > TablesType
Definition: xepivotxml.hxx:58
const ScDPObject * mpTable
Definition: xepivotxml.hxx:50
XclExpXmlPivotTables * GetTablesBySheet(SCTAB nTab)
Definition: xepivotxml.cxx:626
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepivotxml.cxx:131
sal_Int16 SCTAB
Definition: types.hxx:23