Line data Source code
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 : #ifndef OOX_XLS_ADDRESSCONVERTER_HXX
21 : #define OOX_XLS_ADDRESSCONVERTER_HXX
22 :
23 : #include <vector>
24 : #include <com/sun/star/table/CellAddress.hpp>
25 : #include <com/sun/star/table/CellRangeAddress.hpp>
26 : #include "workbookhelper.hxx"
27 :
28 : namespace oox {
29 : namespace xls {
30 :
31 : class BiffInputStream;
32 :
33 :
34 : /** A vector of com.sun.star.table.CellRangeAddress elements and additional
35 : functionality. */
36 0 : class ApiCellRangeList : public ::std::vector< ::com::sun::star::table::CellRangeAddress >
37 : {
38 : public:
39 0 : inline explicit ApiCellRangeList() {}
40 :
41 : /** Returns the base address of this range list (top-left cell of first range). */
42 : ::com::sun::star::table::CellAddress
43 : getBaseAddress() const;
44 : };
45 :
46 : /** A 2D cell address struct for binary filters. */
47 : struct BinAddress
48 : {
49 : sal_Int32 mnCol;
50 : sal_Int32 mnRow;
51 :
52 0 : inline explicit BinAddress() : mnCol( 0 ), mnRow( 0 ) {}
53 0 : inline explicit BinAddress( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
54 0 : inline explicit BinAddress( const ::com::sun::star::table::CellAddress& rAddr ) : mnCol( rAddr.Column ), mnRow( rAddr.Row ) {}
55 :
56 : inline void set( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; }
57 : inline void set( const ::com::sun::star::table::CellAddress& rAddr ) { mnCol = rAddr.Column; mnRow = rAddr.Row; }
58 :
59 : void read( SequenceInputStream& rStrm );
60 : void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
61 : };
62 :
63 : inline bool operator==( const BinAddress& rL, const BinAddress& rR )
64 : {
65 : return (rL.mnCol == rR.mnCol) && (rL.mnRow == rR.mnRow);
66 : }
67 :
68 0 : inline bool operator<( const BinAddress& rL, const BinAddress& rR )
69 : {
70 0 : return (rL.mnCol < rR.mnCol) || ((rL.mnCol == rR.mnCol) && (rL.mnRow < rR.mnRow));
71 : }
72 :
73 0 : inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinAddress& orPos )
74 : {
75 0 : orPos.read( rStrm );
76 0 : return rStrm;
77 : }
78 :
79 0 : inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinAddress& orPos )
80 : {
81 0 : orPos.read( rStrm );
82 0 : return rStrm;
83 : }
84 :
85 : /** A 2D cell range address struct for binary filters. */
86 : struct BinRange
87 : {
88 : BinAddress maFirst;
89 : BinAddress maLast;
90 :
91 0 : inline explicit BinRange() {}
92 : inline explicit BinRange( const BinAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {}
93 : inline explicit BinRange( const BinAddress& rFirst, const BinAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {}
94 : inline explicit BinRange( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 ) :
95 : maFirst( nCol1, nRow1 ), maLast( nCol2, nRow2 ) {}
96 : inline explicit BinRange( const ::com::sun::star::table::CellAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {}
97 : inline explicit BinRange( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {}
98 : inline explicit BinRange( const ::com::sun::star::table::CellRangeAddress& rRange ) : maFirst( rRange.StartColumn, rRange.StartRow ), maLast( rRange.EndColumn, rRange.EndRow ) {}
99 :
100 : inline void set( const BinAddress& rFirst, const BinAddress& rLast )
101 : { maFirst = rFirst; maLast = rLast; }
102 : inline void set( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 )
103 : { maFirst.set( nCol1, nRow1 ); maLast.set( nCol2, nRow2 ); }
104 : inline void set( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast )
105 : { maFirst.set( rFirst ); maLast.set( rLast ); }
106 : inline void set( const ::com::sun::star::table::CellRangeAddress& rRange )
107 : { maFirst.set( rRange.StartColumn, rRange.StartRow ); maLast.set( rRange.EndColumn, rRange.EndRow ); }
108 :
109 : inline sal_Int32 getColCount() const { return maLast.mnCol - maFirst.mnCol + 1; }
110 : inline sal_Int32 getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; }
111 :
112 : void read( SequenceInputStream& rStrm );
113 : void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
114 : };
115 :
116 : inline bool operator==( const BinRange& rL, const BinRange& rR )
117 : {
118 : return (rL.maFirst == rR.maFirst) && (rL.maLast == rR.maLast);
119 : }
120 :
121 : inline bool operator<( const BinRange& rL, const BinRange& rR )
122 : {
123 : return (rL.maFirst < rR.maFirst) || ((rL.maFirst == rR.maFirst) && (rL.maLast < rR.maLast));
124 : }
125 :
126 0 : inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRange& orRange )
127 : {
128 0 : orRange.read( rStrm );
129 0 : return rStrm;
130 : }
131 :
132 0 : inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinRange& orRange )
133 : {
134 0 : orRange.read( rStrm );
135 0 : return rStrm;
136 : }
137 :
138 : /** A 2D cell range address list for binary filters. */
139 0 : class BinRangeList : public ::std::vector< BinRange >
140 : {
141 : public:
142 0 : inline explicit BinRangeList() {}
143 :
144 : void read( SequenceInputStream& rStrm );
145 : };
146 :
147 0 : inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRangeList& orRanges )
148 : {
149 0 : orRanges.read( rStrm );
150 0 : return rStrm;
151 : }
152 :
153 : /** Different target types that can be encoded in a BIFF URL. */
154 : enum BiffTargetType
155 : {
156 : BIFF_TARGETTYPE_URL, /// URL, URL with sheet name, or sheet name.
157 : BIFF_TARGETTYPE_SAMESHEET, /// Target for special '!A1' syntax to refer to current sheet.
158 : BIFF_TARGETTYPE_LIBRARY, /// Library directory in application installation.
159 : BIFF_TARGETTYPE_DDE_OLE, /// DDE server/topic or OLE class/target.
160 : BIFF_TARGETTYPE_UNKNOWN /// Unknown/unsupported target type.
161 : };
162 :
163 :
164 : /** Converter for cell addresses and cell ranges for OOXML and BIFF filters.
165 : */
166 0 : class AddressConverter : public WorkbookHelper
167 : {
168 : public:
169 : explicit AddressConverter( const WorkbookHelper& rHelper );
170 :
171 : /** Tries to parse the passed string for a 2d cell address in A1 notation.
172 :
173 : This function accepts all strings that match the regular expression
174 : "[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters
175 : for the column index (translated to 0-based column indexes from 0 to
176 : 321,272,405), and 1 to 9 digits for the 1-based row index (translated
177 : to 0-based row indexes from 0 to 999,999,998). The row number part may
178 : contain leading zeros, they will be ignored. It is up to the caller to
179 : handle cell addresses outside of a specific valid range (e.g. the
180 : entire spreadsheet).
181 :
182 : @param ornColumn (out-parameter) Returns the converted column index.
183 : @param ornRow (out-parameter) returns the converted row index.
184 : @param rString The string containing the cell address.
185 : @param nStart Start index of string part in rString to be parsed.
186 : @param nLength Length of string part in rString to be parsed.
187 :
188 : @return true = Parsed string was valid, returned values can be used.
189 : */
190 : static bool parseOoxAddress2d(
191 : sal_Int32& ornColumn, sal_Int32& ornRow,
192 : const OUString& rString,
193 : sal_Int32 nStart = 0,
194 : sal_Int32 nLength = SAL_MAX_INT32 );
195 :
196 : static bool parseOoxAddress2d(
197 : sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr );
198 :
199 : /** Tries to parse the passed string for a 2d cell range in A1 notation.
200 :
201 : This function accepts all strings that match the regular expression
202 : "ADDR(:ADDR)?" (without quotes), where ADDR is a cell address accepted
203 : by the parseOoxAddress2d() function of this class. It is up to the
204 : caller to handle cell ranges outside of a specific valid range (e.g.
205 : the entire spreadsheet).
206 :
207 : @param ornStartColumn (out-parameter) Returns the converted start column index.
208 : @param ornStartRow (out-parameter) returns the converted start row index.
209 : @param ornEndColumn (out-parameter) Returns the converted end column index.
210 : @param ornEndRow (out-parameter) returns the converted end row index.
211 : @param rString The string containing the cell address.
212 : @param nStart Start index of string part in rString to be parsed.
213 : @param nLength Length of string part in rString to be parsed.
214 :
215 : @return true = Parsed string was valid, returned values can be used.
216 : */
217 : static bool parseOoxRange2d(
218 : sal_Int32& ornStartColumn, sal_Int32& ornStartRow,
219 : sal_Int32& ornEndColumn, sal_Int32& ornEndRow,
220 : const OUString& rString,
221 : sal_Int32 nStart = 0,
222 : sal_Int32 nLength = SAL_MAX_INT32 );
223 :
224 : /** Returns the biggest valid cell address in the own Calc document. */
225 : inline const ::com::sun::star::table::CellAddress&
226 0 : getMaxApiAddress() const { return maMaxApiPos; }
227 :
228 : /** Returns the biggest valid cell address in the imported/exported
229 : Excel document. */
230 : inline const ::com::sun::star::table::CellAddress&
231 0 : getMaxXlsAddress() const { return maMaxXlsPos; }
232 :
233 : /** Returns the biggest valid cell address in both Calc and the
234 : imported/exported Excel document. */
235 : inline const ::com::sun::star::table::CellAddress&
236 0 : getMaxAddress() const { return maMaxPos; }
237 :
238 : /** Returns the column overflow status. */
239 : inline bool isColOverflow() const { return mbColOverflow; }
240 : /** Returns the row overflow status. */
241 : inline bool isRowOverflow() const { return mbRowOverflow; }
242 : /** Returns the sheet overflow status. */
243 : inline bool isTabOverflow() const { return mbTabOverflow; }
244 :
245 : /** Checks if the passed column index is valid.
246 :
247 : @param nCol The column index to check.
248 : @param bTrackOverflow true = Update the internal overflow flag, if the
249 : column index is outside of the supported limits.
250 : @return true = Passed column index is valid (no index overflow).
251 : */
252 : bool checkCol( sal_Int32 nCol, bool bTrackOverflow );
253 :
254 : /** Checks if the passed row index is valid.
255 :
256 : @param nRow The row index to check.
257 : @param bTrackOverflow true = Update the internal overflow flag, if the
258 : row index is outside of the supported limits.
259 : @return true = Passed row index is valid (no index overflow).
260 : */
261 : bool checkRow( sal_Int32 nRow, bool bTrackOverflow );
262 :
263 : /** Checks if the passed sheet index is valid.
264 :
265 : @param nSheet The sheet index to check.
266 : @param bTrackOverflow true = Update the internal overflow flag, if the
267 : sheet index is outside of the supported limits.
268 : @return true = Passed sheet index is valid (no index overflow).
269 : */
270 : bool checkTab( sal_Int16 nSheet, bool bTrackOverflow );
271 :
272 : /** Checks the passed cell address if it fits into the spreadsheet limits.
273 :
274 : @param rAddress The cell address to be checked.
275 : @param bTrackOverflow true = Update the internal overflow flags, if
276 : the address is outside of the supported sheet limits.
277 : @return true = Passed address is valid (no index overflow).
278 : */
279 : bool checkCellAddress(
280 : const ::com::sun::star::table::CellAddress& rAddress,
281 : bool bTrackOverflow );
282 :
283 : /** Converts the passed string to a single cell address, without checking
284 : any sheet limits.
285 :
286 : @param orAddress (out-parameter) Returns the converted cell address.
287 : @param rString Cell address string in A1 notation.
288 : @param nSheet Sheet index to be inserted into orAddress.
289 : @return true = Cell address could be parsed from the passed string.
290 : */
291 : bool convertToCellAddressUnchecked(
292 : ::com::sun::star::table::CellAddress& orAddress,
293 : const OUString& rString,
294 : sal_Int16 nSheet );
295 :
296 : bool convertToCellAddressUnchecked(
297 : com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet ) const;
298 :
299 : /** Tries to convert the passed string to a single cell address.
300 :
301 : @param orAddress (out-parameter) Returns the converted cell address.
302 : @param rString Cell address string in A1 notation.
303 : @param nSheet Sheet index to be inserted into orAddress (will be checked).
304 : @param bTrackOverflow true = Update the internal overflow flags, if
305 : the address is outside of the supported sheet limits.
306 : @return true = Converted address is valid (no index overflow).
307 : */
308 : bool convertToCellAddress(
309 : ::com::sun::star::table::CellAddress& orAddress,
310 : const OUString& rString,
311 : sal_Int16 nSheet,
312 : bool bTrackOverflow );
313 :
314 : bool convertToCellAddress(
315 : com::sun::star::table::CellAddress& rAddress,
316 : const char* pStr, sal_Int16 nSheet, bool bTrackOverflow );
317 :
318 : /** Returns a valid cell address by moving it into allowed dimensions.
319 :
320 : @param rString Cell address string in A1 notation.
321 : @param nSheet Sheet index for the returned address (will be checked).
322 : @param bTrackOverflow true = Update the internal overflow flags, if
323 : the address is outside of the supported sheet limits.
324 : @return A valid API cell address struct. */
325 : ::com::sun::star::table::CellAddress
326 : createValidCellAddress(
327 : const OUString& rString,
328 : sal_Int16 nSheet,
329 : bool bTrackOverflow );
330 :
331 : /** Converts the passed address to a single cell address, without checking
332 : any sheet limits.
333 :
334 : @param orAddress (out-parameter) Returns the converted cell address.
335 : @param rBinAddress Binary cell address struct.
336 : @param nSheet Sheet index to be inserted into orAddress.
337 : */
338 : void convertToCellAddressUnchecked(
339 : ::com::sun::star::table::CellAddress& orAddress,
340 : const BinAddress& rBinAddress,
341 : sal_Int16 nSheet );
342 :
343 : /** Tries to convert the passed address to a single cell address.
344 :
345 : @param orAddress (out-parameter) Returns the converted cell address.
346 : @param rBinAddress Binary cell address struct.
347 : @param nSheet Sheet index to be inserted into orAddress (will be checked).
348 : @param bTrackOverflow true = Update the internal overflow flags, if
349 : the address is outside of the supported sheet limits.
350 : @return true = Converted address is valid (no index overflow).
351 : */
352 : bool convertToCellAddress(
353 : ::com::sun::star::table::CellAddress& orAddress,
354 : const BinAddress& rBinAddress,
355 : sal_Int16 nSheet,
356 : bool bTrackOverflow );
357 :
358 : /** Returns a valid cell address by moving it into allowed dimensions.
359 :
360 : @param rBinAddress Binary cell address struct.
361 : @param nSheet Sheet index for the returned address (will be checked).
362 : @param bTrackOverflow true = Update the internal overflow flags, if
363 : the address is outside of the supported sheet limits.
364 : @return A valid API cell address struct. */
365 : ::com::sun::star::table::CellAddress
366 : createValidCellAddress(
367 : const BinAddress& rBinAddress,
368 : sal_Int16 nSheet,
369 : bool bTrackOverflow );
370 :
371 : /** Checks the passed cell range if it fits into the spreadsheet limits.
372 :
373 : @param rRange The cell range address to be checked.
374 : @param bAllowOverflow true = Allow ranges that start inside the
375 : supported sheet limits but may end outside of these limits.
376 : false = Do not allow ranges that overflow the supported limits.
377 : @param bTrackOverflow true = Update the internal overflow flags, if
378 : the passed range contains cells outside of the supported sheet
379 : limits.
380 : @return true = Cell range is valid. This function returns also true,
381 : if only parts of the range are outside the current sheet limits and
382 : such an overflow is allowed via parameter bAllowOverflow. Returns
383 : false, if the entire range is outside the sheet limits, or if
384 : overflow is not allowed via parameter bAllowOverflow.
385 : */
386 : bool checkCellRange(
387 : const ::com::sun::star::table::CellRangeAddress& rRange,
388 : bool bAllowOverflow, bool bTrackOverflow );
389 :
390 : /** Checks the passed cell range, may try to fit it to current sheet limits.
391 :
392 : First, this function reorders the column and row indexes so that the
393 : starting indexes are less than or equal to the end indexes. Then,
394 : depending on the parameter bAllowOverflow, the range is just checked or
395 : cropped to the current sheet limits.
396 :
397 : @param orRange (in-out-parameter) Converts the passed cell range
398 : into a valid cell range address. If the passed range contains cells
399 : outside the currently supported spreadsheet limits, it will be
400 : cropped to these limits.
401 : @param bAllowOverflow true = Allow ranges that start inside the
402 : supported sheet limits but may end outside of these limits. The
403 : cell range returned in orRange will be cropped to these limits.
404 : false = Do not allow ranges that overflow the supported limits. The
405 : function will return false when the range overflows the sheet limits.
406 : @param bTrackOverflow true = Update the internal overflow flags, if
407 : the original range contains cells outside of the supported sheet
408 : limits.
409 : @return true = Converted range address is valid. This function
410 : returns also true, if overflowing ranges are allowed via parameter
411 : bAllowOverflow and the range has been cropped, but still contains
412 : cells inside the current sheet limits. Returns false, if the entire
413 : range is outside the sheet limits or overflowing ranges are not
414 : allowed via parameter bAllowOverflow.
415 : */
416 : bool validateCellRange(
417 : ::com::sun::star::table::CellRangeAddress& orRange,
418 : bool bAllowOverflow, bool bTrackOverflow );
419 :
420 : /** Converts the passed string to a cell range address, without checking
421 : any sheet limits.
422 :
423 : @param orRange (out-parameter) Returns the converted range address.
424 : @param rString Cell range string in A1 notation.
425 : @param nSheet Sheet index to be inserted into orRange.
426 : @return true = Range address could be parsed from the passed string.
427 : */
428 : bool convertToCellRangeUnchecked(
429 : ::com::sun::star::table::CellRangeAddress& orRange,
430 : const OUString& rString,
431 : sal_Int16 nSheet );
432 :
433 : /** Tries to convert the passed string to a cell range address.
434 :
435 : @param orRange (out-parameter) Returns the converted cell range
436 : address. If the original range in the passed string contains cells
437 : outside the currently supported spreadsheet limits, and parameter
438 : bAllowOverflow is set to true, the range will be cropped to these
439 : limits. Example: the range string "A1:ZZ100000" may be converted to
440 : the range A1:IV65536.
441 : @param rString Cell range string in A1 notation.
442 : @param nSheet Sheet index to be inserted into orRange (will be checked).
443 : @param bAllowOverflow true = Allow ranges that start inside the
444 : supported sheet limits but may end outside of these limits. The
445 : cell range returned in orRange will be cropped to these limits.
446 : false = Do not allow ranges that overflow the supported limits.
447 : @param bTrackOverflow true = Update the internal overflow flags, if
448 : the original range contains cells outside of the supported sheet
449 : limits.
450 : @return true = Converted and returned range is valid. This function
451 : returns also true, if overflowing ranges are allowed via parameter
452 : bAllowOverflow and the range has been cropped, but still contains
453 : cells inside the current sheet limits. Returns false, if the entire
454 : range is outside the sheet limits or overflowing ranges are not
455 : allowed via parameter bAllowOverflow.
456 : */
457 : bool convertToCellRange(
458 : ::com::sun::star::table::CellRangeAddress& orRange,
459 : const OUString& rString,
460 : sal_Int16 nSheet,
461 : bool bAllowOverflow, bool bTrackOverflow );
462 :
463 : /** Converts the passed range to a cell range address, without checking any
464 : sheet limits.
465 :
466 : @param orRange (out-parameter) Returns the converted range address.
467 : @param rBinRange Binary cell range struct.
468 : @param nSheet Sheet index to be inserted into orRange.
469 : */
470 : void convertToCellRangeUnchecked(
471 : ::com::sun::star::table::CellRangeAddress& orRange,
472 : const BinRange& rBinRange,
473 : sal_Int16 nSheet );
474 :
475 : /** Tries to convert the passed range to a cell range address.
476 :
477 : @param orRange (out-parameter) Returns the converted cell range
478 : address. If the passed original range contains cells outside the
479 : currently supported spreadsheet limits, and parameter bAllowOverflow
480 : is set to true, the range will be cropped to these limits.
481 : @param rBinRange Binary cell range struct.
482 : @param nSheet Sheet index to be inserted into orRange (will be checked).
483 : @param bAllowOverflow true = Allow ranges that start inside the
484 : supported sheet limits but may end outside of these limits. The
485 : cell range returned in orRange will be cropped to these limits.
486 : false = Do not allow ranges that overflow the supported limits.
487 : @param bTrackOverflow true = Update the internal overflow flags, if
488 : the original range contains cells outside of the supported sheet
489 : limits.
490 : @return true = Converted and returned range is valid. This function
491 : returns also true, if overflowing ranges are allowed via parameter
492 : bAllowOverflow and the range has been cropped, but still contains
493 : cells inside the current sheet limits. Returns false, if the entire
494 : range is outside the sheet limits or if overflowing ranges are not
495 : allowed via parameter bAllowOverflow.
496 : */
497 : bool convertToCellRange(
498 : ::com::sun::star::table::CellRangeAddress& orRange,
499 : const BinRange& rBinRange,
500 : sal_Int16 nSheet,
501 : bool bAllowOverflow, bool bTrackOverflow );
502 :
503 : /** Tries to restrict the passed cell range list to current sheet limits.
504 :
505 : @param orRanges (in-out-parameter) Restricts the cell range addresses
506 : in the passed list to the current sheet limits and removes invalid
507 : ranges from the list.
508 : @param bTrackOverflow true = Update the internal overflow flags, if
509 : the original ranges contain cells outside of the supported sheet
510 : limits.
511 : */
512 : void validateCellRangeList(
513 : ApiCellRangeList& orRanges,
514 : bool bTrackOverflow );
515 :
516 : /** Tries to convert the passed string to a cell range list.
517 :
518 : @param orRanges (out-parameter) Returns the converted cell range
519 : addresses. If a range in the passed string contains cells outside
520 : the currently supported spreadsheet limits, it will be cropped to
521 : these limits. Example: the range string "A1:ZZ100000" may be
522 : converted to the range A1:IV65536. If a range is completely outside
523 : the limits, it will be omitted.
524 : @param rString Cell range list string in A1 notation, space separated.
525 : @param nSheet Sheet index to be inserted into orRanges (will be checked).
526 : @param bTrackOverflow true = Update the internal overflow flags, if
527 : the original ranges contain cells outside of the supported sheet
528 : limits.
529 : */
530 : void convertToCellRangeList(
531 : ApiCellRangeList& orRanges,
532 : const OUString& rString,
533 : sal_Int16 nSheet,
534 : bool bTrackOverflow );
535 :
536 : /** Tries to convert the passed range list to a cell range list.
537 :
538 : @param orRanges (out-parameter) Returns the converted cell range
539 : addresses. If a range in the passed string contains cells outside
540 : the currently supported spreadsheet limits, it will be cropped to
541 : these limits. Example: the range string "A1:ZZ100000" may be
542 : converted to the range A1:IV65536. If a range is completely outside
543 : the limits, it will be omitted.
544 : @param rBinRanges List of binary cell range objects.
545 : @param nSheet Sheet index to be inserted into orRanges (will be checked).
546 : @param bTrackOverflow true = Update the internal overflow flags, if
547 : the original ranges contain cells outside of the supported sheet
548 : limits.
549 : */
550 : void convertToCellRangeList(
551 : ApiCellRangeList& orRanges,
552 : const BinRangeList& rBinRanges,
553 : sal_Int16 nSheet,
554 : bool bTrackOverflow );
555 :
556 :
557 : private:
558 : void initializeMaxPos(
559 : sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow );
560 :
561 : private:
562 : struct ControlCharacters
563 : {
564 : sal_Unicode mcThisWorkbook; /// Control character: Link to current workbook.
565 : sal_Unicode mcExternal; /// Control character: Link to external workbook/sheet.
566 : sal_Unicode mcThisSheet; /// Control character: Link to current sheet.
567 : sal_Unicode mcInternal; /// Control character: Link to internal sheet.
568 : sal_Unicode mcSameSheet; /// Control character: Link to same sheet (special '!A1' syntax).
569 :
570 : void set(
571 : sal_Unicode cThisWorkbook, sal_Unicode cExternal,
572 : sal_Unicode cThisSheet, sal_Unicode cInternal,
573 : sal_Unicode cSameSheet );
574 : };
575 :
576 : ::com::sun::star::table::CellAddress maMaxApiPos; /// Maximum valid cell address in Calc.
577 : ::com::sun::star::table::CellAddress maMaxXlsPos; /// Maximum valid cell address in Excel.
578 : ::com::sun::star::table::CellAddress maMaxPos; /// Maximum valid cell address in Calc/Excel.
579 : ControlCharacters maLinkChars; /// Control characters for external link import (BIFF).
580 : ControlCharacters maDConChars; /// Control characters for DCON* record import (BIFF).
581 : bool mbColOverflow; /// Flag for "columns overflow".
582 : bool mbRowOverflow; /// Flag for "rows overflow".
583 : bool mbTabOverflow; /// Flag for "tables overflow".
584 : };
585 :
586 : } // namespace xls
587 : } // namespace oox
588 :
589 : #endif
590 :
591 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|