tdf#125181 maxY is 50000 in prstGeom for star24 and star32
[LibreOffice.git] / sc / inc / rangelst.hxx
blob4aff9611e8850d8b51113360d9fc96593ee7f1a9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_RANGELST_HXX
21 #define INCLUDED_SC_INC_RANGELST_HXX
23 #include "global.hxx"
24 #include "address.hxx"
25 #include <ostream>
26 #include <vector>
27 #include <sal/types.h>
29 class ScDocument;
32 class SAL_WARN_UNUSED SC_DLLPUBLIC ScRangeList final : public SvRefBase
34 public:
35 ScRangeList();
36 ScRangeList( const ScRangeList& rList );
37 ScRangeList( const ScRangeList&& rList );
38 ScRangeList( const ScRange& rRange );
39 virtual ~ScRangeList() override;
41 ScRangeList& operator=(const ScRangeList& rList);
42 ScRangeList& operator=(ScRangeList&& rList);
44 ScRefFlags Parse( const OUString&, const ScDocument*,
45 formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
46 SCTAB nDefaultTab = 0, sal_Unicode cDelimiter = 0 );
48 void Format( OUString&, ScRefFlags nFlags, ScDocument*,
49 formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
50 sal_Unicode cDelimiter = 0, bool bFullAddressNotation = false ) const;
52 void Join( const ScRange&, bool bIsInList = false );
54 bool UpdateReference( UpdateRefMode, const ScDocument*,
55 const ScRange& rWhere,
56 SCCOL nDx,
57 SCROW nDy,
58 SCTAB nDz
61 void InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize );
62 void InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize );
64 /** For now this method assumes that nTab1 == nTab2
65 * The algorithm will be much more complicated if nTab1 != nTab2
67 bool DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2,
68 SCROW nRow2, SCTAB nTab2 );
70 const ScRange* Find( const ScAddress& ) const;
71 ScRange* Find( const ScAddress& );
72 bool operator==( const ScRangeList& ) const;
73 bool operator!=( const ScRangeList& r ) const;
74 bool Intersects( const ScRange& ) const;
75 bool In( const ScRange& ) const;
76 size_t GetCellCount() const;
77 ScAddress GetTopLeftCorner() const;
79 ScRangeList GetIntersectedRange(const ScRange& rRange) const;
81 void Remove(size_t nPos);
82 void RemoveAll();
84 ScRange Combine() const;
86 bool empty() const { return maRanges.empty(); }
87 size_t size() const { return maRanges.size(); }
88 ScRange& operator[](size_t idx) { return maRanges[idx]; }
89 const ScRange& operator[](size_t idx) const { return maRanges[idx]; }
90 ScRange& front() { return maRanges.front(); }
91 const ScRange& front() const { return maRanges.front(); }
92 ScRange& back() { return maRanges.back(); }
93 const ScRange& back() const { return maRanges.back(); }
94 void push_back(const ScRange & rRange);
95 ::std::vector<ScRange>::const_iterator begin() const { return maRanges.begin(); }
96 ::std::vector<ScRange>::const_iterator end() const { return maRanges.end(); }
97 ::std::vector<ScRange>::iterator begin() { return maRanges.begin(); }
98 ::std::vector<ScRange>::iterator end() { return maRanges.end(); }
100 void swap( ScRangeList& r );
102 private:
103 ::std::vector<ScRange> maRanges;
104 SCROW mnMaxRowUsed;
106 typedef tools::SvRef<ScRangeList> ScRangeListRef;
108 // For use in SAL_DEBUG etc. Output format not guaranteed to be stable.
109 template<typename charT, typename traits>
110 inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, traits> & stream, const ScRangeList& rRangeList)
112 stream << "(";
113 for (size_t i = 0; i < rRangeList.size(); ++i)
115 if (i > 0)
116 stream << ",";
117 stream << rRangeList[i];
119 stream << ")";
121 return stream;
124 // RangePairList:
125 // aRange[0]: actual range,
126 // aRange[1]: data for that range, e.g. Rows belonging to a ColName
127 class SC_DLLPUBLIC ScRangePairList : public SvRefBase
129 public:
130 virtual ~ScRangePairList() override;
131 ScRangePairList* Clone() const;
132 void Append( const ScRangePair& rRangePair )
134 maPairs.push_back( rRangePair );
136 void Join( const ScRangePair&, bool bIsInList = false );
137 void UpdateReference( UpdateRefMode, const ScDocument*,
138 const ScRange& rWhere,
139 SCCOL nDx, SCROW nDy, SCTAB nDz );
140 void DeleteOnTab( SCTAB nTab );
141 ScRangePair* Find( const ScAddress& );
142 ScRangePair* Find( const ScRange& );
143 std::vector<const ScRangePair*>
144 CreateNameSortedArray( ScDocument* ) const;
146 void Remove(size_t nPos);
147 void Remove(const ScRangePair & rAdr);
149 size_t size() const;
150 ScRangePair& operator[](size_t idx);
151 const ScRangePair& operator[](size_t idx) const;
153 private:
154 ::std::vector< ScRangePair > maPairs;
156 typedef tools::SvRef<ScRangePairList> ScRangePairListRef;
158 extern "C"
159 int ScRangePairList_QsortNameCompare( const void*, const void* );
161 #endif
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */