xref: /aoo41x/main/sc/inc/rangelst.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_RANGELST_HXX
25 #define SC_RANGELST_HXX
26 
27 #include "global.hxx"
28 #include "address.hxx"
29 #include <tools/solar.h>
30 
31 class ScDocument;
32 
33 typedef ScRange* ScRangePtr;
34 DECLARE_LIST( ScRangeListBase, ScRangePtr )
35 class SC_DLLPUBLIC ScRangeList : public ScRangeListBase, public SvRefBase
36 {
37 private:
38     using ScRangeListBase::operator==;
39     using ScRangeListBase::operator!=;
40 
41 public:
ScRangeList()42 					ScRangeList() {}
43 					ScRangeList( const ScRangeList& rList );
44 	virtual 		~ScRangeList();
45 	ScRangeList&	operator=(const ScRangeList& rList);
46 	void			RemoveAll();
Append(const ScRange & rRange)47 	void			Append( const ScRange& rRange )
48 					{
49 						ScRangePtr pR = new ScRange( rRange );
50 						Insert( pR, LIST_APPEND );
51 					}
52 	sal_uInt16			Parse( const String&, ScDocument* = NULL,
53 						   sal_uInt16 nMask = SCA_VALID,
54 						   formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
55                            sal_Unicode cDelimiter = 0 );
56 	void 			Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL,
57 							formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
58                             sal_Unicode cDelimiter = 0 ) const;
59 	void			Join( const ScRange&, sal_Bool bIsInList = sal_False );
60 	sal_Bool 			UpdateReference( UpdateRefMode, ScDocument*,
61 									const ScRange& rWhere,
62 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
63 	ScRange*		Find( const ScAddress& ) const;
64 	sal_Bool			operator==( const ScRangeList& ) const;
65     sal_Bool            operator!=( const ScRangeList& r ) const;
66 	sal_Bool			Intersects( const ScRange& ) const;
67 	sal_Bool			In( const ScRange& ) const;
68 	sal_uLong			GetCellCount() const;
69 };
70 SV_DECL_IMPL_REF( ScRangeList );
71 
72 
73 // RangePairList: erster Range (aRange[0]) eigentlicher Range, zweiter
74 // Range (aRange[1]) Daten zu diesem Range, z.B. Rows eines ColName
75 DECLARE_LIST( ScRangePairListBase, ScRangePair* )
76 class ScRangePairList : public ScRangePairListBase, public SvRefBase
77 {
78 private:
79     using ScRangePairListBase::operator==;
80 
81 public:
82 	virtual 		~ScRangePairList();
83 	ScRangePairList*	Clone() const;
Append(const ScRangePair & rRangePair)84 	void			Append( const ScRangePair& rRangePair )
85 					{
86 						ScRangePair* pR = new ScRangePair( rRangePair );
87 						Insert( pR, LIST_APPEND );
88 					}
89 	void			Join( const ScRangePair&, sal_Bool bIsInList = sal_False );
90 	sal_Bool 			UpdateReference( UpdateRefMode, ScDocument*,
91 									const ScRange& rWhere,
92 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
93     void            DeleteOnTab( SCTAB nTab );
94 	ScRangePair*	Find( const ScAddress& ) const;
95 	ScRangePair*	Find( const ScRange& ) const;
96 	ScRangePair**	CreateNameSortedArray( sal_uLong& nCount, ScDocument* ) const;
97 	sal_Bool			operator==( const ScRangePairList& ) const;
98 };
99 SV_DECL_IMPL_REF( ScRangePairList );
100 
101 extern "C" int
102 #ifdef WNT
103 __cdecl
104 #endif
105 ScRangePairList_QsortNameCompare( const void*, const void* );
106 
107 #if defined( ICC ) && defined( SC_RANGELST_CXX ) && defined( OS2 )
ICCQsortRPairCompare(const void * a,const void * b)108 	static int _Optlink ICCQsortRPairCompare( const void* a, const void* b)
109 					{ return ScRangePairList_QsortNameCompare(a,b); }
110 #endif
111 
112 
113 #endif
114