LCOV - code coverage report
Current view: top level - sc/inc - olinetab.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 13 92.3 %
Date: 2014-11-03 Functions: 12 13 92.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             :  * 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             : #ifndef INCLUDED_SC_INC_OLINETAB_HXX
      21             : #define INCLUDED_SC_INC_OLINETAB_HXX
      22             : 
      23             : #include "scdllapi.h"
      24             : #include "address.hxx"
      25             : 
      26             : #include <boost/ptr_container/ptr_map.hpp>
      27             : 
      28             : #define SC_OL_MAXDEPTH      7
      29             : 
      30             : class ScTable;
      31             : 
      32             : class ScOutlineEntry
      33             : {
      34             :     SCCOLROW    nStart;
      35             :     SCSIZE      nSize;
      36             :     bool        bHidden;
      37             :     bool        bVisible;
      38             : 
      39             : public:
      40             :     ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden = false );
      41             :     ScOutlineEntry( const ScOutlineEntry& rEntry );
      42             : 
      43        1860 :     SC_DLLPUBLIC SCCOLROW GetStart() const { return nStart;}
      44           0 :     SCSIZE GetSize() const { return nSize;}
      45             :     SC_DLLPUBLIC SCCOLROW GetEnd() const;
      46             : 
      47             :     /**
      48             :      * @return true is the group is hidden, false otherwise.
      49             :      */
      50          66 :     SC_DLLPUBLIC bool IsHidden() const { return bHidden;}
      51             : 
      52             :     /**
      53             :      * @return true if the control is visible, false otherwise.
      54             :      */
      55          28 :     SC_DLLPUBLIC bool IsVisible() const { return bVisible;}
      56             : 
      57             :     void                    Move( SCsCOLROW nDelta );
      58             :     void                    SetSize( SCSIZE nNewSize );
      59             :     void                    SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
      60             :     void                    SetHidden( bool bNewHidden );
      61             :     void                    SetVisible( bool bNewVisible );
      62             : };
      63             : 
      64        8960 : class ScOutlineCollection
      65             : {
      66             :     typedef boost::ptr_map<SCCOLROW, ScOutlineEntry> MapType;
      67             :     MapType maEntries;
      68             : 
      69             : public:
      70             :     typedef MapType::iterator iterator;
      71             :     typedef MapType::const_iterator const_iterator;
      72             : 
      73             :     ScOutlineCollection();
      74             : 
      75             :     size_t size() const;
      76             :     void clear();
      77             :     void insert(ScOutlineEntry* pEntry);
      78             :     iterator begin();
      79             :     iterator end();
      80             :     const_iterator begin() const;
      81             :     const_iterator end() const;
      82             :     void erase(iterator pos);
      83             :     bool empty() const;
      84             : 
      85             :     iterator FindStart(SCCOLROW nMinStart);
      86             : };
      87             : 
      88        1280 : class SC_DLLPUBLIC ScOutlineArray
      89             : {
      90             : friend class ScSubOutlineIterator;
      91             : 
      92             : private:
      93             :     size_t nDepth;
      94             :     ScOutlineCollection     aCollections[SC_OL_MAXDEPTH];
      95             : 
      96             :     bool DecDepth();
      97             :     void FindEntry(
      98             :         SCCOLROW nSearchPos, size_t& rFindLevel, size_t& rFindIndex,
      99             :         size_t nMaxLevel = SC_OL_MAXDEPTH);
     100             : 
     101             :     void RemoveSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nLevel);
     102             :     void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel);
     103             : 
     104             : public:
     105             :     ScOutlineArray();
     106             :     ScOutlineArray( const ScOutlineArray& rArray );
     107             : 
     108        3745 :     size_t GetDepth() const { return nDepth;}
     109             : 
     110             :     bool FindTouchedLevel(
     111             :         SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rFindLevel) const;
     112             : 
     113             :     bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, bool& rSizeChanged,
     114             :                  bool bHidden = false, bool bVisible = true );
     115             :     bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool& rSizeChanged );
     116             : 
     117             :     ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex);
     118             :     const ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex) const;
     119             :     size_t GetCount(size_t nLevel) const;
     120             :     const ScOutlineEntry* GetEntryByPos(size_t nLevel, SCCOLROW nPos) const;
     121             : 
     122             :     bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t& rnIndex) const;
     123             :     bool GetEntryIndexInRange(
     124             :         size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rnIndex) const;
     125             : 
     126             :     void SetVisibleBelow(
     127             :         size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden = false);
     128             : 
     129             :     void GetRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
     130             :     void ExtendBlock(size_t nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd);
     131             : 
     132             :     bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const;
     133             :     void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize);
     134             :     bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize);
     135             : 
     136             :     bool ManualAction(
     137             :         SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
     138             : 
     139             :     void RemoveAll();
     140             : };
     141             : 
     142         640 : class ScOutlineTable
     143             : {
     144             : private:
     145             :     ScOutlineArray          aColOutline;
     146             :     ScOutlineArray          aRowOutline;
     147             : 
     148             : public:
     149             :                             ScOutlineTable();
     150             :                             ScOutlineTable( const ScOutlineTable& rOutline );
     151             : 
     152        1778 :     const ScOutlineArray&   GetColArray() const     { return aColOutline; }
     153         672 :     ScOutlineArray&         GetColArray()           { return aColOutline; }
     154        1890 :     const ScOutlineArray&   GetRowArray() const     { return aRowOutline; }
     155         720 :     ScOutlineArray&         GetRowArray()           { return aRowOutline; }
     156             : 
     157             :     bool                    TestInsertCol( SCSIZE nSize );
     158             :     void                    InsertCol( SCCOL nStartCol, SCSIZE nSize );
     159             :     bool                    DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original
     160             :     bool                    TestInsertRow( SCSIZE nSize );
     161             :     void                    InsertRow( SCROW nStartRow, SCSIZE nSize );
     162             :     bool                    DeleteRow( SCROW nStartRow, SCSIZE nSize );
     163             : };
     164             : 
     165             : class ScSubOutlineIterator
     166             : {
     167             : private:
     168             :     ScOutlineArray*         pArray;
     169             :     SCCOLROW                nStart;
     170             :     SCCOLROW                nEnd;
     171             :     size_t                  nSubLevel;
     172             :     size_t                  nSubEntry;
     173             :     size_t                  nDepth;
     174             : 
     175             : public:
     176             :     ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
     177             :     ScSubOutlineIterator( ScOutlineArray* pOutlineArray, size_t nLevel, size_t nEntry );
     178             : 
     179             :     ScOutlineEntry* GetNext();
     180          36 :     size_t LastLevel() const { return nSubLevel;}
     181             :     size_t LastEntry() const;
     182             :     void DeleteLast();
     183             : };
     184             : 
     185             : #endif
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10