tdf#125181 maxY is 50000 in prstGeom for star24 and star32
[LibreOffice.git] / sc / inc / markdata.hxx
blob2052c23daa5248ef5808dc2f90459eb3d1e052d9
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 "rangelst.hxx"
25 #include "markmulti.hxx"
26 #include "scdllapi.h"
28 #include <set>
29 #include <vector>
31 namespace sc {
33 struct ColRowSpan;
37 class ScMarkArray;
39 //! todo:
40 //! It should be possible to have MarkArrays for each table, in order to
41 //! 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 ScMultiSel aMultiSel; // 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
58 ScRangeList aTopEnvelope; // list of ranges in the top envelope of the multi selection
59 ScRangeList aBottomEnvelope; // list of ranges in the bottom envelope of the multi selection
60 ScRangeList aLeftEnvelope; // list of ranges in the left envelope of the multi selection
61 ScRangeList aRightEnvelope; // list of ranges in the right envelope of the multi selection
63 public:
64 ScMarkData();
65 ScMarkData(const ScMarkData& rData);
66 ScMarkData(const ScRangeList& rList);
67 ~ScMarkData();
69 ScMarkData& operator=(const ScMarkData& rData);
71 void ResetMark();
72 void SetMarkArea( const ScRange& rRange );
74 // bSetupMulti must be set to true only for recursive calls to SetMultiMarkArea
75 void SetMultiMarkArea( const ScRange& rRange, bool bMark = true, bool bSetupMulti = false );
77 void MarkToMulti();
78 void MarkToSimple();
80 bool IsMarked() const { return bMarked; }
81 bool IsMultiMarked() const { return bMultiMarked; }
83 void GetMarkArea( ScRange& rRange ) const;
84 void GetMultiMarkArea( ScRange& rRange ) const;
86 void SetAreaTab( SCTAB nTab );
88 void SelectTable( SCTAB nTab, bool bNew );
89 bool GetTableSelect( SCTAB nTab ) const;
91 void SelectOneTable( SCTAB nTab );
92 SCTAB GetSelectCount() const;
93 SCTAB GetFirstSelected() const;
94 SCTAB GetLastSelected() const;
96 const MarkedTabsType& GetSelectedTabs() const { return maTabMarked;}
97 void SetSelectedTabs(const MarkedTabsType& rTabs);
99 void SetMarkNegative( bool bFlag ) { bMarkIsNeg = bFlag; }
100 bool IsMarkNegative() const { return bMarkIsNeg; }
101 void SetMarking( bool bFlag ) { bMarking = bFlag; }
102 bool GetMarkingFlag() const { return bMarking; }
104 // for FillInfo / Document etc.
105 const ScMultiSel& GetMultiSelData() const { return aMultiSel; }
106 ScMarkArray GetMarkArray( SCCOL nCol ) const;
108 bool IsCellMarked( SCCOL nCol, SCROW nRow, bool bNoSimple = false ) const;
110 /** Create a range list of marks.
111 @param nForTab
112 If -1, use start-sheet-tab of the multi-area in ranges.
113 If >= 0, use given sheet-tab in ranges.
115 void FillRangeListWithMarks( ScRangeList* pList, bool bClear, SCTAB nForTab = -1 ) const;
116 void ExtendRangeListTables( ScRangeList* pList ) const;
118 ScRangeList GetMarkedRanges() const;
119 /** Get marked ranges with sheet-tab set to nTab.
120 Marks are stored for the currently active sheet respectively the
121 multi-area start-sheet-tab, update ranges with the sheet for which this
122 is called. */
123 ScRangeList GetMarkedRangesForTab( SCTAB nTab ) const;
125 void MarkFromRangeList( const ScRangeList& rList, bool bReset );
127 std::vector<sc::ColRowSpan> GetMarkedRowSpans() const;
128 std::vector<sc::ColRowSpan> GetMarkedColSpans() const;
130 bool IsColumnMarked( SCCOL nCol ) const;
131 bool IsRowMarked( SCROW nRow ) const;
132 bool IsAllMarked( const ScRange& rRange ) const; // Multi
134 /// May return -1
135 SCROW GetNextMarked( SCCOL nCol, SCROW nRow, bool bUp ) const;
136 bool HasMultiMarks( SCCOL nCol ) const;
137 bool HasAnyMultiMarks() const;
139 // adjust table marking:
140 void InsertTab( SCTAB nTab );
141 void DeleteTab( SCTAB nTab );
143 void ShiftCols(SCCOL nStartCol, long nColOffset);
144 void ShiftRows(SCROW nStartRow, long nRowOffset);
146 // Generate envelopes if multimarked and fills the passed ScRange object with
147 // the smallest range that includes the marked area plus its envelopes.
148 void GetSelectionCover( ScRange& rRange );
149 // Get top, bottom, left and right envelopes
150 const ScRangeList& GetTopEnvelope() const { return aTopEnvelope; }
151 const ScRangeList& GetBottomEnvelope() const { return aBottomEnvelope; }
152 const ScRangeList& GetLeftEnvelope() const { return aLeftEnvelope; }
153 const ScRangeList& GetRightEnvelope() const { return aRightEnvelope; }
155 // iterators for table access
156 typedef std::set<SCTAB>::iterator iterator;
157 typedef std::set<SCTAB>::const_iterator const_iterator;
158 typedef std::set<SCTAB>::const_reverse_iterator const_reverse_iterator;
159 iterator begin();
160 iterator end();
161 const_iterator begin() const;
162 const_iterator end() const;
163 const_reverse_iterator rbegin() const;
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */