LCOV - code coverage report
Current view: top level - sc/inc - columnspanset.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 0.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             : #ifndef SC_COLUMNSPANSET_HXX
      11             : #define SC_COLUMNSPANSET_HXX
      12             : 
      13             : #include "address.hxx"
      14             : 
      15             : #include <vector>
      16             : #include <mdds/flat_segment_tree.hpp>
      17             : #include <boost/noncopyable.hpp>
      18             : 
      19             : class ScDocument;
      20             : class ScColumn;
      21             : class ScMarkData;
      22             : class ScRange;
      23             : 
      24             : namespace sc {
      25             : 
      26             : struct ColumnBlockConstPosition;
      27             : 
      28             : struct RowSpan
      29             : {
      30             :     SCROW mnRow1;
      31             :     SCROW mnRow2;
      32             : 
      33             :     RowSpan(SCROW nRow1, SCROW nRow2);
      34             : };
      35             : 
      36             : struct SC_DLLPUBLIC ColRowSpan
      37             : {
      38             :     SCCOLROW mnStart;
      39             :     SCCOLROW mnEnd;
      40             : 
      41             :     ColRowSpan(SCCOLROW nStart, SCCOLROW nEnd);
      42             : };
      43             : 
      44             : /**
      45             :  * Structure that stores segments of boolean flags per column, and perform
      46             :  * custom action on those segments.
      47             :  */
      48             : class ColumnSpanSet : boost::noncopyable
      49             : {
      50             :     typedef mdds::flat_segment_tree<SCROW, bool> ColumnSpansType;
      51             : 
      52           0 :     struct ColumnType
      53             :     {
      54             :         ColumnSpansType maSpans;
      55             :         ColumnSpansType::const_iterator miPos;
      56             : 
      57             :         ColumnType(SCROW nStart, SCROW nEnd, bool bInit);
      58             :     };
      59             : 
      60             :     typedef std::vector<ColumnType*> TableType;
      61             :     typedef std::vector<TableType*> DocType;
      62             : 
      63             :     DocType maDoc;
      64             :     bool mbInit;
      65             : 
      66             :     ColumnType& getColumn(SCTAB nTab, SCCOL nCol);
      67             : 
      68             : public:
      69           0 :     class Action
      70             :     {
      71             :     public:
      72             :         virtual ~Action() = 0;
      73             :         virtual void startColumn(SCTAB nTab, SCCOL nCol);
      74             :         virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) = 0;
      75             :     };
      76             : 
      77           0 :     class ColumnAction
      78             :     {
      79             :     public:
      80             :         virtual ~ColumnAction() = 0;
      81             :         virtual void startColumn(ScColumn* pCol) = 0;
      82             :         virtual void execute(SCROW nRow1, SCROW nRow2, bool bVal) = 0;
      83             :     };
      84             : 
      85             :     ColumnSpanSet(bool bInit);
      86             :     ~ColumnSpanSet();
      87             : 
      88             :     void set(SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal);
      89             :     void set(SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, bool bVal);
      90             :     void set(const ScRange& rRange, bool bVal);
      91             : 
      92             :     void executeAction(Action& ac) const;
      93             :     void executeColumnAction(ScDocument& rDoc, ColumnAction& ac) const;
      94             : };
      95             : 
      96             : /**
      97             :  * Keep track of spans in a single column only.
      98             :  */
      99           0 : class SingleColumnSpanSet
     100             : {
     101             : public:
     102             :     typedef mdds::flat_segment_tree<SCROW, bool> ColumnSpansType;
     103             : 
     104             :     typedef std::vector<RowSpan> SpansType;
     105             : 
     106             :     SingleColumnSpanSet();
     107             : 
     108             :     /**
     109             :      * Scan an entire column and tag all non-empty cell positions.
     110             :      */
     111             :     void scan(const ScColumn& rColumn);
     112             : 
     113             :     /**
     114             :      * Scan a column between specified range, and tag all non-empty cell
     115             :      * positions.
     116             :      */
     117             :     void scan(const ScColumn& rColumn, SCROW nStart, SCROW nEnd);
     118             : 
     119             :     void scan(
     120             :         ColumnBlockConstPosition& rBlockPos, const ScColumn& rColumn, SCROW nStart, SCROW nEnd);
     121             : 
     122             :     /**
     123             :      * Scan all marked data and tag all marked segments in specified column.
     124             :      */
     125             :     void scan(const ScMarkData& rMark, SCTAB nTab, SCCOL nCol);
     126             : 
     127             :     void set(SCROW nRow1, SCROW nRow2, bool bVal);
     128             : 
     129             :     void getRows(std::vector<SCROW> &rRows) const;
     130             : 
     131             :     void getSpans(SpansType& rSpans) const;
     132             : 
     133             : private:
     134             :     ColumnSpansType maSpans;
     135             : };
     136             : 
     137             : }
     138             : 
     139             : #endif
     140             : 
     141             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10