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,
86  bool bUseDetailsPos = false );
87 };
88 
90 {
91 public:
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  const OUString& rString,
102  sal_Unicode cSearchChar,
103  sal_Int32 nOffset,
104  sal_Unicode cQuote = '\'');
105 
106  static sal_Int32 IndexOfDifferent(
107  const OUString& rString,
108  sal_Unicode cSearchChar,
109  sal_Int32 nOffset );
110 
111  static sal_Int32 GetTokenCount(
112  const OUString& rString,
113  sal_Unicode cSeparator = ' ');
114 
115  static void GetTokenByOffset(
116  OUString& rToken,
117  const OUString& 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  const OUString& rAddressStr,
130  const ScDocument& rDocument,
132  sal_Int32& nOffset,
133  sal_Unicode cSeparator = ' ',
134  sal_Unicode cQuote = '\'');
135  static bool GetRangeFromString(
136  ScRange& rRange,
137  const OUString& 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  const OUString& rRangeListStr,
146  const ScDocument& rDocument,
148  sal_Unicode cSeparator = ' ',
149  sal_Unicode cQuote = '\'');
150 
151  static bool GetAreaFromString(
152  ScArea& rArea,
153  const OUString& rRangeStr,
154  const ScDocument& rDocument,
156  sal_Int32& nOffset,
157  sal_Unicode cSeparator = ' ');
158 
160  static bool GetRangeFromString(
161  css::table::CellRangeAddress& rRange,
162  const OUString& rRangeStr,
163  const ScDocument& rDocument,
165  sal_Int32& nOffset,
166  sal_Unicode cSeparator = ' ');
167 
169  static void GetStringFromAddress(
170  OUString& rString,
171  const ScAddress& rAddress,
172  const ScDocument* pDocument,
174  sal_Unicode cSeparator = ' ',
175  bool bAppendStr = false,
177  static void GetStringFromRange(
178  OUString& rString,
179  const ScRange& rRange,
180  const ScDocument* pDocument,
182  sal_Unicode cSeparator = ' ',
183  bool bAppendStr = false,
185  static void GetStringFromRangeList(
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 
202  static void GetStringFromAddress(
203  OUString& rString,
204  const css::table::CellAddress& rAddress,
205  const ScDocument* pDocument,
207  sal_Unicode cSeparator = ' ',
208  bool bAppendStr = false );
209  static void GetStringFromRange(
210  OUString& rString,
211  const css::table::CellRangeAddress& rRange,
212  const ScDocument* pDocument,
214  sal_Unicode cSeparator = ' ',
215  bool bAppendStr = false,
217  static void GetStringFromRangeList(
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  const OUString& rXMLRange,
228  const ScDocument& rDoc );
229 
231  static ScRangeData* GetRangeDataFromString( const OUString& rString, const SCTAB nTab,
233 };
234 
235 class ScArea
236 {
237 public:
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 
246 public:
252 };
253 
255 
257 {
258 private:
266 
267 public:
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  static void UpdateDeleteTab(ScAddress& rAddr, const sc::RefUpdateDeleteTabContext& rCxt);
280 };
281 
282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCCOL nColEnd
Definition: rangeutl.hxx:250
SCCOL nColStart
Definition: rangeutl.hxx:248
SCROW nRowStart
Definition: rangeutl.hxx:249
RutlNameScope
Definition: rangeutl.hxx:35
ScRangeName * pRangeName
Definition: rangeutl.hxx:259
bool WasDBName() const
Definition: rangeutl.hxx:271
ScArea(SCTAB tab=0, SCCOL colStart=0, SCROW rowStart=0, SCCOL colEnd=0, SCROW rowEnd=0)
Definition: rangeutl.cxx:977
sal_uInt16 sal_Unicode
DataType::const_iterator const_iterator
Definition: rangenam.hxx:195
SCROW nRowEnd
Definition: rangeutl.hxx:251
bool operator==(const ScArea &r) const
Definition: rangeutl.cxx:986
static SC_DLLPUBLIC const Details detailsOOOa1
Definition: address.hxx:228
ScRangeName::const_iterator maRNPos
Definition: rangeutl.hxx:261
sal_Int16 SCCOL
Definition: types.hxx:21
exports com.sun.star.awt. tab
ScDBCollection * pDBCollection
Definition: rangeutl.hxx:260
ScRangeName::const_iterator maRNEnd
Definition: rangeutl.hxx:262
ScDBCollection::NamedDBs::const_iterator maDBPos
Definition: rangeutl.hxx:263
sal_Int32 SCROW
Definition: types.hxx:17
ScDBCollection::NamedDBs::const_iterator maDBEnd
Definition: rangeutl.hxx:264
DBsType::const_iterator const_iterator
Definition: dbdata.hxx:250
SCTAB nTab
Definition: rangeutl.hxx:247
ScRefFlags
Definition: address.hxx:144
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22