LCOV - code coverage report
Current view: top level - sc/inc - olinetab.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 7 100.0 %
Date: 2012-08-25 Functions: 7 7 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_OUTLINETAB_HXX
      30                 :            : #define SC_OUTLINETAB_HXX
      31                 :            : 
      32                 :            : #include "scdllapi.h"
      33                 :            : #include "address.hxx"
      34                 :            : 
      35                 :            : #include <boost/ptr_container/ptr_map.hpp>
      36                 :            : 
      37                 :            : #define SC_OL_MAXDEPTH      7
      38                 :            : 
      39                 :            : class ScTable;
      40                 :            : 
      41                 :            : 
      42                 :            : class ScOutlineEntry
      43                 :            : {
      44                 :            :     SCCOLROW    nStart;
      45                 :            :     SCSIZE      nSize;
      46                 :            :     bool        bHidden;
      47                 :            :     bool        bVisible;
      48                 :            : 
      49                 :            : public:
      50                 :            :     ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden = false );
      51                 :            :     ScOutlineEntry( const ScOutlineEntry& rEntry );
      52                 :            : 
      53                 :            :     SCCOLROW GetStart() const;
      54                 :            :     SCSIZE GetSize() const;
      55                 :            :     SC_DLLPUBLIC SCCOLROW GetEnd() const;
      56                 :            : 
      57                 :            :     /**
      58                 :            :      * @return true is the group is hidden, false otherwise.
      59                 :            :      */
      60                 :            :     SC_DLLPUBLIC bool IsHidden() const;
      61                 :            : 
      62                 :            :     /**
      63                 :            :      * @return true if the control is visible, false otherwise.
      64                 :            :      */
      65                 :            :     bool IsVisible() const;
      66                 :            : 
      67                 :            :     void                    Move( SCsCOLROW nDelta );
      68                 :            :     void                    SetSize( SCSIZE nNewSize );
      69                 :            :     void                    SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
      70                 :            :     void                    SetHidden( bool bNewHidden );
      71                 :            :     void                    SetVisible( bool bNewVisible );
      72                 :            : };
      73                 :            : 
      74                 :       8876 : class ScOutlineCollection
      75                 :            : {
      76                 :            :     typedef boost::ptr_map<SCCOLROW, ScOutlineEntry> MapType;
      77                 :            :     MapType maEntries;
      78                 :            : 
      79                 :            : public:
      80                 :            :     typedef MapType::iterator iterator;
      81                 :            :     typedef MapType::const_iterator const_iterator;
      82                 :            : 
      83                 :            :     ScOutlineCollection();
      84                 :            : 
      85                 :            :     size_t size() const;
      86                 :            :     void clear();
      87                 :            :     void insert(ScOutlineEntry* pEntry);
      88                 :            :     iterator begin();
      89                 :            :     iterator end();
      90                 :            :     const_iterator begin() const;
      91                 :            :     const_iterator end() const;
      92                 :            :     void erase(iterator pos);
      93                 :            :     bool empty() const;
      94                 :            : 
      95                 :            :     iterator FindStart(SCCOLROW nMinStart);
      96                 :            : };
      97                 :            : 
      98 [ +  - ][ +  + ]:      10144 : class SC_DLLPUBLIC ScOutlineArray
      99                 :            : {
     100                 :            : friend class ScSubOutlineIterator;
     101                 :            : 
     102                 :            : private:
     103                 :            :     size_t nDepth;
     104                 :            :     ScOutlineCollection     aCollections[SC_OL_MAXDEPTH];
     105                 :            : 
     106                 :            :     bool DecDepth();
     107                 :            :     void FindEntry(
     108                 :            :         SCCOLROW nSearchPos, size_t& rFindLevel, size_t& rFindIndex,
     109                 :            :         size_t nMaxLevel = SC_OL_MAXDEPTH);
     110                 :            : 
     111                 :            :     void RemoveSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nLevel);
     112                 :            :     void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel);
     113                 :            : 
     114                 :            : public:
     115                 :            :     ScOutlineArray();
     116                 :            :     ScOutlineArray( const ScOutlineArray& rArray );
     117                 :            : 
     118                 :            :     size_t GetDepth() const;
     119                 :            : 
     120                 :            :     bool FindTouchedLevel(
     121                 :            :         SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rFindLevel) const;
     122                 :            : 
     123                 :            :     bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, bool& rSizeChanged,
     124                 :            :                  bool bHidden = false, bool bVisible = true );
     125                 :            :     bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool& rSizeChanged );
     126                 :            : 
     127                 :            :     ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex);
     128                 :            :     const ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex) const;
     129                 :            :     size_t GetCount(size_t nLevel) const;
     130                 :            :     const ScOutlineEntry* GetEntryByPos(size_t nLevel, SCCOLROW nPos) const;
     131                 :            : 
     132                 :            :     bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t& rnIndex) const;
     133                 :            :     bool GetEntryIndexInRange(
     134                 :            :         size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rnIndex) const;
     135                 :            : 
     136                 :            :     void SetVisibleBelow(
     137                 :            :         size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden = false);
     138                 :            : 
     139                 :            :     void GetRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
     140                 :            :     void ExtendBlock(size_t nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd);
     141                 :            : 
     142                 :            :     bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const;
     143                 :            :     void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize);
     144                 :            :     bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize);
     145                 :            : 
     146                 :            :     bool ManualAction(
     147                 :            :         SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
     148                 :            : 
     149                 :            :     void RemoveAll();
     150                 :            : };
     151                 :            : 
     152                 :            : 
     153         [ +  - ]:        538 : class ScOutlineTable
     154                 :            : {
     155                 :            : private:
     156                 :            :     ScOutlineArray          aColOutline;
     157                 :            :     ScOutlineArray          aRowOutline;
     158                 :            : 
     159                 :            : public:
     160                 :            :                             ScOutlineTable();
     161                 :            :                             ScOutlineTable( const ScOutlineTable& rOutline );
     162                 :            : 
     163                 :         96 :     const ScOutlineArray*   GetColArray() const     { return &aColOutline; }
     164                 :        553 :     ScOutlineArray*         GetColArray()           { return &aColOutline; }
     165                 :        116 :     const ScOutlineArray*   GetRowArray() const     { return &aRowOutline; }
     166                 :        555 :     ScOutlineArray*         GetRowArray()           { return &aRowOutline; }
     167                 :            : 
     168                 :            :     sal_Bool                    TestInsertCol( SCSIZE nSize );
     169                 :            :     void                    InsertCol( SCCOL nStartCol, SCSIZE nSize );
     170                 :            :     sal_Bool                    DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original
     171                 :            :     sal_Bool                    TestInsertRow( SCSIZE nSize );
     172                 :            :     void                    InsertRow( SCROW nStartRow, SCSIZE nSize );
     173                 :            :     sal_Bool                    DeleteRow( SCROW nStartRow, SCSIZE nSize );
     174                 :            : };
     175                 :            : 
     176                 :            : 
     177                 :            : class ScSubOutlineIterator
     178                 :            : {
     179                 :            : private:
     180                 :            :     ScOutlineArray*         pArray;
     181                 :            :     SCCOLROW                nStart;
     182                 :            :     SCCOLROW                nEnd;
     183                 :            :     size_t                  nSubLevel;
     184                 :            :     size_t                  nSubEntry;
     185                 :            :     size_t                  nCount;
     186                 :            :     size_t                  nDepth;
     187                 :            : 
     188                 :            : public:
     189                 :            :     ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
     190                 :            :     ScSubOutlineIterator( ScOutlineArray* pOutlineArray, size_t nLevel, size_t nEntry );
     191                 :            : 
     192                 :            :     ScOutlineEntry* GetNext();
     193                 :            :     size_t LastLevel() const;
     194                 :            :     size_t LastEntry() const;
     195                 :            :     void DeleteLast();
     196                 :            : };
     197                 :            : 
     198                 :            : #endif
     199                 :            : 
     200                 :            : 
     201                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10