Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / olinetab.hxx
blob42c565f7f8b0260c88d7e54bbdfad666742325d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include "scdllapi.h"
24 #include "address.hxx"
26 #include <boost/ptr_container/ptr_map.hpp>
28 #define SC_OL_MAXDEPTH 7
30 class ScTable;
33 class ScOutlineEntry
35 SCCOLROW nStart;
36 SCSIZE nSize;
37 bool bHidden;
38 bool bVisible;
40 public:
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;
48 /**
49 * @return true is the group is hidden, false otherwise.
51 SC_DLLPUBLIC bool IsHidden() const;
53 /**
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;
68 MapType maEntries;
70 public:
71 typedef MapType::iterator iterator;
72 typedef MapType::const_iterator const_iterator;
74 ScOutlineCollection();
76 size_t size() const;
77 void clear();
78 void insert(ScOutlineEntry* pEntry);
79 iterator begin();
80 iterator end();
81 const_iterator begin() const;
82 const_iterator end() const;
83 void erase(iterator pos);
84 bool empty() const;
86 iterator FindStart(SCCOLROW nMinStart);
89 class SC_DLLPUBLIC ScOutlineArray
91 friend class ScSubOutlineIterator;
93 private:
94 size_t nDepth;
95 ScOutlineCollection aCollections[SC_OL_MAXDEPTH];
97 bool DecDepth();
98 void FindEntry(
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);
105 public:
106 ScOutlineArray();
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);
137 bool ManualAction(
138 SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
140 void RemoveAll();
144 class ScOutlineTable
146 private:
147 ScOutlineArray aColOutline;
148 ScOutlineArray aRowOutline;
150 public:
151 ScOutlineTable();
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
170 private:
171 ScOutlineArray* pArray;
172 SCCOLROW nStart;
173 SCCOLROW nEnd;
174 size_t nSubLevel;
175 size_t nSubEntry;
176 size_t nDepth;
178 public:
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;
185 void DeleteLast();
188 #endif
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */