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 
27 namespace com::sun::star::table { struct CellAddress; }
28 namespace com::sun::star::table { struct CellRangeAddress; }
29 namespace com::sun::star::uno { template <typename > class Sequence; }
30 
31 class ScArea;
32 class ScDocument;
33 class ScRangeList;
34 
36 {
37  RUTL_NONE = 0,
42 };
43 
45 {
46 public:
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,
63  ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
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,
71  ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
72 
73  static bool IsAbsPos ( const OUString& rPosStr,
74  const ScDocument& rDoc,
75  SCTAB nTab,
76  OUString* pCompleteStr,
77  ScRefAddress* pPosTripel = nullptr,
78  ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
79 
80  static bool MakeRangeFromName( const OUString& rName,
81  const ScDocument& rDoc,
82  SCTAB nCurTab,
83  ScRange& rRange,
85  ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
86 };
87 
89 {
90 public:
91 
93  static void AssignString(
94  OUString& rString,
95  const OUString& rNewStr,
96  bool bAppendStr,
97  sal_Unicode cSeparator = ' ');
98 
99  static sal_Int32 IndexOf(
100  const OUString& rString,
101  sal_Unicode cSearchChar,
102  sal_Int32 nOffset,
103  sal_Unicode cQuote = '\'');
104 
105  static sal_Int32 IndexOfDifferent(
106  const OUString& rString,
107  sal_Unicode cSearchChar,
108  sal_Int32 nOffset );
109 
110  static sal_Int32 GetTokenCount(
111  const OUString& rString,
112  sal_Unicode cSeparator = ' ');
113 
114  static void GetTokenByOffset(
115  OUString& rToken,
116  const OUString& rString,
117  sal_Int32& nOffset,
118  sal_Unicode cSeparator = ' ',
119  sal_Unicode cQuote = '\'');
120 
121  static void AppendTableName(
122  OUStringBuffer& rBuf,
123  const OUString& rTabName);
124 
126  static bool GetAddressFromString(
127  ScAddress& rAddress,
128  const OUString& rAddressStr,
129  const ScDocument& rDocument,
131  sal_Int32& nOffset,
132  sal_Unicode cSeparator = ' ',
133  sal_Unicode cQuote = '\'');
134  static bool GetRangeFromString(
135  ScRange& rRange,
136  const OUString& rRangeStr,
137  const ScDocument& rDocument,
139  sal_Int32& nOffset,
140  sal_Unicode cSeparator = ' ',
141  sal_Unicode cQuote = '\'');
142  static bool GetRangeListFromString(
143  ScRangeList& rRangeList,
144  const OUString& rRangeListStr,
145  const ScDocument& rDocument,
147  sal_Unicode cSeparator = ' ',
148  sal_Unicode cQuote = '\'');
149 
150  static bool GetAreaFromString(
151  ScArea& rArea,
152  const OUString& rRangeStr,
153  const ScDocument& rDocument,
155  sal_Int32& nOffset,
156  sal_Unicode cSeparator = ' ');
157 
159  static bool GetRangeFromString(
160  css::table::CellRangeAddress& rRange,
161  const OUString& rRangeStr,
162  const ScDocument& rDocument,
164  sal_Int32& nOffset,
165  sal_Unicode cSeparator = ' ');
166 
168  static void GetStringFromAddress(
169  OUString& rString,
170  const ScAddress& rAddress,
171  const ScDocument* pDocument,
173  sal_Unicode cSeparator = ' ',
174  bool bAppendStr = false,
176  static void GetStringFromRange(
177  OUString& rString,
178  const ScRange& rRange,
179  const ScDocument* pDocument,
181  sal_Unicode cSeparator = ' ',
182  bool bAppendStr = false,
184  static void GetStringFromRangeList(
185  OUString& rString,
186  const ScRangeList* pRangeList,
187  const ScDocument* pDocument,
189  sal_Unicode cSeparator = ' ');
190 
191  static void GetStringFromArea(
192  OUString& rString,
193  const ScArea& rArea,
194  const ScDocument* pDocument,
196  sal_Unicode cSeparator,
197  bool bAppendStr = false,
199 
201  static void GetStringFromAddress(
202  OUString& rString,
203  const css::table::CellAddress& rAddress,
204  const ScDocument* pDocument,
206  sal_Unicode cSeparator = ' ',
207  bool bAppendStr = false );
208  static void GetStringFromRange(
209  OUString& rString,
210  const css::table::CellRangeAddress& rRange,
211  const ScDocument* pDocument,
213  sal_Unicode cSeparator = ' ',
214  bool bAppendStr = false,
216  static void GetStringFromRangeList(
217  OUString& rString,
218  const css::uno::Sequence< css::table::CellRangeAddress >& rRangeSeq,
219  const ScDocument* pDocument,
221  sal_Unicode cSeparator = ' ' );
222 
224  static void GetStringFromXMLRangeString(
225  OUString& rString,
226  const OUString& rXMLRange,
227  const ScDocument& rDoc );
228 
230  static ScRangeData* GetRangeDataFromString( const OUString& rString, const SCTAB nTab,
232 };
233 
234 class ScArea
235 {
236 public:
237  ScArea( SCTAB tab = 0,
238  SCCOL colStart = 0,
239  SCROW rowStart = 0,
240  SCCOL colEnd = 0,
241  SCROW rowEnd = 0 );
242 
243  bool operator== ( const ScArea& r ) const;
244 
245 public:
251 };
252 
254 
256 {
257 private:
265 
266 public:
267  ScAreaNameIterator( const ScDocument& rDoc );
268 
269  bool Next( OUString& rName, ScRange& rRange );
270  bool WasDBName() const { return !bFirstPass; }
271 };
272 
274 {
275  ScRangeUpdater() = delete;
276 
277  static void UpdateInsertTab(ScAddress& rAddr, const sc::RefUpdateInsertTabContext& rCxt);
278  static void UpdateDeleteTab(ScAddress& rAddr, const sc::RefUpdateDeleteTabContext& rCxt);
279 };
280 
281 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCCOL nColEnd
Definition: rangeutl.hxx:249
SCCOL nColStart
Definition: rangeutl.hxx:247
SCROW nRowStart
Definition: rangeutl.hxx:248
RutlNameScope
Definition: rangeutl.hxx:35
ScRangeName * pRangeName
Definition: rangeutl.hxx:258
bool WasDBName() const
Definition: rangeutl.hxx:270
ScArea(SCTAB tab=0, SCCOL colStart=0, SCROW rowStart=0, SCCOL colEnd=0, SCROW rowEnd=0)
Definition: rangeutl.cxx:969
sal_uInt16 sal_Unicode
DataType::const_iterator const_iterator
Definition: rangenam.hxx:195
SCROW nRowEnd
Definition: rangeutl.hxx:250
bool operator==(const ScArea &r) const
Definition: rangeutl.cxx:978
static SC_DLLPUBLIC const Details detailsOOOa1
Definition: address.hxx:228
ScRangeName::const_iterator maRNPos
Definition: rangeutl.hxx:260
sal_Int16 SCCOL
Definition: types.hxx:21
exports com.sun.star.awt. tab
ScDBCollection * pDBCollection
Definition: rangeutl.hxx:259
ScRangeName::const_iterator maRNEnd
Definition: rangeutl.hxx:261
ScDBCollection::NamedDBs::const_iterator maDBPos
Definition: rangeutl.hxx:262
sal_Int32 SCROW
Definition: types.hxx:17
ScDBCollection::NamedDBs::const_iterator maDBEnd
Definition: rangeutl.hxx:263
DBsType::const_iterator const_iterator
Definition: dbdata.hxx:250
SCTAB nTab
Definition: rangeutl.hxx:246
ScRefFlags
Definition: address.hxx:144
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22