Bump version to 6.4-15
[LibreOffice.git] / sc / inc / olinetab.hxx
blobcdaa74d19a9374cd7d39176cee48811556dbf815
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 INCLUDED_SC_INC_OLINETAB_HXX
21 #define INCLUDED_SC_INC_OLINETAB_HXX
23 #include "scdllapi.h"
24 #include "address.hxx"
26 #include <map>
28 #define SC_OL_MAXDEPTH 7
30 class ScTable;
32 class ScOutlineEntry
34 SCCOLROW nStart;
35 SCSIZE nSize;
36 bool bHidden;
37 bool bVisible;
39 public:
40 ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden );
41 ScOutlineEntry( const ScOutlineEntry& rEntry );
43 SC_DLLPUBLIC SCCOLROW GetStart() const { return nStart;}
44 SCSIZE GetSize() const { return nSize;}
45 SC_DLLPUBLIC SCCOLROW GetEnd() const;
47 /**
48 * @return true is the group is hidden, false otherwise.
50 SC_DLLPUBLIC bool IsHidden() const { return bHidden;}
52 /**
53 * @return true if the control is visible, false otherwise.
55 SC_DLLPUBLIC bool IsVisible() const { return bVisible;}
57 void Move( SCCOLROW nDelta );
58 void SetSize( SCSIZE nNewSize );
59 void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
60 void SetHidden( bool bNewHidden );
61 void SetVisible( bool bNewVisible );
63 OString dumpAsString() const;
66 class ScOutlineCollection
68 typedef std::map<SCCOLROW, ScOutlineEntry> MapType;
69 MapType m_Entries;
71 public:
72 typedef MapType::iterator iterator;
73 typedef MapType::const_iterator const_iterator;
75 ScOutlineCollection();
77 size_t size() const;
78 void clear();
79 void insert(ScOutlineEntry const& rEntry);
80 iterator begin();
81 iterator end();
82 const_iterator begin() const;
83 const_iterator end() const;
84 void erase(const iterator& pos);
85 bool empty() const;
87 iterator FindStart(SCCOLROW nMinStart);
89 OString dumpAsString() const;
92 class SC_DLLPUBLIC ScOutlineArray
94 friend class ScSubOutlineIterator;
96 private:
97 size_t nDepth;
98 ScOutlineCollection aCollections[SC_OL_MAXDEPTH];
100 bool DecDepth();
101 void FindEntry(
102 SCCOLROW nSearchPos, size_t& rFindLevel, size_t& rFindIndex,
103 size_t nMaxLevel = SC_OL_MAXDEPTH);
105 void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel);
107 public:
108 ScOutlineArray();
109 ScOutlineArray( const ScOutlineArray& rArray );
111 size_t GetDepth() const { return nDepth;}
113 bool FindTouchedLevel(
114 SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rFindLevel) const;
116 bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, bool& rSizeChanged,
117 bool bHidden = false );
118 bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool& rSizeChanged );
120 ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex);
121 const ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex) const;
122 size_t GetCount(size_t nLevel) const;
123 const ScOutlineEntry* GetEntryByPos(size_t nLevel, SCCOLROW nPos) const;
125 bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t& rnIndex) const;
126 bool GetEntryIndexInRange(
127 size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rnIndex) const;
129 void SetVisibleBelow(
130 size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden = false);
132 void GetRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
133 void ExtendBlock(size_t nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd);
135 bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const;
136 void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize);
137 bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize);
139 bool ManualAction(
140 SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
142 void finalizeImport(const ScTable& rTable);
144 void RemoveAll();
146 OString dumpAsString() const;
149 class ScOutlineTable
151 private:
152 ScOutlineArray aColOutline;
153 ScOutlineArray aRowOutline;
155 public:
156 ScOutlineTable();
157 ScOutlineTable( const ScOutlineTable& rOutline );
159 const ScOutlineArray& GetColArray() const { return aColOutline; }
160 ScOutlineArray& GetColArray() { return aColOutline; }
161 const ScOutlineArray& GetRowArray() const { return aRowOutline; }
162 ScOutlineArray& GetRowArray() { return aRowOutline; }
164 bool TestInsertCol( SCSIZE nSize );
165 void InsertCol( SCCOL nStartCol, SCSIZE nSize );
166 bool DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original
167 bool TestInsertRow( SCSIZE nSize );
168 void InsertRow( SCROW nStartRow, SCSIZE nSize );
169 bool DeleteRow( SCROW nStartRow, SCSIZE nSize );
172 class ScSubOutlineIterator
174 private:
175 ScOutlineArray* pArray;
176 SCCOLROW nStart;
177 SCCOLROW nEnd;
178 size_t nSubLevel;
179 size_t nSubEntry;
180 size_t nDepth;
182 public:
183 ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
184 ScSubOutlineIterator( ScOutlineArray* pOutlineArray, size_t nLevel, size_t nEntry );
186 ScOutlineEntry* GetNext();
187 size_t LastLevel() const { return nSubLevel;}
188 size_t LastEntry() const;
189 void DeleteLast();
192 #endif
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */