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