LibreOffice Module sc (master)  1
markmulti.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 #ifndef INCLUDED_SC_INC_MARKMULTI_HXX
21 #define INCLUDED_SC_INC_MARKMULTI_HXX
22 
23 #include "segmenttree.hxx"
24 #include "markarr.hxx"
25 
26 #include <vector>
27 
28 class ScRangeList;
29 struct ScSheetLimits;
30 
32 {
33 
34 private:
35  typedef std::vector<ScMarkArray> MapType;
39 
40 friend class ScMultiSelIter;
41 
42 public:
43  ScMultiSel(ScSheetLimits const &);
44  ScMultiSel(const ScMultiSel& rMultiSel) = default;
45  ScMultiSel(ScMultiSel&& rMultiSel) = default;
46  ~ScMultiSel();
47 
48  ScMultiSel& operator=(const ScMultiSel& rMultiSel);
49  ScMultiSel& operator=(ScMultiSel&& rMultiSel);
50 
51  SCCOL GetMultiSelectionCount() const;
52  bool HasMarks( SCCOL nCol ) const;
53  bool HasOneMark( SCCOL nCol, SCROW& rStartRow, SCROW& rEndRow ) const;
54  bool GetMark( SCCOL nCol, SCROW nRow ) const;
55  bool IsAllMarked( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
56  bool HasEqualRowsMarked( SCCOL nCol1, SCCOL nCol2 ) const;
57  SCROW GetNextMarked( SCCOL nCol, SCROW nRow, bool bUp ) const;
58  void SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow, bool bMark );
59  void Set( ScRangeList const & );
60  bool IsRowMarked( SCROW nRow ) const;
61  bool IsRowRangeMarked( SCROW nStartRow, SCROW nEndRow ) const;
62  bool IsEmpty() const { return ( aMultiSelContainer.empty() && !aRowSel.HasMarks() ); }
63  ScMarkArray GetMarkArray( SCCOL nCol ) const;
64  void Clear();
65  void MarkAllCols( SCROW nStartRow, SCROW nEndRow );
66  bool HasAnyMarks() const;
67  void ShiftCols(SCCOL nStartCol, tools::Long nColOffset);
68  void ShiftRows(SCROW nStartRow, tools::Long nRowOffset);
69 
70  // For faster access from within ScMarkData, instead of creating
71  // ScMultiSelIter with ScFlatBoolRowSegments bottleneck.
72  const ScMarkArray& GetRowSelArray() const;
73  const ScMarkArray* GetMultiSelArray( SCCOL nCol ) const;
74 };
75 
77 {
78 
79 private:
80  std::unique_ptr<ScFlatBoolRowSegments> pRowSegs;
83 public:
84  ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol );
86 
87  bool Next( SCROW& rTop, SCROW& rBottom );
90  bool GetRangeData( SCROW nRow, ScFlatBoolRowSegments::RangeData& rRowRange ) const;
91 };
92 
93 #endif
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long Long
bool IsEmpty() const
Definition: markmulti.hxx:62
MapType aMultiSelContainer
Definition: markmulti.hxx:36
ScMarkArrayIter aMarkArrayIter
Definition: markmulti.hxx:81
bool GetRangeData(SCROW nRow, ScFlatBoolRowSegments::RangeData &rRowRange) const
Only to be used by ScMultiSel::IsAllMarked() or otherwise sure that a segment tree is actually used...
Definition: markmulti.cxx:477
bool Next(SCROW &rTop, SCROW &rBottom)
Definition: markmulti.cxx:454
ScMultiSelIter(const ScMultiSel &rMultiSel, SCCOL nCol)
Definition: markmulti.cxx:414
This is a rather odd datastructure.
Definition: markarr.hxx:44
bool HasMarks() const
Definition: markarr.hxx:64
std::vector< ScMarkArray > MapType
Definition: markmulti.hxx:35
sal_Int16 SCCOL
Definition: types.hxx:22
std::unique_ptr< ScFlatBoolRowSegments > pRowSegs
Definition: markmulti.hxx:80
SCROW nNextSegmentStart
Definition: markmulti.hxx:82
ScMarkArray aRowSel
Definition: markmulti.hxx:37
sal_Int32 SCROW
Definition: types.hxx:18
const ScSheetLimits & mrSheetLimits
Definition: markmulti.hxx:38
#define SC_DLLPUBLIC
Definition: scdllapi.h:28