1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
12 #include "xerecord.hxx"
17 #include <unordered_map>
22 class XclExpXmlPivotCaches
: public XclExpRecordBase
, protected XclExpRoot
27 const ScDPCache
* mpCache
;
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;
39 void SavePivotCacheXml(XclExpXmlStream
& rStrm
, const Entry
& rEntry
, sal_Int32 nCacheId
);
42 std::vector
<Entry
> maCaches
;
45 class XclExpXmlPivotTables
: public XclExpRecordBase
, protected XclExpRoot
49 const ScDPObject
* mpTable
;
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
;
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
);
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
;
78 XclExpXmlPivotTableManager(const XclExpRoot
& rRoot
);
82 XclExpXmlPivotCaches
& GetCaches();
83 XclExpXmlPivotTables
* GetTablesBySheet(SCTAB nTab
);
86 XclExpXmlPivotCaches maCaches
;
88 CacheIdMapType maCacheIdMap
;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */