fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / inc / addressconverter.hxx
blob27f060b2f7e761bf0cdadf822bd0f6b35c14a080
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_SOURCE_FILTER_INC_ADDRESSCONVERTER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_ADDRESSCONVERTER_HXX
23 #include <vector>
24 #include <com/sun/star/table/CellAddress.hpp>
25 #include <com/sun/star/table/CellRangeAddress.hpp>
26 #include "workbookhelper.hxx"
28 namespace oox {
29 namespace xls {
31 class BiffInputStream;
33 /** A vector of com.sun.star.table.CellRangeAddress elements and additional
34 functionality. */
35 class ApiCellRangeList
37 public:
38 inline explicit ApiCellRangeList() : mvAddresses() {}
40 size_t size() const { return mvAddresses.size(); }
42 bool empty() const { return mvAddresses.empty(); }
44 const ::com::sun::star::table::CellRangeAddress& front() const
45 { return mvAddresses.front(); }
47 ::com::sun::star::table::CellRangeAddress& operator[]( size_t i )
48 { return mvAddresses[ i ]; }
50 ::std::vector< ::com::sun::star::table::CellRangeAddress >::const_iterator begin() const
51 { return mvAddresses.begin(); }
52 ::std::vector< ::com::sun::star::table::CellRangeAddress >::iterator begin()
53 { return mvAddresses.begin(); }
55 ::std::vector< ::com::sun::star::table::CellRangeAddress >::const_iterator end() const
56 { return mvAddresses.end(); }
58 ::std::vector< ::com::sun::star::table::CellRangeAddress >::reverse_iterator rbegin()
59 { return mvAddresses.rbegin(); }
61 ::std::vector< ::com::sun::star::table::CellRangeAddress >::reverse_iterator rend()
62 { return mvAddresses.rend(); }
64 void clear() { mvAddresses.clear(); }
66 void erase( ::std::vector< ::com::sun::star::table::CellRangeAddress >::iterator it )
67 { mvAddresses.erase( it ); }
69 void pop_back() { mvAddresses.pop_back(); }
71 void push_back( const ::com::sun::star::table::CellRangeAddress& rAddress )
72 { mvAddresses.push_back( rAddress ); }
74 /** Returns the base address of this range list (top-left cell of first range). */
75 ::com::sun::star::table::CellAddress
76 getBaseAddress() const;
78 /** Converts to a sequence. */
79 com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress >
80 toSequence() const;
82 private:
83 ::std::vector< ::com::sun::star::table::CellRangeAddress > mvAddresses;
86 /** A 2D cell address struct for binary filters. */
87 struct BinAddress
89 sal_Int32 mnCol;
90 sal_Int32 mnRow;
92 inline explicit BinAddress() : mnCol( 0 ), mnRow( 0 ) {}
93 inline explicit BinAddress( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
94 inline explicit BinAddress( const ::com::sun::star::table::CellAddress& rAddr ) : mnCol( rAddr.Column ), mnRow( rAddr.Row ) {}
96 inline void set( sal_Int32 nCol, sal_Int32 nRow ) { mnCol = nCol; mnRow = nRow; }
97 inline void set( const ::com::sun::star::table::CellAddress& rAddr ) { mnCol = rAddr.Column; mnRow = rAddr.Row; }
99 void read( SequenceInputStream& rStrm );
100 void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
103 inline bool operator==( const BinAddress& rL, const BinAddress& rR )
105 return (rL.mnCol == rR.mnCol) && (rL.mnRow == rR.mnRow);
108 inline bool operator<( const BinAddress& rL, const BinAddress& rR )
110 return (rL.mnCol < rR.mnCol) || ((rL.mnCol == rR.mnCol) && (rL.mnRow < rR.mnRow));
113 inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinAddress& orPos )
115 orPos.read( rStrm );
116 return rStrm;
119 inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinAddress& orPos )
121 orPos.read( rStrm );
122 return rStrm;
125 /** A 2D cell range address struct for binary filters. */
126 struct BinRange
128 BinAddress maFirst;
129 BinAddress maLast;
131 inline explicit BinRange() {}
132 inline explicit BinRange( const BinAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {}
133 inline explicit BinRange( const BinAddress& rFirst, const BinAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {}
134 inline explicit BinRange( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 ) :
135 maFirst( nCol1, nRow1 ), maLast( nCol2, nRow2 ) {}
136 inline explicit BinRange( const ::com::sun::star::table::CellAddress& rAddr ) : maFirst( rAddr ), maLast( rAddr ) {}
137 inline explicit BinRange( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast ) : maFirst( rFirst ), maLast( rLast ) {}
138 inline explicit BinRange( const ::com::sun::star::table::CellRangeAddress& rRange ) : maFirst( rRange.StartColumn, rRange.StartRow ), maLast( rRange.EndColumn, rRange.EndRow ) {}
140 inline void set( const BinAddress& rFirst, const BinAddress& rLast )
141 { maFirst = rFirst; maLast = rLast; }
142 inline void set( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nCol2, sal_Int32 nRow2 )
143 { maFirst.set( nCol1, nRow1 ); maLast.set( nCol2, nRow2 ); }
144 inline void set( const ::com::sun::star::table::CellAddress& rFirst, const ::com::sun::star::table::CellAddress& rLast )
145 { maFirst.set( rFirst ); maLast.set( rLast ); }
146 inline void set( const ::com::sun::star::table::CellRangeAddress& rRange )
147 { maFirst.set( rRange.StartColumn, rRange.StartRow ); maLast.set( rRange.EndColumn, rRange.EndRow ); }
149 inline sal_Int32 getColCount() const { return maLast.mnCol - maFirst.mnCol + 1; }
150 inline sal_Int32 getRowCount() const { return maLast.mnRow - maFirst.mnRow + 1; }
152 void read( SequenceInputStream& rStrm );
153 void read( BiffInputStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
156 inline bool operator==( const BinRange& rL, const BinRange& rR )
158 return (rL.maFirst == rR.maFirst) && (rL.maLast == rR.maLast);
161 inline bool operator<( const BinRange& rL, const BinRange& rR )
163 return (rL.maFirst < rR.maFirst) || ((rL.maFirst == rR.maFirst) && (rL.maLast < rR.maLast));
166 inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRange& orRange )
168 orRange.read( rStrm );
169 return rStrm;
172 inline BiffInputStream& operator>>( BiffInputStream& rStrm, BinRange& orRange )
174 orRange.read( rStrm );
175 return rStrm;
178 /** A 2D cell range address list for binary filters. */
179 class BinRangeList
181 public:
182 inline explicit BinRangeList() : mvRanges() {}
184 ::std::vector< BinRange >::const_iterator begin() const { return mvRanges.begin(); }
185 ::std::vector< BinRange >::const_iterator end() const { return mvRanges.end(); }
187 void read( SequenceInputStream& rStrm );
189 private:
190 ::std::vector< BinRange > mvRanges;
193 inline SequenceInputStream& operator>>( SequenceInputStream& rStrm, BinRangeList& orRanges )
195 orRanges.read( rStrm );
196 return rStrm;
199 /** Different target types that can be encoded in a BIFF URL. */
200 enum BiffTargetType
202 BIFF_TARGETTYPE_URL, /// URL, URL with sheet name, or sheet name.
203 BIFF_TARGETTYPE_SAMESHEET, /// Target for special '!A1' syntax to refer to current sheet.
204 BIFF_TARGETTYPE_LIBRARY, /// Library directory in application installation.
205 BIFF_TARGETTYPE_DDE_OLE, /// DDE server/topic or OLE class/target.
206 BIFF_TARGETTYPE_UNKNOWN /// Unknown/unsupported target type.
209 /** Converter for cell addresses and cell ranges for OOXML and BIFF filters.
211 class AddressConverter : public WorkbookHelper
213 public:
214 explicit AddressConverter( const WorkbookHelper& rHelper );
216 /** Tries to parse the passed string for a 2d cell address in A1 notation.
218 This function accepts all strings that match the regular expression
219 "[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters
220 for the column index (translated to 0-based column indexes from 0 to
221 321,272,405), and 1 to 9 digits for the 1-based row index (translated
222 to 0-based row indexes from 0 to 999,999,998). The row number part may
223 contain leading zeros, they will be ignored. It is up to the caller to
224 handle cell addresses outside of a specific valid range (e.g. the
225 entire spreadsheet).
227 @param ornColumn (out-parameter) Returns the converted column index.
228 @param ornRow (out-parameter) returns the converted row index.
229 @param rString The string containing the cell address.
230 @param nStart Start index of string part in rString to be parsed.
231 @param nLength Length of string part in rString to be parsed.
233 @return true = Parsed string was valid, returned values can be used.
235 static bool parseOoxAddress2d(
236 sal_Int32& ornColumn, sal_Int32& ornRow,
237 const OUString& rString,
238 sal_Int32 nStart = 0,
239 sal_Int32 nLength = SAL_MAX_INT32 );
241 static bool parseOoxAddress2d(
242 sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr );
244 /** Tries to parse the passed string for a 2d cell range in A1 notation.
246 This function accepts all strings that match the regular expression
247 "ADDR(:ADDR)?" (without quotes), where ADDR is a cell address accepted
248 by the parseOoxAddress2d() function of this class. It is up to the
249 caller to handle cell ranges outside of a specific valid range (e.g.
250 the entire spreadsheet).
252 @param ornStartColumn (out-parameter) Returns the converted start column index.
253 @param ornStartRow (out-parameter) returns the converted start row index.
254 @param ornEndColumn (out-parameter) Returns the converted end column index.
255 @param ornEndRow (out-parameter) returns the converted end row index.
256 @param rString The string containing the cell address.
257 @param nStart Start index of string part in rString to be parsed.
258 @param nLength Length of string part in rString to be parsed.
260 @return true = Parsed string was valid, returned values can be used.
262 static bool parseOoxRange2d(
263 sal_Int32& ornStartColumn, sal_Int32& ornStartRow,
264 sal_Int32& ornEndColumn, sal_Int32& ornEndRow,
265 const OUString& rString,
266 sal_Int32 nStart = 0,
267 sal_Int32 nLength = SAL_MAX_INT32 );
269 /** Returns the biggest valid cell address in the own Calc document. */
270 inline const ::com::sun::star::table::CellAddress&
271 getMaxApiAddress() const { return maMaxApiPos; }
273 /** Returns the biggest valid cell address in the imported/exported
274 Excel document. */
275 inline const ::com::sun::star::table::CellAddress&
276 getMaxXlsAddress() const { return maMaxXlsPos; }
278 /** Returns the biggest valid cell address in both Calc and the
279 imported/exported Excel document. */
280 inline const ::com::sun::star::table::CellAddress&
281 getMaxAddress() const { return maMaxPos; }
283 /** Returns the column overflow status. */
284 inline bool isColOverflow() const { return mbColOverflow; }
285 /** Returns the row overflow status. */
286 inline bool isRowOverflow() const { return mbRowOverflow; }
287 /** Returns the sheet overflow status. */
288 inline bool isTabOverflow() const { return mbTabOverflow; }
290 /** Checks if the passed column index is valid.
292 @param nCol The column index to check.
293 @param bTrackOverflow true = Update the internal overflow flag, if the
294 column index is outside of the supported limits.
295 @return true = Passed column index is valid (no index overflow).
297 bool checkCol( sal_Int32 nCol, bool bTrackOverflow );
299 /** Checks if the passed row index is valid.
301 @param nRow The row index to check.
302 @param bTrackOverflow true = Update the internal overflow flag, if the
303 row index is outside of the supported limits.
304 @return true = Passed row index is valid (no index overflow).
306 bool checkRow( sal_Int32 nRow, bool bTrackOverflow );
308 /** Checks if the passed sheet index is valid.
310 @param nSheet The sheet index to check.
311 @param bTrackOverflow true = Update the internal overflow flag, if the
312 sheet index is outside of the supported limits.
313 @return true = Passed sheet index is valid (no index overflow).
315 bool checkTab( sal_Int16 nSheet, bool bTrackOverflow );
317 /** Checks the passed cell address if it fits into the spreadsheet limits.
319 @param rAddress The cell address to be checked.
320 @param bTrackOverflow true = Update the internal overflow flags, if
321 the address is outside of the supported sheet limits.
322 @return true = Passed address is valid (no index overflow).
324 bool checkCellAddress(
325 const ::com::sun::star::table::CellAddress& rAddress,
326 bool bTrackOverflow );
328 /** Converts the passed string to a single cell address, without checking
329 any sheet limits.
331 @param orAddress (out-parameter) Returns the converted cell address.
332 @param rString Cell address string in A1 notation.
333 @param nSheet Sheet index to be inserted into orAddress.
334 @return true = Cell address could be parsed from the passed string.
336 static bool convertToCellAddressUnchecked(
337 ::com::sun::star::table::CellAddress& orAddress,
338 const OUString& rString,
339 sal_Int16 nSheet );
341 static bool convertToCellAddressUnchecked(
342 com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet );
344 /** Tries to convert the passed string to a single cell address.
346 @param orAddress (out-parameter) Returns the converted cell address.
347 @param rString Cell address string in A1 notation.
348 @param nSheet Sheet index to be inserted into orAddress (will be checked).
349 @param bTrackOverflow true = Update the internal overflow flags, if
350 the address is outside of the supported sheet limits.
351 @return true = Converted address is valid (no index overflow).
353 bool convertToCellAddress(
354 ::com::sun::star::table::CellAddress& orAddress,
355 const OUString& rString,
356 sal_Int16 nSheet,
357 bool bTrackOverflow );
359 bool convertToCellAddress(
360 com::sun::star::table::CellAddress& rAddress,
361 const char* pStr, sal_Int16 nSheet, bool bTrackOverflow );
363 /** Returns a valid cell address by moving it into allowed dimensions.
365 @param rString Cell address string in A1 notation.
366 @param nSheet Sheet index for the returned address (will be checked).
367 @param bTrackOverflow true = Update the internal overflow flags, if
368 the address is outside of the supported sheet limits.
369 @return A valid API cell address struct. */
370 ::com::sun::star::table::CellAddress
371 createValidCellAddress(
372 const OUString& rString,
373 sal_Int16 nSheet,
374 bool bTrackOverflow );
376 /** Converts the passed address to a single cell address, without checking
377 any sheet limits.
379 @param orAddress (out-parameter) Returns the converted cell address.
380 @param rBinAddress Binary cell address struct.
381 @param nSheet Sheet index to be inserted into orAddress.
383 static void convertToCellAddressUnchecked(
384 ::com::sun::star::table::CellAddress& orAddress,
385 const BinAddress& rBinAddress,
386 sal_Int16 nSheet );
388 /** Tries to convert the passed address to a single cell address.
390 @param orAddress (out-parameter) Returns the converted cell address.
391 @param rBinAddress Binary cell address struct.
392 @param nSheet Sheet index to be inserted into orAddress (will be checked).
393 @param bTrackOverflow true = Update the internal overflow flags, if
394 the address is outside of the supported sheet limits.
395 @return true = Converted address is valid (no index overflow).
397 bool convertToCellAddress(
398 ::com::sun::star::table::CellAddress& orAddress,
399 const BinAddress& rBinAddress,
400 sal_Int16 nSheet,
401 bool bTrackOverflow );
403 /** Returns a valid cell address by moving it into allowed dimensions.
405 @param rBinAddress Binary cell address struct.
406 @param nSheet Sheet index for the returned address (will be checked).
407 @param bTrackOverflow true = Update the internal overflow flags, if
408 the address is outside of the supported sheet limits.
409 @return A valid API cell address struct. */
410 ::com::sun::star::table::CellAddress
411 createValidCellAddress(
412 const BinAddress& rBinAddress,
413 sal_Int16 nSheet,
414 bool bTrackOverflow );
416 /** Checks the passed cell range if it fits into the spreadsheet limits.
418 @param rRange The cell range address to be checked.
419 @param bAllowOverflow true = Allow ranges that start inside the
420 supported sheet limits but may end outside of these limits.
421 false = Do not allow ranges that overflow the supported limits.
422 @param bTrackOverflow true = Update the internal overflow flags, if
423 the passed range contains cells outside of the supported sheet
424 limits.
425 @return true = Cell range is valid. This function returns also true,
426 if only parts of the range are outside the current sheet limits and
427 such an overflow is allowed via parameter bAllowOverflow. Returns
428 false, if the entire range is outside the sheet limits, or if
429 overflow is not allowed via parameter bAllowOverflow.
431 bool checkCellRange(
432 const ::com::sun::star::table::CellRangeAddress& rRange,
433 bool bAllowOverflow, bool bTrackOverflow );
435 /** Checks the passed cell range, may try to fit it to current sheet limits.
437 First, this function reorders the column and row indexes so that the
438 starting indexes are less than or equal to the end indexes. Then,
439 depending on the parameter bAllowOverflow, the range is just checked or
440 cropped to the current sheet limits.
442 @param orRange (in-out-parameter) Converts the passed cell range
443 into a valid cell range address. If the passed range contains cells
444 outside the currently supported spreadsheet limits, it will be
445 cropped to these limits.
446 @param bAllowOverflow true = Allow ranges that start inside the
447 supported sheet limits but may end outside of these limits. The
448 cell range returned in orRange will be cropped to these limits.
449 false = Do not allow ranges that overflow the supported limits. The
450 function will return false when the range overflows the sheet limits.
451 @param bTrackOverflow true = Update the internal overflow flags, if
452 the original range contains cells outside of the supported sheet
453 limits.
454 @return true = Converted range address is valid. This function
455 returns also true, if overflowing ranges are allowed via parameter
456 bAllowOverflow and the range has been cropped, but still contains
457 cells inside the current sheet limits. Returns false, if the entire
458 range is outside the sheet limits or overflowing ranges are not
459 allowed via parameter bAllowOverflow.
461 bool validateCellRange(
462 ::com::sun::star::table::CellRangeAddress& orRange,
463 bool bAllowOverflow, bool bTrackOverflow );
465 /** Converts the passed string to a cell range address, without checking
466 any sheet limits.
468 @param orRange (out-parameter) Returns the converted range address.
469 @param rString Cell range string in A1 notation.
470 @param nSheet Sheet index to be inserted into orRange.
471 @return true = Range address could be parsed from the passed string.
473 static bool convertToCellRangeUnchecked(
474 ::com::sun::star::table::CellRangeAddress& orRange,
475 const OUString& rString,
476 sal_Int16 nSheet );
478 /** Tries to convert the passed string to a cell range address.
480 @param orRange (out-parameter) Returns the converted cell range
481 address. If the original range in the passed string contains cells
482 outside the currently supported spreadsheet limits, and parameter
483 bAllowOverflow is set to true, the range will be cropped to these
484 limits. Example: the range string "A1:ZZ100000" may be converted to
485 the range A1:IV65536.
486 @param rString Cell range string in A1 notation.
487 @param nSheet Sheet index to be inserted into orRange (will be checked).
488 @param bAllowOverflow true = Allow ranges that start inside the
489 supported sheet limits but may end outside of these limits. The
490 cell range returned in orRange will be cropped to these limits.
491 false = Do not allow ranges that overflow the supported limits.
492 @param bTrackOverflow true = Update the internal overflow flags, if
493 the original range contains cells outside of the supported sheet
494 limits.
495 @return true = Converted and returned range is valid. This function
496 returns also true, if overflowing ranges are allowed via parameter
497 bAllowOverflow and the range has been cropped, but still contains
498 cells inside the current sheet limits. Returns false, if the entire
499 range is outside the sheet limits or overflowing ranges are not
500 allowed via parameter bAllowOverflow.
502 bool convertToCellRange(
503 ::com::sun::star::table::CellRangeAddress& orRange,
504 const OUString& rString,
505 sal_Int16 nSheet,
506 bool bAllowOverflow, bool bTrackOverflow );
508 /** Converts the passed range to a cell range address, without checking any
509 sheet limits.
511 @param orRange (out-parameter) Returns the converted range address.
512 @param rBinRange Binary cell range struct.
513 @param nSheet Sheet index to be inserted into orRange.
515 static void convertToCellRangeUnchecked(
516 ::com::sun::star::table::CellRangeAddress& orRange,
517 const BinRange& rBinRange,
518 sal_Int16 nSheet );
520 /** Tries to convert the passed range to a cell range address.
522 @param orRange (out-parameter) Returns the converted cell range
523 address. If the passed original range contains cells outside the
524 currently supported spreadsheet limits, and parameter bAllowOverflow
525 is set to true, the range will be cropped to these limits.
526 @param rBinRange Binary cell range struct.
527 @param nSheet Sheet index to be inserted into orRange (will be checked).
528 @param bAllowOverflow true = Allow ranges that start inside the
529 supported sheet limits but may end outside of these limits. The
530 cell range returned in orRange will be cropped to these limits.
531 false = Do not allow ranges that overflow the supported limits.
532 @param bTrackOverflow true = Update the internal overflow flags, if
533 the original range contains cells outside of the supported sheet
534 limits.
535 @return true = Converted and returned range is valid. This function
536 returns also true, if overflowing ranges are allowed via parameter
537 bAllowOverflow and the range has been cropped, but still contains
538 cells inside the current sheet limits. Returns false, if the entire
539 range is outside the sheet limits or if overflowing ranges are not
540 allowed via parameter bAllowOverflow.
542 bool convertToCellRange(
543 ::com::sun::star::table::CellRangeAddress& orRange,
544 const BinRange& rBinRange,
545 sal_Int16 nSheet,
546 bool bAllowOverflow, bool bTrackOverflow );
548 /** Tries to restrict the passed cell range list to current sheet limits.
550 @param orRanges (in-out-parameter) Restricts the cell range addresses
551 in the passed list to the current sheet limits and removes invalid
552 ranges from the list.
553 @param bTrackOverflow true = Update the internal overflow flags, if
554 the original ranges contain cells outside of the supported sheet
555 limits.
557 void validateCellRangeList(
558 ApiCellRangeList& orRanges,
559 bool bTrackOverflow );
561 /** Tries to convert the passed string to a cell range list.
563 @param orRanges (out-parameter) Returns the converted cell range
564 addresses. If a range in the passed string contains cells outside
565 the currently supported spreadsheet limits, it will be cropped to
566 these limits. Example: the range string "A1:ZZ100000" may be
567 converted to the range A1:IV65536. If a range is completely outside
568 the limits, it will be omitted.
569 @param rString Cell range list string in A1 notation, space separated.
570 @param nSheet Sheet index to be inserted into orRanges (will be checked).
571 @param bTrackOverflow true = Update the internal overflow flags, if
572 the original ranges contain cells outside of the supported sheet
573 limits.
575 void convertToCellRangeList(
576 ApiCellRangeList& orRanges,
577 const OUString& rString,
578 sal_Int16 nSheet,
579 bool bTrackOverflow );
581 /** Tries to convert the passed range list to a cell range list.
583 @param orRanges (out-parameter) Returns the converted cell range
584 addresses. If a range in the passed string contains cells outside
585 the currently supported spreadsheet limits, it will be cropped to
586 these limits. Example: the range string "A1:ZZ100000" may be
587 converted to the range A1:IV65536. If a range is completely outside
588 the limits, it will be omitted.
589 @param rBinRanges List of binary cell range objects.
590 @param nSheet Sheet index to be inserted into orRanges (will be checked).
591 @param bTrackOverflow true = Update the internal overflow flags, if
592 the original ranges contain cells outside of the supported sheet
593 limits.
595 void convertToCellRangeList(
596 ApiCellRangeList& orRanges,
597 const BinRangeList& rBinRanges,
598 sal_Int16 nSheet,
599 bool bTrackOverflow );
601 private:
602 void initializeMaxPos(
603 sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow );
605 private:
606 struct ControlCharacters
608 sal_Unicode mcThisWorkbook; /// Control character: Link to current workbook.
609 sal_Unicode mcExternal; /// Control character: Link to external workbook/sheet.
610 sal_Unicode mcThisSheet; /// Control character: Link to current sheet.
611 sal_Unicode mcInternal; /// Control character: Link to internal sheet.
612 sal_Unicode mcSameSheet; /// Control character: Link to same sheet (special '!A1' syntax).
614 void set(
615 sal_Unicode cThisWorkbook, sal_Unicode cExternal,
616 sal_Unicode cThisSheet, sal_Unicode cInternal,
617 sal_Unicode cSameSheet );
620 ::com::sun::star::table::CellAddress maMaxApiPos; /// Maximum valid cell address in Calc.
621 ::com::sun::star::table::CellAddress maMaxXlsPos; /// Maximum valid cell address in Excel.
622 ::com::sun::star::table::CellAddress maMaxPos; /// Maximum valid cell address in Calc/Excel.
623 ControlCharacters maLinkChars; /// Control characters for external link import (BIFF).
624 ControlCharacters maDConChars; /// Control characters for DCON* record import (BIFF).
625 bool mbColOverflow; /// Flag for "columns overflow".
626 bool mbRowOverflow; /// Flag for "rows overflow".
627 bool mbTabOverflow; /// Flag for "tables overflow".
630 } // namespace xls
631 } // namespace oox
633 #endif
635 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */