LCOV - code coverage report
Current view: top level - sc/inc - pivot.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 5 40.0 %
Date: 2012-08-25 Functions: 3 11 27.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 6 16.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : /*
      29                 :            :     IMPORTANT:
      30                 :            :     Strictly adhere to the following sequence when creating a pivot table:
      31                 :            : 
      32                 :            :     pPivot->SetColFields(aColArr, aColCount)
      33                 :            :     pPivot->SetRowFields(aRowArr, aRowCount)
      34                 :            :     pPivot->SetDataFields(aDataArr, aDataCount)
      35                 :            :     if (pPivot->CreateData())
      36                 :            :     {
      37                 :            :         pPivotDrawData();
      38                 :            :         pPivotReleaseData();
      39                 :            :     }
      40                 :            : 
      41                 :            :     Make sure that either ColArr or RowArr contains a PivotDataField entry.
      42                 :            : */
      43                 :            : 
      44                 :            : 
      45                 :            : #ifndef SC_PIVOT_HXX
      46                 :            : #define SC_PIVOT_HXX
      47                 :            : 
      48                 :            : #include "global.hxx"
      49                 :            : #include "address.hxx"
      50                 :            : #include "dpglobal.hxx"
      51                 :            : 
      52                 :            : #include <vector>
      53                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      54                 :            : 
      55                 :            : #define PIVOT_DATA_FIELD        (MAXCOLCOUNT)
      56                 :            : #include <com/sun/star/uno/Sequence.hxx>
      57                 :            : #include <com/sun/star/sheet/DataPilotFieldReference.hpp>
      58                 :            : #include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
      59                 :            : #include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
      60                 :            : #include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
      61                 :            : 
      62                 :            : struct ScDPLabelData;
      63                 :            : 
      64                 :            : // -----------------------------------------------------------------------
      65                 :            : 
      66                 :          0 : struct PivotField
      67                 :            : {
      68                 :            :     SCCOL               nCol; /// 0-based dimension index (not source column index)
      69                 :            :     long                mnOriginalDim; /// >= 0 for duplicated field.
      70                 :            :     sal_uInt16          nFuncMask;
      71                 :            :     sal_uInt8           mnDupCount;
      72                 :            :     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
      73                 :            : 
      74                 :            :     explicit PivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
      75                 :            :     PivotField( const PivotField& r );
      76                 :            : 
      77                 :            :     long getOriginalDim() const;
      78                 :            :     bool                operator==( const PivotField& r ) const;
      79                 :            : };
      80                 :            : 
      81                 :            : // -----------------------------------------------------------------------
      82                 :            : 
      83                 :            : typedef boost::ptr_vector<ScDPLabelData> ScDPLabelDataVec;
      84                 :            : 
      85                 :            : struct ScPivotParam
      86                 :            : {
      87                 :            :     SCCOL           nCol;           // cursor position /
      88                 :            :     SCROW           nRow;           // or start of destination area
      89                 :            :     SCTAB           nTab;
      90                 :            :     ScDPLabelDataVec maLabelArray;
      91                 :            :     ::std::vector<PivotField> maPageFields;
      92                 :            :     ::std::vector<PivotField> maColFields;
      93                 :            :     ::std::vector<PivotField> maRowFields;
      94                 :            :     ::std::vector<PivotField> maDataFields;
      95                 :            :     bool            bIgnoreEmptyRows;
      96                 :            :     bool            bDetectCategories;
      97                 :            :     bool            bMakeTotalCol;
      98                 :            :     bool            bMakeTotalRow;
      99                 :            : 
     100                 :            :     ScPivotParam();
     101                 :            :     ScPivotParam( const ScPivotParam& r );
     102                 :            :     ~ScPivotParam();
     103                 :            : 
     104                 :            :     ScPivotParam&   operator=       ( const ScPivotParam& r );
     105                 :            :     bool            operator==      ( const ScPivotParam& r ) const;
     106                 :            :     void SetLabelData(const ScDPLabelDataVec& r);
     107                 :            : };
     108                 :            : 
     109                 :            : //------------------------------------------------------------------------
     110                 :            : 
     111                 :          0 : struct ScDPName
     112                 :            : {
     113                 :            :     ::rtl::OUString     maName;         /// Original name of the dimension.
     114                 :            :     ::rtl::OUString     maLayoutName;   /// Layout name (display name)
     115                 :            : 
     116                 :            :     explicit ScDPName(const ::rtl::OUString& rName, const ::rtl::OUString& rLayoutName);
     117                 :            : };
     118                 :            : 
     119                 :            : // ============================================================================
     120                 :            : 
     121 [ +  - ][ #  # ]:         12 : struct ScDPLabelData
                 [ #  # ]
     122                 :            : {
     123                 :            :     rtl::OUString       maName;         /// Original name of the dimension.
     124                 :            :     rtl::OUString       maLayoutName;   /// Layout name (display name)
     125                 :            :     rtl::OUString       maSubtotalName;
     126                 :            :     SCCOL               mnCol;          /// 0-based field index (not the source column index)
     127                 :            :     long                mnOriginalDim;  /// original dimension index (>= 0 for duplicated dimension)
     128                 :            :     sal_uInt16          mnFuncMask;     /// Page/Column/Row subtotal function.
     129                 :            :     sal_Int32           mnUsedHier;     /// Used hierarchy.
     130                 :            :     sal_Int32           mnFlags;        /// Flags from the DataPilotSource dimension
     131                 :            :     bool                mbShowAll:1;    /// true = Show all (also empty) results.
     132                 :            :     bool                mbIsValue:1;    /// true = Sum or count in data field.
     133                 :            :     bool                mbDataLayout:1;
     134                 :            : 
     135                 :        243 :     struct Member
     136                 :            :     {
     137                 :            :         ::rtl::OUString maName;
     138                 :            :         ::rtl::OUString maLayoutName;
     139                 :            :         bool mbVisible;
     140                 :            :         bool mbShowDetails;
     141                 :            : 
     142                 :            :         Member();
     143                 :            : 
     144                 :            :         /**
     145                 :            :          * return the name that should be displayed in the dp dialogs i.e.
     146                 :            :          * when the layout name is present, use it, or else use the original
     147                 :            :          * name.
     148                 :            :          */
     149                 :            :         ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
     150                 :            :     };
     151                 :            :     ::std::vector<Member>                               maMembers;
     152                 :            :     ::com::sun::star::uno::Sequence< ::rtl::OUString >  maHiers;        /// Hierarchies.
     153                 :            :     ::com::sun::star::sheet::DataPilotFieldSortInfo     maSortInfo;     /// Sorting info.
     154                 :            :     ::com::sun::star::sheet::DataPilotFieldLayoutInfo   maLayoutInfo;   /// Layout info.
     155                 :            :     ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo;     /// AutoShow info.
     156                 :            : 
     157                 :            :     ScDPLabelData();
     158                 :            : 
     159                 :            :     /**
     160                 :            :      * return the name that should be displayed in the dp dialogs i.e. when
     161                 :            :      * the layout name is present, use it, or else use the original name.
     162                 :            :      */
     163                 :            :     ::rtl::OUString SC_DLLPUBLIC getDisplayName() const;
     164                 :            : };
     165                 :            : 
     166                 :            : // ============================================================================
     167                 :            : 
     168                 :            : struct ScPivotField
     169                 :            : {
     170                 :            :     SCCOL               nCol;
     171                 :            :     sal_uInt16          nFuncMask;
     172                 :            :     sal_uInt16          nFuncCount;
     173                 :            :     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
     174                 :            : 
     175                 :            :     explicit            ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE );
     176                 :            : 
     177                 :            :     bool                operator==( const ScPivotField& r ) const;
     178                 :            : };
     179                 :            : 
     180                 :            : // ============================================================================
     181                 :            : 
     182                 :          0 : struct ScDPFuncData
     183                 :            : {
     184                 :            :     SCCOL               mnCol;
     185                 :            :     long                mnOriginalDim;
     186                 :            :     sal_uInt16          mnFuncMask;
     187                 :            :     sal_uInt8           mnDupCount;
     188                 :            :     ::com::sun::star::sheet::DataPilotFieldReference maFieldRef;
     189                 :            : 
     190                 :            :     explicit ScDPFuncData( SCCOL nNewCol, sal_uInt16 nNewFuncMask );
     191                 :            :     explicit ScDPFuncData(
     192                 :            :         SCCOL nNewCol, long nOriginalDim, sal_uInt16 nNewFuncMask, sal_uInt8 nDupCount,
     193                 :            :         const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef );
     194                 :            : 
     195                 :            :     bool operator== (const ScDPFuncData& r) const;
     196                 :            : };
     197                 :            : 
     198                 :            : // ============================================================================
     199                 :            : 
     200                 :            : typedef std::vector<ScDPName> ScDPNameVec;
     201                 :            : 
     202                 :            : #endif
     203                 :            : 
     204                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10