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

Generated by: LCOV version 1.11