LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/docshell - pagedata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 55 0.0 %
Date: 2012-12-27 Functions: 0 9 0.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 <string.h>
      21             : 
      22             : #include "pagedata.hxx"
      23             : 
      24             : //============================================================================
      25             : 
      26           0 : ScPrintRangeData::ScPrintRangeData()
      27             : {
      28           0 :     nPagesX = nPagesY = 0;
      29           0 :     pPageEndX = NULL;
      30           0 :     pPageEndY = NULL;
      31           0 :     bTopDown = bAutomatic = sal_True;
      32           0 :     nFirstPage = 1;
      33           0 : }
      34             : 
      35           0 : ScPrintRangeData::~ScPrintRangeData()
      36             : {
      37           0 :     delete[] pPageEndX;
      38           0 :     delete[] pPageEndY;
      39           0 : }
      40             : 
      41           0 : void ScPrintRangeData::SetPagesX( size_t nCount, const SCCOL* pData )
      42             : {
      43           0 :     delete[] pPageEndX;
      44           0 :     if ( nCount )
      45             :     {
      46           0 :         pPageEndX = new SCCOL[nCount];
      47           0 :         memcpy( pPageEndX, pData, nCount * sizeof(SCCOL) );
      48             :     }
      49             :     else
      50           0 :         pPageEndX = NULL;
      51           0 :     nPagesX = nCount;
      52           0 : }
      53             : 
      54           0 : void ScPrintRangeData::SetPagesY( size_t nCount, const SCROW* pData )
      55             : {
      56           0 :     delete[] pPageEndY;
      57           0 :     if ( nCount )
      58             :     {
      59           0 :         pPageEndY = new SCROW[nCount];
      60           0 :         memcpy( pPageEndY, pData, nCount * sizeof(SCROW) );
      61             :     }
      62             :     else
      63           0 :         pPageEndY = NULL;
      64           0 :     nPagesY = nCount;
      65           0 : }
      66             : 
      67             : //============================================================================
      68             : 
      69           0 : ScPageBreakData::ScPageBreakData(size_t nMax)
      70             : {
      71           0 :     nUsed = 0;
      72           0 :     if (nMax)
      73           0 :         pData = new ScPrintRangeData[nMax];
      74             :     else
      75           0 :         pData = NULL;
      76           0 :     nAlloc = nMax;
      77           0 : }
      78             : 
      79           0 : ScPageBreakData::~ScPageBreakData()
      80             : {
      81           0 :     delete[] pData;
      82           0 : }
      83             : 
      84           0 : ScPrintRangeData& ScPageBreakData::GetData(size_t nPos)
      85             : {
      86             :     OSL_ENSURE(nPos < nAlloc, "ScPageBreakData::GetData bumm");
      87             : 
      88           0 :     if ( nPos >= nUsed )
      89             :     {
      90             :         OSL_ENSURE(nPos == nUsed, "ScPageBreakData::GetData falsche Reihenfolge");
      91           0 :         nUsed = nPos+1;
      92             :     }
      93             : 
      94           0 :     return pData[nPos];
      95             : }
      96             : 
      97           0 : sal_Bool ScPageBreakData::IsEqual( const ScPageBreakData& rOther ) const
      98             : {
      99           0 :     if ( nUsed != rOther.nUsed )
     100           0 :         return false;
     101             : 
     102           0 :     for (sal_uInt16 i=0; i<nUsed; i++)
     103           0 :         if ( pData[i].GetPrintRange() != rOther.pData[i].GetPrintRange() )
     104           0 :             return false;
     105             : 
     106             :     //! ScPrintRangeData komplett vergleichen ??
     107             : 
     108           0 :     return sal_True;
     109             : }
     110             : 
     111           0 : void ScPageBreakData::AddPages()
     112             : {
     113           0 :     if ( nUsed > 1 )
     114             :     {
     115           0 :         long nPage = pData[0].GetFirstPage();
     116           0 :         for (sal_uInt16 i=0; sal::static_int_cast<size_t>(i+1)<nUsed; i++)
     117             :         {
     118           0 :             nPage += ((long)pData[i].GetPagesX())*pData[i].GetPagesY();
     119           0 :             pData[i+1].SetFirstPage( nPage );
     120             :         }
     121             :     }
     122           0 : }
     123             : 
     124             : 
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10