LCOV - code coverage report
Current view: top level - sc/source/core/data - pivot2.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 93 12.9 %
Date: 2014-11-03 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          64 : ScDPLabelData::Member::Member() :
      74             :     mbVisible(true),
      75          64 :     mbShowDetails(true)
      76          64 : {}
      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           8 : 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           8 :     mbDataLayout(false)
      96           8 : {}
      97             : 
      98           0 : OUString ScDPLabelData::getDisplayName() const
      99             : {
     100           0 :     if (!maLayoutName.isEmpty())
     101           0 :         return maLayoutName;
     102             : 
     103           0 :     return maName;
     104             : }
     105             : 
     106             : // ScPivotField
     107             : 
     108           0 : ScPivotField::ScPivotField(SCCOL nNewCol, sal_uInt16 nNewFuncMask) :
     109             :     nCol(nNewCol),
     110             :     mnOriginalDim(-1),
     111             :     nFuncMask(nNewFuncMask),
     112           0 :     mnDupCount(0)
     113           0 : {}
     114             : 
     115           0 : ScPivotField::ScPivotField( const ScPivotField& rPivotField ) :
     116             :     nCol(rPivotField.nCol),
     117             :     mnOriginalDim(rPivotField.mnOriginalDim),
     118             :     nFuncMask(rPivotField.nFuncMask),
     119             :     mnDupCount(rPivotField.mnDupCount),
     120           0 :     maFieldRef(rPivotField.maFieldRef)
     121           0 : {}
     122             : 
     123           0 : long ScPivotField::getOriginalDim() const
     124             : {
     125           0 :     return mnOriginalDim >= 0 ? mnOriginalDim : static_cast<long>(nCol);
     126             : }
     127             : 
     128           0 : bool ScPivotField::operator==( const ScPivotField& r ) const
     129             : {
     130           0 :     return (nCol          == r.nCol)
     131           0 :         && (mnOriginalDim == r.mnOriginalDim)
     132           0 :         && (nFuncMask     == r.nFuncMask)
     133           0 :         && equals(maFieldRef, r.maFieldRef);
     134             : }
     135             : 
     136             : // ScPivotParam
     137             : 
     138           2 : ScPivotParam::ScPivotParam() :
     139             :     nCol(0), nRow(0), nTab(0),
     140             :     bIgnoreEmptyRows(false), bDetectCategories(false),
     141           2 :     bMakeTotalCol(true), bMakeTotalRow(true)
     142           2 : {}
     143             : 
     144           0 : ScPivotParam::ScPivotParam( const ScPivotParam& r )
     145             :     :   nCol( r.nCol ), nRow( r.nRow ), nTab( r.nTab ),
     146             :         maPageFields(r.maPageFields),
     147             :         maColFields(r.maColFields),
     148             :         maRowFields(r.maRowFields),
     149             :         maDataFields(r.maDataFields),
     150             :         bIgnoreEmptyRows(r.bIgnoreEmptyRows),
     151             :         bDetectCategories(r.bDetectCategories),
     152             :         bMakeTotalCol(r.bMakeTotalCol),
     153           0 :         bMakeTotalRow(r.bMakeTotalRow)
     154             : {
     155           0 :     SetLabelData(r.maLabelArray);
     156           0 : }
     157             : 
     158           2 : ScPivotParam::~ScPivotParam()
     159           2 : {}
     160             : 
     161           0 : void ScPivotParam::SetLabelData(const ScDPLabelDataVector& rVector)
     162             : {
     163           0 :     ScDPLabelDataVector aNewArray;
     164           0 :     aNewArray.reserve(rVector.size());
     165           0 :     ScDPLabelDataVector::const_iterator it;
     166           0 :     for (it = rVector.begin(); it != rVector.end(); ++it)
     167             :     {
     168           0 :         aNewArray.push_back(new ScDPLabelData(*it));
     169             :     }
     170           0 :     maLabelArray.swap(aNewArray);
     171           0 : }
     172             : 
     173           0 : ScPivotParam& ScPivotParam::operator=( const ScPivotParam& rPivotParam )
     174             : {
     175           0 :     nCol              = rPivotParam.nCol;
     176           0 :     nRow              = rPivotParam.nRow;
     177           0 :     nTab              = rPivotParam.nTab;
     178           0 :     bIgnoreEmptyRows  = rPivotParam.bIgnoreEmptyRows;
     179           0 :     bDetectCategories = rPivotParam.bDetectCategories;
     180           0 :     bMakeTotalCol     = rPivotParam.bMakeTotalCol;
     181           0 :     bMakeTotalRow     = rPivotParam.bMakeTotalRow;
     182             : 
     183           0 :     maPageFields = rPivotParam.maPageFields;
     184           0 :     maColFields  = rPivotParam.maColFields;
     185           0 :     maRowFields  = rPivotParam.maRowFields;
     186           0 :     maDataFields = rPivotParam.maDataFields;
     187             : 
     188           0 :     SetLabelData(rPivotParam.maLabelArray);
     189           0 :     return *this;
     190             : }
     191             : 
     192           0 : bool ScPivotParam::operator==( const ScPivotParam& rPivotParam ) const
     193             : {
     194           0 :     bool bEqual = (nCol == rPivotParam.nCol &&
     195           0 :                   nRow == rPivotParam.nRow &&
     196           0 :                   nTab == rPivotParam.nTab &&
     197           0 :                   bIgnoreEmptyRows  == rPivotParam.bIgnoreEmptyRows &&
     198           0 :                   bDetectCategories == rPivotParam.bDetectCategories &&
     199           0 :                   bMakeTotalCol == rPivotParam.bMakeTotalCol &&
     200           0 :                   bMakeTotalRow == rPivotParam.bMakeTotalRow &&
     201           0 :                   maLabelArray.size() == rPivotParam.maLabelArray.size() &&
     202           0 :                   maPageFields == rPivotParam.maPageFields &&
     203           0 :                   maColFields == rPivotParam.maColFields &&
     204           0 :                   maRowFields == rPivotParam.maRowFields &&
     205           0 :                   maDataFields == rPivotParam.maDataFields);
     206           0 :     return bEqual;
     207             : }
     208             : 
     209             : // ScPivotFuncData
     210             : 
     211           0 : ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) :
     212             :     mnCol( nCol ),
     213             :     mnOriginalDim(-1),
     214             :     mnFuncMask(nFuncMask),
     215           0 :     mnDupCount(0)
     216           0 : {}
     217             : 
     218           0 : bool ScPivotFuncData::operator== (const ScPivotFuncData& rFuncData) const
     219             : {
     220           0 :     if (mnCol != rFuncData.mnCol ||
     221           0 :         mnOriginalDim != rFuncData.mnOriginalDim ||
     222           0 :         mnFuncMask != rFuncData.mnFuncMask ||
     223           0 :         mnDupCount != rFuncData.mnDupCount)
     224             :     {
     225           0 :         return false;
     226             :     }
     227           0 :     return equals(maFieldRef, rFuncData.maFieldRef);
     228         228 : }
     229             : 
     230             : #if DEBUG_PIVOT_TABLE
     231             : void ScPivotFuncData::Dump() const
     232             : {
     233             :     cout << "ScPivotFuncData: (col=" << mnCol << ", original dim=" << mnOriginalDim
     234             :         << ", func mask=" << mnFuncMask << ", duplicate count=" << static_cast<int>(mnDupCount)
     235             :         << ")" << endl;
     236             : }
     237             : #endif
     238             : 
     239             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10