xref: /trunk/main/sc/inc/markdata.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_MARKDATA_HXX
25 #define SC_MARKDATA_HXX
26 
27 #include "address.hxx"
28 #include <tools/solar.h>
29 #include "scdllapi.h"
30 
31 class ScMarkArray;
32 class ScRangeList;
33 
34 //!		todo:
35 //!		Es muss auch die Moeglichkeit geben, MarkArrays pro Tabelle zu halten,
36 //!		damit "alle suchen" ueber mehrere Tabellen wieder funktioniert!
37 
38 
39 class SC_DLLPUBLIC ScMarkData
40 {
41 private:
42 	ScRange			aMarkRange;				// Bereich
43 	ScRange			aMultiRange;			// maximaler Bereich insgesamt
44 	ScMarkArray*	pMultiSel;				// Mehrfachselektion
45 	sal_Bool			bTabMarked[MAXTABCOUNT];// Tabelle selektiert
46 	sal_Bool			bMarked;				// Rechteck markiert
47 	sal_Bool			bMultiMarked;			// mehrfach markiert
48 
49 	sal_Bool			bMarking;				// Bereich wird aufgezogen -> kein MarkToMulti
50 	sal_Bool			bMarkIsNeg;				// Aufheben bei Mehrfachselektion
51 
52 public:
53 				ScMarkData();
54 				ScMarkData(const ScMarkData& rData);
55 				~ScMarkData();
56 
57 	ScMarkData&	operator=(const ScMarkData& rData);
58 
59 	void		ResetMark();
60 	void		SetMarkArea( const ScRange& rRange );
61 
62 	void		SetMultiMarkArea( const ScRange& rRange, sal_Bool bMark = sal_True );
63 
64 	void		MarkToMulti();
65 	void		MarkToSimple();
66 
IsMarked() const67 	sal_Bool		IsMarked() const				{ return bMarked; }
IsMultiMarked() const68 	sal_Bool		IsMultiMarked() const			{ return bMultiMarked; }
69 
70 	void		GetMarkArea( ScRange& rRange ) const;
71 	void		GetMultiMarkArea( ScRange& rRange ) const;
72 
73 	void		SetAreaTab( SCTAB nTab );
74 
SelectTable(SCTAB nTab,sal_Bool bNew)75 	void		SelectTable( SCTAB nTab, sal_Bool bNew )		{ bTabMarked[nTab] = bNew; }
GetTableSelect(SCTAB nTab) const76 	sal_Bool		GetTableSelect( SCTAB nTab ) const			{ return bTabMarked[nTab]; }
77 
78 	void		SelectOneTable( SCTAB nTab );
79 	SCTAB		GetSelectCount() const;
80 	SCTAB		GetFirstSelected() const;
81 
SetMarkNegative(sal_Bool bFlag)82 	void		SetMarkNegative( sal_Bool bFlag )	{ bMarkIsNeg = bFlag; }
IsMarkNegative() const83 	sal_Bool		IsMarkNegative() const			{ return bMarkIsNeg;  }
SetMarking(sal_Bool bFlag)84 	void		SetMarking( sal_Bool bFlag )		{ bMarking = bFlag;   }
GetMarkingFlag() const85 	sal_Bool		GetMarkingFlag() const			{ return bMarking;	  }
86 
87 	//	fuer FillInfo / Document etc.
GetArray() const88 	const ScMarkArray* GetArray() const			{ return pMultiSel; }
89 
90 	sal_Bool		IsCellMarked( SCCOL nCol, SCROW nRow, sal_Bool bNoSimple = sal_False ) const;
91 	void		FillRangeListWithMarks( ScRangeList* pList, sal_Bool bClear ) const;
92 	void		ExtendRangeListTables( ScRangeList* pList ) const;
93 
94 	void		MarkFromRangeList( const ScRangeList& rList, sal_Bool bReset );
95 
96 	SCCOLROW	GetMarkColumnRanges( SCCOLROW* pRanges );
97 	SCCOLROW	GetMarkRowRanges( SCCOLROW* pRanges );
98 
99 	sal_Bool		IsColumnMarked( SCCOL nCol ) const;
100 	sal_Bool		IsRowMarked( SCROW nRow ) const;
101 	sal_Bool		IsAllMarked( const ScRange& rRange ) const;		// Multi
102 
103                 /// May return -1
104 	SCsROW		GetNextMarked( SCCOL nCol, SCsROW nRow, sal_Bool bUp ) const;
105 	sal_Bool		HasMultiMarks( SCCOL nCol ) const;
106 	sal_Bool		HasAnyMultiMarks() const;
107 
108 	//	Tabellen-Markierungen anpassen:
109 	void		InsertTab( SCTAB nTab );
110 	void		DeleteTab( SCTAB nTab );
111 };
112 
113 
114 
115 #endif
116 
117 
118