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>
22 #include <scerrors.hxx>
23 #include <fprogressbar.hxx>
24 #include <globstr.hrc>
25 #include <xlcontent.hxx>
26 #include <xltracer.hxx>
27 #include <xltable.hxx>
28 #include <xihelper.hxx>
34 #include <xicontent.hxx>
35 #include <xiescher.hxx>
36 #include <xipivot.hxx>
37 #include <xistyle.hxx>
38 #include <XclImpChangeTrack.hxx>
39 #include <documentimport.hxx>
43 #include <excimp8.hxx>
45 #include <comphelper/configuration.hxx>
51 bool TryStartNextRecord(XclImpStream
& rIn
, std::size_t nProgressBasePos
)
54 // i#115255 fdo#40304 BOUNDSHEET doesn't point to a valid
55 // BOF record position. Scan the records manually (from
56 // the BOUNDSHEET position) until we find a BOF. Some 3rd
57 // party Russian programs generate invalid xls docs with
58 // this kind of silliness.
59 if (rIn
.PeekRecId(nProgressBasePos
) == EXC_ID5_BOF
)
60 // BOUNDSHEET points to a valid BOF record. Good.
61 rIn
.StartNextRecord(nProgressBasePos
);
64 while (bValid
&& rIn
.GetRecId() != EXC_ID5_BOF
)
65 bValid
= rIn
.StartNextRecord();
71 ErrCode
ImportExcel::Read()
73 XclImpPageSettings
& rPageSett
= GetPageSettings();
74 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
75 XclImpPalette
& rPal
= GetPalette();
76 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
77 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
78 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
79 XclImpNameManager
& rNameMgr
= GetNameManager();
80 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
83 Z_BiffNull
, // not a valid Biff-Format
84 Z_Biff2
, // Biff2: only one table
86 Z_Biff3
, // Biff3: only one table
88 Z_Biff4
, // Biff4: only one table
89 Z_Biff4W
, // Biff4 Workbook: Globals
90 Z_Biff4T
, // Biff4 Workbook: a table itself
91 Z_Biff4E
, // Biff4 Workbook: between tables
93 Z_Biff5WPre
,// Biff5: Prefetch Workbook
94 Z_Biff5W
, // Biff5: Globals
95 Z_Biff5TPre
,// Biff5: Prefetch for Shrfmla/Array Formula
96 Z_Biff5T
, // Biff5: a table itself
97 Z_Biff5E
, // Biff5: between tables
98 Z_Biffn0
, // all Biffs: skip table till next EOF
101 STATE eCurrent
= Z_BiffNull
, ePrev
= Z_BiffNull
;
103 ErrCode eLastErr
= ERRCODE_NONE
;
105 sal_uInt16 nBofLevel
= 0;
107 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
108 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
110 /* #i104057# Need to track a base position for progress bar calculation,
111 because sheet substreams may not be in order of sheets. */
112 std::size_t nProgressBasePos
= 0;
113 std::size_t nProgressBaseSize
= 0;
115 for (; eCurrent
!= Z_End
; mnLastRecId
= nOpcode
)
117 if( eCurrent
== Z_Biff5E
)
119 sal_uInt16 nScTab
= GetCurrScTab();
120 if( nScTab
< maSheetOffsets
.size() )
122 nProgressBaseSize
+= (aIn
.GetSvStreamPos() - nProgressBasePos
);
123 nProgressBasePos
= maSheetOffsets
[ nScTab
];
125 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
128 // Safeguard ourselves from potential infinite loop.
136 aIn
.StartNextRecord();
138 nOpcode
= aIn
.GetRecId();
142 // finalize table if EOF is missing
151 rNumFmtBfr
.CreateScFormats();
159 if( eCurrent
== Z_End
)
162 if( eCurrent
!= Z_Biff5TPre
&& eCurrent
!= Z_Biff5WPre
)
163 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
168 case Z_BiffNull
: // ------------------------------- Z_BiffNull -
177 // #i23425# don't rely on the record ID, but on the detected BIFF version
182 if( pExcRoot
->eDateiTyp
== Biff2
)
190 if( pExcRoot
->eDateiTyp
== Biff3
)
198 if( pExcRoot
->eDateiTyp
== Biff4
)
203 else if( pExcRoot
->eDateiTyp
== Biff4W
)
208 if( pExcRoot
->eDateiTyp
== Biff5W
)
210 eCurrent
= Z_Biff5WPre
;
214 aIn
.StoreGlobalPosition(); // store position
216 else if( pExcRoot
->eDateiTyp
== Biff5
)
218 // #i62752# possible to have BIFF5 sheet without globals
220 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
222 aIn
.StoreGlobalPosition(); // store position
234 case Z_Biff2
: // ---------------------------------- Z_Biff2 -
238 case EXC_ID2_DIMENSIONS
:
239 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
241 case EXC_ID3_BLANK
: ReadBlank(); break;
242 case EXC_ID2_INTEGER
: ReadInteger(); break;
244 case EXC_ID3_NUMBER
: ReadNumber(); break;
246 case EXC_ID3_LABEL
: ReadLabel(); break;
247 case EXC_ID2_BOOLERR
:
248 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
249 case EXC_ID_RK
: ReadRk(); break;
251 case 0x06: Formula25(); break; // FORMULA [ 2 5]
252 case 0x08: Row25(); break; // ROW [ 2 5]
253 case 0x0A: // EOF [ 2345]
254 rNumFmtBfr
.CreateScFormats();
255 rNameMgr
.ConvertAllTokens();
260 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
261 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
262 case 0x18: rNameMgr
.ReadName( maStrm
); break;
263 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
264 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
265 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
266 case 0x20: Columndefault(); break; // COLUMNDEFAULT[ 2 ]
267 case 0x21: Array25(); break; // ARRAY [ 2 5]
268 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
269 case 0x24: Colwidth(); break; // COLWIDTH [ 2 ]
270 case 0x25: Defrowheight2(); break; // DEFAULTROWHEI[ 2 ]
274 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
275 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
276 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
277 case 0x2F: // FILEPASS [ 2345]
278 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
279 if( eLastErr
!= ERRCODE_NONE
)
282 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
283 case EXC_ID_EFONT
: rFontBfr
.ReadEfont( maStrm
); break;
284 case 0x3E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
285 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
286 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
287 case 0x43: rXFBfr
.ReadXF( maStrm
); break;
288 case 0x44: Ixfe(); break; // IXFE [ 2 ]
293 case Z_Biff3
: // ---------------------------------- Z_Biff3 -
297 // skip chart substream
301 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
303 case EXC_ID2_DIMENSIONS
:
304 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
306 case EXC_ID3_BLANK
: ReadBlank(); break;
307 case EXC_ID2_INTEGER
: ReadInteger(); break;
309 case EXC_ID3_NUMBER
: ReadNumber(); break;
311 case EXC_ID3_LABEL
: ReadLabel(); break;
312 case EXC_ID2_BOOLERR
:
313 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
314 case EXC_ID_RK
: ReadRk(); break;
316 case 0x0A: // EOF [ 2345]
317 rNumFmtBfr
.CreateScFormats();
318 rNameMgr
.ConvertAllTokens();
323 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
324 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
326 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
327 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
328 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
329 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
330 case 0x22: Rec1904(); break; // 1904 [ 2345]
334 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
335 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
336 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
337 case 0x2F: // FILEPASS [ 2345]
338 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
339 if( eLastErr
!= ERRCODE_NONE
)
342 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
343 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
344 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
345 case 0x56: break; // BUILTINFMTCNT[ 34 ]
346 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
347 case 0x7D: Colinfo(); break; // COLINFO [ 345]
348 case 0x8C: Country(); break; // COUNTRY [ 345]
349 case 0x92: rPal
.ReadPalette( maStrm
); break;
350 case 0x0206: Formula3(); break; // FORMULA [ 3 ]
351 case 0x0208: Row34(); break; // ROW [ 34 ]
352 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
353 case 0x0221: Array34(); break; // ARRAY [ 34 ]
354 case 0x0223: break; // EXTERNNAME [ 34 ]
355 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
356 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
357 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
358 case 0x0243: rXFBfr
.ReadXF( maStrm
); break;
359 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
364 case Z_Biff4
: // ---------------------------------- Z_Biff4 -
368 // skip chart substream
372 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
374 case EXC_ID2_DIMENSIONS
:
375 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
377 case EXC_ID3_BLANK
: ReadBlank(); break;
378 case EXC_ID2_INTEGER
: ReadInteger(); break;
380 case EXC_ID3_NUMBER
: ReadNumber(); break;
382 case EXC_ID3_LABEL
: ReadLabel(); break;
383 case EXC_ID2_BOOLERR
:
384 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
385 case EXC_ID_RK
: ReadRk(); break;
387 case 0x0A: // EOF [ 2345]
388 rNumFmtBfr
.CreateScFormats();
389 rNameMgr
.ConvertAllTokens();
393 case 0x12: SheetProtect(); break; // SHEET PROTECTION
395 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
396 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
398 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
399 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
400 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
401 case 0x22: Rec1904(); break; // 1904 [ 2345]
405 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
406 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
407 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
408 case 0x2F: // FILEPASS [ 2345]
409 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
410 if( eLastErr
!= ERRCODE_NONE
)
413 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
414 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
415 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
416 case 0x55: DefColWidth(); break;
417 case 0x56: break; // BUILTINFMTCNT[ 34 ]
418 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
419 case 0x7D: Colinfo(); break; // COLINFO [ 345]
420 case 0x8C: Country(); break; // COUNTRY [ 345]
421 case 0x92: rPal
.ReadPalette( maStrm
); break;
422 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
423 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
424 case 0x0208: Row34(); break; // ROW [ 34 ]
425 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
426 case 0x0221: Array34(); break; // ARRAY [ 34 ]
427 case 0x0223: break; // EXTERNNAME [ 34 ]
428 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
429 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
430 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
431 case 0x0406: Formula4(); break; // FORMULA [ 4 ]
432 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
433 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
434 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
439 case Z_Biff4W
: // --------------------------------- Z_Biff4W -
443 case 0x0A: // EOF [ 2345]
444 rNameMgr
.ConvertAllTokens();
447 case 0x12: DocProtect(); break; // PROTECT [ 5]
448 case 0x2F: // FILEPASS [ 2345]
449 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
450 if( eLastErr
!= ERRCODE_NONE
)
453 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
454 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
455 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
456 case 0x55: DefColWidth(); break;
457 case 0x56: break; // BUILTINFMTCNT[ 34 ]
458 case 0x8C: Country(); break; // COUNTRY [ 345]
459 case 0x8F: break; // BUNDLEHEADER [ 4 ]
460 case 0x92: rPal
.ReadPalette( maStrm
); break;
461 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
462 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
463 case 0x0223: break; // EXTERNNAME [ 34 ]
464 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
465 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
466 case EXC_ID4_BOF
: // BOF [ 4 ]
468 if( pExcRoot
->eDateiTyp
== Biff4
)
476 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
477 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
478 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
484 case Z_Biff4T
: // --------------------------------- Z_Biff4T -
488 // skip chart substream
492 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
494 case EXC_ID2_DIMENSIONS
:
495 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
497 case EXC_ID3_BLANK
: ReadBlank(); break;
498 case EXC_ID2_INTEGER
: ReadInteger(); break;
500 case EXC_ID3_NUMBER
: ReadNumber(); break;
502 case EXC_ID3_LABEL
: ReadLabel(); break;
503 case EXC_ID2_BOOLERR
:
504 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
505 case EXC_ID_RK
: ReadRk(); break;
507 case 0x0A: // EOF [ 2345]
508 rNameMgr
.ConvertAllTokens();
512 case 0x12: SheetProtect(); break; // SHEET PROTECTION
514 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
516 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
517 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
518 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
519 case 0x2F: // FILEPASS [ 2345]
520 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
521 if( eLastErr
!= ERRCODE_NONE
)
524 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
525 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
526 case 0x55: DefColWidth(); break;
527 case 0x56: break; // BUILTINFMTCNT[ 34 ]
528 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
529 case 0x7D: Colinfo(); break; // COLINFO [ 345]
530 case 0x8C: Country(); break; // COUNTRY [ 345]
531 case 0x8F: break; // BUNDLEHEADER [ 4 ]
532 case 0x92: rPal
.ReadPalette( maStrm
); break;
533 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
534 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
535 case 0x0208: Row34(); break; // ROW [ 34 ]
536 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
537 case 0x0221: Array34(); break;
538 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
539 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
540 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
541 case 0x0406: Formula4(); break;
542 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
543 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
544 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
550 case Z_Biff4E
: // --------------------------------- Z_Biff4E -
554 case 0x0A: // EOF [ 2345]
557 case 0x8F: break; // BUNDLEHEADER [ 4 ]
558 case EXC_ID4_BOF
: // BOF [ 4 ]
561 if( pExcRoot
->eDateiTyp
== Biff4
)
575 case Z_Biff5WPre
: // ------------------------------ Z_Biff5WPre -
579 case 0x0A: // EOF [ 2345]
581 aIn
.SeekGlobalPosition(); // and back to old position
583 case 0x12: DocProtect(); break; // PROTECT [ 5]
584 case 0x2F: // FILEPASS [ 2345]
585 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
586 if( eLastErr
!= ERRCODE_NONE
)
589 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
590 case 0x3D: Window1(); break;
591 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
592 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5]
593 case 0x8C: Country(); break; // COUNTRY [ 345]
594 // PALETTE follows XFs, but already needed while reading the XFs
595 case 0x92: rPal
.ReadPalette( maStrm
); break;
599 case Z_Biff5W
: // --------------------------------- Z_Biff5W -
603 case 0x0A: // EOF [ 2345]
604 rNumFmtBfr
.CreateScFormats();
605 rXFBfr
.CreateUserStyles();
606 rNameMgr
.ConvertAllTokens();
609 case 0x18: rNameMgr
.ReadName( maStrm
); break;
610 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
611 case 0x22: Rec1904(); break; // 1904 [ 2345]
612 case 0x31: rFontBfr
.ReadFont( maStrm
); break;
613 case 0x56: break; // BUILTINFMTCNT[ 34 ]
614 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345]
615 case 0xDE: Olesize(); break;
616 case 0xE0: rXFBfr
.ReadXF( maStrm
); break;
617 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
618 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
624 case Z_Biff5TPre
: // ------------------------------- Z_Biff5Pre -
626 if (nOpcode
== EXC_ID5_BOF
)
628 else if( (nOpcode
== 0x000A) && nBofLevel
)
630 else if( !nBofLevel
) // don't read chart records
634 case EXC_ID2_DIMENSIONS
:
635 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
636 case 0x08: Row25(); break; // ROW [ 2 5]
637 case 0x0A: // EOF [ 2345]
639 aIn
.SeekGlobalPosition(); // and back to old position
641 case 0x12: SheetProtect(); break; // SHEET PROTECTION
643 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
644 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
645 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
646 case 0x21: Array25(); break; // ARRAY [ 2 5]
647 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
648 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
649 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
650 case 0x55: DefColWidth(); break;
651 case 0x7D: Colinfo(); break; // COLINFO [ 345]
652 case 0x81: Wsbool(); break; // WSBOOL [ 2345]
653 case 0x8C: Country(); break; // COUNTRY [ 345]
654 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
655 case 0x0208: Row34(); break; // ROW [ 34 ]
656 case 0x0221: Array34(); break; // ARRAY [ 34 ]
657 case 0x0223: break; // EXTERNNAME [ 34 ]
658 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
659 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
665 case Z_Biff5T
: // --------------------------------- Z_Biff5T -
670 case EXC_ID3_BLANK
: ReadBlank(); break;
671 case EXC_ID2_INTEGER
: ReadInteger(); break;
673 case EXC_ID3_NUMBER
: ReadNumber(); break;
675 case EXC_ID3_LABEL
: ReadLabel(); break;
676 case EXC_ID2_BOOLERR
:
677 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
678 case EXC_ID_RK
: ReadRk(); break;
680 case EXC_ID2_FORMULA
:
681 case EXC_ID3_FORMULA
:
682 case EXC_ID4_FORMULA
: Formula25(); break;
683 case EXC_ID_SHRFMLA
: Shrfmla(); break;
684 case 0x0A: Eof(); eCurrent
= Z_Biff5E
; break;
686 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
687 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
688 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
689 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
690 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
694 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
695 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
696 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
697 case 0x2F: // FILEPASS [ 2345]
698 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
699 if( eLastErr
!= ERRCODE_NONE
)
702 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
704 case 0x84: rPageSett
.ReadCenter( maStrm
); break;
705 case 0xA0: rTabViewSett
.ReadScl( maStrm
); break;
706 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
707 case 0xBD: Mulrk(); break; // MULRK [ 5]
708 case 0xBE: Mulblank(); break; // MULBLANK [ 5]
709 case 0xD6: Rstring(); break; // RSTRING [ 5]
710 case 0x00E5: Cellmerging(); break; // #i62300#
711 case 0x0236: TableOp(); break; // TABLE [ 5]
712 case EXC_ID5_BOF
: // BOF [ 5]
713 XclTools::SkipSubStream( maStrm
);
720 case Z_Biff5E
: // --------------------------------- Z_Biff5E -
724 case EXC_ID5_BOF
: // BOF [ 5]
727 switch( pExcRoot
->eDateiTyp
)
731 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
733 aIn
.StoreGlobalPosition(); // store position
735 case Biff5C
: // chart sheet
736 GetCurrSheetDrawing().ReadTabChart( maStrm
);
738 GetTracer().TraceChartOnlySheet();
742 rD
.SetVisible( GetCurrScTab(), false );
746 OSL_ENSURE( pExcRoot
->eDateiTyp
!= Biff5W
,
747 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
754 case Z_Biffn0
: // --------------------------------- Z_Biffn0 -
758 case 0x0A: // EOF [ 2345]
767 case Z_End
: // ----------------------------------- Z_End -
768 OSL_FAIL( "*ImportExcel::Read(): Not possible state!" );
770 default: OSL_FAIL( "-ImportExcel::Read(): state forgotten!" );
774 if( eLastErr
== ERRCODE_NONE
)
778 GetDocImport().finalize();
779 if (!comphelper::IsFuzzing())
783 rD
.CalcAfterLoad(false);
785 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
786 if( rAddrConv
.IsTabTruncated() )
787 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
788 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
789 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
790 else if( rAddrConv
.IsColTruncated() )
791 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
797 ErrCode
ImportExcel8::Read()
799 #ifdef EXC_INCL_DUMPER
801 Biff8RecDumper
aDumper( GetRoot(), sal_True
);
802 if( aDumper
.Dump( aIn
) )
803 return ERRCODE_ABORT
;
806 // read the entire BIFF8 stream
807 // don't look too close - this stuff seriously needs to be reworked
809 XclImpPageSettings
& rPageSett
= GetPageSettings();
810 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
811 XclImpPalette
& rPal
= GetPalette();
812 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
813 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
814 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
815 XclImpSst
& rSst
= GetSst();
816 XclImpTabInfo
& rTabInfo
= GetTabInfo();
817 XclImpNameManager
& rNameMgr
= GetNameManager();
818 XclImpLinkManager
& rLinkMgr
= GetLinkManager();
819 XclImpObjectManager
& rObjMgr
= GetObjectManager();
820 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
821 XclImpCondFormatManager
& rCondFmtMgr
= GetCondFormatManager();
822 XclImpValidationManager
& rValidMgr
= GetValidationManager();
823 XclImpPivotTableManager
& rPTableMgr
= GetPivotTableManager();
824 XclImpWebQueryBuffer
& rWQBfr
= GetWebQueryBuffer();
826 bool bInUserView
= false; // true = In USERSVIEW(BEGIN|END) record block.
830 EXC_STATE_BEFORE_GLOBALS
, /// Before workbook globals (wait for initial BOF).
831 EXC_STATE_GLOBALS_PRE
, /// Prefetch for workbook globals.
832 EXC_STATE_GLOBALS
, /// Workbook globals.
833 EXC_STATE_BEFORE_SHEET
, /// Before worksheet (wait for new worksheet BOF).
834 EXC_STATE_SHEET_PRE
, /// Prefetch for worksheet.
835 EXC_STATE_SHEET
, /// Worksheet.
836 EXC_STATE_END
/// Stop reading.
839 XclImpReadState eCurrent
= EXC_STATE_BEFORE_GLOBALS
;
841 ErrCode eLastErr
= ERRCODE_NONE
;
843 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
844 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
846 /* #i104057# Need to track a base position for progress bar calculation,
847 because sheet substreams may not be in order of sheets. */
848 std::size_t nProgressBasePos
= 0;
849 std::size_t nProgressBaseSize
= 0;
851 bool bSheetHasCodeName
= false;
853 std::vector
<OUString
> aCodeNames
;
854 std::vector
< SCTAB
> nTabsWithNoCodeName
;
856 sal_uInt16 nRecId
= 0;
858 for (; eCurrent
!= EXC_STATE_END
; mnLastRecId
= nRecId
)
860 if( eCurrent
== EXC_STATE_BEFORE_SHEET
)
862 sal_uInt16 nScTab
= GetCurrScTab();
863 if( nScTab
< maSheetOffsets
.size() )
865 nProgressBaseSize
+= (maStrm
.GetSvStreamPos() - nProgressBasePos
);
866 nProgressBasePos
= maSheetOffsets
[ nScTab
];
868 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
871 // Safeguard ourselves from potential infinite loop.
872 eCurrent
= EXC_STATE_END
;
875 // import only 256 sheets
876 if( nScTab
> GetScMaxPos().Tab() )
878 if( maStrm
.GetRecId() != EXC_ID_EOF
)
879 XclTools::SkipSubStream( maStrm
);
880 // #i29930# show warning box
881 GetAddressConverter().CheckScTab( nScTab
);
882 eCurrent
= EXC_STATE_END
;
886 // #i109800# SHEET record may point to any record inside the
888 bool bIsBof
= maStrm
.GetRecId() == EXC_ID5_BOF
;
890 Bof5(); // read the BOF record
892 pExcRoot
->eDateiTyp
= Biff8
; // on missing BOF, assume a standard worksheet
894 switch( pExcRoot
->eDateiTyp
)
896 case Biff8
: // worksheet
897 case Biff8M4
: // macro sheet
898 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
900 if( bIsBof
) maStrm
.StartNextRecord();
901 maStrm
.StoreGlobalPosition();
903 case Biff8C
: // chart sheet
904 GetCurrSheetDrawing().ReadTabChart( maStrm
);
906 GetTracer().TraceChartOnlySheet();
908 case Biff8W
: // workbook
909 OSL_FAIL( "ImportExcel8::Read - double workbook globals" );
911 case Biff8V
: // VB module
913 // TODO: do not create a sheet in the Calc document
914 rD
.SetVisible( nScTab
, false );
915 XclTools::SkipSubStream( maStrm
);
921 eCurrent
= EXC_STATE_END
;
924 aIn
.StartNextRecord();
928 // #i63591# finalize table if EOF is missing
931 case EXC_STATE_SHEET_PRE
:
932 eCurrent
= EXC_STATE_SHEET
;
933 aIn
.SeekGlobalPosition();
934 continue; // next iteration in while loop
935 case EXC_STATE_SHEET
:
937 eCurrent
= EXC_STATE_END
;
940 eCurrent
= EXC_STATE_END
;
944 if( eCurrent
== EXC_STATE_END
)
947 if( eCurrent
!= EXC_STATE_SHEET_PRE
&& eCurrent
!= EXC_STATE_GLOBALS_PRE
)
948 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
950 nRecId
= aIn
.GetRecId();
952 /* #i39464# Ignore records between USERSVIEWBEGIN and USERSVIEWEND
953 completely (user specific view settings). Otherwise view settings
954 and filters are loaded multiple times, which at least causes
955 problems in auto-filters. */
958 case EXC_ID_USERSVIEWBEGIN
:
959 OSL_ENSURE( !bInUserView
, "ImportExcel8::Read - nested user view settings" );
962 case EXC_ID_USERSVIEWEND
:
963 OSL_ENSURE( bInUserView
, "ImportExcel8::Read - not in user view settings" );
968 if( !bInUserView
) switch( eCurrent
)
971 // before workbook globals: wait for initial workbook globals BOF
972 case EXC_STATE_BEFORE_GLOBALS
:
974 if( nRecId
== EXC_ID5_BOF
)
976 OSL_ENSURE( GetBiff() == EXC_BIFF8
, "ImportExcel8::Read - wrong BIFF version" );
978 if( pExcRoot
->eDateiTyp
== Biff8W
)
980 eCurrent
= EXC_STATE_GLOBALS_PRE
;
981 maStrm
.StoreGlobalPosition();
984 else if( pExcRoot
->eDateiTyp
== Biff8
)
986 // #i62752# possible to have BIFF8 sheet without globals
988 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
989 bSheetHasCodeName
= false; // reset
990 aIn
.StoreGlobalPosition();
996 // prefetch for workbook globals
997 case EXC_STATE_GLOBALS_PRE
:
1003 /* #i56376# evil hack: if EOF for globals is missing,
1004 simulate it. This hack works only for the bugdoc
1005 given in the issue, where the sheet substreams
1006 start directly after the EXTSST record. A future
1007 implementation should be more robust against
1009 if( (nRecId
== EXC_ID_EOF
) ||
1010 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1012 eCurrent
= EXC_STATE_GLOBALS
;
1013 aIn
.SeekGlobalPosition();
1016 case 0x12: DocProtect(); break; // PROTECT [ 5678]
1017 case 0x13: DocPassword(); break;
1018 case 0x19: WinProtection(); break;
1019 case 0x2F: // FILEPASS [ 2345 ]
1020 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
1021 if( eLastErr
!= ERRCODE_NONE
)
1022 eCurrent
= EXC_STATE_END
;
1024 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
1025 case 0x3D: Window1(); break;
1026 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1027 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ]
1028 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1030 // PALETTE follows XFs, but already needed while reading the XFs
1031 case EXC_ID_PALETTE
: rPal
.ReadPalette( maStrm
); break;
1037 case EXC_STATE_GLOBALS
:
1043 /* #i56376# evil hack: if EOF for globals is missing,
1044 simulate it. This hack works only for the bugdoc
1045 given in the issue, where the sheet substreams
1046 start directly after the EXTSST record. A future
1047 implementation should be more robust against
1049 if( (nRecId
== EXC_ID_EOF
) ||
1050 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1052 rNumFmtBfr
.CreateScFormats();
1053 rXFBfr
.CreateUserStyles();
1054 rPTableMgr
.ReadPivotCaches( maStrm
);
1055 rNameMgr
.ConvertAllTokens();
1056 eCurrent
= EXC_STATE_BEFORE_SHEET
;
1059 case 0x0E: Precision(); break; // PRECISION
1060 case 0x22: Rec1904(); break; // 1904 [ 2345 ]
1061 case 0x56: break; // BUILTINFMTCNT[ 34 ]
1062 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
1063 case 0xD3: SetHasBasic(); break;
1064 case 0xDE: Olesize(); break;
1066 case EXC_ID_CODENAME
: ReadCodeName( aIn
, true ); break;
1067 case EXC_ID_USESELFS
: ReadUsesElfs(); break;
1069 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
1070 case EXC_ID4_FORMAT
: rNumFmtBfr
.ReadFormat( maStrm
); break;
1071 case EXC_ID5_XF
: rXFBfr
.ReadXF( maStrm
); break;
1072 case EXC_ID_STYLE
: rXFBfr
.ReadStyle( maStrm
); break;
1074 case EXC_ID_SST
: rSst
.ReadSst( maStrm
); break;
1075 case EXC_ID_TABID
: rTabInfo
.ReadTabid( maStrm
); break;
1076 case EXC_ID_NAME
: rNameMgr
.ReadName( maStrm
); break;
1078 case EXC_ID_EXTERNSHEET
: rLinkMgr
.ReadExternsheet( maStrm
); break;
1079 case EXC_ID_SUPBOOK
: rLinkMgr
.ReadSupbook( maStrm
); break;
1080 case EXC_ID_XCT
: rLinkMgr
.ReadXct( maStrm
); break;
1081 case EXC_ID_CRN
: rLinkMgr
.ReadCrn( maStrm
); break;
1082 case EXC_ID_EXTERNNAME
: rLinkMgr
.ReadExternname( maStrm
, pFormConv
.get() ); break;
1084 case EXC_ID_MSODRAWINGGROUP
:rObjMgr
.ReadMsoDrawingGroup( maStrm
); break;
1086 case EXC_ID_SXIDSTM
: rPTableMgr
.ReadSxidstm( maStrm
); break;
1087 case EXC_ID_SXVS
: rPTableMgr
.ReadSxvs( maStrm
); break;
1088 case EXC_ID_DCONREF
: rPTableMgr
.ReadDconref( maStrm
); break;
1089 case EXC_ID_DCONNAME
: rPTableMgr
.ReadDConName( maStrm
); break;
1095 // prefetch for worksheet
1096 case EXC_STATE_SHEET_PRE
:
1100 // skip chart substream
1104 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1106 case EXC_ID_WINDOW2
: rTabViewSett
.ReadWindow2( maStrm
, false );break;
1107 case EXC_ID_SCL
: rTabViewSett
.ReadScl( maStrm
); break;
1108 case EXC_ID_PANE
: rTabViewSett
.ReadPane( maStrm
); break;
1109 case EXC_ID_SELECTION
: rTabViewSett
.ReadSelection( maStrm
); break;
1111 case EXC_ID2_DIMENSIONS
:
1112 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
1114 case EXC_ID_CODENAME
: ReadCodeName( aIn
, false ); bSheetHasCodeName
= true; break;
1116 case 0x0A: // EOF [ 2345 ]
1118 eCurrent
= EXC_STATE_SHEET
;
1120 GetDoc().GetName( GetCurrScTab(), sName
);
1121 if ( !bSheetHasCodeName
)
1123 nTabsWithNoCodeName
.push_back( GetCurrScTab() );
1128 GetDoc().GetCodeName( GetCurrScTab(), sCodeName
);
1129 aCodeNames
.push_back( sCodeName
);
1132 bSheetHasCodeName
= false; // reset
1134 aIn
.SeekGlobalPosition(); // and back to old position
1137 case 0x12: SheetProtect(); break;
1138 case 0x13: SheetPassword(); break;
1139 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1140 case 0x55: DefColWidth(); break;
1141 case 0x7D: Colinfo(); break; // COLINFO [ 345 ]
1142 case 0x81: Wsbool(); break; // WSBOOL [ 2345 ]
1143 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1144 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45 ]
1145 case 0x9B: FilterMode(); break; // FILTERMODE
1146 case EXC_ID_AUTOFILTERINFO
: AutoFilterInfo(); break;// AUTOFILTERINFO
1147 case EXC_ID_AUTOFILTER
: AutoFilter(); break; // AUTOFILTER
1148 case 0x0208: Row34(); break; // ROW [ 34 ]
1150 case EXC_ID3_ARRAY
: Array34(); break; // ARRAY [ 34 ]
1151 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
1152 case 0x0867: FeatHdr(); break; // FEATHDR
1153 case 0x0868: Feat(); break; // FEAT
1159 case EXC_STATE_SHEET
:
1163 // skip unknown substreams
1167 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1169 case EXC_ID_EOF
: Eof(); eCurrent
= EXC_STATE_BEFORE_SHEET
; break;
1172 case EXC_ID3_BLANK
: ReadBlank(); break;
1173 case EXC_ID2_INTEGER
: ReadInteger(); break;
1174 case EXC_ID2_NUMBER
:
1175 case EXC_ID3_NUMBER
: ReadNumber(); break;
1177 case EXC_ID3_LABEL
: ReadLabel(); break;
1178 case EXC_ID2_BOOLERR
:
1179 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
1180 case EXC_ID_RK
: ReadRk(); break;
1182 case EXC_ID2_FORMULA
:
1183 case EXC_ID3_FORMULA
:
1184 case EXC_ID4_FORMULA
: Formula25(); break;
1185 case EXC_ID_SHRFMLA
: Shrfmla(); break;
1186 case 0x000C: Calccount(); break; // CALCCOUNT
1187 case 0x0010: Delta(); break; // DELTA
1188 case 0x0011: Iteration(); break; // ITERATION
1190 case 0x00AE: Scenman(); break; // SCENMAN
1191 case 0x00AF: Scenario(); break; // SCENARIO
1192 case 0x00BD: Mulrk(); break; // MULRK [ 5 ]
1193 case 0x00BE: Mulblank(); break; // MULBLANK [ 5 ]
1194 case 0x00D6: Rstring(); break; // RSTRING [ 5 ]
1195 case 0x00E5: Cellmerging(); break; // CELLMERGING
1196 case 0x00FD: Labelsst(); break; // LABELSST [ 8 ]
1197 case 0x0236: TableOp(); break; // TABLE
1199 case EXC_ID_HORPAGEBREAKS
:
1200 case EXC_ID_VERPAGEBREAKS
: rPageSett
.ReadPageBreaks( maStrm
); break;
1202 case EXC_ID_FOOTER
: rPageSett
.ReadHeaderFooter( maStrm
); break;
1203 case EXC_ID_LEFTMARGIN
:
1204 case EXC_ID_RIGHTMARGIN
:
1205 case EXC_ID_TOPMARGIN
:
1206 case EXC_ID_BOTTOMMARGIN
: rPageSett
.ReadMargin( maStrm
); break;
1207 case EXC_ID_PRINTHEADERS
: rPageSett
.ReadPrintHeaders( maStrm
); break;
1208 case EXC_ID_PRINTGRIDLINES
: rPageSett
.ReadPrintGridLines( maStrm
); break;
1209 case EXC_ID_HCENTER
:
1210 case EXC_ID_VCENTER
: rPageSett
.ReadCenter( maStrm
); break;
1211 case EXC_ID_SETUP
: rPageSett
.ReadSetup( maStrm
); break;
1212 case EXC_ID8_IMGDATA
: rPageSett
.ReadImgData( maStrm
); break;
1214 case EXC_ID_MSODRAWING
: GetCurrSheetDrawing().ReadMsoDrawing( maStrm
); break;
1215 // #i61786# weird documents: OBJ without MSODRAWING -> read in BIFF5 format
1216 case EXC_ID_OBJ
: GetCurrSheetDrawing().ReadObj( maStrm
); break;
1217 case EXC_ID_NOTE
: GetCurrSheetDrawing().ReadNote( maStrm
); break;
1219 case EXC_ID_HLINK
: XclImpHyperlink::ReadHlink( maStrm
); break;
1220 case EXC_ID_LABELRANGES
: XclImpLabelranges::ReadLabelranges( maStrm
); break;
1222 case EXC_ID_CONDFMT
: rCondFmtMgr
.ReadCondfmt( maStrm
); break;
1223 case EXC_ID_CF
: rCondFmtMgr
.ReadCF( maStrm
); break;
1225 case EXC_ID_DVAL
: XclImpValidationManager::ReadDval( maStrm
); break;
1226 case EXC_ID_DV
: rValidMgr
.ReadDV( maStrm
); break;
1228 case EXC_ID_QSI
: rWQBfr
.ReadQsi( maStrm
); break;
1229 case EXC_ID_WQSTRING
: rWQBfr
.ReadWqstring( maStrm
); break;
1230 case EXC_ID_PQRY
: rWQBfr
.ReadParamqry( maStrm
); break;
1231 case EXC_ID_WQSETT
: rWQBfr
.ReadWqsettings( maStrm
); break;
1232 case EXC_ID_WQTABLES
: rWQBfr
.ReadWqtables( maStrm
); break;
1234 case EXC_ID_SXVIEW
: rPTableMgr
.ReadSxview( maStrm
); break;
1235 case EXC_ID_SXVD
: rPTableMgr
.ReadSxvd( maStrm
); break;
1236 case EXC_ID_SXVI
: rPTableMgr
.ReadSxvi( maStrm
); break;
1237 case EXC_ID_SXIVD
: rPTableMgr
.ReadSxivd( maStrm
); break;
1238 case EXC_ID_SXPI
: rPTableMgr
.ReadSxpi( maStrm
); break;
1239 case EXC_ID_SXDI
: rPTableMgr
.ReadSxdi( maStrm
); break;
1240 case EXC_ID_SXVDEX
: rPTableMgr
.ReadSxvdex( maStrm
); break;
1241 case EXC_ID_SXEX
: rPTableMgr
.ReadSxex( maStrm
); break;
1242 case EXC_ID_SHEETEXT
: rTabViewSett
.ReadTabBgColor( maStrm
, rPal
); break;
1243 case EXC_ID_SXVIEWEX9
: rPTableMgr
.ReadSxViewEx9( maStrm
); break;
1244 case EXC_ID_SXADDL
: rPTableMgr
.ReadSxAddl( maStrm
); break;
1253 if( eLastErr
== ERRCODE_NONE
)
1255 // In some strange circumstances the codename might be missing
1256 // # Create any missing Sheet CodeNames
1257 for ( const auto& rTab
: nTabsWithNoCodeName
)
1262 OUString sTmpName
= "Sheet" + OUString::number(static_cast<sal_Int32
>(nTab
++));
1264 if ( std::find(aCodeNames
.begin(), aCodeNames
.end(), sTmpName
) == aCodeNames
.end() ) // generated codename not found
1267 GetDoc().SetCodeName( rTab
, sTmpName
);
1268 // Record newly used codename
1269 aCodeNames
.push_back(sTmpName
);
1274 // #i45843# Convert pivot tables before calculation, so they are available
1275 // for the GETPIVOTDATA function.
1276 if( GetBiff() == EXC_BIFF8
)
1277 GetPivotTableManager().ConvertPivotTables();
1279 ScDocumentImport
& rDoc
= GetDocImport();
1283 // Excel documents look much better without this call; better in the
1284 // sense that the row heights are identical to the original heights in
1286 if ( !rD
.IsAdjustHeightLocked())
1291 rD
.CalcAfterLoad(false);
1293 // import change tracking data
1294 XclImpChangeTrack
aImpChTr( GetRoot(), maStrm
);
1297 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
1298 if( rAddrConv
.IsTabTruncated() )
1299 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
1300 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
1301 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
1302 else if( rAddrConv
.IsColTruncated() )
1303 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
1305 if( GetBiff() == EXC_BIFF8
)
1306 GetPivotTableManager().MaybeRefreshPivotTables();
1312 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */