Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_RANGELST_HXX
30 : : #define SC_RANGELST_HXX
31 : :
32 : : #include "global.hxx"
33 : : #include "address.hxx"
34 : : #include <tools/solar.h>
35 : : #include <vector>
36 : :
37 : : class ScDocument;
38 : :
39 : : class SC_DLLPUBLIC ScRangeList : public SvRefBase
40 : : {
41 : : public:
42 : : ScRangeList();
43 : : ScRangeList( const ScRangeList& rList );
44 : : ScRangeList( const ScRange& rRange );
45 : : virtual ~ScRangeList();
46 : :
47 : : ScRangeList& operator=(const ScRangeList& rList);
48 : : void Append( const ScRange& rRange );
49 : :
50 : : sal_uInt16 Parse( const String&, ScDocument* = NULL,
51 : : sal_uInt16 nMask = SCA_VALID,
52 : : formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
53 : : sal_Unicode cDelimiter = 0 );
54 : :
55 : : void Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL,
56 : : formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
57 : : sal_Unicode cDelimiter = 0 ) const;
58 : : void Format( rtl::OUString&, sal_uInt16 nFlags = 0, ScDocument* = NULL,
59 : : formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
60 : : sal_Unicode cDelimiter = 0 ) const;
61 : :
62 : : void Join( const ScRange&, bool bIsInList = false );
63 : :
64 : : bool UpdateReference( UpdateRefMode, ScDocument*,
65 : : const ScRange& rWhere,
66 : : SCsCOL nDx,
67 : : SCsROW nDy,
68 : : SCsTAB nDz
69 : : );
70 : :
71 : : const ScRange* Find( const ScAddress& ) const;
72 : : ScRange* Find( const ScAddress& );
73 : : bool operator==( const ScRangeList& ) const;
74 : : bool operator!=( const ScRangeList& r ) const;
75 : : bool Intersects( const ScRange& ) const;
76 : : bool In( const ScRange& ) const;
77 : : size_t GetCellCount() const;
78 : :
79 : : ScRange* Remove(size_t nPos);
80 : : void RemoveAll();
81 : :
82 : : ScRange Combine() const;
83 : :
84 : : bool empty() const;
85 : : size_t size() const;
86 : : ScRange* operator[](size_t idx);
87 : : const ScRange* operator[](size_t idx) const;
88 : : ScRange* front();
89 : : const ScRange* front() const;
90 : : ScRange* back();
91 : : const ScRange* back() const;
92 : : void push_back(ScRange* p);
93 : :
94 : : private:
95 : : ::std::vector<ScRange*> maRanges;
96 : : };
97 [ # + - ]: 20037 : SV_DECL_IMPL_REF( ScRangeList );
[ # # ][ # # ]
[ + - ]
[ # # - + ]
[ # # ][ + + ]
[ + - ][ + + ]
[ # # ]
98 : :
99 : :
100 : : // RangePairList:
101 : : // aRange[0]: actual range,
102 : : // aRange[1]: data for that range, e.g. Rows belonging to a ColName
103 [ + - ]: 3569 : class SC_DLLPUBLIC ScRangePairList : public SvRefBase
104 : : {
105 : : public:
106 : : virtual ~ScRangePairList();
107 : : ScRangePairList* Clone() const;
108 : 11 : void Append( const ScRangePair& rRangePair )
109 : : {
110 [ + - ]: 11 : ScRangePair* pR = new ScRangePair( rRangePair );
111 [ + - ]: 11 : maPairs.push_back( pR );
112 : 11 : }
113 : : void Join( const ScRangePair&, bool bIsInList = false );
114 : : bool UpdateReference( UpdateRefMode, ScDocument*,
115 : : const ScRange& rWhere,
116 : : SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
117 : : void DeleteOnTab( SCTAB nTab );
118 : : ScRangePair* Find( const ScAddress& ) const;
119 : : ScRangePair* Find( const ScRange& ) const;
120 : : ScRangePair** CreateNameSortedArray( size_t& nCount, ScDocument* ) const;
121 : : bool operator==( const ScRangePairList& ) const;
122 : :
123 : : ScRangePair* Remove(size_t nPos);
124 : : ScRangePair* Remove(ScRangePair* pAdr);
125 : :
126 : : size_t size() const;
127 : : ScRangePair* operator[](size_t idx);
128 : : const ScRangePair* operator[](size_t idx) const;
129 : :
130 : : private:
131 : : ::std::vector< ScRangePair* > maPairs;
132 : : };
133 [ # + - ]: 21932 : SV_DECL_IMPL_REF( ScRangePairList );
[ # # ][ # # ]
[ + - ]
[ # # + + ]
[ # # ][ + - ]
[ + - ]
134 : :
135 : : extern "C"
136 : : int SAL_CALL ScRangePairList_QsortNameCompare( const void*, const void* );
137 : :
138 : :
139 : : #endif
140 : :
141 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|