Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / olinetab.hxx
bloba25064d86c4ee7b61186ca123e13261e28530d98
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 );
64 class ScOutlineCollection
66 typedef std::map<SCCOLROW, ScOutlineEntry> MapType;
67 MapType m_Entries;
69 public:
70 typedef MapType::iterator iterator;
71 typedef MapType::const_iterator const_iterator;
73 ScOutlineCollection();
75 size_t size() const;
76 void clear();
77 void insert(ScOutlineEntry const& rEntry);
78 iterator begin();
79 iterator end();
80 const_iterator begin() const;
81 const_iterator end() const;
82 void erase(const iterator& pos);
83 bool empty() const;
85 iterator FindStart(SCCOLROW nMinStart);
88 class SC_DLLPUBLIC ScOutlineArray
90 friend class ScSubOutlineIterator;
92 private:
93 size_t nDepth;
94 ScOutlineCollection aCollections[SC_OL_MAXDEPTH];
96 bool DecDepth();
97 void FindEntry(
98 SCCOLROW nSearchPos, size_t& rFindLevel, size_t& rFindIndex,
99 size_t nMaxLevel = SC_OL_MAXDEPTH);
101 void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel);
103 public:
104 ScOutlineArray();
105 ScOutlineArray( const ScOutlineArray& rArray );
107 size_t GetDepth() const { return nDepth;}
109 bool FindTouchedLevel(
110 SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rFindLevel) const;
112 bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, bool& rSizeChanged,
113 bool bHidden = false );
114 bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool& rSizeChanged );
116 ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex);
117 const ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex) const;
118 size_t GetCount(size_t nLevel) const;
119 const ScOutlineEntry* GetEntryByPos(size_t nLevel, SCCOLROW nPos) const;
121 bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t& rnIndex) const;
122 bool GetEntryIndexInRange(
123 size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rnIndex) const;
125 void SetVisibleBelow(
126 size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden = false);
128 void GetRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
129 void ExtendBlock(size_t nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd);
131 bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const;
132 void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize);
133 bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize);
135 bool ManualAction(
136 SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
138 void finalizeImport(const ScTable& rTable);
140 void RemoveAll();
143 class ScOutlineTable
145 private:
146 ScOutlineArray aColOutline;
147 ScOutlineArray aRowOutline;
149 public:
150 ScOutlineTable();
151 ScOutlineTable( const ScOutlineTable& rOutline );
153 const ScOutlineArray& GetColArray() const { return aColOutline; }
154 ScOutlineArray& GetColArray() { return aColOutline; }
155 const ScOutlineArray& GetRowArray() const { return aRowOutline; }
156 ScOutlineArray& GetRowArray() { return aRowOutline; }
158 bool TestInsertCol( SCSIZE nSize );
159 void InsertCol( SCCOL nStartCol, SCSIZE nSize );
160 bool DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original
161 bool TestInsertRow( SCSIZE nSize );
162 void InsertRow( SCROW nStartRow, SCSIZE nSize );
163 bool DeleteRow( SCROW nStartRow, SCSIZE nSize );
166 class ScSubOutlineIterator
168 private:
169 ScOutlineArray* pArray;
170 SCCOLROW nStart;
171 SCCOLROW nEnd;
172 size_t nSubLevel;
173 size_t nSubEntry;
174 size_t nDepth;
176 public:
177 ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
178 ScSubOutlineIterator( ScOutlineArray* pOutlineArray, size_t nLevel, size_t nEntry );
180 ScOutlineEntry* GetNext();
181 size_t LastLevel() const { return nSubLevel;}
182 size_t LastEntry() const;
183 void DeleteLast();
186 #endif
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */