LibreOffice Module sc (master) 1
olinetab.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "scdllapi.h"
23#include "address.hxx"
24
25#include <map>
26
27#define SC_OL_MAXDEPTH 7
28
29class ScTable;
30
32{
35 bool bHidden;
37
38public:
39 ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden );
40 ScOutlineEntry( const ScOutlineEntry& rEntry );
41
43 SCSIZE GetSize() const { return nSize;}
45
49 SC_DLLPUBLIC bool IsHidden() const { return bHidden;}
50
54 SC_DLLPUBLIC bool IsVisible() const { return bVisible;}
55
56 void Move( SCCOLROW nDelta );
57 void SetSize( SCSIZE nNewSize );
58 void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize );
59 void SetHidden( bool bNewHidden );
60 void SetVisible( bool bNewVisible );
61
62 OString dumpAsString() const;
63};
64
66{
67 typedef std::map<SCCOLROW, ScOutlineEntry> MapType;
69
70public:
71 typedef MapType::iterator iterator;
72 typedef MapType::const_iterator const_iterator;
73
75
76 size_t size() const;
77 void clear();
78 void insert(ScOutlineEntry const& rEntry);
80 iterator end();
81 const_iterator begin() const;
82 const_iterator end() const;
83 iterator erase(const iterator& pos);
84 bool empty() const;
85
86 iterator FindStart(SCCOLROW nMinStart);
87
88 OString dumpAsString() const;
89};
90
92{
94
95private:
96 size_t nDepth;
98
99 bool DecDepth();
100 void FindEntry(
101 SCCOLROW nSearchPos, size_t& rFindLevel, size_t& rFindIndex,
102 size_t nMaxLevel = SC_OL_MAXDEPTH);
103
104 void PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nStartLevel);
105
106public:
108 ScOutlineArray( const ScOutlineArray& rArray );
109
110 size_t GetDepth() const { return nDepth;}
111
112 bool FindTouchedLevel(
113 SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rFindLevel) const;
114
115 bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, bool& rSizeChanged,
116 bool bHidden = false );
117 bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, bool& rSizeChanged );
118
119 ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex);
120 const ScOutlineEntry* GetEntry(size_t nLevel, size_t nIndex) const;
121 size_t GetCount(size_t nLevel) const;
122 const ScOutlineEntry* GetEntryByPos(size_t nLevel, SCCOLROW nPos) const;
123
124 bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t& rnIndex) const;
125 bool GetEntryIndexInRange(
126 size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t& rnIndex) const;
127
128 void SetVisibleBelow(
129 size_t nLevel, size_t nEntry, bool bValue, bool bSkipHidden = false);
130
131 void GetRange(SCCOLROW& rStart, SCCOLROW& rEnd) const;
132 void ExtendBlock(size_t nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd);
133
134 bool TestInsertSpace(SCSIZE nSize, SCCOLROW nMaxVal) const;
135 void InsertSpace(SCCOLROW nStartPos, SCSIZE nSize);
136 bool DeleteSpace(SCCOLROW nStartPos, SCSIZE nSize);
137
138 bool ManualAction(
139 SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, const ScTable& rTable, bool bCol);
140
141 void finalizeImport(const ScTable& rTable);
142
143 void RemoveAll();
144
145 OString dumpAsString() const;
146};
147
149{
150private:
153
154public:
156 ScOutlineTable( const ScOutlineTable& rOutline );
157
158 const ScOutlineArray& GetColArray() const { return aColOutline; }
160 const ScOutlineArray& GetRowArray() const { return aRowOutline; }
162
163 bool TestInsertCol( SCSIZE nSize );
164 void InsertCol( SCCOL nStartCol, SCSIZE nSize );
165 bool DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original
166 bool TestInsertRow( SCSIZE nSize );
167 void InsertRow( SCROW nStartRow, SCSIZE nSize );
168 bool DeleteRow( SCROW nStartRow, SCSIZE nSize );
169};
170
172{
173private:
177 size_t nSubLevel;
178 size_t nSubEntry;
179 size_t nDepth;
180
181public:
182 ScSubOutlineIterator( ScOutlineArray* pOutlineArray );
183 ScSubOutlineIterator( ScOutlineArray* pOutlineArray, size_t nLevel, size_t nEntry );
184
186 size_t LastLevel() const { return nSubLevel;}
187 size_t LastEntry() const;
188 void DeleteLast();
189};
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
size_t nDepth
Definition: olinetab.hxx:96
size_t GetDepth() const
Definition: olinetab.hxx:110
MapType::iterator iterator
Definition: olinetab.hxx:71
iterator begin()
Definition: olinetab.cxx:109
MapType::const_iterator const_iterator
Definition: olinetab.hxx:72
bool empty() const
Definition: olinetab.cxx:134
OString dumpAsString() const
Definition: olinetab.cxx:144
void insert(ScOutlineEntry const &rEntry)
Definition: olinetab.cxx:103
iterator erase(const iterator &pos)
Definition: olinetab.cxx:129
size_t size() const
Definition: olinetab.cxx:93
iterator FindStart(SCCOLROW nMinStart)
Definition: olinetab.cxx:139
std::map< SCCOLROW, ScOutlineEntry > MapType
Definition: olinetab.hxx:67
SC_DLLPUBLIC SCCOLROW GetStart() const
Definition: olinetab.hxx:42
SC_DLLPUBLIC bool IsHidden() const
Definition: olinetab.hxx:49
SCSIZE nSize
Definition: olinetab.hxx:34
void SetPosSize(SCCOLROW nNewPos, SCSIZE nNewSize)
Definition: olinetab.cxx:68
void SetSize(SCSIZE nNewSize)
Definition: olinetab.cxx:58
void Move(SCCOLROW nDelta)
Definition: olinetab.cxx:47
SC_DLLPUBLIC bool IsVisible() const
Definition: olinetab.hxx:54
SCCOLROW nStart
Definition: olinetab.hxx:33
SC_DLLPUBLIC SCCOLROW GetEnd() const
Definition: olinetab.cxx:42
void SetVisible(bool bNewVisible)
Definition: olinetab.cxx:79
SCSIZE GetSize() const
Definition: olinetab.hxx:43
OString dumpAsString() const
Definition: olinetab.cxx:84
void SetHidden(bool bNewHidden)
Definition: olinetab.cxx:74
ScOutlineEntry(SCCOLROW nNewStart, SCCOLROW nNewSize, bool bNewHidden)
Definition: olinetab.cxx:26
ScOutlineArray & GetRowArray()
Definition: olinetab.hxx:161
void InsertCol(SCCOL nStartCol, SCSIZE nSize)
Definition: olinetab.cxx:760
bool TestInsertRow(SCSIZE nSize)
Definition: olinetab.cxx:770
const ScOutlineArray & GetColArray() const
Definition: olinetab.hxx:158
bool TestInsertCol(SCSIZE nSize)
Definition: olinetab.cxx:755
bool DeleteRow(SCROW nStartRow, SCSIZE nSize)
Definition: olinetab.cxx:780
ScOutlineArray aRowOutline
Definition: olinetab.hxx:152
bool DeleteCol(SCCOL nStartCol, SCSIZE nSize)
Definition: olinetab.cxx:765
void InsertRow(SCROW nStartRow, SCSIZE nSize)
Definition: olinetab.cxx:775
ScOutlineArray & GetColArray()
Definition: olinetab.hxx:159
ScOutlineArray aColOutline
Definition: olinetab.hxx:151
const ScOutlineArray & GetRowArray() const
Definition: olinetab.hxx:160
size_t LastLevel() const
Definition: olinetab.hxx:186
ScOutlineArray * pArray
Definition: olinetab.hxx:174
ScOutlineEntry * GetNext()
Definition: olinetab.cxx:810
ScSubOutlineIterator(ScOutlineArray *pOutlineArray)
Definition: olinetab.cxx:785
size_t LastEntry() const
Definition: olinetab.cxx:842
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
#define SC_OL_MAXDEPTH
Definition: olinetab.hxx:27
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17