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

Generated by: LCOV version 1.11