LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/core/data - listenercontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 29 100.0 %
Date: 2013-07-09 Functions: 14 15 93.3 %
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             : namespace {
      17             : 
      18          41 : class PurgeAction : public ColumnSpanSet::Action
      19             : {
      20             :     ScDocument& mrDoc;
      21             :     sc::ColumnBlockPosition maBlockPos;
      22             : 
      23             : public:
      24          41 :     PurgeAction(ScDocument& rDoc) : mrDoc(rDoc) {}
      25             : 
      26          16 :     virtual void startColumn(SCTAB nTab, SCCOL nCol)
      27             :     {
      28          16 :         mrDoc.InitColumnBlockPosition(maBlockPos, nTab, nCol);
      29          16 :     }
      30             : 
      31          43 :     virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal)
      32             :     {
      33          43 :         if (bVal)
      34             :         {
      35          16 :             mrDoc.DeleteBroadcasters(maBlockPos, rPos, nLength);
      36             :         }
      37          43 :     };
      38             : };
      39             : 
      40             : }
      41             : 
      42          24 : StartListeningContext::StartListeningContext(ScDocument& rDoc) :
      43          24 :     mrDoc(rDoc), mpSet(new ColumnBlockPositionSet(rDoc)) {}
      44             : 
      45          12 : ScDocument& StartListeningContext::getDoc()
      46             : {
      47          12 :     return mrDoc;
      48             : }
      49             : 
      50          12 : ColumnBlockPosition* StartListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      51             : {
      52          12 :     return mpSet->getBlockPosition(nTab, nCol);
      53             : }
      54             : 
      55          41 : EndListeningContext::EndListeningContext(ScDocument& rDoc) :
      56          41 :     mrDoc(rDoc), maSet(false), mpPosSet(new ColumnBlockPositionSet(rDoc)) {}
      57             : 
      58         234 : ScDocument& EndListeningContext::getDoc()
      59             : {
      60         234 :     return mrDoc;
      61             : }
      62             : 
      63          38 : ColumnBlockPosition* EndListeningContext::getBlockPosition(SCTAB nTab, SCCOL nCol)
      64             : {
      65          38 :     return mpPosSet->getBlockPosition(nTab, nCol);
      66             : }
      67             : 
      68          34 : void EndListeningContext::addEmptyBroadcasterPosition(SCTAB nTab, SCCOL nCol, SCROW nRow)
      69             : {
      70          34 :     maSet.set(nTab, nCol, nRow, true);
      71          34 : }
      72             : 
      73          41 : void EndListeningContext::purgeEmptyBroadcasters()
      74             : {
      75          41 :     PurgeAction aAction(mrDoc);
      76          41 :     maSet.executeAction(aAction);
      77          41 : }
      78             : 
      79          93 : }
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10