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