LCOV - code coverage report
Current view: top level - libreoffice/sc/inc - pivot.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 5 40.0 %
Date: 2012-12-17 Functions: 3 11 27.3 %
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             : /*
      21             :     IMPORTANT:
      22             :     Strictly adhere to the following sequence when creating a pivot table:
      23             : 
      24             :     pPivot->SetColFields(aColArr, aColCount)
      25             :     pPivot->SetRowFields(aRowArr, aRowCount)
      26             :     pPivot->SetDataFields(aDataArr, aDataCount)
      27             :     if (pPivot->CreateData())
      28             :     {
      29             :         pPivotDrawData();
      30             :         pPivotReleaseData();
      31             :     }
      32             : 
      33             :     Make sure that either ColArr or RowArr contains a PivotDataField entry.
      34             : */
      35             : 
      36             : 
      37             : #ifndef SC_PIVOT_HXX
      38             : #define SC_PIVOT_HXX
      39             : 
      40             : #include "global.hxx"
      41             : #include "address.hxx"
      42             : #include "dpglobal.hxx"
      43             : 
      44             : #include <vector>
      45             : #include <boost/ptr_container/ptr_vector.hpp>
      46             : 
      47             : #define PIVOT_DATA_FIELD        (MAXCOLCOUNT)
      48             : #include <com/sun/star/uno/Sequence.hxx>
      49             : #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
      50             : #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
      51             : #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
      52             : #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
      53             : 
      54             : 
      55           0 : struct ScDPName
      56             : {
      57             :     ::rtl::OUString     maName;         /// Original name of the dimension.
      58             :     ::rtl::OUString     maLayoutName;   /// Layout name (display name)
      59             : 
      60             :     explicit ScDPName(const ::rtl::OUString& rName, const ::rtl::OUString& rLayoutName);
      61             : };
      62             : 
      63             : // ============================================================================
      64             : 
      65           8 : struct ScDPLabelData
      66             : {
      67             :     rtl::OUString       maName;         /// Original name of the dimension.
      68             :     rtl::OUString       maLayoutName;   /// Layout name (display name)
      69             :     rtl::OUString       maSubtotalName;
      70             :     SCCOL               mnCol;          /// 0-based field index (not the source column index)
      71             :     long                mnOriginalDim;  /// original dimension index (>= 0 for duplicated dimension)
      72             :     sal_uInt16          mnFuncMask;     /// Page/Column/Row subtotal function.
      73             :     sal_Int32           mnUsedHier;     /// Used hierarchy.
      74             :     sal_Int32           mnFlags;        /// Flags from the DataPilotSource dimension
      75             :     bool                mbShowAll:1;    /// true = Show all (also empty) results.
      76             :     bool                mbIsValue:1;    /// true = Sum or count in data field.
      77             :     bool                mbDataLayout:1;
      78             : 
      79         162 :     struct Member
      80             :     {
      81             :         ::rtl::OUString maName;
      82             :         ::rtl::OUString maLayoutName;
      83             :         bool mbVisible;
      84             :         bool mbShowDetails;
      85             : 
      86             :         Member();
      87             : 
      88             :         /**
      89             :          * return the name that should be displayed in the dp dialogs i.e.
      90             :          * when the layout name is present, use it, or else use the original
      91             :          * name.
      92             :          */
      93             :         ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
      94             :     };
      95             :     ::std::vector<Member>                               maMembers;
      96             :     ::com::sun::star::uno::Sequence< ::rtl::OUString >  maHiers;        /// Hierarchies.
      97             :     ::com::sun::star::sheet::DataPilotFieldSortInfo     maSortInfo;     /// Sorting info.
      98             :     ::com::sun::star::sheet::DataPilotFieldLayoutInfo   maLayoutInfo;   /// Layout info.
      99             :     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo;     /// AutoShow info.
     100             : 
     101             :     ScDPLabelData();
     102             : 
     103             :     /**
     104             :      * return the name that should be displayed in the dp dialogs i.e. when
     105             :      * the layout name is present, use it, or else use the original name.
     106             :      */
     107             :     ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
     108             : };
     109             : 
     110             : typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVector;
     111             : 
     112           0 : struct ScPivotField
     113             : {
     114             :     SCCOL               nCol; /// 0-based dimension index (not source column index)
     115             :     long                mnOriginalDim; /// >= 0 for duplicated field.
     116             :     sal_uInt16          nFuncMask;
     117             :     sal_uInt8           mnDupCount;
     118             :     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
     119             : 
     120             :     explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
     121             :     ScPivotField( const ScPivotField& r );
     122             : 
     123             :     long getOriginalDim() const;
     124             :     bool                operator==( const ScPivotField& r ) const;
     125             : };
     126             : 
     127             : typedef ::std::vector< ScPivotField > ScPivotFieldVector;
     128             : 
     129             : struct ScPivotParam
     130             : {
     131             :     SCCOL           nCol;           // Cursor Position /
     132             :     SCROW           nRow;           // or start of destination area
     133             :     SCTAB           nTab;
     134             :     ScDPLabelDataVector maLabelArray;
     135             :     ScPivotFieldVector maPageFields;
     136             :     ScPivotFieldVector maColFields;
     137             :     ScPivotFieldVector maRowFields;
     138             :     ScPivotFieldVector maDataFields;
     139             :     bool            bIgnoreEmptyRows;
     140             :     bool            bDetectCategories;
     141             :     bool            bMakeTotalCol;
     142             :     bool            bMakeTotalRow;
     143             : 
     144             :     ScPivotParam();
     145             :     ScPivotParam( const ScPivotParam& r );
     146             :     ~ScPivotParam();
     147             : 
     148             :     ScPivotParam&   operator=       ( const ScPivotParam& r );
     149             :     bool            operator==      ( const ScPivotParam& r ) const;
     150             :     void SetLabelData(const ScDPLabelDataVector& r);
     151             : };
     152             : 
     153           0 : struct ScPivotFuncData
     154             : {
     155             :     SCCOL               mnCol;
     156             :     long                mnOriginalDim;
     157             :     sal_uInt16          mnFuncMask;
     158             :     sal_uInt8           mnDupCount;
     159             :     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
     160             : 
     161             :     explicit ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask );
     162             :     explicit ScPivotFuncData(
     163             :         SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
     164             :         const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
     165             : 
     166             :     bool operator== (const ScPivotFuncData& r) const;
     167             : };
     168             : 
     169             : typedef ::std::vector< ScPivotFuncData > ScPivotFuncDataVector;
     170             : typedef std::vector<ScDPName> ScDPNameVec;
     171             : 
     172             : #endif
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10