build fix
[LibreOffice.git] / sc / inc / rangelst.hxx
blob18eb33da90a611e66c95cb253b577c6765d35049
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 <vector>
26 #include <sal/types.h>
28 class ScDocument;
30 class SC_DLLPUBLIC ScRangeList : public SvRefBase
32 public:
33 ScRangeList();
34 ScRangeList( const ScRangeList& rList );
35 ScRangeList( const ScRange& rRange );
36 virtual ~ScRangeList() override;
38 ScRangeList& operator=(const ScRangeList& rList);
39 void Append( const ScRange& rRange );
41 ScRefFlags Parse( const OUString&, ScDocument*,
42 formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
43 SCTAB nDefaultTab = 0, sal_Unicode cDelimiter = 0 );
45 void Format( OUString&, ScRefFlags nFlags, ScDocument* = nullptr,
46 formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO,
47 sal_Unicode cDelimiter = 0 ) const;
49 void Join( const ScRange&, bool bIsInList = false );
51 bool UpdateReference( UpdateRefMode, ScDocument*,
52 const ScRange& rWhere,
53 SCsCOL nDx,
54 SCsROW nDy,
55 SCsTAB nDz
58 void InsertRow( SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize );
59 void InsertCol( SCTAB nTab, SCROW nRowStart, SCROW nRowEnd, SCCOL nColPos, SCSIZE nSize );
61 /** For now this method assumes that nTab1 == nTab2
62 * The algorithm will be much more complicated if nTab1 != nTab2
64 bool DeleteArea( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2,
65 SCROW nRow2, SCTAB nTab2 );
67 const ScRange* Find( const ScAddress& ) const;
68 ScRange* Find( const ScAddress& );
69 bool operator==( const ScRangeList& ) const;
70 bool operator!=( const ScRangeList& r ) const;
71 bool Intersects( const ScRange& ) const;
72 bool In( const ScRange& ) const;
73 size_t GetCellCount() const;
74 ScAddress GetTopLeftCorner() const;
76 ScRangeList GetIntersectedRange(const ScRange& rRange) const;
78 ScRange* Remove(size_t nPos);
79 void RemoveAll();
81 ScRange Combine() const;
83 bool empty() const;
84 size_t size() const;
85 ScRange* operator[](size_t idx);
86 const ScRange* operator[](size_t idx) const;
87 ScRange* front();
88 const ScRange* front() const;
89 ScRange* back();
90 const ScRange* back() const;
91 void push_back(ScRange* p);
93 void swap( ScRangeList& r );
95 private:
96 ::std::vector<ScRange*> maRanges;
97 SCROW mnMaxRowUsed;
98 typedef std::vector<ScRange*>::iterator iterator;
99 typedef std::vector<ScRange*>::const_iterator const_iterator;
101 typedef tools::SvRef<ScRangeList> ScRangeListRef;
103 // RangePairList:
104 // aRange[0]: actual range,
105 // aRange[1]: data for that range, e.g. Rows belonging to a ColName
106 class SC_DLLPUBLIC ScRangePairList : public SvRefBase
108 public:
109 virtual ~ScRangePairList() override;
110 ScRangePairList* Clone() const;
111 void Append( const ScRangePair& rRangePair )
113 ScRangePair* pR = new ScRangePair( rRangePair );
114 maPairs.push_back( pR );
116 void Join( const ScRangePair&, bool bIsInList = false );
117 void UpdateReference( UpdateRefMode, ScDocument*,
118 const ScRange& rWhere,
119 SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
120 void DeleteOnTab( SCTAB nTab );
121 ScRangePair* Find( const ScAddress& ) const;
122 ScRangePair* Find( const ScRange& ) const;
123 ScRangePair** CreateNameSortedArray( size_t& nCount, ScDocument* ) const;
125 void Remove(size_t nPos);
126 ScRangePair* Remove(ScRangePair* pAdr);
128 size_t size() const;
129 ScRangePair* operator[](size_t idx);
130 const ScRangePair* operator[](size_t idx) const;
132 private:
133 ::std::vector< ScRangePair* > maPairs;
135 typedef tools::SvRef<ScRangePairList> ScRangePairListRef;
137 extern "C"
138 int SAL_CALL ScRangePairList_QsortNameCompare( const void*, const void* );
140 #endif
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */