merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / lotrange.hxx
blobab9acf9f476e72a56f42fd527a1c00654279c49a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef SC_LOTRANGE_HXX
29 #define SC_LOTRANGE_HXX
31 #include <tools/solar.h>
32 #include <compiler.hxx>
34 // --------------------------------------------------------- class LotusRange -
36 class LotusRangeList;
38 typedef UINT16 LR_ID;
39 #define ID_FAIL 0xFFFF
41 class LotusRange
43 friend class LotusRangeList;
44 private:
45 UINT32 nHash;
46 SCCOL nColStart;
47 SCROW nRowStart;
48 SCCOL nColEnd;
49 SCROW nRowEnd;
50 LR_ID nId;
51 void MakeHash( void );
52 inline void Copy( const LotusRange& );
53 inline void SetId( LR_ID nId );
54 public:
55 LotusRange( SCCOL nCol, SCROW nRow );
56 LotusRange( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
57 LotusRange( const LotusRange& );
58 inline LotusRange &operator =( const LotusRange& );
59 inline BOOL operator ==( const LotusRange& ) const;
60 inline BOOL operator !=( const LotusRange& ) const;
61 inline BOOL IsSingle( void ) const;
65 inline void LotusRange::Copy( const LotusRange& rCpy )
67 nColStart = rCpy.nColStart;
68 nRowStart = rCpy.nRowStart;
69 nColEnd = rCpy.nColEnd;
70 nRowEnd = rCpy.nRowEnd;
74 inline void LotusRange::SetId( LR_ID nNewId )
76 nId = nNewId;
80 inline LotusRange &LotusRange::operator =( const LotusRange& rCpy )
82 Copy( rCpy );
83 return *this;
87 inline BOOL LotusRange::operator ==( const LotusRange& rRef ) const
89 return ( nHash == rRef.nHash && nColStart == rRef.nColStart &&
90 nRowStart == rRef.nRowStart && nColEnd == rRef.nColEnd &&
91 nRowEnd == rRef.nRowEnd );
95 inline BOOL LotusRange::operator !=( const LotusRange& rRef ) const
97 return ( nHash != rRef.nHash || nColStart != rRef.nColStart ||
98 nRowStart != rRef.nRowStart || nColEnd != rRef.nColEnd ||
99 nRowEnd != rRef.nRowEnd );
103 inline BOOL LotusRange::IsSingle( void ) const
105 return ( nColStart == nColEnd && nRowStart == nRowEnd );
110 // ----------------------------------------------------- class LotusRangeList -
112 class LotusRangeList : private List
114 private:
115 LR_ID nIdCnt;
116 ScComplexRefData aComplRef;
117 static SCCOL nEingCol;
118 static SCROW nEingRow;
119 public:
120 LotusRangeList( void );
121 ~LotusRangeList( void );
122 inline UINT16 GetIndex( SCCOL nCol, SCROW nRow );
123 inline UINT16 GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
124 UINT16 GetIndex( const LotusRange& );
125 inline void Append( SCCOL nCol, SCROW nRow, const String& );
126 inline void Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const String& );
127 void Append( LotusRange* pLR, const String& rName );
128 inline static void SetEing( const SCCOL nCol, const SCROW nRow );
132 inline LR_ID LotusRangeList::GetIndex( SCCOL nCol, SCROW nRow )
134 LotusRange aRef( nCol, nRow );
135 return GetIndex( aRef );
139 inline LR_ID LotusRangeList::GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE )
141 LotusRange aRef( nColS, nRowS, nColE, nRowE );
142 return GetIndex( aRef );
146 inline void LotusRangeList::Append( SCCOL nCol, SCROW nRow, const String& rName )
148 Append( new LotusRange( nCol, nRow ), rName );
152 inline void LotusRangeList::Append( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE, const String& r )
154 Append( new LotusRange( nColS, nRowS, nColE, nRowE ), r );
158 inline void LotusRangeList::SetEing( const SCCOL nCol, const SCROW nRow )
160 nEingCol = nCol;
161 nEingRow = nRow;
164 #endif