1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTRANGE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_LOTRANGE_HXX
23 #include <compiler.hxx>
27 typedef sal_uInt16 LR_ID
;
29 #define ID_FAIL 0xFFFF
33 friend class LotusRangeList
;
42 inline void Copy( const LotusRange
& );
43 inline void SetId( LR_ID nId
);
45 LotusRange( SCCOL nCol
, SCROW nRow
);
46 LotusRange( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
47 LotusRange( const LotusRange
& );
48 inline LotusRange
&operator =( const LotusRange
& );
49 inline bool operator ==( const LotusRange
& ) const;
50 inline bool operator !=( const LotusRange
& ) const;
51 inline bool IsSingle() const;
54 inline void LotusRange::Copy( const LotusRange
& rCpy
)
57 nColStart
= rCpy
.nColStart
;
58 nRowStart
= rCpy
.nRowStart
;
59 nColEnd
= rCpy
.nColEnd
;
60 nRowEnd
= rCpy
.nRowEnd
;
64 inline void LotusRange::SetId( LR_ID nNewId
)
69 inline LotusRange
&LotusRange::operator =( const LotusRange
& rCpy
)
75 inline bool LotusRange::operator ==( const LotusRange
& rRef
) const
77 return ( nHash
== rRef
.nHash
&& nColStart
== rRef
.nColStart
&&
78 nRowStart
== rRef
.nRowStart
&& nColEnd
== rRef
.nColEnd
&&
79 nRowEnd
== rRef
.nRowEnd
);
82 inline bool LotusRange::operator !=( const LotusRange
& rRef
) const
84 return ( nHash
!= rRef
.nHash
|| nColStart
!= rRef
.nColStart
||
85 nRowStart
!= rRef
.nRowStart
|| nColEnd
!= rRef
.nColEnd
||
86 nRowEnd
!= rRef
.nRowEnd
);
89 inline bool LotusRange::IsSingle() const
91 return ( nColStart
== nColEnd
&& nRowStart
== nRowEnd
);
97 LOTUS_ROOT
* m_pLotRoot
;
99 ScComplexRefData aComplRef
;
100 static SCCOL nEingCol
;
101 static SCROW nEingRow
;
102 std::vector
<LotusRange
*> maRanges
;
105 LotusRangeList(LOTUS_ROOT
* pLotRoot
);
107 inline sal_uInt16
GetIndex( SCCOL nCol
, SCROW nRow
);
108 inline sal_uInt16
GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
109 sal_uInt16
GetIndex( const LotusRange
& );
110 inline void Append( SCCOL nCol
, SCROW nRow
, const OUString
& );
111 inline void Append( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
, const OUString
& );
112 void Append( LotusRange
* pLR
, const OUString
& rName
);
113 inline static void SetEing( const SCCOL nCol
, const SCROW nRow
);
116 inline LR_ID
LotusRangeList::GetIndex( SCCOL nCol
, SCROW nRow
)
118 LotusRange
aRef( nCol
, nRow
);
119 return GetIndex( aRef
);
122 inline LR_ID
LotusRangeList::GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
)
124 LotusRange
aRef( nColS
, nRowS
, nColE
, nRowE
);
125 return GetIndex( aRef
);
128 inline void LotusRangeList::Append( SCCOL nCol
, SCROW nRow
, const OUString
& rName
)
130 Append( new LotusRange( nCol
, nRow
), rName
);
133 inline void LotusRangeList::Append( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
, const OUString
& r
)
135 Append( new LotusRange( nColS
, nRowS
, nColE
, nRowE
), r
);
138 inline void LotusRangeList::SetEing( const SCCOL nCol
, const SCROW nRow
)
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */