LCOV - code coverage report
Current view: top level - sc/source/core/tool - detdata.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 42 16.7 %
Date: 2015-06-13 12:38:46 Functions: 4 8 50.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 "detdata.hxx"
      21             : #include "refupdat.hxx"
      22             : #include "rechead.hxx"
      23             : 
      24           0 : ScDetOpList::ScDetOpList(const ScDetOpList& rList) :
      25           0 :     bHasAddError( false )
      26             : {
      27           0 :     size_t nCount = rList.Count();
      28             : 
      29           0 :     for (size_t i=0; i<nCount; i++)
      30           0 :         Append( new ScDetOpData(rList.aDetOpDataVector[i]) );
      31           0 : }
      32             : 
      33           0 : void ScDetOpList::DeleteOnTab( SCTAB nTab )
      34             : {
      35           0 :     for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); /*noop*/ )
      36             :     {
      37             :         // look for operations on the deleted sheet
      38           0 :         if (it->GetPos().Tab() == nTab)
      39           0 :             it = aDetOpDataVector.erase( it);
      40             :         else
      41           0 :             ++it;
      42             :     }
      43           0 : }
      44             : 
      45           0 : void ScDetOpList::UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
      46             :                                 const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
      47             : {
      48           0 :     for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); ++it )
      49             :     {
      50           0 :         ScAddress aPos = it->GetPos();
      51           0 :         SCCOL nCol1 = aPos.Col();
      52           0 :         SCROW nRow1 = aPos.Row();
      53           0 :         SCTAB nTab1 = aPos.Tab();
      54           0 :         SCCOL nCol2 = nCol1;
      55           0 :         SCROW nRow2 = nRow1;
      56           0 :         SCTAB nTab2 = nTab1;
      57             : 
      58             :         ScRefUpdateRes eRes =
      59             :             ScRefUpdate::Update( pDoc, eUpdateRefMode,
      60           0 :                 rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(),
      61           0 :                 rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(), nDx, nDy, nDz,
      62           0 :                 nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
      63           0 :         if ( eRes != UR_NOTHING )
      64           0 :             it->SetPos( ScAddress( nCol1, nRow1, nTab1 ) );
      65             :     }
      66           0 : }
      67             : 
      68          11 : void ScDetOpList::Append( ScDetOpData* pDetOpData )
      69             : {
      70          11 :     if ( pDetOpData->GetOperation() == SCDETOP_ADDERROR )
      71           0 :         bHasAddError = true;
      72             : 
      73          11 :     aDetOpDataVector.push_back( pDetOpData );
      74          11 : }
      75             : 
      76           0 : bool ScDetOpList::operator==( const ScDetOpList& r ) const
      77             : {
      78             :     // for Ref-Undo
      79             : 
      80           0 :     size_t nCount = Count();
      81           0 :     bool bEqual = ( nCount == r.Count() );
      82           0 :     for (size_t i=0; i<nCount && bEqual; i++)       // order has to be the same
      83           0 :         if ( !(aDetOpDataVector[i] == r.aDetOpDataVector[i]) )    // entries are different ?
      84           0 :             bEqual = false;
      85             : 
      86           0 :     return bEqual;
      87             : }
      88             : 
      89          31 : const ScDetOpData* ScDetOpList::GetObject( size_t nPos ) const
      90             : {
      91          31 :     return &aDetOpDataVector[nPos];
      92         156 : }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11