LCOV - code coverage report
Current view: top level - sc/source/core/data - listenercontext.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 41 41 100.0 %
Date: 2014-04-11 Functions: 16 16 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             : 
      10             : #include "listenercontext.hxx"
      11             : #include "document.hxx"
      12             : #include "mtvelements.hxx"
      13             : 
      14             : namespace sc {
      15             : 
      16         592 : StartListeningContext::StartListeningContext(ScDocument& rDoc) :
      17         592 :     mrDoc(rDoc), mpSet(new ColumnBlockPositionSet(rDoc)) {}
      18             : 
      19        3859 : ScDocument& StartListeningContext::getDoc()
      20             : {
      21        3859 :     return mrDoc;
      22             : }
      23             : 
      24        5996 : ColumnBlockPosition* StartListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      25             : {
      26        5996 :     return mpSet->getBlockPosition(nTab, nCol);
      27             : }
      28             : 
      29         155 : EndListeningContext::EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode) :
      30         155 :     mrDoc(rDoc), maSet(false), mpPosSet(new ColumnBlockPositionSet(rDoc)),
      31         310 :     mpOldCode(pOldCode), maPosDelta(0,0,0) {}
      32             : 
      33          19 : void EndListeningContext::setPositionDelta( const ScAddress& rDelta )
      34             : {
      35          19 :     maPosDelta = rDelta;
      36          19 : }
      37             : 
      38         681 : ScDocument& EndListeningContext::getDoc()
      39             : {
      40         681 :     return mrDoc;
      41             : }
      42             : 
      43         340 : ScTokenArray* EndListeningContext::getOldCode()
      44             : {
      45         340 :     return mpOldCode;
      46             : }
      47             : 
      48         340 : ScAddress EndListeningContext::getOldPosition( const ScAddress& rPos ) const
      49             : {
      50         340 :     ScAddress aOldPos = rPos;
      51         340 :     aOldPos.IncCol(maPosDelta.Col());
      52         340 :     aOldPos.IncRow(maPosDelta.Row());
      53         340 :     aOldPos.IncTab(maPosDelta.Tab());
      54         340 :     return aOldPos;
      55             : }
      56             : 
      57         218 : ColumnBlockPosition* EndListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      58             : {
      59         218 :     return mpPosSet->getBlockPosition(nTab, nCol);
      60             : }
      61             : 
      62         194 : void EndListeningContext::addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
      63             : {
      64         194 :     maSet.set(nTab, nCol, nRow, true);
      65         194 : }
      66             : 
      67         104 : void EndListeningContext::purgeEmptyBroadcasters()
      68             : {
      69         104 :     PurgeListenerAction aAction(mrDoc);
      70         104 :     maSet.executeAction(aAction);
      71         104 : }
      72             : 
      73         107 : PurgeListenerAction::PurgeListenerAction(ScDocument& rDoc) :
      74         107 :     mrDoc(rDoc), mpBlockPos(new ColumnBlockPosition) {}
      75             : 
      76          66 : void PurgeListenerAction::startColumn( SCTAB nTab, SCCOL nCol )
      77             : {
      78          66 :     mrDoc.InitColumnBlockPosition(*mpBlockPos, nTab, nCol);
      79          66 : }
      80             : 
      81         195 : void PurgeListenerAction::execute( const ScAddress& rPos, SCROW nLength, bool bVal )
      82             : {
      83         195 :     if (bVal)
      84             :     {
      85          72 :         mrDoc.DeleteBroadcasters(*mpBlockPos, rPos, nLength);
      86             :     }
      87         195 : };
      88             : 
      89         102 : }
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10