LCOV - code coverage report
Current view: top level - sc/source/core/data - pivot2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 75 14.7 %
Date: 2012-08-25 Functions: 4 19 21.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 100 6.0 %

           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                 :            : 
      30                 :            : #ifdef _MSC_VER
      31                 :            : #pragma optimize("",off)
      32                 :            : #endif
      33                 :            : 
      34                 :            : #include "scitems.hxx"
      35                 :            : #include <editeng/boxitem.hxx>
      36                 :            : #include <editeng/wghtitem.hxx>
      37                 :            : #include <svx/algitem.hxx>
      38                 :            : #include <unotools/transliterationwrapper.hxx>
      39                 :            : 
      40                 :            : #include "globstr.hrc"
      41                 :            : #include "subtotal.hxx"
      42                 :            : #include "rangeutl.hxx"
      43                 :            : #include "attrib.hxx"
      44                 :            : #include "patattr.hxx"
      45                 :            : #include "docpool.hxx"
      46                 :            : #include "document.hxx"
      47                 :            : #include "userlist.hxx"
      48                 :            : #include "pivot.hxx"
      49                 :            : #include "rechead.hxx"
      50                 :            : #include "formula/errorcodes.hxx"                           // fuer errNoValue
      51                 :            : #include "refupdat.hxx"
      52                 :            : #include "stlpool.hxx"
      53                 :            : #include "stlsheet.hxx"
      54                 :            : 
      55                 :            : using ::com::sun::star::sheet::DataPilotFieldReference;
      56                 :            : using ::rtl::OUString;
      57                 :            : using ::std::vector;
      58                 :            : 
      59                 :            : namespace {
      60                 :            : 
      61                 :          0 : bool equals(const DataPilotFieldReference& left, const DataPilotFieldReference& right)
      62                 :            : {
      63                 :            :     return (left.ReferenceType     == right.ReferenceType)
      64                 :          0 :         && (left.ReferenceField    == right.ReferenceField)
      65                 :            :         && (left.ReferenceItemType == right.ReferenceItemType)
      66   [ #  #  #  # ]:          0 :         && (left.ReferenceItemName == right.ReferenceItemName);
         [ #  # ][ #  # ]
      67                 :            : }
      68                 :            : 
      69                 :            : }
      70                 :            : 
      71                 :            : // ============================================================================
      72                 :            : 
      73                 :          0 : ScDPName::ScDPName(const OUString& rName, const OUString& rLayoutName) :
      74                 :          0 :     maName(rName), maLayoutName(rLayoutName) {}
      75                 :            : 
      76                 :            : // ============================================================================
      77                 :            : 
      78                 :         81 : ScDPLabelData::Member::Member() :
      79                 :            :     mbVisible(true),
      80                 :         81 :     mbShowDetails(true)
      81                 :            : {
      82                 :         81 : }
      83                 :            : 
      84                 :          0 : OUString ScDPLabelData::Member::getDisplayName() const
      85                 :            : {
      86         [ #  # ]:          0 :     if (!maLayoutName.isEmpty())
      87                 :          0 :         return maLayoutName;
      88                 :            : 
      89                 :          0 :     return maName;
      90                 :            : }
      91                 :            : 
      92                 :         12 : ScDPLabelData::ScDPLabelData() :
      93                 :            :     mnCol(-1),
      94                 :            :     mnOriginalDim(-1),
      95                 :            :     mnFuncMask(PIVOT_FUNC_NONE),
      96                 :            :     mnUsedHier(0),
      97                 :            :     mnFlags(0),
      98                 :            :     mbShowAll(false),
      99                 :            :     mbIsValue(false),
     100 [ +  - ][ +  - ]:         12 :     mbDataLayout(false)
     101                 :            : {
     102                 :         12 : }
     103                 :            : 
     104                 :          0 : OUString ScDPLabelData::getDisplayName() const
     105                 :            : {
     106         [ #  # ]:          0 :     if (!maLayoutName.isEmpty())
     107                 :          0 :         return maLayoutName;
     108                 :            : 
     109                 :          0 :     return maName;
     110                 :            : }
     111                 :            : 
     112                 :          0 : PivotField::PivotField(SCCOL nNewCol, sal_uInt16 nNewFuncMask) :
     113                 :            :     nCol( nNewCol ),
     114                 :            :     mnOriginalDim(-1),
     115                 :            :     nFuncMask( nNewFuncMask ),
     116                 :          0 :     mnDupCount(0)
     117                 :            : {
     118                 :          0 : }
     119                 :            : 
     120                 :          0 : PivotField::PivotField( const PivotField& r ) :
     121                 :            :     nCol(r.nCol),
     122                 :            :     mnOriginalDim(r.mnOriginalDim),
     123                 :            :     nFuncMask(r.nFuncMask),
     124                 :            :     mnDupCount(r.mnDupCount),
     125                 :          0 :     maFieldRef(r.maFieldRef) {}
     126                 :            : 
     127                 :          0 : long PivotField::getOriginalDim() const
     128                 :            : {
     129         [ #  # ]:          0 :     return mnOriginalDim >= 0 ? mnOriginalDim : static_cast<long>(nCol);
     130                 :            : }
     131                 :            : 
     132                 :          0 : bool PivotField::operator==( const PivotField& r ) const
     133                 :            : {
     134                 :            :     return (nCol          == r.nCol)
     135                 :            :         && (mnOriginalDim == r.mnOriginalDim)
     136                 :            :         && (nFuncMask     == r.nFuncMask)
     137 [ #  # ][ #  # ]:          0 :         && equals(maFieldRef, r.maFieldRef);
         [ #  # ][ #  # ]
     138                 :            : }
     139                 :            : 
     140                 :          3 : ScPivotParam::ScPivotParam()
     141                 :            :     :   nCol(0), nRow(0), nTab(0),
     142                 :            :         bIgnoreEmptyRows(false), bDetectCategories(false),
     143 [ +  - ][ +  - ]:          3 :         bMakeTotalCol(true), bMakeTotalRow(true)
         [ +  - ][ +  - ]
     144                 :            : {
     145                 :          3 : }
     146                 :            : 
     147                 :          0 : ScPivotParam::ScPivotParam( const ScPivotParam& r )
     148                 :            :     :   nCol( r.nCol ), nRow( r.nRow ), nTab( r.nTab ),
     149                 :            :         maPageFields(r.maPageFields),
     150                 :            :         maColFields(r.maColFields),
     151                 :            :         maRowFields(r.maRowFields),
     152                 :            :         maDataFields(r.maDataFields),
     153                 :            :         bIgnoreEmptyRows(r.bIgnoreEmptyRows),
     154                 :            :         bDetectCategories(r.bDetectCategories),
     155                 :            :         bMakeTotalCol(r.bMakeTotalCol),
     156 [ #  # ][ #  # ]:          0 :         bMakeTotalRow(r.bMakeTotalRow)
         [ #  # ][ #  # ]
     157                 :            : {
     158         [ #  # ]:          0 :     SetLabelData(r.maLabelArray);
     159                 :          0 : }
     160                 :            : 
     161                 :          3 : ScPivotParam::~ScPivotParam()
     162                 :            : {
     163                 :          3 : }
     164                 :            : 
     165                 :          0 : void ScPivotParam::SetLabelData(const ScDPLabelDataVec& r)
     166                 :            : {
     167         [ #  # ]:          0 :     ScDPLabelDataVec aNewArray;
     168         [ #  # ]:          0 :     aNewArray.reserve(r.size());
     169 [ #  # ][ #  # ]:          0 :     for (ScDPLabelDataVec::const_iterator itr = r.begin(), itrEnd = r.end();
         [ #  # ][ #  # ]
                 [ #  # ]
     170                 :            :          itr != itrEnd; ++itr)
     171 [ #  # ][ #  # ]:          0 :         aNewArray.push_back(new ScDPLabelData(*itr));
         [ #  # ][ #  # ]
     172                 :            : 
     173         [ #  # ]:          0 :     maLabelArray.swap(aNewArray);
     174                 :          0 : }
     175                 :            : 
     176                 :          0 : ScPivotParam& ScPivotParam::operator=( const ScPivotParam& r )
     177                 :            : {
     178                 :          0 :     nCol              = r.nCol;
     179                 :          0 :     nRow              = r.nRow;
     180                 :          0 :     nTab              = r.nTab;
     181                 :          0 :     bIgnoreEmptyRows  = r.bIgnoreEmptyRows;
     182                 :          0 :     bDetectCategories = r.bDetectCategories;
     183                 :          0 :     bMakeTotalCol     = r.bMakeTotalCol;
     184                 :          0 :     bMakeTotalRow     = r.bMakeTotalRow;
     185                 :            : 
     186                 :          0 :     maPageFields = r.maPageFields;
     187                 :          0 :     maColFields  = r.maColFields;
     188                 :          0 :     maRowFields  = r.maRowFields;
     189                 :          0 :     maDataFields = r.maDataFields;
     190                 :          0 :     SetLabelData(r.maLabelArray);
     191                 :          0 :     return *this;
     192                 :            : }
     193                 :            : 
     194                 :          0 : bool ScPivotParam::operator==( const ScPivotParam& r ) const
     195                 :            : {
     196                 :            :     bool bEqual = (nCol == r.nCol)
     197                 :            :                  && (nRow == r.nRow)
     198                 :            :                  && (nTab == r.nTab)
     199                 :            :                  && (bIgnoreEmptyRows  == r.bIgnoreEmptyRows)
     200                 :            :                  && (bDetectCategories == r.bDetectCategories)
     201                 :            :                  && (bMakeTotalCol == r.bMakeTotalCol)
     202                 :            :                  && (bMakeTotalRow == r.bMakeTotalRow)
     203                 :          0 :                  && (maLabelArray.size() == r.maLabelArray.size())
     204                 :          0 :                  && maPageFields == r.maPageFields
     205                 :          0 :                  && maColFields == r.maColFields
     206                 :          0 :                  && maRowFields == r.maRowFields
     207 [ #  # ][ #  # ]:          0 :                  && maDataFields == r.maDataFields;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
          #  #  #  #  #  
              # ][ #  # ]
     208                 :            : 
     209                 :          0 :     return bEqual;
     210                 :            : }
     211                 :            : 
     212                 :            : // ============================================================================
     213                 :            : 
     214                 :          0 : ScDPFuncData::ScDPFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) :
     215                 :            :     mnCol( nCol ),
     216                 :            :     mnOriginalDim(-1),
     217                 :            :     mnFuncMask( nFuncMask ),
     218                 :          0 :     mnDupCount(0)
     219                 :            : {
     220                 :          0 : }
     221                 :            : 
     222                 :          0 : ScDPFuncData::ScDPFuncData(
     223                 :            :     SCCOL nCol, long nOriginalDim, sal_uInt16 nFuncMask, sal_uInt8 nDupCount,
     224                 :            :     const DataPilotFieldReference& rFieldRef) :
     225                 :            :     mnCol( nCol ),
     226                 :            :     mnOriginalDim(nOriginalDim),
     227                 :            :     mnFuncMask( nFuncMask ),
     228                 :            :     mnDupCount(nDupCount),
     229                 :          0 :     maFieldRef( rFieldRef )
     230                 :            : {
     231                 :          0 : }
     232                 :            : 
     233                 :          0 : bool ScDPFuncData::operator== (const ScDPFuncData& r) const
     234                 :            : {
     235 [ #  # ][ #  # ]:          0 :     if (mnCol != r.mnCol || mnOriginalDim != r.mnOriginalDim || mnFuncMask != r.mnFuncMask || mnDupCount != r.mnDupCount)
         [ #  # ][ #  # ]
     236                 :          0 :         return false;
     237                 :            : 
     238                 :          0 :     return equals(maFieldRef, r.maFieldRef);
     239                 :            : }
     240                 :            : 
     241                 :            : // ============================================================================
     242                 :            : 
     243                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10