LCOV - code coverage report
Current view: top level - sc/source/filter/inc - xepivotxml.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_SC_FILTER_XEPIVOTXML_HXX
      11             : #define INCLUDED_SC_FILTER_XEPIVOTXML_HXX
      12             : 
      13             : #include <xerecord.hxx>
      14             : #include <xeroot.hxx>
      15             : 
      16             : #include <boost/ptr_container/ptr_map.hpp>
      17             : #include <unordered_map>
      18             : 
      19             : class ScDPCache;
      20             : class ScDPCollection;
      21             : class ScDPObject;
      22             : 
      23          55 : class XclExpXmlPivotCaches : public XclExpRecordBase, protected XclExpRoot
      24             : {
      25             : public:
      26             :     enum EntryType { Worksheet, Name, Database };
      27             : 
      28           6 :     struct Entry
      29             :     {
      30             :         const ScDPCache* mpCache;
      31             :         EntryType meType;
      32             :         ScRange maSrcRange;
      33             :     };
      34             : 
      35             :     XclExpXmlPivotCaches( const XclExpRoot& rRoot );
      36             :     virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
      37             : 
      38             :     void SetCaches( const std::vector<Entry>& rCaches );
      39             :     bool HasCaches() const;
      40             :     const Entry* GetCache( sal_Int32 nCacheId ) const;
      41             : 
      42             : private:
      43             :     void SavePivotCacheXml( XclExpXmlStream& rStrm, const Entry& rEntry, sal_Int32 nCacheId );
      44             : 
      45             : private:
      46             :     std::vector<Entry> maCaches;
      47             : };
      48             : 
      49           4 : class XclExpXmlPivotTables : public XclExpRecordBase, protected XclExpRoot
      50             : {
      51             :     struct Entry
      52             :     {
      53             :         const ScDPObject* mpTable;
      54             :         sal_Int32 mnCacheId;
      55             :         sal_Int32 mnPivotId; /// used as [n] in pivotTable[n].xml part name.
      56             : 
      57             :         Entry( const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId );
      58             :     };
      59             : 
      60             :     const XclExpXmlPivotCaches& mrCaches;
      61             :     typedef std::vector<Entry> TablesType;
      62             :     TablesType maTables;
      63             : 
      64             : public:
      65             :     XclExpXmlPivotTables( const XclExpRoot& rRoot, const XclExpXmlPivotCaches& rCaches );
      66             : 
      67             :     virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
      68             : 
      69             :     void AppendTable( const ScDPObject* pTable, sal_Int32 nCacheId, sal_Int32 nPivotId );
      70             : 
      71             : private:
      72             :     void SavePivotTableXml( XclExpXmlStream& rStrm, const ScDPObject& rObj, sal_Int32 nCacheId );
      73             : };
      74             : 
      75         110 : class XclExpXmlPivotTableManager : protected XclExpRoot
      76             : {
      77             :     typedef boost::ptr_map<SCTAB, XclExpXmlPivotTables> TablesType;
      78             :     typedef std::unordered_map<const ScDPObject*, sal_Int32> CacheIdMapType;
      79             : public:
      80             :     XclExpXmlPivotTableManager( const XclExpRoot& rRoot );
      81             : 
      82             :     void Initialize();
      83             : 
      84             :     XclExpXmlPivotCaches& GetCaches();
      85             :     XclExpXmlPivotTables* GetTablesBySheet( SCTAB nTab );
      86             : 
      87             : private:
      88             :     XclExpXmlPivotCaches maCaches;
      89             :     TablesType maTables;
      90             :     CacheIdMapType maCacheIdMap;
      91             : };
      92             : 
      93             : #endif
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11