Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / sc / inc / segmenttree.hxx
blobc2f384560bf3bff1e645008df90857592c84949e
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_SEGMENTTREE_HXX
21 #define SC_SEGMENTTREE_HXX
23 #include "address.hxx"
25 #include <memory>
27 class ScFlatBoolSegmentsImpl;
29 class ScFlatBoolRowSegments
31 public:
32 struct RangeData
34 SCROW mnRow1;
35 SCROW mnRow2;
36 bool mbValue;
39 class ForwardIterator
41 public:
42 explicit ForwardIterator(ScFlatBoolRowSegments& rSegs);
44 bool getValue(SCROW nPos, bool& rVal);
45 SCROW getLastPos() const;
47 private:
48 ScFlatBoolRowSegments& mrSegs;
50 SCROW mnCurPos;
51 SCROW mnLastPos;
52 bool mbCurValue;
55 class RangeIterator
57 public:
58 explicit RangeIterator(ScFlatBoolRowSegments& rSegs);
59 bool getFirst(RangeData& rRange);
60 bool getNext(RangeData& rRange);
61 private:
62 ScFlatBoolRowSegments& mrSegs;
65 ScFlatBoolRowSegments();
66 ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r);
67 ~ScFlatBoolRowSegments();
69 bool setTrue(SCROW nRow1, SCROW nRow2);
70 bool setFalse(SCROW nRow1, SCROW nRow2);
71 bool getValue(SCROW nRow);
72 bool getRangeData(SCROW nRow, RangeData& rData);
73 bool getRangeDataLeaf(SCROW nRow, RangeData& rData);
74 void removeSegment(SCROW nRow1, SCROW nRow2);
75 void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
77 SCROW findLastNotOf(bool bValue) const;
79 private:
80 SAL_WNODEPRECATED_DECLARATIONS_PUSH
81 ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl;
82 SAL_WNODEPRECATED_DECLARATIONS_POP
85 class ScFlatBoolColSegments
87 public:
88 struct RangeData
90 SCCOL mnCol1;
91 SCCOL mnCol2;
92 bool mbValue;
94 ScFlatBoolColSegments();
95 ScFlatBoolColSegments(const ScFlatBoolColSegments& r);
96 ~ScFlatBoolColSegments();
98 bool setTrue(SCCOL nCol1, SCCOL nCol2);
99 bool setFalse(SCCOL nCol1, SCCOL nCol2);
100 bool getRangeData(SCCOL nCol, RangeData& rData);
101 void removeSegment(SCCOL nCol1, SCCOL nCol2);
102 void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary);
104 private:
105 SAL_WNODEPRECATED_DECLARATIONS_PUSH
106 ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl;
107 SAL_WNODEPRECATED_DECLARATIONS_POP
110 class ScFlatUInt16SegmentsImpl;
112 class ScFlatUInt16RowSegments
114 public:
115 struct RangeData
117 SCROW mnRow1;
118 SCROW mnRow2;
119 sal_uInt16 mnValue;
122 class ForwardIterator
124 public:
125 explicit ForwardIterator(ScFlatUInt16RowSegments& rSegs);
127 bool getValue(SCROW nPos, sal_uInt16& rVal);
128 SCROW getLastPos() const;
130 private:
131 ScFlatUInt16RowSegments& mrSegs;
133 SCROW mnCurPos;
134 SCROW mnLastPos;
135 sal_uInt16 mnCurValue;
138 ScFlatUInt16RowSegments(sal_uInt16 nDefault);
139 ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r);
140 ~ScFlatUInt16RowSegments();
142 void setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue);
143 sal_uInt16 getValue(SCROW nRow);
144 sal_uInt32 getSumValue(SCROW nRow1, SCROW nRow2);
145 bool getRangeData(SCROW nRow, RangeData& rData);
146 void removeSegment(SCROW nRow1, SCROW nRow2);
147 void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary);
149 SCROW findLastNotOf(sal_uInt16 nValue) const;
151 void enableTreeSearch(bool bEnable);
153 private:
154 SAL_WNODEPRECATED_DECLARATIONS_PUSH
155 ::std::auto_ptr<ScFlatUInt16SegmentsImpl> mpImpl;
156 SAL_WNODEPRECATED_DECLARATIONS_POP
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */