tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sc / source / filter / inc / xepivotxml.hxx
blob5e02ba214b78c73777b8f1be8fa9dc4027dad8b3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #pragma once
12 #include "xerecord.hxx"
13 #include "xeroot.hxx"
15 #include <memory>
16 #include <map>
17 #include <unordered_map>
19 class ScDPCache;
20 class ScDPObject;
22 class XclExpXmlPivotCaches : public XclExpRecordBase, protected XclExpRoot
24 public:
25 struct Entry
27 const ScDPCache* mpCache;
28 ScRange maSrcRange;
31 XclExpXmlPivotCaches(const XclExpRoot& rRoot);
32 virtual void SaveXml(XclExpXmlStream& rStrm) override;
34 void SetCaches(std::vector<Entry>&& rCaches);
35 bool HasCaches() const;
36 const Entry* GetCache(sal_Int32 nCacheId) const;
38 private:
39 void SavePivotCacheXml(XclExpXmlStream& rStrm, const Entry& rEntry, sal_Int32 nCacheId);
41 private:
42 std::vector<Entry> maCaches;
45 class XclExpXmlPivotTables : public XclExpRecordBase, protected XclExpRoot
47 struct Entry
49 const ScDPObject* mpTable;
50 sal_Int32 mnCacheId;
51 sal_Int32 mnPivotId; /// used as [n] in pivotTable[n].xml part name.
53 Entry(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
56 const XclExpXmlPivotCaches& mrCaches;
57 typedef std::vector<Entry> TablesType;
58 TablesType maTables;
60 public:
61 XclExpXmlPivotTables(const XclExpRoot& rRoot, const XclExpXmlPivotCaches& rCaches);
63 virtual void SaveXml(XclExpXmlStream& rStrm) override;
65 void AppendTable(const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId);
67 private:
68 void SavePivotTableXml(XclExpXmlStream& rStrm, const ScDPObject& rObj, sal_Int32 nCacheId);
69 void savePivotTableFormats(XclExpXmlStream& rStrm, ScDPObject const& rDPObject);
72 class XclExpXmlPivotTableManager : protected XclExpRoot
74 typedef std::map<SCTAB, std::unique_ptr<XclExpXmlPivotTables>> TablesType;
75 typedef std::unordered_map<const ScDPObject*, sal_Int32> CacheIdMapType;
77 public:
78 XclExpXmlPivotTableManager(const XclExpRoot& rRoot);
80 void Initialize();
82 XclExpXmlPivotCaches& GetCaches();
83 XclExpXmlPivotTables* GetTablesBySheet(SCTAB nTab);
85 private:
86 XclExpXmlPivotCaches maCaches;
87 TablesType m_Tables;
88 CacheIdMapType maCacheIdMap;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */