1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: lotrange.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_LOTRANGE_HXX
32 #define SC_LOTRANGE_HXX
34 #include <tools/solar.h>
35 #include <compiler.hxx>
37 // --------------------------------------------------------- class LotusRange -
42 #define ID_FAIL 0xFFFF
46 friend class LotusRangeList
;
54 void MakeHash( void );
55 inline void Copy( const LotusRange
& );
56 inline void SetId( LR_ID nId
);
58 LotusRange( SCCOL nCol
, SCROW nRow
);
59 LotusRange( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
60 LotusRange( const LotusRange
& );
61 inline LotusRange
&operator =( const LotusRange
& );
62 inline BOOL
operator ==( const LotusRange
& ) const;
63 inline BOOL
operator !=( const LotusRange
& ) const;
64 inline BOOL
IsSingle( void ) const;
68 inline void LotusRange::Copy( const LotusRange
& rCpy
)
70 nColStart
= rCpy
.nColStart
;
71 nRowStart
= rCpy
.nRowStart
;
72 nColEnd
= rCpy
.nColEnd
;
73 nRowEnd
= rCpy
.nRowEnd
;
77 inline void LotusRange::SetId( LR_ID nNewId
)
83 inline LotusRange
&LotusRange::operator =( const LotusRange
& rCpy
)
90 inline BOOL
LotusRange::operator ==( const LotusRange
& rRef
) const
92 return ( nHash
== rRef
.nHash
&& nColStart
== rRef
.nColStart
&&
93 nRowStart
== rRef
.nRowStart
&& nColEnd
== rRef
.nColEnd
&&
94 nRowEnd
== rRef
.nRowEnd
);
98 inline BOOL
LotusRange::operator !=( const LotusRange
& rRef
) const
100 return ( nHash
!= rRef
.nHash
|| nColStart
!= rRef
.nColStart
||
101 nRowStart
!= rRef
.nRowStart
|| nColEnd
!= rRef
.nColEnd
||
102 nRowEnd
!= rRef
.nRowEnd
);
106 inline BOOL
LotusRange::IsSingle( void ) const
108 return ( nColStart
== nColEnd
&& nRowStart
== nRowEnd
);
113 // ----------------------------------------------------- class LotusRangeList -
115 class LotusRangeList
: private List
119 ScComplexRefData aComplRef
;
120 static SCCOL nEingCol
;
121 static SCROW nEingRow
;
123 LotusRangeList( void );
124 ~LotusRangeList( void );
125 inline UINT16
GetIndex( SCCOL nCol
, SCROW nRow
);
126 inline UINT16
GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
127 UINT16
GetIndex( const LotusRange
& );
128 inline void Append( SCCOL nCol
, SCROW nRow
, const String
& );
129 inline void Append( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
, const String
& );
130 void Append( LotusRange
* pLR
, const String
& rName
);
131 inline static void SetEing( const SCCOL nCol
, const SCROW nRow
);
135 inline LR_ID
LotusRangeList::GetIndex( SCCOL nCol
, SCROW nRow
)
137 LotusRange
aRef( nCol
, nRow
);
138 return GetIndex( aRef
);
142 inline LR_ID
LotusRangeList::GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
)
144 LotusRange
aRef( nColS
, nRowS
, nColE
, nRowE
);
145 return GetIndex( aRef
);
149 inline void LotusRangeList::Append( SCCOL nCol
, SCROW nRow
, const String
& rName
)
151 Append( new LotusRange( nCol
, nRow
), rName
);
155 inline void LotusRangeList::Append( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
, const String
& r
)
157 Append( new LotusRange( nColS
, nRowS
, nColE
, nRowE
), r
);
161 inline void LotusRangeList::SetEing( const SCCOL nCol
, const SCROW nRow
)