1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <document.hxx>
21 #include <scerrors.hxx>
22 #include <fprogressbar.hxx>
23 #include <globstr.hrc>
24 #include <xlcontent.hxx>
25 #include <xltracer.hxx>
26 #include <xltable.hxx>
27 #include <xihelper.hxx>
33 #include <xicontent.hxx>
34 #include <xiescher.hxx>
35 #include <xipivot.hxx>
36 #include <xistyle.hxx>
37 #include <XclImpChangeTrack.hxx>
38 #include <documentimport.hxx>
42 #include <excimp8.hxx>
44 #include <unotools/configmgr.hxx>
50 bool TryStartNextRecord(XclImpStream
& rIn
, std::size_t nProgressBasePos
)
53 // i#115255 fdo#40304 BOUNDSHEET doesn't point to a valid
54 // BOF record position. Scan the records manually (from
55 // the BOUNDSHEET position) until we find a BOF. Some 3rd
56 // party Russian programs generate invalid xls docs with
57 // this kind of silliness.
58 if (rIn
.PeekRecId(nProgressBasePos
) == EXC_ID5_BOF
)
59 // BOUNDSHEET points to a valid BOF record. Good.
60 rIn
.StartNextRecord(nProgressBasePos
);
63 while (bValid
&& rIn
.GetRecId() != EXC_ID5_BOF
)
64 bValid
= rIn
.StartNextRecord();
70 ErrCode
ImportExcel::Read()
72 XclImpPageSettings
& rPageSett
= GetPageSettings();
73 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
74 XclImpPalette
& rPal
= GetPalette();
75 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
76 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
77 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
78 XclImpNameManager
& rNameMgr
= GetNameManager();
79 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
82 Z_BiffNull
, // not a valid Biff-Format
83 Z_Biff2
, // Biff2: only one table
85 Z_Biff3
, // Biff3: only one table
87 Z_Biff4
, // Biff4: only one table
88 Z_Biff4W
, // Biff4 Workbook: Globals
89 Z_Biff4T
, // Biff4 Workbook: a table itself
90 Z_Biff4E
, // Biff4 Workbook: between tables
92 Z_Biff5WPre
,// Biff5: Prefetch Workbook
93 Z_Biff5W
, // Biff5: Globals
94 Z_Biff5TPre
,// Biff5: Prefetch for Shrfmla/Array Formula
95 Z_Biff5T
, // Biff5: a table itself
96 Z_Biff5E
, // Biff5: between tables
97 Z_Biffn0
, // all Biffs: skip table till next EOF
100 STATE eCurrent
= Z_BiffNull
, ePrev
= Z_BiffNull
;
102 ErrCode eLastErr
= ERRCODE_NONE
;
104 sal_uInt16 nBofLevel
= 0;
106 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
107 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
109 /* #i104057# Need to track a base position for progress bar calculation,
110 because sheet substreams may not be in order of sheets. */
111 std::size_t nProgressBasePos
= 0;
112 std::size_t nProgressBaseSize
= 0;
114 for (; eCurrent
!= Z_End
; mnLastRecId
= nOpcode
)
116 if( eCurrent
== Z_Biff5E
)
118 sal_uInt16 nScTab
= GetCurrScTab();
119 if( nScTab
< maSheetOffsets
.size() )
121 nProgressBaseSize
+= (aIn
.GetSvStreamPos() - nProgressBasePos
);
122 nProgressBasePos
= maSheetOffsets
[ nScTab
];
124 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
127 // Safeguard ourselves from potential infinite loop.
135 aIn
.StartNextRecord();
137 nOpcode
= aIn
.GetRecId();
141 // finalize table if EOF is missing
150 rNumFmtBfr
.CreateScFormats();
158 if( eCurrent
== Z_End
)
161 if( eCurrent
!= Z_Biff5TPre
&& eCurrent
!= Z_Biff5WPre
)
162 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
167 case Z_BiffNull
: // ------------------------------- Z_BiffNull -
176 // #i23425# don't rely on the record ID, but on the detected BIFF version
181 if( pExcRoot
->eDateiTyp
== Biff2
)
189 if( pExcRoot
->eDateiTyp
== Biff3
)
197 if( pExcRoot
->eDateiTyp
== Biff4
)
202 else if( pExcRoot
->eDateiTyp
== Biff4W
)
207 if( pExcRoot
->eDateiTyp
== Biff5W
)
209 eCurrent
= Z_Biff5WPre
;
213 aIn
.StoreGlobalPosition(); // store position
215 else if( pExcRoot
->eDateiTyp
== Biff5
)
217 // #i62752# possible to have BIFF5 sheet without globals
219 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
221 aIn
.StoreGlobalPosition(); // store position
233 case Z_Biff2
: // ---------------------------------- Z_Biff2 -
237 case EXC_ID2_DIMENSIONS
:
238 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
240 case EXC_ID3_BLANK
: ReadBlank(); break;
241 case EXC_ID2_INTEGER
: ReadInteger(); break;
243 case EXC_ID3_NUMBER
: ReadNumber(); break;
245 case EXC_ID3_LABEL
: ReadLabel(); break;
246 case EXC_ID2_BOOLERR
:
247 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
248 case EXC_ID_RK
: ReadRk(); break;
250 case 0x06: Formula25(); break; // FORMULA [ 2 5]
251 case 0x08: Row25(); break; // ROW [ 2 5]
252 case 0x0A: // EOF [ 2345]
253 rNumFmtBfr
.CreateScFormats();
254 rNameMgr
.ConvertAllTokens();
259 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
260 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
261 case 0x18: rNameMgr
.ReadName( maStrm
); break;
262 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
263 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
264 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
265 case 0x20: Columndefault(); break; // COLUMNDEFAULT[ 2 ]
266 case 0x21: Array25(); break; // ARRAY [ 2 5]
267 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
268 case 0x24: Colwidth(); break; // COLWIDTH [ 2 ]
269 case 0x25: Defrowheight2(); break; // DEFAULTROWHEI[ 2 ]
273 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
274 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
275 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
276 case 0x2F: // FILEPASS [ 2345]
277 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
278 if( eLastErr
!= ERRCODE_NONE
)
281 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
282 case EXC_ID_EFONT
: rFontBfr
.ReadEfont( maStrm
); break;
283 case 0x3E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
284 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
285 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
286 case 0x43: rXFBfr
.ReadXF( maStrm
); break;
287 case 0x44: Ixfe(); break; // IXFE [ 2 ]
292 case Z_Biff3
: // ---------------------------------- Z_Biff3 -
296 // skip chart substream
300 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
302 case EXC_ID2_DIMENSIONS
:
303 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
305 case EXC_ID3_BLANK
: ReadBlank(); break;
306 case EXC_ID2_INTEGER
: ReadInteger(); break;
308 case EXC_ID3_NUMBER
: ReadNumber(); break;
310 case EXC_ID3_LABEL
: ReadLabel(); break;
311 case EXC_ID2_BOOLERR
:
312 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
313 case EXC_ID_RK
: ReadRk(); break;
315 case 0x0A: // EOF [ 2345]
316 rNumFmtBfr
.CreateScFormats();
317 rNameMgr
.ConvertAllTokens();
322 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
323 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
325 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
326 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
327 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
328 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
329 case 0x22: Rec1904(); break; // 1904 [ 2345]
333 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
334 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
335 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
336 case 0x2F: // FILEPASS [ 2345]
337 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
338 if( eLastErr
!= ERRCODE_NONE
)
341 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
342 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
343 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
344 case 0x56: break; // BUILTINFMTCNT[ 34 ]
345 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
346 case 0x7D: Colinfo(); break; // COLINFO [ 345]
347 case 0x8C: Country(); break; // COUNTRY [ 345]
348 case 0x92: rPal
.ReadPalette( maStrm
); break;
349 case 0x0206: Formula3(); break; // FORMULA [ 3 ]
350 case 0x0208: Row34(); break; // ROW [ 34 ]
351 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
352 case 0x0221: Array34(); break; // ARRAY [ 34 ]
353 case 0x0223: break; // EXTERNNAME [ 34 ]
354 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
355 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
356 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
357 case 0x0243: rXFBfr
.ReadXF( maStrm
); break;
358 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
363 case Z_Biff4
: // ---------------------------------- Z_Biff4 -
367 // skip chart substream
371 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
373 case EXC_ID2_DIMENSIONS
:
374 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
376 case EXC_ID3_BLANK
: ReadBlank(); break;
377 case EXC_ID2_INTEGER
: ReadInteger(); break;
379 case EXC_ID3_NUMBER
: ReadNumber(); break;
381 case EXC_ID3_LABEL
: ReadLabel(); break;
382 case EXC_ID2_BOOLERR
:
383 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
384 case EXC_ID_RK
: ReadRk(); break;
386 case 0x0A: // EOF [ 2345]
387 rNumFmtBfr
.CreateScFormats();
388 rNameMgr
.ConvertAllTokens();
392 case 0x12: SheetProtect(); break; // SHEET PROTECTION
394 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
395 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
397 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
398 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
399 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
400 case 0x22: Rec1904(); break; // 1904 [ 2345]
404 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
405 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
406 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
407 case 0x2F: // FILEPASS [ 2345]
408 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
409 if( eLastErr
!= ERRCODE_NONE
)
412 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
413 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
414 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
415 case 0x55: DefColWidth(); break;
416 case 0x56: break; // BUILTINFMTCNT[ 34 ]
417 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
418 case 0x7D: Colinfo(); break; // COLINFO [ 345]
419 case 0x8C: Country(); break; // COUNTRY [ 345]
420 case 0x92: rPal
.ReadPalette( maStrm
); break;
421 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
422 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
423 case 0x0208: Row34(); break; // ROW [ 34 ]
424 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
425 case 0x0221: Array34(); break; // ARRAY [ 34 ]
426 case 0x0223: break; // EXTERNNAME [ 34 ]
427 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
428 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
429 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
430 case 0x0406: Formula4(); break; // FORMULA [ 4 ]
431 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
432 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
433 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
438 case Z_Biff4W
: // --------------------------------- Z_Biff4W -
442 case 0x0A: // EOF [ 2345]
443 rNameMgr
.ConvertAllTokens();
446 case 0x12: DocProtect(); break; // PROTECT [ 5]
447 case 0x2F: // FILEPASS [ 2345]
448 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
449 if( eLastErr
!= ERRCODE_NONE
)
452 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
453 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
454 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
455 case 0x55: DefColWidth(); break;
456 case 0x56: break; // BUILTINFMTCNT[ 34 ]
457 case 0x8C: Country(); break; // COUNTRY [ 345]
458 case 0x8F: break; // BUNDLEHEADER [ 4 ]
459 case 0x92: rPal
.ReadPalette( maStrm
); break;
460 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
461 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
462 case 0x0223: break; // EXTERNNAME [ 34 ]
463 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
464 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
465 case EXC_ID4_BOF
: // BOF [ 4 ]
467 if( pExcRoot
->eDateiTyp
== Biff4
)
475 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
476 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
477 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
483 case Z_Biff4T
: // --------------------------------- Z_Biff4T -
487 // skip chart substream
491 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
493 case EXC_ID2_DIMENSIONS
:
494 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
496 case EXC_ID3_BLANK
: ReadBlank(); break;
497 case EXC_ID2_INTEGER
: ReadInteger(); break;
499 case EXC_ID3_NUMBER
: ReadNumber(); break;
501 case EXC_ID3_LABEL
: ReadLabel(); break;
502 case EXC_ID2_BOOLERR
:
503 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
504 case EXC_ID_RK
: ReadRk(); break;
506 case 0x0A: // EOF [ 2345]
507 rNameMgr
.ConvertAllTokens();
511 case 0x12: SheetProtect(); break; // SHEET PROTECTION
513 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
515 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
516 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
517 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
518 case 0x2F: // FILEPASS [ 2345]
519 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
520 if( eLastErr
!= ERRCODE_NONE
)
523 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
524 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
525 case 0x55: DefColWidth(); break;
526 case 0x56: break; // BUILTINFMTCNT[ 34 ]
527 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
528 case 0x7D: Colinfo(); break; // COLINFO [ 345]
529 case 0x8C: Country(); break; // COUNTRY [ 345]
530 case 0x8F: break; // BUNDLEHEADER [ 4 ]
531 case 0x92: rPal
.ReadPalette( maStrm
); break;
532 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
533 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
534 case 0x0208: Row34(); break; // ROW [ 34 ]
535 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
536 case 0x0221: Array34(); break;
537 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
538 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
539 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
540 case 0x0406: Formula4(); break;
541 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
542 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
543 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
549 case Z_Biff4E
: // --------------------------------- Z_Biff4E -
553 case 0x0A: // EOF [ 2345]
556 case 0x8F: break; // BUNDLEHEADER [ 4 ]
557 case EXC_ID4_BOF
: // BOF [ 4 ]
560 if( pExcRoot
->eDateiTyp
== Biff4
)
574 case Z_Biff5WPre
: // ------------------------------ Z_Biff5WPre -
578 case 0x0A: // EOF [ 2345]
580 aIn
.SeekGlobalPosition(); // and back to old position
582 case 0x12: DocProtect(); break; // PROTECT [ 5]
583 case 0x2F: // FILEPASS [ 2345]
584 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
585 if( eLastErr
!= ERRCODE_NONE
)
588 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
589 case 0x3D: Window1(); break;
590 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
591 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5]
592 case 0x8C: Country(); break; // COUNTRY [ 345]
593 // PALETTE follows XFs, but already needed while reading the XFs
594 case 0x92: rPal
.ReadPalette( maStrm
); break;
598 case Z_Biff5W
: // --------------------------------- Z_Biff5W -
602 case 0x0A: // EOF [ 2345]
603 rNumFmtBfr
.CreateScFormats();
604 rXFBfr
.CreateUserStyles();
605 rNameMgr
.ConvertAllTokens();
608 case 0x18: rNameMgr
.ReadName( maStrm
); break;
609 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
610 case 0x22: Rec1904(); break; // 1904 [ 2345]
611 case 0x31: rFontBfr
.ReadFont( maStrm
); break;
612 case 0x56: break; // BUILTINFMTCNT[ 34 ]
613 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345]
614 case 0xDE: Olesize(); break;
615 case 0xE0: rXFBfr
.ReadXF( maStrm
); break;
616 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
617 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
623 case Z_Biff5TPre
: // ------------------------------- Z_Biff5Pre -
625 if (nOpcode
== EXC_ID5_BOF
)
627 else if( (nOpcode
== 0x000A) && nBofLevel
)
629 else if( !nBofLevel
) // don't read chart records
633 case EXC_ID2_DIMENSIONS
:
634 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
635 case 0x08: Row25(); break; // ROW [ 2 5]
636 case 0x0A: // EOF [ 2345]
638 aIn
.SeekGlobalPosition(); // and back to old position
640 case 0x12: SheetProtect(); break; // SHEET PROTECTION
642 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
643 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
644 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
645 case 0x21: Array25(); break; // ARRAY [ 2 5]
646 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
647 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
648 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
649 case 0x55: DefColWidth(); break;
650 case 0x7D: Colinfo(); break; // COLINFO [ 345]
651 case 0x81: Wsbool(); break; // WSBOOL [ 2345]
652 case 0x8C: Country(); break; // COUNTRY [ 345]
653 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
654 case 0x0208: Row34(); break; // ROW [ 34 ]
655 case 0x0221: Array34(); break; // ARRAY [ 34 ]
656 case 0x0223: break; // EXTERNNAME [ 34 ]
657 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
658 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
664 case Z_Biff5T
: // --------------------------------- Z_Biff5T -
669 case EXC_ID3_BLANK
: ReadBlank(); break;
670 case EXC_ID2_INTEGER
: ReadInteger(); break;
672 case EXC_ID3_NUMBER
: ReadNumber(); break;
674 case EXC_ID3_LABEL
: ReadLabel(); break;
675 case EXC_ID2_BOOLERR
:
676 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
677 case EXC_ID_RK
: ReadRk(); break;
679 case EXC_ID2_FORMULA
:
680 case EXC_ID3_FORMULA
:
681 case EXC_ID4_FORMULA
: Formula25(); break;
682 case EXC_ID_SHRFMLA
: Shrfmla(); break;
683 case 0x0A: Eof(); eCurrent
= Z_Biff5E
; break;
685 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
686 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
687 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
688 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
689 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
693 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
694 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
695 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
696 case 0x2F: // FILEPASS [ 2345]
697 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
698 if( eLastErr
!= ERRCODE_NONE
)
701 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
703 case 0x84: rPageSett
.ReadCenter( maStrm
); break;
704 case 0xA0: rTabViewSett
.ReadScl( maStrm
); break;
705 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
706 case 0xBD: Mulrk(); break; // MULRK [ 5]
707 case 0xBE: Mulblank(); break; // MULBLANK [ 5]
708 case 0xD6: Rstring(); break; // RSTRING [ 5]
709 case 0x00E5: Cellmerging(); break; // #i62300#
710 case 0x0236: TableOp(); break; // TABLE [ 5]
711 case EXC_ID5_BOF
: // BOF [ 5]
712 XclTools::SkipSubStream( maStrm
);
719 case Z_Biff5E
: // --------------------------------- Z_Biff5E -
723 case EXC_ID5_BOF
: // BOF [ 5]
726 switch( pExcRoot
->eDateiTyp
)
730 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
732 aIn
.StoreGlobalPosition(); // store position
734 case Biff5C
: // chart sheet
735 GetCurrSheetDrawing().ReadTabChart( maStrm
);
737 GetTracer().TraceChartOnlySheet();
741 rD
.SetVisible( GetCurrScTab(), false );
745 OSL_ENSURE( pExcRoot
->eDateiTyp
!= Biff5W
,
746 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
753 case Z_Biffn0
: // --------------------------------- Z_Biffn0 -
757 case 0x0A: // EOF [ 2345]
766 case Z_End
: // ----------------------------------- Z_End -
767 OSL_FAIL( "*ImportExcel::Read(): Not possible state!" );
769 default: OSL_FAIL( "-ImportExcel::Read(): state forgotten!" );
773 if( eLastErr
== ERRCODE_NONE
)
777 GetDocImport().finalize();
778 if (!utl::ConfigManager::IsFuzzing())
782 rD
.CalcAfterLoad(false);
784 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
785 if( rAddrConv
.IsTabTruncated() )
786 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
787 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
788 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
789 else if( rAddrConv
.IsColTruncated() )
790 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
796 ErrCode
ImportExcel8::Read()
798 #ifdef EXC_INCL_DUMPER
800 Biff8RecDumper
aDumper( GetRoot(), sal_True
);
801 if( aDumper
.Dump( aIn
) )
802 return ERRCODE_ABORT
;
805 // read the entire BIFF8 stream
806 // don't look too close - this stuff seriously needs to be reworked
808 XclImpPageSettings
& rPageSett
= GetPageSettings();
809 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
810 XclImpPalette
& rPal
= GetPalette();
811 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
812 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
813 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
814 XclImpSst
& rSst
= GetSst();
815 XclImpTabInfo
& rTabInfo
= GetTabInfo();
816 XclImpNameManager
& rNameMgr
= GetNameManager();
817 XclImpLinkManager
& rLinkMgr
= GetLinkManager();
818 XclImpObjectManager
& rObjMgr
= GetObjectManager();
819 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
820 XclImpCondFormatManager
& rCondFmtMgr
= GetCondFormatManager();
821 XclImpValidationManager
& rValidMgr
= GetValidationManager();
822 XclImpPivotTableManager
& rPTableMgr
= GetPivotTableManager();
823 XclImpWebQueryBuffer
& rWQBfr
= GetWebQueryBuffer();
825 bool bInUserView
= false; // true = In USERSVIEW(BEGIN|END) record block.
829 EXC_STATE_BEFORE_GLOBALS
, /// Before workbook globals (wait for initial BOF).
830 EXC_STATE_GLOBALS_PRE
, /// Prefetch for workbook globals.
831 EXC_STATE_GLOBALS
, /// Workbook globals.
832 EXC_STATE_BEFORE_SHEET
, /// Before worksheet (wait for new worksheet BOF).
833 EXC_STATE_SHEET_PRE
, /// Prefetch for worksheet.
834 EXC_STATE_SHEET
, /// Worksheet.
835 EXC_STATE_END
/// Stop reading.
838 XclImpReadState eCurrent
= EXC_STATE_BEFORE_GLOBALS
;
840 ErrCode eLastErr
= ERRCODE_NONE
;
842 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
843 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
845 /* #i104057# Need to track a base position for progress bar calculation,
846 because sheet substreams may not be in order of sheets. */
847 std::size_t nProgressBasePos
= 0;
848 std::size_t nProgressBaseSize
= 0;
850 bool bSheetHasCodeName
= false;
852 std::vector
<OUString
> aCodeNames
;
853 std::vector
< SCTAB
> nTabsWithNoCodeName
;
855 sal_uInt16 nRecId
= 0;
857 for (; eCurrent
!= EXC_STATE_END
; mnLastRecId
= nRecId
)
859 if( eCurrent
== EXC_STATE_BEFORE_SHEET
)
861 sal_uInt16 nScTab
= GetCurrScTab();
862 if( nScTab
< maSheetOffsets
.size() )
864 nProgressBaseSize
+= (maStrm
.GetSvStreamPos() - nProgressBasePos
);
865 nProgressBasePos
= maSheetOffsets
[ nScTab
];
867 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
870 // Safeguard ourselves from potential infinite loop.
871 eCurrent
= EXC_STATE_END
;
874 // import only 256 sheets
875 if( nScTab
> GetScMaxPos().Tab() )
877 if( maStrm
.GetRecId() != EXC_ID_EOF
)
878 XclTools::SkipSubStream( maStrm
);
879 // #i29930# show warning box
880 GetAddressConverter().CheckScTab( nScTab
);
881 eCurrent
= EXC_STATE_END
;
885 // #i109800# SHEET record may point to any record inside the
887 bool bIsBof
= maStrm
.GetRecId() == EXC_ID5_BOF
;
889 Bof5(); // read the BOF record
891 pExcRoot
->eDateiTyp
= Biff8
; // on missing BOF, assume a standard worksheet
893 switch( pExcRoot
->eDateiTyp
)
895 case Biff8
: // worksheet
896 case Biff8M4
: // macro sheet
897 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
899 if( bIsBof
) maStrm
.StartNextRecord();
900 maStrm
.StoreGlobalPosition();
902 case Biff8C
: // chart sheet
903 GetCurrSheetDrawing().ReadTabChart( maStrm
);
905 GetTracer().TraceChartOnlySheet();
907 case Biff8W
: // workbook
908 OSL_FAIL( "ImportExcel8::Read - double workbook globals" );
910 case Biff8V
: // VB module
912 // TODO: do not create a sheet in the Calc document
913 rD
.SetVisible( nScTab
, false );
914 XclTools::SkipSubStream( maStrm
);
920 eCurrent
= EXC_STATE_END
;
923 aIn
.StartNextRecord();
927 // #i63591# finalize table if EOF is missing
930 case EXC_STATE_SHEET_PRE
:
931 eCurrent
= EXC_STATE_SHEET
;
932 aIn
.SeekGlobalPosition();
933 continue; // next iteration in while loop
934 case EXC_STATE_SHEET
:
936 eCurrent
= EXC_STATE_END
;
939 eCurrent
= EXC_STATE_END
;
943 if( eCurrent
== EXC_STATE_END
)
946 if( eCurrent
!= EXC_STATE_SHEET_PRE
&& eCurrent
!= EXC_STATE_GLOBALS_PRE
)
947 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
949 nRecId
= aIn
.GetRecId();
951 /* #i39464# Ignore records between USERSVIEWBEGIN and USERSVIEWEND
952 completely (user specific view settings). Otherwise view settings
953 and filters are loaded multiple times, which at least causes
954 problems in auto-filters. */
957 case EXC_ID_USERSVIEWBEGIN
:
958 OSL_ENSURE( !bInUserView
, "ImportExcel8::Read - nested user view settings" );
961 case EXC_ID_USERSVIEWEND
:
962 OSL_ENSURE( bInUserView
, "ImportExcel8::Read - not in user view settings" );
967 if( !bInUserView
) switch( eCurrent
)
970 // before workbook globals: wait for initial workbook globals BOF
971 case EXC_STATE_BEFORE_GLOBALS
:
973 if( nRecId
== EXC_ID5_BOF
)
975 OSL_ENSURE( GetBiff() == EXC_BIFF8
, "ImportExcel8::Read - wrong BIFF version" );
977 if( pExcRoot
->eDateiTyp
== Biff8W
)
979 eCurrent
= EXC_STATE_GLOBALS_PRE
;
980 maStrm
.StoreGlobalPosition();
983 else if( pExcRoot
->eDateiTyp
== Biff8
)
985 // #i62752# possible to have BIFF8 sheet without globals
987 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
988 bSheetHasCodeName
= false; // reset
989 aIn
.StoreGlobalPosition();
995 // prefetch for workbook globals
996 case EXC_STATE_GLOBALS_PRE
:
1002 /* #i56376# evil hack: if EOF for globals is missing,
1003 simulate it. This hack works only for the bugdoc
1004 given in the issue, where the sheet substreams
1005 start directly after the EXTSST record. A future
1006 implementation should be more robust against
1008 if( (nRecId
== EXC_ID_EOF
) ||
1009 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1011 eCurrent
= EXC_STATE_GLOBALS
;
1012 aIn
.SeekGlobalPosition();
1015 case 0x12: DocProtect(); break; // PROTECT [ 5678]
1016 case 0x13: DocPassword(); break;
1017 case 0x19: WinProtection(); break;
1018 case 0x2F: // FILEPASS [ 2345 ]
1019 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
1020 if( eLastErr
!= ERRCODE_NONE
)
1021 eCurrent
= EXC_STATE_END
;
1023 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
1024 case 0x3D: Window1(); break;
1025 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1026 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ]
1027 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1029 // PALETTE follows XFs, but already needed while reading the XFs
1030 case EXC_ID_PALETTE
: rPal
.ReadPalette( maStrm
); break;
1036 case EXC_STATE_GLOBALS
:
1042 /* #i56376# evil hack: if EOF for globals is missing,
1043 simulate it. This hack works only for the bugdoc
1044 given in the issue, where the sheet substreams
1045 start directly after the EXTSST record. A future
1046 implementation should be more robust against
1048 if( (nRecId
== EXC_ID_EOF
) ||
1049 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1051 rNumFmtBfr
.CreateScFormats();
1052 rXFBfr
.CreateUserStyles();
1053 rPTableMgr
.ReadPivotCaches( maStrm
);
1054 rNameMgr
.ConvertAllTokens();
1055 eCurrent
= EXC_STATE_BEFORE_SHEET
;
1058 case 0x0E: Precision(); break; // PRECISION
1059 case 0x22: Rec1904(); break; // 1904 [ 2345 ]
1060 case 0x56: break; // BUILTINFMTCNT[ 34 ]
1061 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
1062 case 0xD3: SetHasBasic(); break;
1063 case 0xDE: Olesize(); break;
1065 case EXC_ID_CODENAME
: ReadCodeName( aIn
, true ); break;
1066 case EXC_ID_USESELFS
: ReadUsesElfs(); break;
1068 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
1069 case EXC_ID4_FORMAT
: rNumFmtBfr
.ReadFormat( maStrm
); break;
1070 case EXC_ID5_XF
: rXFBfr
.ReadXF( maStrm
); break;
1071 case EXC_ID_STYLE
: rXFBfr
.ReadStyle( maStrm
); break;
1073 case EXC_ID_SST
: rSst
.ReadSst( maStrm
); break;
1074 case EXC_ID_TABID
: rTabInfo
.ReadTabid( maStrm
); break;
1075 case EXC_ID_NAME
: rNameMgr
.ReadName( maStrm
); break;
1077 case EXC_ID_EXTERNSHEET
: rLinkMgr
.ReadExternsheet( maStrm
); break;
1078 case EXC_ID_SUPBOOK
: rLinkMgr
.ReadSupbook( maStrm
); break;
1079 case EXC_ID_XCT
: rLinkMgr
.ReadXct( maStrm
); break;
1080 case EXC_ID_CRN
: rLinkMgr
.ReadCrn( maStrm
); break;
1081 case EXC_ID_EXTERNNAME
: rLinkMgr
.ReadExternname( maStrm
, pFormConv
.get() ); break;
1083 case EXC_ID_MSODRAWINGGROUP
:rObjMgr
.ReadMsoDrawingGroup( maStrm
); break;
1085 case EXC_ID_SXIDSTM
: rPTableMgr
.ReadSxidstm( maStrm
); break;
1086 case EXC_ID_SXVS
: rPTableMgr
.ReadSxvs( maStrm
); break;
1087 case EXC_ID_DCONREF
: rPTableMgr
.ReadDconref( maStrm
); break;
1088 case EXC_ID_DCONNAME
: rPTableMgr
.ReadDConName( maStrm
); break;
1094 // prefetch for worksheet
1095 case EXC_STATE_SHEET_PRE
:
1099 // skip chart substream
1103 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1105 case EXC_ID_WINDOW2
: rTabViewSett
.ReadWindow2( maStrm
, false );break;
1106 case EXC_ID_SCL
: rTabViewSett
.ReadScl( maStrm
); break;
1107 case EXC_ID_PANE
: rTabViewSett
.ReadPane( maStrm
); break;
1108 case EXC_ID_SELECTION
: rTabViewSett
.ReadSelection( maStrm
); break;
1110 case EXC_ID2_DIMENSIONS
:
1111 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
1113 case EXC_ID_CODENAME
: ReadCodeName( aIn
, false ); bSheetHasCodeName
= true; break;
1115 case 0x0A: // EOF [ 2345 ]
1117 eCurrent
= EXC_STATE_SHEET
;
1119 GetDoc().GetName( GetCurrScTab(), sName
);
1120 if ( !bSheetHasCodeName
)
1122 nTabsWithNoCodeName
.push_back( GetCurrScTab() );
1127 GetDoc().GetCodeName( GetCurrScTab(), sCodeName
);
1128 aCodeNames
.push_back( sCodeName
);
1131 bSheetHasCodeName
= false; // reset
1133 aIn
.SeekGlobalPosition(); // and back to old position
1136 case 0x12: SheetProtect(); break;
1137 case 0x13: SheetPassword(); break;
1138 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1139 case 0x55: DefColWidth(); break;
1140 case 0x7D: Colinfo(); break; // COLINFO [ 345 ]
1141 case 0x81: Wsbool(); break; // WSBOOL [ 2345 ]
1142 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1143 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45 ]
1144 case 0x9B: FilterMode(); break; // FILTERMODE
1145 case EXC_ID_AUTOFILTERINFO
: AutoFilterInfo(); break;// AUTOFILTERINFO
1146 case EXC_ID_AUTOFILTER
: AutoFilter(); break; // AUTOFILTER
1147 case 0x0208: Row34(); break; // ROW [ 34 ]
1149 case EXC_ID3_ARRAY
: Array34(); break; // ARRAY [ 34 ]
1150 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
1151 case 0x0867: FeatHdr(); break; // FEATHDR
1152 case 0x0868: Feat(); break; // FEAT
1158 case EXC_STATE_SHEET
:
1162 // skip unknown substreams
1166 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1168 case EXC_ID_EOF
: Eof(); eCurrent
= EXC_STATE_BEFORE_SHEET
; break;
1171 case EXC_ID3_BLANK
: ReadBlank(); break;
1172 case EXC_ID2_INTEGER
: ReadInteger(); break;
1173 case EXC_ID2_NUMBER
:
1174 case EXC_ID3_NUMBER
: ReadNumber(); break;
1176 case EXC_ID3_LABEL
: ReadLabel(); break;
1177 case EXC_ID2_BOOLERR
:
1178 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
1179 case EXC_ID_RK
: ReadRk(); break;
1181 case EXC_ID2_FORMULA
:
1182 case EXC_ID3_FORMULA
:
1183 case EXC_ID4_FORMULA
: Formula25(); break;
1184 case EXC_ID_SHRFMLA
: Shrfmla(); break;
1185 case 0x000C: Calccount(); break; // CALCCOUNT
1186 case 0x0010: Delta(); break; // DELTA
1187 case 0x0011: Iteration(); break; // ITERATION
1189 case 0x00AE: Scenman(); break; // SCENMAN
1190 case 0x00AF: Scenario(); break; // SCENARIO
1191 case 0x00BD: Mulrk(); break; // MULRK [ 5 ]
1192 case 0x00BE: Mulblank(); break; // MULBLANK [ 5 ]
1193 case 0x00D6: Rstring(); break; // RSTRING [ 5 ]
1194 case 0x00E5: Cellmerging(); break; // CELLMERGING
1195 case 0x00FD: Labelsst(); break; // LABELSST [ 8 ]
1196 case 0x0236: TableOp(); break; // TABLE
1198 case EXC_ID_HORPAGEBREAKS
:
1199 case EXC_ID_VERPAGEBREAKS
: rPageSett
.ReadPageBreaks( maStrm
); break;
1201 case EXC_ID_FOOTER
: rPageSett
.ReadHeaderFooter( maStrm
); break;
1202 case EXC_ID_LEFTMARGIN
:
1203 case EXC_ID_RIGHTMARGIN
:
1204 case EXC_ID_TOPMARGIN
:
1205 case EXC_ID_BOTTOMMARGIN
: rPageSett
.ReadMargin( maStrm
); break;
1206 case EXC_ID_PRINTHEADERS
: rPageSett
.ReadPrintHeaders( maStrm
); break;
1207 case EXC_ID_PRINTGRIDLINES
: rPageSett
.ReadPrintGridLines( maStrm
); break;
1208 case EXC_ID_HCENTER
:
1209 case EXC_ID_VCENTER
: rPageSett
.ReadCenter( maStrm
); break;
1210 case EXC_ID_SETUP
: rPageSett
.ReadSetup( maStrm
); break;
1211 case EXC_ID8_IMGDATA
: rPageSett
.ReadImgData( maStrm
); break;
1213 case EXC_ID_MSODRAWING
: GetCurrSheetDrawing().ReadMsoDrawing( maStrm
); break;
1214 // #i61786# weird documents: OBJ without MSODRAWING -> read in BIFF5 format
1215 case EXC_ID_OBJ
: GetCurrSheetDrawing().ReadObj( maStrm
); break;
1216 case EXC_ID_NOTE
: GetCurrSheetDrawing().ReadNote( maStrm
); break;
1218 case EXC_ID_HLINK
: XclImpHyperlink::ReadHlink( maStrm
); break;
1219 case EXC_ID_LABELRANGES
: XclImpLabelranges::ReadLabelranges( maStrm
); break;
1221 case EXC_ID_CONDFMT
: rCondFmtMgr
.ReadCondfmt( maStrm
); break;
1222 case EXC_ID_CF
: rCondFmtMgr
.ReadCF( maStrm
); break;
1224 case EXC_ID_DVAL
: XclImpValidationManager::ReadDval( maStrm
); break;
1225 case EXC_ID_DV
: rValidMgr
.ReadDV( maStrm
); break;
1227 case EXC_ID_QSI
: rWQBfr
.ReadQsi( maStrm
); break;
1228 case EXC_ID_WQSTRING
: rWQBfr
.ReadWqstring( maStrm
); break;
1229 case EXC_ID_PQRY
: rWQBfr
.ReadParamqry( maStrm
); break;
1230 case EXC_ID_WQSETT
: rWQBfr
.ReadWqsettings( maStrm
); break;
1231 case EXC_ID_WQTABLES
: rWQBfr
.ReadWqtables( maStrm
); break;
1233 case EXC_ID_SXVIEW
: rPTableMgr
.ReadSxview( maStrm
); break;
1234 case EXC_ID_SXVD
: rPTableMgr
.ReadSxvd( maStrm
); break;
1235 case EXC_ID_SXVI
: rPTableMgr
.ReadSxvi( maStrm
); break;
1236 case EXC_ID_SXIVD
: rPTableMgr
.ReadSxivd( maStrm
); break;
1237 case EXC_ID_SXPI
: rPTableMgr
.ReadSxpi( maStrm
); break;
1238 case EXC_ID_SXDI
: rPTableMgr
.ReadSxdi( maStrm
); break;
1239 case EXC_ID_SXVDEX
: rPTableMgr
.ReadSxvdex( maStrm
); break;
1240 case EXC_ID_SXEX
: rPTableMgr
.ReadSxex( maStrm
); break;
1241 case EXC_ID_SHEETEXT
: rTabViewSett
.ReadTabBgColor( maStrm
, rPal
); break;
1242 case EXC_ID_SXVIEWEX9
: rPTableMgr
.ReadSxViewEx9( maStrm
); break;
1243 case EXC_ID_SXADDL
: rPTableMgr
.ReadSxAddl( maStrm
); break;
1252 if( eLastErr
== ERRCODE_NONE
)
1254 // In some strange circumstances the codename might be missing
1255 // # Create any missing Sheet CodeNames
1256 for ( const auto& rTab
: nTabsWithNoCodeName
)
1261 OUStringBuffer aBuf
;
1262 aBuf
.append("Sheet");
1263 aBuf
.append(static_cast<sal_Int32
>(nTab
++));
1264 OUString sTmpName
= aBuf
.makeStringAndClear();
1266 if ( std::find(aCodeNames
.begin(), aCodeNames
.end(), sTmpName
) == aCodeNames
.end() ) // generated codename not found
1269 GetDoc().SetCodeName( rTab
, sTmpName
);
1270 // Record newly used codename
1271 aCodeNames
.push_back(sTmpName
);
1276 // #i45843# Convert pivot tables before calculation, so they are available
1277 // for the GETPIVOTDATA function.
1278 if( GetBiff() == EXC_BIFF8
)
1279 GetPivotTableManager().ConvertPivotTables();
1281 ScDocumentImport
& rDoc
= GetDocImport();
1285 // Excel documents look much better without this call; better in the
1286 // sense that the row heights are identical to the original heights in
1288 if ( !rD
.IsAdjustHeightLocked())
1293 rD
.CalcAfterLoad(false);
1295 // import change tracking data
1296 XclImpChangeTrack
aImpChTr( GetRoot(), maStrm
);
1299 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
1300 if( rAddrConv
.IsTabTruncated() )
1301 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
1302 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
1303 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
1304 else if( rAddrConv
.IsColTruncated() )
1305 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
1307 if( GetBiff() == EXC_BIFF8
)
1308 GetPivotTableManager().MaybeRefreshPivotTables();
1314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */