LibreOffice Module sc (master)  1
lotrange.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_LOTRANGE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_LOTRANGE_HXX
22 
23 #include <refdata.hxx>
24 #include <types.hxx>
25 
26 typedef sal_uInt16 LR_ID;
27 
28 #define ID_FAIL 0xFFFF
29 
31 {
32  friend class LotusRangeList;
33 private:
34  sal_uInt32 nHash;
40  void MakeHash();
41  inline void Copy( const LotusRange& );
42  inline void SetId( LR_ID nId );
43 public:
44  LotusRange( SCCOL nCol, SCROW nRow );
45  LotusRange( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
46  LotusRange( const LotusRange& );
47  inline LotusRange &operator =( const LotusRange& );
48  inline bool operator ==( const LotusRange& ) const;
49  inline bool IsSingle() const;
50 };
51 
52 inline void LotusRange::Copy( const LotusRange& rCpy )
53 {
54  nHash = rCpy.nHash;
55  nColStart = rCpy.nColStart;
56  nRowStart = rCpy.nRowStart;
57  nColEnd = rCpy.nColEnd;
58  nRowEnd = rCpy.nRowEnd;
59  nId = rCpy.nId;
60 }
61 
62 inline void LotusRange::SetId( LR_ID nNewId )
63 {
64  nId = nNewId;
65 }
66 
68 {
69  Copy( rCpy );
70  return *this;
71 }
72 
73 inline bool LotusRange::operator ==( const LotusRange& rRef ) const
74 {
75  return ( nHash == rRef.nHash && nColStart == rRef.nColStart &&
76  nRowStart == rRef.nRowStart && nColEnd == rRef.nColEnd &&
77  nRowEnd == rRef.nRowEnd );
78 }
79 
80 inline bool LotusRange::IsSingle() const
81 {
82  return ( nColStart == nColEnd && nRowStart == nRowEnd );
83 }
84 
86 {
87 private:
90  std::vector<std::unique_ptr<LotusRange>> maRanges;
91 
92 public:
95  inline LR_ID GetIndex( SCCOL nCol, SCROW nRow );
96  inline LR_ID GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
97  LR_ID GetIndex( const LotusRange& );
98  void Append( const ScDocument* pDoc, std::unique_ptr<LotusRange> pLR );
99 };
100 
102 {
103  LotusRange aRef( nCol, nRow );
104  return GetIndex( aRef );
105 }
106 
107 inline LR_ID LotusRangeList::GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE )
108 {
109  LotusRange aRef( nColS, nRowS, nColE, nRowE );
110  return GetIndex( aRef );
111 }
112 
113 #endif
114 
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LR_ID nId
Definition: lotrange.hxx:39
std::vector< std::unique_ptr< LotusRange > > maRanges
Definition: lotrange.hxx:90
void Copy(const LotusRange &)
Definition: lotrange.hxx:52
sal_uInt16 LR_ID
Definition: lotrange.hxx:26
SCROW nRowStart
Definition: lotrange.hxx:36
void MakeHash()
Definition: tool.cxx:330
LR_ID GetIndex(SCCOL nCol, SCROW nRow)
Definition: lotrange.hxx:101
ScComplexRefData aComplRef
Definition: lotrange.hxx:89
LotusRangeList()
Definition: tool.cxx:367
sal_uInt32 nHash
Definition: lotrange.hxx:34
void Append(const ScDocument *pDoc, std::unique_ptr< LotusRange > pLR)
Definition: tool.cxx:401
SCCOL nColEnd
Definition: lotrange.hxx:37
bool operator==(const LotusRange &) const
Definition: lotrange.hxx:73
~LotusRangeList()
Definition: tool.cxx:387
sal_Int16 SCCOL
Definition: types.hxx:22
LotusRange & operator=(const LotusRange &)
Definition: lotrange.hxx:67
LotusRange(SCCOL nCol, SCROW nRow)
Definition: tool.cxx:344
sal_Int32 SCROW
Definition: types.hxx:18
SCROW nRowEnd
Definition: lotrange.hxx:38
void SetId(LR_ID nId)
Definition: lotrange.hxx:62
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
bool IsSingle() const
Definition: lotrange.hxx:80
SCCOL nColStart
Definition: lotrange.hxx:35