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 #pragma once
11 
12 #include "xerecord.hxx"
13 #include "xeroot.hxx"
14 
15 #include <memory>
16 #include <map>
17 #include <unordered_map>
18 
19 class ScDPCache;
20 class ScDPObject;
21 
23 {
24 public:
25  struct Entry
26  {
29  };
30 
31  XclExpXmlPivotCaches(const XclExpRoot& rRoot);
32  virtual void SaveXml(XclExpXmlStream& rStrm) override;
33 
34  void SetCaches(const std::vector<Entry>& rCaches);
35  bool HasCaches() const;
36  const Entry* GetCache(sal_Int32 nCacheId) const;
37 
38 private:
39  void SavePivotCacheXml(XclExpXmlStream& rStrm, const Entry& rEntry, sal_Int32 nCacheId);
40 
41 private:
42  std::vector<Entry> maCaches;
43 };
44 
46 {
47  struct Entry
48  {
50  sal_Int32 mnCacheId;
51  sal_Int32 mnPivotId;
52 
53  Entry(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
54  };
55 
57  typedef std::vector<Entry> TablesType;
58  TablesType maTables;
59 
60 public:
61  XclExpXmlPivotTables(const XclExpRoot& rRoot, const XclExpXmlPivotCaches& rCaches);
62 
63  virtual void SaveXml(XclExpXmlStream& rStrm) override;
64 
65  void AppendTable(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
66 
67 private:
68  void SavePivotTableXml(XclExpXmlStream& rStrm, const ScDPObject& rObj, sal_Int32 nCacheId);
69 };
70 
72 {
73  typedef std::map<SCTAB, std::unique_ptr<XclExpXmlPivotTables>> TablesType;
74  typedef std::unordered_map<const ScDPObject*, sal_Int32> CacheIdMapType;
75 
76 public:
78 
79  void Initialize();
80 
83 
84 private:
86  TablesType m_Tables;
87  CacheIdMapType maCacheIdMap;
88 };
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool HasCaches() const
Definition: xepivotxml.cxx:168
CacheIdMapType maCacheIdMap
Definition: xepivotxml.hxx:87
XclExpXmlPivotTableManager(const XclExpRoot &rRoot)
Definition: xepivotxml.cxx:544
void SetCaches(const std::vector< Entry > &rCaches)
Definition: xepivotxml.cxx:163
This class represents the cached data part of the datapilot cache table implementation.
Definition: dpcache.hxx:47
std::map< SCTAB, std::unique_ptr< XclExpXmlPivotTables > > TablesType
Definition: xepivotxml.hxx:73
Access to global data from other classes.
Definition: xeroot.hxx:112
const XclExpXmlPivotCaches & mrCaches
Definition: xepivotxml.hxx:56
void AppendTable(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
std::vector< Entry > maCaches
Definition: xepivotxml.hxx:42
Base class for all Excel records.
Definition: xerecord.hxx:37
void SavePivotCacheXml(XclExpXmlStream &rStrm, const Entry &rEntry, sal_Int32 nCacheId)
Definition: xepivotxml.cxx:244
const Entry * GetCache(sal_Int32 nCacheId) const
Definition: xepivotxml.cxx:173
Entry(const ScDPObject *pTable, sal_Int32 nCacheId, sal_Int32 nPivotId)
used as [n] in pivotTable[n].xml part name.
Definition: xepivotxml.cxx:631
const ScDPCache * mpCache
Definition: xepivotxml.hxx:27
XclExpXmlPivotCaches(const XclExpRoot &rRoot)
Definition: xepivotxml.cxx:129
XclExpXmlPivotCaches & GetCaches()
Definition: xepivotxml.cxx:620
std::unordered_map< const ScDPObject *, sal_Int32 > CacheIdMapType
Definition: xepivotxml.hxx:74
XclExpXmlPivotTables(const XclExpRoot &rRoot, const XclExpXmlPivotCaches &rCaches)
Definition: xepivotxml.cxx:634
XclExpXmlPivotCaches maCaches
Definition: xepivotxml.hxx:85
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepivotxml.cxx:637
void SavePivotTableXml(XclExpXmlStream &rStrm, const ScDPObject &rObj, sal_Int32 nCacheId)
Definition: xepivotxml.cxx:745
std::vector< Entry > TablesType
Definition: xepivotxml.hxx:57
const ScDPObject * mpTable
Definition: xepivotxml.hxx:49
XclExpXmlPivotTables * GetTablesBySheet(SCTAB nTab)
Definition: xepivotxml.cxx:625
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepivotxml.cxx:132
sal_Int16 SCTAB
Definition: types.hxx:22