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 .
22 #include <refdata.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 IsSingle() const;
53 inline void LotusRange::Copy( const LotusRange
& rCpy
)
56 nColStart
= rCpy
.nColStart
;
57 nRowStart
= rCpy
.nRowStart
;
58 nColEnd
= rCpy
.nColEnd
;
59 nRowEnd
= rCpy
.nRowEnd
;
63 inline void LotusRange::SetId( LR_ID nNewId
)
68 inline LotusRange
&LotusRange::operator =( const LotusRange
& rCpy
)
74 inline bool LotusRange::operator ==( const LotusRange
& rRef
) const
76 return ( nHash
== rRef
.nHash
&& nColStart
== rRef
.nColStart
&&
77 nRowStart
== rRef
.nRowStart
&& nColEnd
== rRef
.nColEnd
&&
78 nRowEnd
== rRef
.nRowEnd
);
81 inline bool LotusRange::IsSingle() const
83 return ( nColStart
== nColEnd
&& nRowStart
== nRowEnd
);
90 ScComplexRefData aComplRef
;
91 std::vector
<std::unique_ptr
<LotusRange
>> maRanges
;
96 inline LR_ID
GetIndex( SCCOL nCol
, SCROW nRow
);
97 inline LR_ID
GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
);
98 LR_ID
GetIndex( const LotusRange
& );
99 void Append( const ScDocument
* pDoc
, std::unique_ptr
<LotusRange
> pLR
);
102 inline LR_ID
LotusRangeList::GetIndex( SCCOL nCol
, SCROW nRow
)
104 LotusRange
aRef( nCol
, nRow
);
105 return GetIndex( aRef
);
108 inline LR_ID
LotusRangeList::GetIndex( SCCOL nColS
, SCROW nRowS
, SCCOL nColE
, SCROW nRowE
)
110 LotusRange
aRef( nColS
, nRowS
, nColE
, nRowE
);
111 return GetIndex( aRef
);
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */