1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SEGMENTTREE_HXX
21 #define INCLUDED_SC_INC_SEGMENTTREE_HXX
23 #include "address.hxx"
27 class ScFlatBoolSegmentsImpl
;
29 class ScFlatBoolRowSegments
42 explicit ForwardIterator(ScFlatBoolRowSegments
& rSegs
);
44 SAL_WARN_UNUSED_RESULT
45 bool getValue(SCROW nPos
, bool& rVal
);
46 SCROW
getLastPos() const { return mnLastPos
;}
49 ScFlatBoolRowSegments
& mrSegs
;
59 explicit RangeIterator(ScFlatBoolRowSegments
& rSegs
);
60 bool getFirst(RangeData
& rRange
);
61 bool getNext(RangeData
& rRange
);
63 ScFlatBoolRowSegments
& mrSegs
;
66 ScFlatBoolRowSegments();
67 ScFlatBoolRowSegments(const ScFlatBoolRowSegments
& r
);
68 ~ScFlatBoolRowSegments();
70 bool setTrue(SCROW nRow1
, SCROW nRow2
);
71 bool setFalse(SCROW nRow1
, SCROW nRow2
);
72 bool getRangeData(SCROW nRow
, RangeData
& rData
) const;
73 bool getRangeDataLeaf(SCROW nRow
, RangeData
& rData
);
74 void removeSegment(SCROW nRow1
, SCROW nRow2
);
75 void insertSegment(SCROW nRow
, SCROW nSize
);
77 SCROW
findLastTrue() const;
80 ::std::unique_ptr
<ScFlatBoolSegmentsImpl
> mpImpl
;
83 class ScFlatBoolColSegments
92 ScFlatBoolColSegments();
93 ScFlatBoolColSegments(const ScFlatBoolColSegments
& r
);
94 ~ScFlatBoolColSegments();
96 bool setTrue(SCCOL nCol1
, SCCOL nCol2
);
97 bool setFalse(SCCOL nCol1
, SCCOL nCol2
);
98 bool getRangeData(SCCOL nCol
, RangeData
& rData
);
99 void removeSegment(SCCOL nCol1
, SCCOL nCol2
);
100 void insertSegment(SCCOL nCol
, SCCOL nSize
);
103 ::std::unique_ptr
<ScFlatBoolSegmentsImpl
> mpImpl
;
106 class ScFlatUInt16SegmentsImpl
;
108 class ScFlatUInt16RowSegments
118 class ForwardIterator
121 explicit ForwardIterator(ScFlatUInt16RowSegments
& rSegs
);
123 bool getValue(SCROW nPos
, sal_uInt16
& rVal
);
124 SCROW
getLastPos() const { return mnLastPos
;}
127 ScFlatUInt16RowSegments
& mrSegs
;
131 sal_uInt16 mnCurValue
;
134 ScFlatUInt16RowSegments(sal_uInt16 nDefault
);
135 ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments
& r
);
136 ~ScFlatUInt16RowSegments();
138 void setValue(SCROW nRow1
, SCROW nRow2
, sal_uInt16 nValue
);
139 void setValueIf(SCROW nRow1
, SCROW nRow2
, sal_uInt16 nValue
, const std::function
<bool(sal_uInt16
)>& rPredicate
);
140 sal_uInt16
getValue(SCROW nRow
);
141 sal_uInt32
getSumValue(SCROW nRow1
, SCROW nRow2
);
142 bool getRangeData(SCROW nRow
, RangeData
& rData
);
143 void removeSegment(SCROW nRow1
, SCROW nRow2
);
144 void insertSegment(SCROW nRow
, SCROW nSize
);
146 SCROW
findLastTrue(sal_uInt16 nValue
) const;
148 void enableTreeSearch(bool bEnable
);
151 ::std::unique_ptr
<ScFlatUInt16SegmentsImpl
> mpImpl
;
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */