1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_OUTLINETAB_HXX
21 #define SC_OUTLINETAB_HXX
24 #include "address.hxx"
26 #include <boost/ptr_container/ptr_map.hpp>
28 #define SC_OL_MAXDEPTH 7
41 ScOutlineEntry( SCCOLROW nNewStart
, SCCOLROW nNewSize
, bool bNewHidden
= false );
42 ScOutlineEntry( const ScOutlineEntry
& rEntry
);
44 SC_DLLPUBLIC SCCOLROW
GetStart() const;
45 SCSIZE
GetSize() const;
46 SC_DLLPUBLIC SCCOLROW
GetEnd() const;
49 * @return true is the group is hidden, false otherwise.
51 SC_DLLPUBLIC
bool IsHidden() const;
54 * @return true if the control is visible, false otherwise.
56 SC_DLLPUBLIC
bool IsVisible() const;
58 void Move( SCsCOLROW nDelta
);
59 void SetSize( SCSIZE nNewSize
);
60 void SetPosSize( SCCOLROW nNewPos
, SCSIZE nNewSize
);
61 void SetHidden( bool bNewHidden
);
62 void SetVisible( bool bNewVisible
);
65 class ScOutlineCollection
67 typedef boost::ptr_map
<SCCOLROW
, ScOutlineEntry
> MapType
;
71 typedef MapType::iterator iterator
;
72 typedef MapType::const_iterator const_iterator
;
74 ScOutlineCollection();
78 void insert(ScOutlineEntry
* pEntry
);
81 const_iterator
begin() const;
82 const_iterator
end() const;
83 void erase(iterator pos
);
86 iterator
FindStart(SCCOLROW nMinStart
);
89 class SC_DLLPUBLIC ScOutlineArray
91 friend class ScSubOutlineIterator
;
95 ScOutlineCollection aCollections
[SC_OL_MAXDEPTH
];
99 SCCOLROW nSearchPos
, size_t& rFindLevel
, size_t& rFindIndex
,
100 size_t nMaxLevel
= SC_OL_MAXDEPTH
);
102 void RemoveSub(SCCOLROW nStartPos
, SCCOLROW nEndPos
, size_t nLevel
);
103 void PromoteSub(SCCOLROW nStartPos
, SCCOLROW nEndPos
, size_t nStartLevel
);
107 ScOutlineArray( const ScOutlineArray
& rArray
);
109 size_t GetDepth() const;
111 bool FindTouchedLevel(
112 SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, size_t& rFindLevel
) const;
114 bool Insert( SCCOLROW nStartPos
, SCCOLROW nEndPos
, bool& rSizeChanged
,
115 bool bHidden
= false, bool bVisible
= true );
116 bool Remove( SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, bool& rSizeChanged
);
118 ScOutlineEntry
* GetEntry(size_t nLevel
, size_t nIndex
);
119 const ScOutlineEntry
* GetEntry(size_t nLevel
, size_t nIndex
) const;
120 size_t GetCount(size_t nLevel
) const;
121 const ScOutlineEntry
* GetEntryByPos(size_t nLevel
, SCCOLROW nPos
) const;
123 bool GetEntryIndex(size_t nLevel
, SCCOLROW nPos
, size_t& rnIndex
) const;
124 bool GetEntryIndexInRange(
125 size_t nLevel
, SCCOLROW nBlockStart
, SCCOLROW nBlockEnd
, size_t& rnIndex
) const;
127 void SetVisibleBelow(
128 size_t nLevel
, size_t nEntry
, bool bValue
, bool bSkipHidden
= false);
130 void GetRange(SCCOLROW
& rStart
, SCCOLROW
& rEnd
) const;
131 void ExtendBlock(size_t nLevel
, SCCOLROW
& rBlkStart
, SCCOLROW
& rBlkEnd
);
133 bool TestInsertSpace(SCSIZE nSize
, SCCOLROW nMaxVal
) const;
134 void InsertSpace(SCCOLROW nStartPos
, SCSIZE nSize
);
135 bool DeleteSpace(SCCOLROW nStartPos
, SCSIZE nSize
);
138 SCCOLROW nStartPos
, SCCOLROW nEndPos
, bool bShow
, const ScTable
& rTable
, bool bCol
);
147 ScOutlineArray aColOutline
;
148 ScOutlineArray aRowOutline
;
152 ScOutlineTable( const ScOutlineTable
& rOutline
);
154 const ScOutlineArray
* GetColArray() const { return &aColOutline
; }
155 ScOutlineArray
* GetColArray() { return &aColOutline
; }
156 const ScOutlineArray
* GetRowArray() const { return &aRowOutline
; }
157 ScOutlineArray
* GetRowArray() { return &aRowOutline
; }
159 sal_Bool
TestInsertCol( SCSIZE nSize
);
160 void InsertCol( SCCOL nStartCol
, SCSIZE nSize
);
161 sal_Bool
DeleteCol( SCCOL nStartCol
, SCSIZE nSize
); // TRUE: Undo only using original
162 sal_Bool
TestInsertRow( SCSIZE nSize
);
163 void InsertRow( SCROW nStartRow
, SCSIZE nSize
);
164 sal_Bool
DeleteRow( SCROW nStartRow
, SCSIZE nSize
);
168 class ScSubOutlineIterator
171 ScOutlineArray
* pArray
;
179 ScSubOutlineIterator( ScOutlineArray
* pOutlineArray
);
180 ScSubOutlineIterator( ScOutlineArray
* pOutlineArray
, size_t nLevel
, size_t nEntry
);
182 ScOutlineEntry
* GetNext();
183 size_t LastLevel() const;
184 size_t LastEntry() const;
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */