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/.
10 #ifndef INCLUDED_SC_FILTER_XEPIVOTXML_HXX
11 #define INCLUDED_SC_FILTER_XEPIVOTXML_HXX
13 #include "xerecord.hxx"
18 #include <unordered_map>
23 class XclExpXmlPivotCaches
: public XclExpRecordBase
, protected XclExpRoot
28 const ScDPCache
* mpCache
;
32 XclExpXmlPivotCaches( const XclExpRoot
& rRoot
);
33 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
35 void SetCaches( const std::vector
<Entry
>& rCaches
);
36 bool HasCaches() const;
37 const Entry
* GetCache( sal_Int32 nCacheId
) const;
40 void SavePivotCacheXml( XclExpXmlStream
& rStrm
, const Entry
& rEntry
, sal_Int32 nCacheId
);
43 std::vector
<Entry
> maCaches
;
46 class XclExpXmlPivotTables
: public XclExpRecordBase
, protected XclExpRoot
50 const ScDPObject
* mpTable
;
51 sal_Int32
const mnCacheId
;
52 sal_Int32
const mnPivotId
; /// used as [n] in pivotTable[n].xml part name.
54 Entry( const ScDPObject
* pTable
, sal_Int32 nCacheId
, sal_Int32 nPivotId
);
57 const XclExpXmlPivotCaches
& mrCaches
;
58 typedef std::vector
<Entry
> TablesType
;
62 XclExpXmlPivotTables( const XclExpRoot
& rRoot
, const XclExpXmlPivotCaches
& rCaches
);
64 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
66 void AppendTable( const ScDPObject
* pTable
, sal_Int32 nCacheId
, sal_Int32 nPivotId
);
69 void SavePivotTableXml( XclExpXmlStream
& rStrm
, const ScDPObject
& rObj
, sal_Int32 nCacheId
);
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 XclExpXmlPivotTableManager( const XclExpRoot
& rRoot
);
81 XclExpXmlPivotCaches
& GetCaches();
82 XclExpXmlPivotTables
* GetTablesBySheet( SCTAB nTab
);
85 XclExpXmlPivotCaches maCaches
;
87 CacheIdMapType maCacheIdMap
;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */