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 <refdata.hxx>
28 typedef sal_uInt16 LR_ID
;
30 #define ID_FAIL 0xFFFF
34 friend class LotusRangeList
;
43 inline void Copy( const LotusRange
& );
44 inline void SetId( LR_ID nId
);
46 LotusRange( SCCOL nCol
, SCROW nRow
);
47 LotusRange( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
48 LotusRange( const LotusRange
& );
49 inline LotusRange
&operator =( const LotusRange
& );
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::IsSingle() const
84 return ( nColStart
== nColEnd
&& nRowStart
== nRowEnd
);
91 ScComplexRefData aComplRef
;
92 std::vector
<std::unique_ptr
<LotusRange
>> maRanges
;
97 inline LR_ID
GetIndex( SCCOL nCol
, SCROW nRow
);
98 inline LR_ID
GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
99 LR_ID
GetIndex( const LotusRange
& );
100 void Append( std::unique_ptr
<LotusRange
> pLR
);
103 inline LR_ID
LotusRangeList::GetIndex( SCCOL nCol
, SCROW nRow
)
105 LotusRange
aRef( nCol
, nRow
);
106 return GetIndex( aRef
);
109 inline LR_ID
LotusRangeList::GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
)
111 LotusRange
aRef( nColS
, nRowS
, nColE
, nRowE
);
112 return GetIndex( aRef
);
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */