1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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"
39 #define SC_OL_MAXDEPTH 7
45 class ScOutlineEntry
: public ScDataObject
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
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
;
90 ScOutlineCollection aCollections
[SC_OL_MAXDEPTH
];
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
);
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
);
139 ScOutlineArray aColOutline
;
140 ScOutlineArray aRowOutline
;
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
163 ScOutlineArray
* pArray
;
172 ScSubOutlineIterator( ScOutlineArray
* pOutlineArray
);
173 ScSubOutlineIterator( ScOutlineArray
* pOutlineArray
,
174 USHORT nLevel
, USHORT nEntry
);
175 ScOutlineEntry
* GetNext();
176 USHORT
LastLevel() const;
177 USHORT
LastEntry() const;