LCOV - code coverage report
Current view: top level - sc/source/core/data - listenercontext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 39 39 100.0 %
Date: 2014-11-03 Functions: 15 15 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        1834 : StartListeningContext::StartListeningContext(ScDocument& rDoc) :
      17        1834 :     mrDoc(rDoc), mpSet(new ColumnBlockPositionSet(rDoc)) {}
      18             : 
      19          16 : StartListeningContext::StartListeningContext(
      20             :     ScDocument& rDoc, const boost::shared_ptr<ColumnBlockPositionSet>& pSet) :
      21          16 :     mrDoc(rDoc), mpSet(pSet) {}
      22             : 
      23       22946 : ColumnBlockPosition* StartListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      24             : {
      25       22946 :     return mpSet->getBlockPosition(nTab, nCol);
      26             : }
      27             : 
      28         374 : EndListeningContext::EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode) :
      29         374 :     mrDoc(rDoc), maSet(false), mpPosSet(new ColumnBlockPositionSet(rDoc)),
      30         748 :     mpOldCode(pOldCode), maPosDelta(0,0,0) {}
      31             : 
      32          16 : EndListeningContext::EndListeningContext(
      33             :     ScDocument& rDoc, const boost::shared_ptr<ColumnBlockPositionSet>& pSet, ScTokenArray* pOldCode) :
      34             :     mrDoc(rDoc), maSet(false), mpPosSet(pSet),
      35          16 :     mpOldCode(pOldCode), maPosDelta(0,0,0) {}
      36             : 
      37          56 : void EndListeningContext::setPositionDelta( const ScAddress& rDelta )
      38             : {
      39          56 :     maPosDelta = rDelta;
      40          56 : }
      41             : 
      42         846 : ScAddress EndListeningContext::getOldPosition( const ScAddress& rPos ) const
      43             : {
      44         846 :     ScAddress aOldPos = rPos;
      45         846 :     aOldPos.IncCol(maPosDelta.Col());
      46         846 :     aOldPos.IncRow(maPosDelta.Row());
      47         846 :     aOldPos.IncTab(maPosDelta.Tab());
      48         846 :     return aOldPos;
      49             : }
      50             : 
      51         528 : ColumnBlockPosition* EndListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      52             : {
      53         528 :     return mpPosSet->getBlockPosition(nTab, nCol);
      54             : }
      55             : 
      56         466 : void EndListeningContext::addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
      57             : {
      58         466 :     maSet.set(nTab, nCol, nRow, true);
      59         466 : }
      60             : 
      61         244 : void EndListeningContext::purgeEmptyBroadcasters()
      62             : {
      63         244 :     PurgeListenerAction aAction(mrDoc);
      64         244 :     maSet.executeAction(aAction);
      65         244 : }
      66             : 
      67         258 : PurgeListenerAction::PurgeListenerAction(ScDocument& rDoc) :
      68         258 :     mrDoc(rDoc), mpBlockPos(new ColumnBlockPosition) {}
      69             : 
      70         152 : void PurgeListenerAction::startColumn( SCTAB nTab, SCCOL nCol )
      71             : {
      72         152 :     mrDoc.InitColumnBlockPosition(*mpBlockPos, nTab, nCol);
      73         152 : }
      74             : 
      75         442 : void PurgeListenerAction::execute( const ScAddress& rPos, SCROW nLength, bool bVal )
      76             : {
      77         442 :     if (bVal)
      78             :     {
      79         164 :         mrDoc.DeleteBroadcasters(*mpBlockPos, rPos, nLength);
      80             :     }
      81         442 : };
      82             : 
      83         228 : }
      84             : 
      85             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10