update dev300-m58
[ooovba.git] / sc / inc / olinetab.hxx
bloba71519b7c7e8031bc109e5db16b4e396fe6e64fe
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;
42 class ScTable;
45 class ScOutlineEntry : public ScDataObject
47 SCCOLROW nStart;
48 SCSIZE nSize;
49 BOOL bHidden;
50 BOOL bVisible;
52 public:
53 ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize,
54 BOOL bNewHidden = FALSE );
55 ScOutlineEntry( const ScOutlineEntry& rEntry );
57 virtual ScDataObject* Clone() const;
59 SCCOLROW GetStart() const { return nStart; }
60 SCSIZE GetSize() const { return nSize; }
61 SCCOLROW GetEnd() const { return nStart+nSize-1; }
62 BOOL IsHidden() const { return bHidden; } // Gruppe versteckt
63 BOOL IsVisible() const { return bVisible; } // Control sichtbar?
65 void Move( SCsCOLROW nDelta );
66 void SetSize( SCSIZE nNewSize );
67 void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
68 void SetHidden( BOOL bNewHidden );
69 void SetVisible( BOOL bNewVisible );
73 class ScOutlineCollection : public ScSortedCollection
75 public:
76 ScOutlineCollection();
78 virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const;
80 USHORT FindStart( SCCOLROW nMinStart );
84 class SC_DLLPUBLIC ScOutlineArray
86 friend class ScSubOutlineIterator;
88 private:
89 USHORT nDepth;
90 ScOutlineCollection aCollections[SC_OL_MAXDEPTH];
92 BOOL DecDepth();
93 void FindEntry( SCCOLROW nSearchPos, USHORT& rFindLevel, USHORT& rFindIndex,
94 USHORT nMaxLevel = SC_OL_MAXDEPTH );
95 void RemoveSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nLevel );
96 void PromoteSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nStartLevel );
98 public:
99 ScOutlineArray();
100 ScOutlineArray( const ScOutlineArray& rArray );
102 USHORT GetDepth() const { return nDepth; }
104 BOOL FindTouchedLevel( SCCOLROW nBlockStart, SCCOLROW nBlockEnd,
105 USHORT& rFindLevel ) const;
107 BOOL Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, BOOL& rSizeChanged,
108 BOOL bHidden = FALSE, BOOL bVisible = TRUE );
109 BOOL Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, BOOL& rSizeChanged );
111 ScOutlineEntry* GetEntry( USHORT nLevel, USHORT nIndex ) const;
112 USHORT GetCount( USHORT nLevel ) const;
113 ScOutlineEntry* GetEntryByPos( USHORT nLevel, SCCOLROW nPos ) const;
115 BOOL GetEntryIndex( USHORT nLevel, SCCOLROW nPos, USHORT& rnIndex ) const;
116 BOOL GetEntryIndexInRange(
117 USHORT nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd,
118 USHORT& rnIndex ) const;
120 void SetVisibleBelow( USHORT nLevel, USHORT nEntry, BOOL bValue,
121 BOOL bSkipHidden = FALSE );
123 void GetRange( SCCOLROW& rStart, SCCOLROW& rEnd ) const;
124 void ExtendBlock( USHORT nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd );
126 BOOL TestInsertSpace( SCSIZE nSize, SCCOLROW nMaxVal ) const;
127 void InsertSpace( SCCOLROW nStartPos, SCSIZE nSize );
128 BOOL DeleteSpace( SCCOLROW nStartPos, SCSIZE nSize );
130 bool ManualAction( SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, ScTable& rTable, bool bCol );
132 void RemoveAll();
136 class ScOutlineTable
138 private:
139 ScOutlineArray aColOutline;
140 ScOutlineArray aRowOutline;
142 public:
143 ScOutlineTable();
144 ScOutlineTable( const ScOutlineTable& rOutline );
146 const ScOutlineArray* GetColArray() const { return &aColOutline; }
147 ScOutlineArray* GetColArray() { return &aColOutline; }
148 const ScOutlineArray* GetRowArray() const { return &aRowOutline; }
149 ScOutlineArray* GetRowArray() { return &aRowOutline; }
151 BOOL TestInsertCol( SCSIZE nSize );
152 void InsertCol( SCCOL nStartCol, SCSIZE nSize );
153 BOOL DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo nur ueber Original
154 BOOL TestInsertRow( SCSIZE nSize );
155 void InsertRow( SCROW nStartRow, SCSIZE nSize );
156 BOOL DeleteRow( SCROW nStartRow, SCSIZE nSize );
160 class ScSubOutlineIterator
162 private:
163 ScOutlineArray* pArray;
164 SCCOLROW nStart;
165 SCCOLROW nEnd;
166 USHORT nSubLevel;
167 USHORT nSubEntry;
168 USHORT nCount;
169 USHORT nDepth;
171 public:
172 ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
173 ScSubOutlineIterator( ScOutlineArray* pOutlineArray,
174 USHORT nLevel, USHORT nEntry );
175 ScOutlineEntry* GetNext();
176 USHORT LastLevel() const;
177 USHORT LastEntry() const;
178 void DeleteLast();
181 #endif