LCOV - code coverage report
Current view: top level - sc/source/core/tool - prnsave.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 42 45 93.3 %
Date: 2014-04-11 Functions: 11 11 100.0 %
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 "prnsave.hxx"
      21             : #include "global.hxx"
      22             : #include "address.hxx"
      23             : 
      24             : // STATIC DATA
      25             : 
      26             : 
      27             : //      Daten pro Tabelle
      28             : 
      29             : 
      30         179 : ScPrintSaverTab::ScPrintSaverTab() :
      31             :     mpRepeatCol(NULL),
      32             :     mpRepeatRow(NULL),
      33         179 :     mbEntireSheet(false)
      34             : {
      35         179 : }
      36             : 
      37         330 : ScPrintSaverTab::~ScPrintSaverTab()
      38             : {
      39         165 :     delete mpRepeatCol;
      40         165 :     delete mpRepeatRow;
      41         165 : }
      42             : 
      43         179 : void ScPrintSaverTab::SetAreas( const ScRangeVec& rRanges, bool bEntireSheet )
      44             : {
      45         179 :     maPrintRanges = rRanges;
      46         179 :     mbEntireSheet = bEntireSheet;
      47         179 : }
      48             : 
      49         179 : void ScPrintSaverTab::SetRepeat( const ScRange* pCol, const ScRange* pRow )
      50             : {
      51         179 :     delete mpRepeatCol;
      52         179 :     mpRepeatCol = pCol ? new ScRange(*pCol) : NULL;
      53         179 :     delete mpRepeatRow;
      54         179 :     mpRepeatRow = pRow ? new ScRange(*pRow) : NULL;
      55         179 : }
      56             : 
      57          98 : inline sal_Bool PtrEqual( const ScRange* p1, const ScRange* p2 )
      58             : {
      59          98 :     return ( !p1 && !p2 ) || ( p1 && p2 && *p1 == *p2 );
      60             : }
      61             : 
      62          49 : bool ScPrintSaverTab::operator==( const ScPrintSaverTab& rCmp ) const
      63             : {
      64             :     return
      65          98 :         PtrEqual( mpRepeatCol, rCmp.mpRepeatCol ) &&
      66          98 :         PtrEqual( mpRepeatRow, rCmp.mpRepeatRow ) &&
      67         147 :         (mbEntireSheet == rCmp.mbEntireSheet) &&
      68          98 :         (maPrintRanges == rCmp.maPrintRanges);
      69             : }
      70             : 
      71             : 
      72             : //      Daten fuer das ganze Dokument
      73             : 
      74             : 
      75         106 : ScPrintRangeSaver::ScPrintRangeSaver( SCTAB nCount ) :
      76         106 :     nTabCount( nCount )
      77             : {
      78         106 :     if (nCount > 0)
      79         106 :         pData = new ScPrintSaverTab[nCount];
      80             :     else
      81           0 :         pData = NULL;
      82         106 : }
      83             : 
      84         101 : ScPrintRangeSaver::~ScPrintRangeSaver()
      85             : {
      86         101 :     delete[] pData;
      87         101 : }
      88             : 
      89         179 : ScPrintSaverTab& ScPrintRangeSaver::GetTabData(SCTAB nTab)
      90             : {
      91             :     OSL_ENSURE(nTab<nTabCount,"ScPrintRangeSaver Tab too big");
      92         179 :     return pData[nTab];
      93             : }
      94             : 
      95           2 : const ScPrintSaverTab& ScPrintRangeSaver::GetTabData(SCTAB nTab) const
      96             : {
      97             :     OSL_ENSURE(nTab<nTabCount,"ScPrintRangeSaver Tab too big");
      98           2 :     return pData[nTab];
      99             : }
     100             : 
     101          49 : bool ScPrintRangeSaver::operator==( const ScPrintRangeSaver& rCmp ) const
     102             : {
     103          49 :     bool bEqual = ( nTabCount == rCmp.nTabCount );
     104          49 :     if (bEqual)
     105          79 :         for (SCTAB i=0; i<nTabCount; i++)
     106          49 :             if (!(pData[i]==rCmp.pData[i]))
     107             :             {
     108           0 :                 bEqual = false;
     109           0 :                 break;
     110             :             }
     111          49 :     return bEqual;
     112             : }
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10