Bump version to 4.3-4
[LibreOffice.git] / sc / inc / markdata.hxx
blobeb374ec6d037da3b9c58d23a90ea95eb7ea078c5
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_MARKDATA_HXX
21 #define INCLUDED_SC_INC_MARKDATA_HXX
23 #include "address.hxx"
24 #include "scdllapi.h"
26 #include <set>
28 namespace sc {
30 struct RowSpan;
31 struct ColRowSpan;
35 class ScMarkArray;
36 class ScRangeList;
38 //! todo:
39 //! It should be possible to have MarkArrays for each table, in order to
40 //! enable "search all" across more than one table again!
43 class SC_DLLPUBLIC ScMarkData
45 public:
46 typedef std::set<SCTAB> MarkedTabsType;
47 private:
48 MarkedTabsType maTabMarked;
50 ScRange aMarkRange; // area
51 ScRange aMultiRange; // maximum area altogether
52 ScMarkArray* pMultiSel; // multi selection
53 bool bMarked:1; // rectangle marked
54 bool bMultiMarked:1;
56 bool bMarking:1; // area is being marked -> no MarkToMulti
57 bool bMarkIsNeg:1; // cancel if multi selection
59 public:
60 ScMarkData();
61 ScMarkData(const ScMarkData& rData);
62 ~ScMarkData();
64 ScMarkData& operator=(const ScMarkData& rData);
66 void ResetMark();
67 void SetMarkArea( const ScRange& rRange );
69 void SetMultiMarkArea( const ScRange& rRange, bool bMark = true );
71 void MarkToMulti();
72 void MarkToSimple();
74 bool IsMarked() const { return bMarked; }
75 bool IsMultiMarked() const { return bMultiMarked; }
77 void GetMarkArea( ScRange& rRange ) const;
78 void GetMultiMarkArea( ScRange& rRange ) const;
80 void SetAreaTab( SCTAB nTab );
82 void SelectTable( SCTAB nTab, bool bNew );
83 bool GetTableSelect( SCTAB nTab ) const;
85 void SelectOneTable( SCTAB nTab );
86 SCTAB GetSelectCount() const;
87 SCTAB GetFirstSelected() const;
88 SCTAB GetLastSelected() const;
90 const MarkedTabsType& GetSelectedTabs() const;
91 void SetSelectedTabs(const MarkedTabsType& rTabs);
93 void SetMarkNegative( bool bFlag ) { bMarkIsNeg = bFlag; }
94 bool IsMarkNegative() const { return bMarkIsNeg; }
95 void SetMarking( bool bFlag ) { bMarking = bFlag; }
96 bool GetMarkingFlag() const { return bMarking; }
98 // for FillInfo / Document etc.
99 const ScMarkArray* GetArray() const { return pMultiSel; }
101 bool IsCellMarked( SCCOL nCol, SCROW nRow, bool bNoSimple = false ) const;
102 void FillRangeListWithMarks( ScRangeList* pList, bool bClear ) const;
103 void ExtendRangeListTables( ScRangeList* pList ) const;
105 ScRangeList GetMarkedRanges() const;
107 void MarkFromRangeList( const ScRangeList& rList, bool bReset );
109 std::vector<sc::ColRowSpan> GetMarkedRowSpans() const;
110 std::vector<sc::ColRowSpan> GetMarkedColSpans() const;
112 bool IsColumnMarked( SCCOL nCol ) const;
113 bool IsRowMarked( SCROW nRow ) const;
114 bool IsAllMarked( const ScRange& rRange ) const; // Multi
116 /// May return -1
117 SCsROW GetNextMarked( SCCOL nCol, SCsROW nRow, bool bUp ) const;
118 bool HasMultiMarks( SCCOL nCol ) const;
119 bool HasAnyMultiMarks() const;
121 // adjust table marking:
122 void InsertTab( SCTAB nTab );
123 void DeleteTab( SCTAB nTab );
125 // iterators for table access
126 typedef std::set<SCTAB>::iterator iterator;
127 typedef std::set<SCTAB>::const_iterator const_iterator;
128 iterator begin();
129 iterator end();
130 const_iterator begin() const;
131 const_iterator end() const;
134 #endif
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */