xref: /aoo41x/main/sc/inc/rangelst.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_RANGELST_HXX
29 #define SC_RANGELST_HXX
30 
31 #include "global.hxx"
32 #include "address.hxx"
33 #include <tools/solar.h>
34 
35 class ScDocument;
36 
37 typedef ScRange* ScRangePtr;
38 DECLARE_LIST( ScRangeListBase, ScRangePtr )
39 class SC_DLLPUBLIC ScRangeList : public ScRangeListBase, public SvRefBase
40 {
41 private:
42     using ScRangeListBase::operator==;
43     using ScRangeListBase::operator!=;
44 
45 public:
46 					ScRangeList() {}
47 					ScRangeList( const ScRangeList& rList );
48 	virtual 		~ScRangeList();
49 	ScRangeList&	operator=(const ScRangeList& rList);
50 	void			RemoveAll();
51 	void			Append( const ScRange& rRange )
52 					{
53 						ScRangePtr pR = new ScRange( rRange );
54 						Insert( pR, LIST_APPEND );
55 					}
56 	sal_uInt16			Parse( const String&, ScDocument* = NULL,
57 						   sal_uInt16 nMask = SCA_VALID,
58 						   formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
59                            sal_Unicode cDelimiter = 0 );
60 	void 			Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL,
61 							formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
62                             sal_Unicode cDelimiter = 0 ) const;
63 	void			Join( const ScRange&, sal_Bool bIsInList = sal_False );
64 	sal_Bool 			UpdateReference( UpdateRefMode, ScDocument*,
65 									const ScRange& rWhere,
66 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
67 	ScRange*		Find( const ScAddress& ) const;
68 	sal_Bool			operator==( const ScRangeList& ) const;
69     sal_Bool            operator!=( const ScRangeList& r ) const;
70 	sal_Bool			Intersects( const ScRange& ) const;
71 	sal_Bool			In( const ScRange& ) const;
72 	sal_uLong			GetCellCount() const;
73 };
74 SV_DECL_IMPL_REF( ScRangeList );
75 
76 
77 // RangePairList: erster Range (aRange[0]) eigentlicher Range, zweiter
78 // Range (aRange[1]) Daten zu diesem Range, z.B. Rows eines ColName
79 DECLARE_LIST( ScRangePairListBase, ScRangePair* )
80 class ScRangePairList : public ScRangePairListBase, public SvRefBase
81 {
82 private:
83     using ScRangePairListBase::operator==;
84 
85 public:
86 	virtual 		~ScRangePairList();
87 	ScRangePairList*	Clone() const;
88 	void			Append( const ScRangePair& rRangePair )
89 					{
90 						ScRangePair* pR = new ScRangePair( rRangePair );
91 						Insert( pR, LIST_APPEND );
92 					}
93 	void			Join( const ScRangePair&, sal_Bool bIsInList = sal_False );
94 	sal_Bool 			UpdateReference( UpdateRefMode, ScDocument*,
95 									const ScRange& rWhere,
96 									SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
97     void            DeleteOnTab( SCTAB nTab );
98 	ScRangePair*	Find( const ScAddress& ) const;
99 	ScRangePair*	Find( const ScRange& ) const;
100 	ScRangePair**	CreateNameSortedArray( sal_uLong& nCount, ScDocument* ) const;
101 	sal_Bool			operator==( const ScRangePairList& ) const;
102 };
103 SV_DECL_IMPL_REF( ScRangePairList );
104 
105 extern "C" int
106 #ifdef WNT
107 __cdecl
108 #endif
109 ScRangePairList_QsortNameCompare( const void*, const void* );
110 
111 #if defined( ICC ) && defined( SC_RANGELST_CXX ) && defined( OS2 )
112 	static int _Optlink ICCQsortRPairCompare( const void* a, const void* b)
113 					{ return ScRangePairList_QsortNameCompare(a,b); }
114 #endif
115 
116 
117 #endif
118