tdf#125800: accessing cond format props in UNO throws error
[LibreOffice.git] / sc / inc / markmulti.hxx
blob386f7b135f5a8a6ca7ef620956b131ee6b4bb310
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_MARKMULTI_HXX
21 #define INCLUDED_SC_INC_MARKMULTI_HXX
23 #include "segmenttree.hxx"
24 #include "markarr.hxx"
26 #include <vector>
28 class ScRangeList;
30 class ScMultiSel
33 private:
34 typedef std::vector<ScMarkArray> MapType;
35 MapType aMultiSelContainer;
36 ScMarkArray aRowSel;
38 friend class ScMultiSelIter;
40 public:
41 ScMultiSel();
42 ScMultiSel( const ScMultiSel& rMultiSel );
43 ~ScMultiSel();
45 ScMultiSel& operator=(const ScMultiSel& rMultiSel);
46 ScMultiSel& operator=(const ScMultiSel&& rMultiSel) = delete;
48 SCCOL GetMultiSelectionCount() const;
49 bool HasMarks( SCCOL nCol ) const;
50 bool HasOneMark( SCCOL nCol, SCROW& rStartRow, SCROW& rEndRow ) const;
51 bool GetMark( SCCOL nCol, SCROW nRow ) const;
52 bool IsAllMarked( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
53 bool HasEqualRowsMarked( SCCOL nCol1, SCCOL nCol2 ) const;
54 SCROW GetNextMarked( SCCOL nCol, SCROW nRow, bool bUp ) const;
55 void SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow, bool bMark );
56 void Set( ScRangeList const & );
57 bool IsRowMarked( SCROW nRow ) const;
58 bool IsRowRangeMarked( SCROW nStartRow, SCROW nEndRow ) const;
59 bool IsEmpty() const { return ( aMultiSelContainer.empty() && !aRowSel.HasMarks() ); }
60 ScMarkArray GetMarkArray( SCCOL nCol ) const;
61 void Clear();
62 void MarkAllCols( SCROW nStartRow, SCROW nEndRow );
63 bool HasAnyMarks() const;
64 void ShiftCols(SCCOL nStartCol, long nColOffset);
65 void ShiftRows(SCROW nStartRow, long nRowOffset);
67 // For faster access from within ScMarkData, instead of creating
68 // ScMultiSelIter with ScFlatBoolRowSegments bottleneck.
69 const ScMarkArray& GetRowSelArray() const;
70 const ScMarkArray* GetMultiSelArray( SCCOL nCol ) const;
73 class ScMultiSelIter
76 private:
77 std::unique_ptr<ScFlatBoolRowSegments> pRowSegs;
78 ScMarkArrayIter aMarkArrayIter;
79 SCROW nNextSegmentStart;
80 public:
81 ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol );
82 ~ScMultiSelIter();
84 bool Next( SCROW& rTop, SCROW& rBottom );
85 /** Only to be used by ScMultiSel::IsAllMarked() or otherwise sure that a
86 segment tree is actually used. */
87 bool GetRangeData( SCROW nRow, ScFlatBoolRowSegments::RangeData& rRowRange ) const;
90 #endif
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */