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>
16 #include <boost/ptr_container/ptr_map.hpp>
17 #include <unordered_map>
23 class XclExpXmlPivotCaches
: public XclExpRecordBase
, protected XclExpRoot
26 enum EntryType
{ Worksheet
, Name
, Database
};
30 const ScDPCache
* mpCache
;
35 XclExpXmlPivotCaches( const XclExpRoot
& rRoot
);
36 virtual void SaveXml( XclExpXmlStream
& rStrm
) SAL_OVERRIDE
;
38 void SetCaches( const std::vector
<Entry
>& rCaches
);
39 bool HasCaches() const;
40 const Entry
* GetCache( sal_Int32 nCacheId
) const;
43 void SavePivotCacheXml( XclExpXmlStream
& rStrm
, const Entry
& rEntry
, sal_Int32 nCacheId
);
46 std::vector
<Entry
> maCaches
;
49 class XclExpXmlPivotTables
: public XclExpRecordBase
, protected XclExpRoot
53 const ScDPObject
* mpTable
;
55 sal_Int32 mnPivotId
; /// used as [n] in pivotTable[n].xml part name.
57 Entry( const ScDPObject
* pTable
, sal_Int32 nCacheId
, sal_Int32 nPivotId
);
60 const XclExpXmlPivotCaches
& mrCaches
;
61 typedef std::vector
<Entry
> TablesType
;
65 XclExpXmlPivotTables( const XclExpRoot
& rRoot
, const XclExpXmlPivotCaches
& rCaches
);
67 virtual void SaveXml( XclExpXmlStream
& rStrm
) SAL_OVERRIDE
;
69 void AppendTable( const ScDPObject
* pTable
, sal_Int32 nCacheId
, sal_Int32 nPivotId
);
72 void SavePivotTableXml( XclExpXmlStream
& rStrm
, const ScDPObject
& rObj
, sal_Int32 nCacheId
);
75 class XclExpXmlPivotTableManager
: protected XclExpRoot
77 typedef boost::ptr_map
<SCTAB
, XclExpXmlPivotTables
> TablesType
;
78 typedef std::unordered_map
<const ScDPObject
*, sal_Int32
> CacheIdMapType
;
80 XclExpXmlPivotTableManager( const XclExpRoot
& rRoot
);
84 XclExpXmlPivotCaches
& GetCaches();
85 XclExpXmlPivotTables
* GetTablesBySheet( SCTAB nTab
);
88 XclExpXmlPivotCaches maCaches
;
90 CacheIdMapType maCacheIdMap
;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */