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

Generated by: LCOV version 1.10