LibreOffice Module sc (master) 1
rangeutl.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#pragma once
21
22#include "address.hxx"
23#include "rangenam.hxx"
24#include "dbdata.hxx"
25#include "scdllapi.h"
26
27namespace com::sun::star::table { struct CellAddress; }
28namespace com::sun::star::table { struct CellRangeAddress; }
29namespace com::sun::star::uno { template <typename > class Sequence; }
30
31class ScArea;
32class ScDocument;
33class ScRangeList;
34
36{
42};
43
45{
46public:
47 ScRangeUtil() = delete;
48
49 static bool MakeArea ( const OUString& rAreaStr,
50 ScArea& rArea,
51 const ScDocument& rDoc,
52 SCTAB nTab,
53 ScAddress::Details const & rDetails );
54
55 static void CutPosString ( const OUString& theAreaStr,
56 OUString& thePosStr );
57
58 static bool IsAbsTabArea ( const OUString& rAreaStr,
59 const ScDocument* pDoc,
60 std::unique_ptr<ScArea[]>* ppAreas,
61 sal_uInt16* pAreaCount,
62 bool bAcceptCellRef = false,
64
65 static bool IsAbsArea ( const OUString& rAreaStr,
66 const ScDocument& rDoc,
67 SCTAB nTab,
68 OUString* pCompleteStr,
69 ScRefAddress* pStartPos = nullptr,
70 ScRefAddress* pEndPos = nullptr,
72
73 static bool IsAbsPos ( const OUString& rPosStr,
74 const ScDocument& rDoc,
75 SCTAB nTab,
76 OUString* pCompleteStr,
77 ScRefAddress* pPosTripel = nullptr,
79
80 static bool MakeRangeFromName( const OUString& rName,
81 const ScDocument& rDoc,
82 SCTAB nCurTab,
83 ScRange& rRange,
86 bool bUseDetailsPos = false );
87};
88
90{
91public:
92
94 static void AssignString(
95 OUString& rString,
96 const OUString& rNewStr,
97 bool bAppendStr,
98 sal_Unicode cSeparator = ' ');
99
100 static sal_Int32 IndexOf(
101 std::u16string_view rString,
102 sal_Unicode cSearchChar,
103 sal_Int32 nOffset,
104 sal_Unicode cQuote = '\'');
105
106 static sal_Int32 IndexOfDifferent(
107 std::u16string_view rString,
108 sal_Unicode cSearchChar,
109 sal_Int32 nOffset );
110
111 static sal_Int32 GetTokenCount(
112 std::u16string_view rString,
113 sal_Unicode cSeparator = ' ');
114
115 static void GetTokenByOffset(
116 OUString& rToken,
117 std::u16string_view rString,
118 sal_Int32& nOffset,
119 sal_Unicode cSeparator = ' ',
120 sal_Unicode cQuote = '\'');
121
122 static void AppendTableName(
123 OUStringBuffer& rBuf,
124 const OUString& rTabName);
125
127 static bool GetAddressFromString(
128 ScAddress& rAddress,
129 std::u16string_view rAddressStr,
130 const ScDocument& rDocument,
132 sal_Int32& nOffset,
133 sal_Unicode cSeparator = ' ',
134 sal_Unicode cQuote = '\'');
136 ScRange& rRange,
137 std::u16string_view rRangeStr,
138 const ScDocument& rDocument,
140 sal_Int32& nOffset,
141 sal_Unicode cSeparator = ' ',
142 sal_Unicode cQuote = '\'');
143 static bool GetRangeListFromString(
144 ScRangeList& rRangeList,
145 std::u16string_view rRangeListStr,
146 const ScDocument& rDocument,
148 sal_Unicode cSeparator = ' ',
149 sal_Unicode cQuote = '\'');
150
151 static bool GetAreaFromString(
152 ScArea& rArea,
153 std::u16string_view rRangeStr,
154 const ScDocument& rDocument,
156 sal_Int32& nOffset,
157 sal_Unicode cSeparator = ' ');
158
161 css::table::CellRangeAddress& rRange,
162 std::u16string_view rRangeStr,
163 const ScDocument& rDocument,
165 sal_Int32& nOffset,
166 sal_Unicode cSeparator = ' ');
167
170 OUString& rString,
171 const ScAddress& rAddress,
172 const ScDocument* pDocument,
174 sal_Unicode cSeparator = ' ',
175 bool bAppendStr = false,
178 OUString& rString,
179 const ScRange& rRange,
180 const ScDocument* pDocument,
182 sal_Unicode cSeparator = ' ',
183 bool bAppendStr = false,
186 OUString& rString,
187 const ScRangeList* pRangeList,
188 const ScDocument* pDocument,
190 sal_Unicode cSeparator = ' ');
191
192 static void GetStringFromArea(
193 OUString& rString,
194 const ScArea& rArea,
195 const ScDocument* pDocument,
197 sal_Unicode cSeparator,
198 bool bAppendStr = false,
200
203 OUString& rString,
204 const css::table::CellAddress& rAddress,
205 const ScDocument* pDocument,
207 sal_Unicode cSeparator = ' ',
208 bool bAppendStr = false );
210 OUString& rString,
211 const css::table::CellRangeAddress& rRange,
212 const ScDocument* pDocument,
214 sal_Unicode cSeparator = ' ',
215 bool bAppendStr = false,
218 OUString& rString,
219 const css::uno::Sequence< css::table::CellRangeAddress >& rRangeSeq,
220 const ScDocument* pDocument,
222 sal_Unicode cSeparator = ' ' );
223
225 static void GetStringFromXMLRangeString(
226 OUString& rString,
227 std::u16string_view rXMLRange,
228 const ScDocument& rDoc );
229
231 static ScRangeData* GetRangeDataFromString( const OUString& rString, const SCTAB nTab,
233};
234
236{
237public:
238 ScArea( SCTAB tab = 0,
239 SCCOL colStart = 0,
240 SCROW rowStart = 0,
241 SCCOL colEnd = 0,
242 SCROW rowEnd = 0 );
243
244 bool operator== ( const ScArea& r ) const;
245
246public:
252};
253
255
257{
258private:
266
267public:
268 ScAreaNameIterator( const ScDocument& rDoc );
269
270 bool Next( OUString& rName, ScRange& rRange );
271 bool WasDBName() const { return !bFirstPass; }
272};
273
275{
276 ScRangeUpdater() = delete;
277
278 static void UpdateInsertTab(ScAddress& rAddr, const sc::RefUpdateInsertTabContext& rCxt);
279
288 static void UpdateDeleteTab(ScAddress& rAddr, const sc::RefUpdateDeleteTabContext& rCxt);
289};
290
291/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScRefFlags
Definition: address.hxx:158
static SC_DLLPUBLIC const Details detailsOOOa1
Definition: address.hxx:241
ScRangeName::const_iterator maRNPos
Definition: rangeutl.hxx:261
bool WasDBName() const
Definition: rangeutl.hxx:271
ScRangeName * pRangeName
Definition: rangeutl.hxx:259
ScDBCollection * pDBCollection
Definition: rangeutl.hxx:260
ScDBCollection::NamedDBs::const_iterator maDBEnd
Definition: rangeutl.hxx:264
ScRangeName::const_iterator maRNEnd
Definition: rangeutl.hxx:262
ScDBCollection::NamedDBs::const_iterator maDBPos
Definition: rangeutl.hxx:263
SCCOL nColEnd
Definition: rangeutl.hxx:250
SCTAB nTab
Definition: rangeutl.hxx:247
SCCOL nColStart
Definition: rangeutl.hxx:248
ScArea(SCTAB tab=0, SCCOL colStart=0, SCROW rowStart=0, SCCOL colEnd=0, SCROW rowEnd=0)
Definition: rangeutl.cxx:976
SCROW nRowEnd
Definition: rangeutl.hxx:251
SCROW nRowStart
Definition: rangeutl.hxx:249
bool operator==(const ScArea &r) const
Definition: rangeutl.cxx:985
DBsType::const_iterator const_iterator
Definition: dbdata.hxx:258
DataType::const_iterator const_iterator
Definition: rangenam.hxx:203
static void GetStringFromRange(OUString &rString, const ScRange &rRange, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
static bool GetRangeFromString(ScRange &rRange, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ', sal_Unicode cQuote='\'')
static void GetStringFromRangeList(OUString &rString, const ScRangeList *pRangeList, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ')
static void GetStringFromRange(OUString &rString, const css::table::CellRangeAddress &rRange, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
static void GetStringFromAddress(OUString &rString, const ScAddress &rAddress, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false, ScRefFlags nFormatFlags=ScRefFlags::VALID|ScRefFlags::TAB_3D)
Range to String core.
static void GetStringFromAddress(OUString &rString, const css::table::CellAddress &rAddress, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ', bool bAppendStr=false)
Range to String API.
static bool GetRangeFromString(css::table::CellRangeAddress &rRange, std::u16string_view rRangeStr, const ScDocument &rDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Int32 &nOffset, sal_Unicode cSeparator=' ')
String to Range API.
static void GetStringFromRangeList(OUString &rString, const css::uno::Sequence< css::table::CellRangeAddress > &rRangeSeq, const ScDocument *pDocument, formula::FormulaGrammar::AddressConvention eConv, sal_Unicode cSeparator=' ')
ScRangeUtil()=delete
RutlNameScope
Definition: rangeutl.hxx:36
@ RUTL_DBASE
Definition: rangeutl.hxx:41
@ RUTL_NAMES_GLOBAL
Definition: rangeutl.hxx:40
@ RUTL_NONE
Definition: rangeutl.hxx:37
@ RUTL_NAMES_LOCAL
Definition: rangeutl.hxx:39
@ RUTL_NAMES
Definition: rangeutl.hxx:38
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
ScRangeUpdater()=delete
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17