update dev300-m57
[ooovba.git] / sc / inc / olinetab.hxx
blob456d223662b3cb43a84207535558d8dfb235213a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: olinetab.hxx,v $
10 * $Revision: 1.6.32.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_OUTLINETAB_HXX
32 #define SC_OUTLINETAB_HXX
35 #include "collect.hxx"
36 #include "compressedarray.hxx"
37 #include "scdllapi.h"
39 #define SC_OL_MAXDEPTH 7
41 class SvStream;
44 class ScOutlineEntry : public ScDataObject
46 SCCOLROW nStart;
47 SCSIZE nSize;
48 BOOL bHidden;
49 BOOL bVisible;
51 public:
52 ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize,
53 BOOL bNewHidden = FALSE );
54 ScOutlineEntry( const ScOutlineEntry& rEntry );
56 virtual ScDataObject* Clone() const;
58 SCCOLROW GetStart() const { return nStart; }
59 SCSIZE GetSize() const { return nSize; }
60 SCCOLROW GetEnd() const { return nStart+nSize-1; }
61 BOOL IsHidden() const { return bHidden; } // Gruppe versteckt
62 BOOL IsVisible() const { return bVisible; } // Control sichtbar?
64 void Move( SCsCOLROW nDelta );
65 void SetSize( SCSIZE nNewSize );
66 void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
67 void SetHidden( BOOL bNewHidden );
68 void SetVisible( BOOL bNewVisible );
72 class ScOutlineCollection : public ScSortedCollection
74 public:
75 ScOutlineCollection();
77 virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
79 USHORT FindStart( SCCOLROW nMinStart );
83 class SC_DLLPUBLIC ScOutlineArray
85 friend class ScSubOutlineIterator;
87 private:
88 USHORT nDepth;
89 ScOutlineCollection aCollections[SC_OL_MAXDEPTH];
91 BOOL DecDepth();
92 void FindEntry( SCCOLROW nSearchPos, USHORT& rFindLevel, USHORT& rFindIndex,
93 USHORT nMaxLevel = SC_OL_MAXDEPTH );
94 void RemoveSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nLevel );
95 void PromoteSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nStartLevel );
97 public:
98 ScOutlineArray();
99 ScOutlineArray( const ScOutlineArray& rArray );
101 USHORT GetDepth() const { return nDepth; }
103 BOOL FindTouchedLevel( SCCOLROW nBlockStart, SCCOLROW nBlockEnd,
104 USHORT& rFindLevel ) const;
106 BOOL Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, BOOL& rSizeChanged,
107 BOOL bHidden = FALSE, BOOL bVisible = TRUE );
108 BOOL Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, BOOL& rSizeChanged );
110 ScOutlineEntry* GetEntry( USHORT nLevel, USHORT nIndex ) const;
111 USHORT GetCount( USHORT nLevel ) const;
112 ScOutlineEntry* GetEntryByPos( USHORT nLevel, SCCOLROW nPos ) const;
114 BOOL GetEntryIndex( USHORT nLevel, SCCOLROW nPos, USHORT& rnIndex ) const;
115 BOOL GetEntryIndexInRange(
116 USHORT nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd,
117 USHORT& rnIndex ) const;
119 void SetVisibleBelow( USHORT nLevel, USHORT nEntry, BOOL bValue,
120 BOOL bSkipHidden = FALSE );
122 void GetRange( SCCOLROW& rStart, SCCOLROW& rEnd ) const;
123 void ExtendBlock( USHORT nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd );
125 BOOL TestInsertSpace( SCSIZE nSize, SCCOLROW nMaxVal ) const;
126 void InsertSpace( SCCOLROW nStartPos, SCSIZE nSize );
127 BOOL DeleteSpace( SCCOLROW nStartPos, SCSIZE nSize );
129 BOOL ManualAction( SCCOLROW nStartPos, SCCOLROW nEndPos,
130 BOOL bShow,
131 const ScBitMaskCompressedArray< SCCOLROW, BYTE>& rHiddenFlags );
133 void RemoveAll();
137 class ScOutlineTable
139 private:
140 ScOutlineArray aColOutline;
141 ScOutlineArray aRowOutline;
143 public:
144 ScOutlineTable();
145 ScOutlineTable( const ScOutlineTable& rOutline );
147 const ScOutlineArray* GetColArray() const { return &aColOutline; }
148 ScOutlineArray* GetColArray() { return &aColOutline; }
149 const ScOutlineArray* GetRowArray() const { return &aRowOutline; }
150 ScOutlineArray* GetRowArray() { return &aRowOutline; }
152 BOOL TestInsertCol( SCSIZE nSize );
153 void InsertCol( SCCOL nStartCol, SCSIZE nSize );
154 BOOL DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo nur ueber Original
155 BOOL TestInsertRow( SCSIZE nSize );
156 void InsertRow( SCROW nStartRow, SCSIZE nSize );
157 BOOL DeleteRow( SCROW nStartRow, SCSIZE nSize );
161 class ScSubOutlineIterator
163 private:
164 ScOutlineArray* pArray;
165 SCCOLROW nStart;
166 SCCOLROW nEnd;
167 USHORT nSubLevel;
168 USHORT nSubEntry;
169 USHORT nCount;
170 USHORT nDepth;
172 public:
173 ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
174 ScSubOutlineIterator( ScOutlineArray* pOutlineArray,
175 USHORT nLevel, USHORT nEntry );
176 ScOutlineEntry* GetNext();
177 USHORT LastLevel() const;
178 USHORT LastEntry() const;
179 void DeleteLast();
182 #endif