LCOV - code coverage report
Current view: top level - sc/inc - dptabdat.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 0.0 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef SC_DPTABDAT_HXX
      21             : #define SC_DPTABDAT_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include "dpoutput.hxx"
      25             : #include "dpfilteredcache.hxx"
      26             : #include "dpcache.hxx"
      27             : #include "calcmacros.hxx"
      28             : 
      29             : #include "svl/zforlist.hxx"
      30             : 
      31             : #include <vector>
      32             : #include <set>
      33             : #include <boost/unordered_set.hpp>
      34             : #include <boost/unordered_map.hpp>
      35             : #include <boost/noncopyable.hpp>
      36             : 
      37             : namespace com { namespace sun { namespace star { namespace sheet {
      38             :     struct DataPilotFieldFilter;
      39             : }}}}
      40             : 
      41             : 
      42             : #define SC_DAPI_HIERARCHY_FLAT      0
      43             : #define SC_DAPI_HIERARCHY_QUARTER   1
      44             : #define SC_DAPI_HIERARCHY_WEEK      2
      45             : 
      46             : #define SC_DAPI_FLAT_LEVELS     1       // single level for flat dates
      47             : #define SC_DAPI_QUARTER_LEVELS  4       // levels in year/quarter/month/day hierarchy
      48             : #define SC_DAPI_WEEK_LEVELS     3       // levels in year/week/day hierarchy
      49             : 
      50             : #define SC_DAPI_LEVEL_YEAR      0
      51             : #define SC_DAPI_LEVEL_QUARTER   1
      52             : #define SC_DAPI_LEVEL_MONTH     2
      53             : #define SC_DAPI_LEVEL_DAY       3
      54             : #define SC_DAPI_LEVEL_WEEK      4
      55             : #define SC_DAPI_LEVEL_WEEKDAY   5
      56             : 
      57             : class ScDPResultMember;
      58             : class ScDPDimension;
      59             : class ScDPLevel;
      60             : class ScDPInitState;
      61             : class ScDPResultMember;
      62             : class ScDocument;
      63             : 
      64             : /**
      65             :  * Base class that abstracts different data source types of a datapilot
      66             :  * table.
      67             :  */
      68             : class SC_DLLPUBLIC ScDPTableData : public ::boost::noncopyable
      69             : {
      70             :     //  cached data for GetDatePart
      71             :     long    nLastDateVal;
      72             :     long    nLastHier;
      73             :     long    nLastLevel;
      74             :     long    nLastRet;
      75             :     const ScDocument* mpDoc;
      76             : public:
      77             : 
      78             :     /** This structure stores dimension information used when calculating
      79             :         results.  These data are read only during result calculation, so it
      80             :         should be passed as a const instance. */
      81           0 :     struct CalcInfo
      82             :     {
      83             :         ::std::vector<long>             aColLevelDims;
      84             :         ::std::vector<ScDPDimension*>   aColDims;
      85             :         ::std::vector<ScDPLevel*>       aColLevels;
      86             :         ::std::vector<long>             aRowLevelDims;
      87             :         ::std::vector<ScDPDimension*>   aRowDims;
      88             :         ::std::vector<ScDPLevel*>       aRowLevels;
      89             :         ::std::vector<long>             aPageDims;
      90             :         ::std::vector<long>             aDataSrcCols;
      91             : 
      92             :         ScDPInitState*                  pInitState;
      93             :         ScDPResultMember*               pColRoot;
      94             :         ScDPResultMember*               pRowRoot;
      95             : 
      96             :         bool                            bRepeatIfEmpty;
      97             : 
      98             :         CalcInfo();
      99             :     };
     100             : 
     101             :     ScDPTableData(ScDocument* pDoc);
     102             :     virtual     ~ScDPTableData();
     103             : 
     104             :     OUString GetFormattedString(long nDim, const ScDPItemData& rItem) const;
     105             : 
     106             :     long        GetDatePart( long nDateVal, long nHierarchy, long nLevel );
     107             : 
     108             :                 //! use (new) typed collection instead of ScStrCollection
     109             :                 //! or separate Str and ValueCollection
     110             : 
     111             :     virtual long                    GetColumnCount() = 0;
     112             :     virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ;
     113             :     virtual OUString                getDimensionName(long nColumn) = 0;
     114             :     virtual bool                    getIsDataLayoutDimension(long nColumn) = 0;
     115             :     virtual bool                    IsDateDimension(long nDim) = 0;
     116             :     virtual sal_uLong               GetNumberFormat(long nDim);
     117             :     virtual sal_uInt32              GetNumberFormatByIdx( NfIndexTableOffset );
     118             :     virtual void                    DisposeData() = 0;
     119             :     virtual void                    SetEmptyFlags( bool bIgnoreEmptyRows, bool bRepeatIfEmpty ) = 0;
     120             : 
     121             :     virtual bool                    IsRepeatIfEmpty();
     122             : 
     123             :     virtual void                    CreateCacheTable() = 0;
     124             :     virtual void                    FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims) = 0;
     125             :     virtual void                    GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria,
     126             :                                                      const ::boost::unordered_set<sal_Int32>& rCatDims,
     127             :                                                      ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData) = 0;
     128             :     virtual void                    CalcResults(CalcInfo& rInfo, bool bAutoShow) = 0;
     129             :     virtual const ScDPFilteredCache&   GetCacheTable() const = 0;
     130             :     virtual void ReloadCacheTable() = 0;
     131             : 
     132             :                                     // overloaded in ScDPGroupTableData:
     133             :     virtual bool                    IsBaseForGroup(long nDim) const;
     134             :     virtual long                    GetGroupBase(long nGroupDim) const;
     135             :     virtual bool                    IsNumOrDateGroup(long nDim) const;
     136             :     virtual bool                    IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex,
     137             :                                                const ScDPItemData& rBaseData, long nBaseIndex ) const;
     138             :     virtual bool                    HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex,
     139             :                                                       const ScDPItemData& rSecondData, long nSecondIndex ) const;
     140             : 
     141             :     virtual long                            GetMembersCount( long nDim );
     142             :     virtual const ScDPItemData*   GetMemberByIndex( long nDim, long nIndex );
     143             :     virtual const ScDPItemData*   GetMemberById( long nDim, long nId);
     144             :     virtual long                GetSourceDim( long nDim );
     145             :     virtual long                Compare( long nDim, long nDataId1, long nDataId2);
     146             : 
     147             : #if DEBUG_PIVOT_TABLE
     148             :     virtual void Dump() const;
     149             : #endif
     150             : 
     151             : protected:
     152             :     /** This structure stores vector arrays that hold intermediate data for
     153             :         each row during cache table iteration. */
     154           0 :     struct CalcRowData
     155             :     {
     156             :         ::std::vector< SCROW >  aColData;
     157             :         ::std::vector< SCROW >  aRowData;
     158             :         ::std::vector< SCROW >  aPageData;
     159             :         ::std::vector<ScDPValue> aValues;
     160             :     };
     161             : 
     162             :     void            FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPFilteredCache& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData);
     163             :     void ProcessRowData(CalcInfo& rInfo, const CalcRowData& rData, bool bAutoShow);
     164             :     void            CalcResultsFromCacheTable(const ScDPFilteredCache& rCacheTable, CalcInfo& rInfo, bool bAutoShow);
     165             : 
     166             : private:
     167             :     void            GetItemData(const ScDPFilteredCache& rCacheTable, sal_Int32 nRow,
     168             :                                           const ::std::vector<long>& rDims, ::std::vector< SCROW >& rItemData);
     169             : };
     170             : #endif
     171             : 
     172             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10