LCOV - code coverage report
Current view: top level - sw/source/core/bastyp - tabcol.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 39 54 72.2 %
Date: 2015-06-13 12:38:46 Functions: 6 7 85.7 %
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 "tabcol.hxx"
      21             : #include <limits.h>
      22             : 
      23        2927 : SwTabCols::SwTabCols( sal_uInt16 nSize ) :
      24             :     nLeftMin( 0 ),
      25             :     nLeft( 0 ),
      26             :     nRight( 0 ),
      27             :     nRightMax( 0 ),
      28        2927 :     bLastRowAllowedToChange( true )
      29             : {
      30        2927 :     if ( nSize )
      31           0 :         aData.reserve( nSize );
      32        2927 : }
      33             : 
      34        2520 : SwTabCols::SwTabCols( const SwTabCols& rCpy ) :
      35        2520 :     nLeftMin( rCpy.GetLeftMin() ),
      36        2520 :     nLeft( rCpy.GetLeft() ),
      37        2520 :     nRight( rCpy.GetRight() ),
      38        2520 :     nRightMax( rCpy.GetRightMax() ),
      39        2520 :     bLastRowAllowedToChange( rCpy.IsLastRowAllowedToChange() ),
      40       12600 :     aData( rCpy.GetData() )
      41             : {
      42        2520 : }
      43             : 
      44           7 : SwTabCols &SwTabCols::operator=( const SwTabCols& rCpy )
      45             : {
      46           7 :     nLeftMin = rCpy.GetLeftMin();
      47           7 :     nLeft    = rCpy.GetLeft();
      48           7 :     nRight   = rCpy.GetRight();
      49           7 :     nRightMax= rCpy.GetRightMax();
      50           7 :     bLastRowAllowedToChange = rCpy.IsLastRowAllowedToChange();
      51             : 
      52           7 :     Remove( 0, Count() );
      53           7 :     aData = rCpy.GetData();
      54             : 
      55           7 :     return *this;
      56             : }
      57             : 
      58           0 : bool SwTabCols::operator==( const SwTabCols& rCmp ) const
      59             : {
      60           0 :     if ( !(nLeftMin == rCmp.GetLeftMin() &&
      61           0 :            nLeft    == rCmp.GetLeft()    &&
      62           0 :            nRight   == rCmp.GetRight()   &&
      63           0 :            nRightMax== rCmp.GetRightMax()&&
      64           0 :            bLastRowAllowedToChange== rCmp.IsLastRowAllowedToChange() &&
      65           0 :            Count()== rCmp.Count()) )
      66           0 :         return false;
      67             : 
      68           0 :     for ( size_t i = 0; i < Count(); ++i )
      69             :     {
      70           0 :         SwTabColsEntry aEntry1 = aData[i];
      71           0 :         SwTabColsEntry aEntry2 = rCmp.GetData()[i];
      72           0 :         if ( aEntry1.nPos != aEntry2.nPos || aEntry1.bHidden != aEntry2.bHidden )
      73           0 :             return false;
      74             :     }
      75             : 
      76           0 :     return true;
      77             : }
      78             : 
      79           3 : void SwTabCols::Insert( long nValue, long nMin, long nMax,
      80             :                         bool bValue, size_t nPos )
      81             : {
      82             :     SwTabColsEntry aEntry;
      83           3 :     aEntry.nPos = nValue;
      84           3 :     aEntry.nMin = nMin;
      85           3 :     aEntry.nMax = nMax;
      86           3 :     aEntry.bHidden = bValue;
      87           3 :     aData.insert( aData.begin() + nPos, aEntry );
      88           3 : }
      89             : 
      90        8231 : void SwTabCols::Insert( long nValue, bool bValue, size_t nPos )
      91             : {
      92             :     SwTabColsEntry aEntry;
      93        8231 :     aEntry.nPos = nValue;
      94        8231 :     aEntry.nMin = 0;
      95        8231 :     aEntry.nMax = LONG_MAX;
      96        8231 :     aEntry.bHidden = bValue;
      97        8231 :     aData.insert( aData.begin() + nPos, aEntry );
      98             : 
      99             : #if OSL_DEBUG_LEVEL > 1
     100             :     SwTabColsEntries::iterator aPos = aData.begin();
     101             :     for ( ; aPos != aData.end(); ++aPos )
     102             :     {
     103             :         aEntry =(*aPos);
     104             :     }
     105             : #endif
     106        8231 : }
     107             : 
     108        5847 : void SwTabCols::Remove( size_t nPos, size_t nCount )
     109             : {
     110        5847 :     SwTabColsEntries::iterator aStart = aData.begin() + nPos;
     111        5847 :     aData.erase( aStart, aStart + nCount );
     112        5847 : }
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11