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>
48 bool TryStartNextRecord(XclImpStream
& rIn
, std::size_t nProgressBasePos
)
51 // i#115255 fdo#40304 BOUNDSHEET doesn't point to a valid
52 // BOF record position. Scan the records manually (from
53 // the BOUNDSHEET position) until we find a BOF. Some 3rd
54 // party Russian programs generate invalid xls docs with
55 // this kind of silliness.
56 if (rIn
.PeekRecId(nProgressBasePos
) == EXC_ID5_BOF
)
57 // BOUNDSHEET points to a valid BOF record. Good.
58 rIn
.StartNextRecord(nProgressBasePos
);
61 while (bValid
&& rIn
.GetRecId() != EXC_ID5_BOF
)
62 bValid
= rIn
.StartNextRecord();
68 ErrCode
ImportExcel::Read()
70 XclImpPageSettings
& rPageSett
= GetPageSettings();
71 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
72 XclImpPalette
& rPal
= GetPalette();
73 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
74 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
75 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
76 XclImpNameManager
& rNameMgr
= GetNameManager();
77 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
80 Z_BiffNull
, // not a valid Biff-Format
81 Z_Biff2
, // Biff2: only one table
83 Z_Biff3
, // Biff3: only one table
85 Z_Biff4
, // Biff4: only one table
86 Z_Biff4W
, // Biff4 Workbook: Globals
87 Z_Biff4T
, // Biff4 Workbook: a table itself
88 Z_Biff4E
, // Biff4 Workbook: between tables
90 Z_Biff5WPre
,// Biff5: Prefetch Workbook
91 Z_Biff5W
, // Biff5: Globals
92 Z_Biff5TPre
,// Biff5: Prefetch for Shrfmla/Array Formula
93 Z_Biff5T
, // Biff5: a table itself
94 Z_Biff5E
, // Biff5: between tables
95 Z_Biffn0
, // all Biffs: skip table till next EOF
98 STATE eCurrent
= Z_BiffNull
, ePrev
= Z_BiffNull
;
100 ErrCode eLastErr
= ERRCODE_NONE
;
102 sal_uInt16 nBofLevel
= 0;
104 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
105 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
107 /* #i104057# Need to track a base position for progress bar calculation,
108 because sheet substreams may not be in order of sheets. */
109 std::size_t nProgressBasePos
= 0;
110 std::size_t nProgressBaseSize
= 0;
112 for (; eCurrent
!= Z_End
; mnLastRecId
= nOpcode
)
114 if( eCurrent
== Z_Biff5E
)
116 sal_uInt16 nScTab
= GetCurrScTab();
117 if( nScTab
< maSheetOffsets
.size() )
119 nProgressBaseSize
+= (aIn
.GetSvStreamPos() - nProgressBasePos
);
120 nProgressBasePos
= maSheetOffsets
[ nScTab
];
122 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
125 // Safeguard ourselves from potential infinite loop.
133 aIn
.StartNextRecord();
135 nOpcode
= aIn
.GetRecId();
139 // finalize table if EOF is missing
148 rNumFmtBfr
.CreateScFormats();
156 if( eCurrent
== Z_End
)
159 if( eCurrent
!= Z_Biff5TPre
&& eCurrent
!= Z_Biff5WPre
)
160 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
165 case Z_BiffNull
: // ------------------------------- Z_BiffNull -
174 // #i23425# don't rely on the record ID, but on the detected BIFF version
179 if( pExcRoot
->eDateiTyp
== Biff2
)
187 if( pExcRoot
->eDateiTyp
== Biff3
)
195 if( pExcRoot
->eDateiTyp
== Biff4
)
200 else if( pExcRoot
->eDateiTyp
== Biff4W
)
205 if( pExcRoot
->eDateiTyp
== Biff5W
)
207 eCurrent
= Z_Biff5WPre
;
211 aIn
.StoreGlobalPosition(); // store position
213 else if( pExcRoot
->eDateiTyp
== Biff5
)
215 // #i62752# possible to have BIFF5 sheet without globals
217 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
219 aIn
.StoreGlobalPosition(); // store position
231 case Z_Biff2
: // ---------------------------------- Z_Biff2 -
235 case EXC_ID2_DIMENSIONS
:
236 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
238 case EXC_ID3_BLANK
: ReadBlank(); break;
239 case EXC_ID2_INTEGER
: ReadInteger(); break;
241 case EXC_ID3_NUMBER
: ReadNumber(); break;
243 case EXC_ID3_LABEL
: ReadLabel(); break;
244 case EXC_ID2_BOOLERR
:
245 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
246 case EXC_ID_RK
: ReadRk(); break;
248 case 0x06: Formula25(); break; // FORMULA [ 2 5]
249 case 0x08: Row25(); break; // ROW [ 2 5]
250 case 0x0A: // EOF [ 2345]
251 rNumFmtBfr
.CreateScFormats();
252 rNameMgr
.ConvertAllTokens();
257 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
258 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
259 case 0x18: rNameMgr
.ReadName( maStrm
); break;
260 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
261 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
262 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
263 case 0x20: Columndefault(); break; // COLUMNDEFAULT[ 2 ]
264 case 0x21: Array25(); break; // ARRAY [ 2 5]
265 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
266 case 0x24: Colwidth(); break; // COLWIDTH [ 2 ]
267 case 0x25: Defrowheight2(); break; // DEFAULTROWHEI[ 2 ]
271 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
272 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
273 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
274 case 0x2F: // FILEPASS [ 2345]
275 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
276 if( eLastErr
!= ERRCODE_NONE
)
279 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
280 case EXC_ID_EFONT
: rFontBfr
.ReadEfont( maStrm
); break;
281 case 0x3E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
282 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
283 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
284 case 0x43: rXFBfr
.ReadXF( maStrm
); break;
285 case 0x44: Ixfe(); break; // IXFE [ 2 ]
290 case Z_Biff3
: // ---------------------------------- Z_Biff3 -
294 // skip chart substream
298 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
300 case EXC_ID2_DIMENSIONS
:
301 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
303 case EXC_ID3_BLANK
: ReadBlank(); break;
304 case EXC_ID2_INTEGER
: ReadInteger(); break;
306 case EXC_ID3_NUMBER
: ReadNumber(); break;
308 case EXC_ID3_LABEL
: ReadLabel(); break;
309 case EXC_ID2_BOOLERR
:
310 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
311 case EXC_ID_RK
: ReadRk(); break;
313 case 0x0A: // EOF [ 2345]
314 rNumFmtBfr
.CreateScFormats();
315 rNameMgr
.ConvertAllTokens();
320 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
321 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
323 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
324 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
325 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
326 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
327 case 0x22: Rec1904(); break; // 1904 [ 2345]
331 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
332 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
333 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
334 case 0x2F: // FILEPASS [ 2345]
335 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
336 if( eLastErr
!= ERRCODE_NONE
)
339 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
340 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
341 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
342 case 0x56: break; // BUILTINFMTCNT[ 34 ]
343 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
344 case 0x7D: Colinfo(); break; // COLINFO [ 345]
345 case 0x8C: Country(); break; // COUNTRY [ 345]
346 case 0x92: rPal
.ReadPalette( maStrm
); break;
347 case 0x0206: Formula3(); break; // FORMULA [ 3 ]
348 case 0x0208: Row34(); break; // ROW [ 34 ]
349 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
350 case 0x0221: Array34(); break; // ARRAY [ 34 ]
351 case 0x0223: break; // EXTERNNAME [ 34 ]
352 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
353 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
354 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
355 case 0x0243: rXFBfr
.ReadXF( maStrm
); break;
356 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
361 case Z_Biff4
: // ---------------------------------- Z_Biff4 -
365 // skip chart substream
369 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
371 case EXC_ID2_DIMENSIONS
:
372 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
374 case EXC_ID3_BLANK
: ReadBlank(); break;
375 case EXC_ID2_INTEGER
: ReadInteger(); break;
377 case EXC_ID3_NUMBER
: ReadNumber(); break;
379 case EXC_ID3_LABEL
: ReadLabel(); break;
380 case EXC_ID2_BOOLERR
:
381 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
382 case EXC_ID_RK
: ReadRk(); break;
384 case 0x0A: // EOF [ 2345]
385 rNumFmtBfr
.CreateScFormats();
386 rNameMgr
.ConvertAllTokens();
390 case 0x12: SheetProtect(); break; // SHEET PROTECTION
392 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
393 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
395 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
396 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
397 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
398 case 0x22: Rec1904(); break; // 1904 [ 2345]
402 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
403 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
404 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
405 case 0x2F: // FILEPASS [ 2345]
406 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
407 if( eLastErr
!= ERRCODE_NONE
)
410 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
411 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
412 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
413 case 0x55: DefColWidth(); break;
414 case 0x56: break; // BUILTINFMTCNT[ 34 ]
415 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
416 case 0x7D: Colinfo(); break; // COLINFO [ 345]
417 case 0x8C: Country(); break; // COUNTRY [ 345]
418 case 0x92: rPal
.ReadPalette( maStrm
); break;
419 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
420 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
421 case 0x0208: Row34(); break; // ROW [ 34 ]
422 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
423 case 0x0221: Array34(); break; // ARRAY [ 34 ]
424 case 0x0223: break; // EXTERNNAME [ 34 ]
425 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
426 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
427 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
428 case 0x0406: Formula4(); break; // FORMULA [ 4 ]
429 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
430 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
431 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
436 case Z_Biff4W
: // --------------------------------- Z_Biff4W -
440 case 0x0A: // EOF [ 2345]
441 rNameMgr
.ConvertAllTokens();
444 case 0x12: DocProtect(); break; // PROTECT [ 5]
445 case 0x2F: // FILEPASS [ 2345]
446 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
447 if( eLastErr
!= ERRCODE_NONE
)
450 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
451 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
452 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
453 case 0x55: DefColWidth(); break;
454 case 0x56: break; // BUILTINFMTCNT[ 34 ]
455 case 0x8C: Country(); break; // COUNTRY [ 345]
456 case 0x8F: break; // BUNDLEHEADER [ 4 ]
457 case 0x92: rPal
.ReadPalette( maStrm
); break;
458 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
459 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
460 case 0x0223: break; // EXTERNNAME [ 34 ]
461 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
462 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
463 case EXC_ID4_BOF
: // BOF [ 4 ]
465 if( pExcRoot
->eDateiTyp
== Biff4
)
473 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
474 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
475 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
481 case Z_Biff4T
: // --------------------------------- Z_Biff4T -
485 // skip chart substream
489 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
491 case EXC_ID2_DIMENSIONS
:
492 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
494 case EXC_ID3_BLANK
: ReadBlank(); break;
495 case EXC_ID2_INTEGER
: ReadInteger(); break;
497 case EXC_ID3_NUMBER
: ReadNumber(); break;
499 case EXC_ID3_LABEL
: ReadLabel(); break;
500 case EXC_ID2_BOOLERR
:
501 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
502 case EXC_ID_RK
: ReadRk(); break;
504 case 0x0A: // EOF [ 2345]
505 rNameMgr
.ConvertAllTokens();
509 case 0x12: SheetProtect(); break; // SHEET PROTECTION
511 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
513 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
514 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
515 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
516 case 0x2F: // FILEPASS [ 2345]
517 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
518 if( eLastErr
!= ERRCODE_NONE
)
521 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
522 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
523 case 0x55: DefColWidth(); break;
524 case 0x56: break; // BUILTINFMTCNT[ 34 ]
525 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
526 case 0x7D: Colinfo(); break; // COLINFO [ 345]
527 case 0x8C: Country(); break; // COUNTRY [ 345]
528 case 0x8F: break; // BUNDLEHEADER [ 4 ]
529 case 0x92: rPal
.ReadPalette( maStrm
); break;
530 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
531 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
532 case 0x0208: Row34(); break; // ROW [ 34 ]
533 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
534 case 0x0221: Array34(); break;
535 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
536 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
537 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
538 case 0x0406: Formula4(); break;
539 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
540 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
541 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
547 case Z_Biff4E
: // --------------------------------- Z_Biff4E -
551 case 0x0A: // EOF [ 2345]
554 case 0x8F: break; // BUNDLEHEADER [ 4 ]
555 case EXC_ID4_BOF
: // BOF [ 4 ]
558 if( pExcRoot
->eDateiTyp
== Biff4
)
572 case Z_Biff5WPre
: // ------------------------------ Z_Biff5WPre -
576 case 0x0A: // EOF [ 2345]
578 aIn
.SeekGlobalPosition(); // and back to old position
580 case 0x12: DocProtect(); break; // PROTECT [ 5]
581 case 0x2F: // FILEPASS [ 2345]
582 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
583 if( eLastErr
!= ERRCODE_NONE
)
586 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
587 case 0x3D: Window1(); break;
588 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
589 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5]
590 case 0x8C: Country(); break; // COUNTRY [ 345]
591 // PALETTE follows XFs, but already needed while reading the XFs
592 case 0x92: rPal
.ReadPalette( maStrm
); break;
596 case Z_Biff5W
: // --------------------------------- Z_Biff5W -
600 case 0x0A: // EOF [ 2345]
601 rNumFmtBfr
.CreateScFormats();
602 rXFBfr
.CreateUserStyles();
603 rNameMgr
.ConvertAllTokens();
606 case 0x18: rNameMgr
.ReadName( maStrm
); break;
607 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
608 case 0x22: Rec1904(); break; // 1904 [ 2345]
609 case 0x31: rFontBfr
.ReadFont( maStrm
); break;
610 case 0x56: break; // BUILTINFMTCNT[ 34 ]
611 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345]
612 case 0xDE: Olesize(); break;
613 case 0xE0: rXFBfr
.ReadXF( maStrm
); break;
614 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
615 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
621 case Z_Biff5TPre
: // ------------------------------- Z_Biff5Pre -
623 if (nOpcode
== EXC_ID5_BOF
)
625 else if( (nOpcode
== 0x000A) && nBofLevel
)
627 else if( !nBofLevel
) // don't read chart records
631 case EXC_ID2_DIMENSIONS
:
632 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
633 case 0x08: Row25(); break; // ROW [ 2 5]
634 case 0x0A: // EOF [ 2345]
636 aIn
.SeekGlobalPosition(); // and back to old position
638 case 0x12: SheetProtect(); break; // SHEET PROTECTION
640 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
641 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
642 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
643 case 0x21: Array25(); break; // ARRAY [ 2 5]
644 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
645 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
646 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
647 case 0x55: DefColWidth(); break;
648 case 0x7D: Colinfo(); break; // COLINFO [ 345]
649 case 0x81: Wsbool(); break; // WSBOOL [ 2345]
650 case 0x8C: Country(); break; // COUNTRY [ 345]
651 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
652 case 0x0208: Row34(); break; // ROW [ 34 ]
653 case 0x0221: Array34(); break; // ARRAY [ 34 ]
654 case 0x0223: break; // EXTERNNAME [ 34 ]
655 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
656 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
662 case Z_Biff5T
: // --------------------------------- Z_Biff5T -
667 case EXC_ID3_BLANK
: ReadBlank(); break;
668 case EXC_ID2_INTEGER
: ReadInteger(); break;
670 case EXC_ID3_NUMBER
: ReadNumber(); break;
672 case EXC_ID3_LABEL
: ReadLabel(); break;
673 case EXC_ID2_BOOLERR
:
674 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
675 case EXC_ID_RK
: ReadRk(); break;
677 case EXC_ID2_FORMULA
:
678 case EXC_ID3_FORMULA
:
679 case EXC_ID4_FORMULA
: Formula25(); break;
680 case EXC_ID_SHRFMLA
: Shrfmla(); break;
681 case 0x0A: Eof(); eCurrent
= Z_Biff5E
; break;
683 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
684 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
685 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
686 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
687 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
691 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
692 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
693 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
694 case 0x2F: // FILEPASS [ 2345]
695 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
696 if( eLastErr
!= ERRCODE_NONE
)
699 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
701 case 0x84: rPageSett
.ReadCenter( maStrm
); break;
702 case 0xA0: rTabViewSett
.ReadScl( maStrm
); break;
703 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
704 case 0xBD: Mulrk(); break; // MULRK [ 5]
705 case 0xBE: Mulblank(); break; // MULBLANK [ 5]
706 case 0xD6: Rstring(); break; // RSTRING [ 5]
707 case 0x00E5: Cellmerging(); break; // #i62300#
708 case 0x0236: TableOp(); break; // TABLE [ 5]
709 case EXC_ID5_BOF
: // BOF [ 5]
710 XclTools::SkipSubStream( maStrm
);
717 case Z_Biff5E
: // --------------------------------- Z_Biff5E -
721 case EXC_ID5_BOF
: // BOF [ 5]
724 switch( pExcRoot
->eDateiTyp
)
728 eCurrent
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
730 aIn
.StoreGlobalPosition(); // store position
732 case Biff5C
: // chart sheet
733 GetCurrSheetDrawing().ReadTabChart( maStrm
);
735 GetTracer().TraceChartOnlySheet();
739 pD
->SetVisible( GetCurrScTab(), false );
743 OSL_ENSURE( pExcRoot
->eDateiTyp
!= Biff5W
,
744 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
751 case Z_Biffn0
: // --------------------------------- Z_Biffn0 -
755 case 0x0A: // EOF [ 2345]
764 case Z_End
: // ----------------------------------- Z_End -
765 OSL_FAIL( "*ImportExcel::Read(): Not possible state!" );
767 default: OSL_FAIL( "-ImportExcel::Read(): state forgotten!" );
771 if( eLastErr
== ERRCODE_NONE
)
775 GetDocImport().finalize();
779 pD
->CalcAfterLoad(false);
781 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
782 if( rAddrConv
.IsTabTruncated() )
783 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
784 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
785 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
786 else if( rAddrConv
.IsColTruncated() )
787 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
793 ErrCode
ImportExcel8::Read()
795 #ifdef EXC_INCL_DUMPER
797 Biff8RecDumper
aDumper( GetRoot(), sal_True
);
798 if( aDumper
.Dump( aIn
) )
799 return ERRCODE_ABORT
;
802 // read the entire BIFF8 stream
803 // don't look too close - this stuff seriously needs to be reworked
805 XclImpPageSettings
& rPageSett
= GetPageSettings();
806 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
807 XclImpPalette
& rPal
= GetPalette();
808 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
809 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
810 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
811 XclImpSst
& rSst
= GetSst();
812 XclImpTabInfo
& rTabInfo
= GetTabInfo();
813 XclImpNameManager
& rNameMgr
= GetNameManager();
814 XclImpLinkManager
& rLinkMgr
= GetLinkManager();
815 XclImpObjectManager
& rObjMgr
= GetObjectManager();
816 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
817 XclImpCondFormatManager
& rCondFmtMgr
= GetCondFormatManager();
818 XclImpValidationManager
& rValidMgr
= GetValidationManager();
819 XclImpPivotTableManager
& rPTableMgr
= GetPivotTableManager();
820 XclImpWebQueryBuffer
& rWQBfr
= GetWebQueryBuffer();
822 bool bInUserView
= false; // true = In USERSVIEW(BEGIN|END) record block.
826 EXC_STATE_BEFORE_GLOBALS
, /// Before workbook globals (wait for initial BOF).
827 EXC_STATE_GLOBALS_PRE
, /// Prefetch for workbook globals.
828 EXC_STATE_GLOBALS
, /// Workbook globals.
829 EXC_STATE_BEFORE_SHEET
, /// Before worksheet (wait for new worksheet BOF).
830 EXC_STATE_SHEET_PRE
, /// Prefetch for worksheet.
831 EXC_STATE_SHEET
, /// Worksheet.
832 EXC_STATE_END
/// Stop reading.
835 XclImpReadState eCurrent
= EXC_STATE_BEFORE_GLOBALS
;
837 ErrCode eLastErr
= ERRCODE_NONE
;
839 std::unique_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
840 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
842 /* #i104057# Need to track a base position for progress bar calculation,
843 because sheet substreams may not be in order of sheets. */
844 std::size_t nProgressBasePos
= 0;
845 std::size_t nProgressBaseSize
= 0;
847 bool bSheetHasCodeName
= false;
849 std::vector
<OUString
> aCodeNames
;
850 std::vector
< SCTAB
> nTabsWithNoCodeName
;
852 sal_uInt16 nRecId
= 0;
854 for (; eCurrent
!= EXC_STATE_END
; mnLastRecId
= nRecId
)
856 if( eCurrent
== EXC_STATE_BEFORE_SHEET
)
858 sal_uInt16 nScTab
= GetCurrScTab();
859 if( nScTab
< maSheetOffsets
.size() )
861 nProgressBaseSize
+= (maStrm
.GetSvStreamPos() - nProgressBasePos
);
862 nProgressBasePos
= maSheetOffsets
[ nScTab
];
864 bool bValid
= TryStartNextRecord(aIn
, nProgressBasePos
);
867 // Safeguard ourselves from potential infinite loop.
868 eCurrent
= EXC_STATE_END
;
871 // import only 256 sheets
872 if( nScTab
> GetScMaxPos().Tab() )
874 if( maStrm
.GetRecId() != EXC_ID_EOF
)
875 XclTools::SkipSubStream( maStrm
);
876 // #i29930# show warning box
877 GetAddressConverter().CheckScTab( nScTab
);
878 eCurrent
= EXC_STATE_END
;
882 // #i109800# SHEET record may point to any record inside the
884 bool bIsBof
= maStrm
.GetRecId() == EXC_ID5_BOF
;
886 Bof5(); // read the BOF record
888 pExcRoot
->eDateiTyp
= Biff8
; // on missing BOF, assume a standard worksheet
890 switch( pExcRoot
->eDateiTyp
)
892 case Biff8
: // worksheet
893 case Biff8M4
: // macro sheet
894 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
896 if( bIsBof
) maStrm
.StartNextRecord();
897 maStrm
.StoreGlobalPosition();
899 case Biff8C
: // chart sheet
900 GetCurrSheetDrawing().ReadTabChart( maStrm
);
902 GetTracer().TraceChartOnlySheet();
904 case Biff8W
: // workbook
905 OSL_FAIL( "ImportExcel8::Read - double workbook globals" );
907 case Biff8V
: // VB module
909 // TODO: do not create a sheet in the Calc document
910 pD
->SetVisible( nScTab
, false );
911 XclTools::SkipSubStream( maStrm
);
917 eCurrent
= EXC_STATE_END
;
920 aIn
.StartNextRecord();
924 // #i63591# finalize table if EOF is missing
927 case EXC_STATE_SHEET_PRE
:
928 eCurrent
= EXC_STATE_SHEET
;
929 aIn
.SeekGlobalPosition();
930 continue; // next iteration in while loop
931 case EXC_STATE_SHEET
:
933 eCurrent
= EXC_STATE_END
;
936 eCurrent
= EXC_STATE_END
;
940 if( eCurrent
== EXC_STATE_END
)
943 if( eCurrent
!= EXC_STATE_SHEET_PRE
&& eCurrent
!= EXC_STATE_GLOBALS_PRE
)
944 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
946 nRecId
= aIn
.GetRecId();
948 /* #i39464# Ignore records between USERSVIEWBEGIN and USERSVIEWEND
949 completely (user specific view settings). Otherwise view settings
950 and filters are loaded multiple times, which at least causes
951 problems in auto-filters. */
954 case EXC_ID_USERSVIEWBEGIN
:
955 OSL_ENSURE( !bInUserView
, "ImportExcel8::Read - nested user view settings" );
958 case EXC_ID_USERSVIEWEND
:
959 OSL_ENSURE( bInUserView
, "ImportExcel8::Read - not in user view settings" );
964 if( !bInUserView
) switch( eCurrent
)
967 // before workbook globals: wait for initial workbook globals BOF
968 case EXC_STATE_BEFORE_GLOBALS
:
970 if( nRecId
== EXC_ID5_BOF
)
972 OSL_ENSURE( GetBiff() == EXC_BIFF8
, "ImportExcel8::Read - wrong BIFF version" );
974 if( pExcRoot
->eDateiTyp
== Biff8W
)
976 eCurrent
= EXC_STATE_GLOBALS_PRE
;
977 maStrm
.StoreGlobalPosition();
980 else if( pExcRoot
->eDateiTyp
== Biff8
)
982 // #i62752# possible to have BIFF8 sheet without globals
984 eCurrent
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
985 bSheetHasCodeName
= false; // reset
986 aIn
.StoreGlobalPosition();
992 // prefetch for workbook globals
993 case EXC_STATE_GLOBALS_PRE
:
999 /* #i56376# evil hack: if EOF for globals is missing,
1000 simulate it. This hack works only for the bugdoc
1001 given in the issue, where the sheet substreams
1002 start directly after the EXTSST record. A future
1003 implementation should be more robust against
1005 if( (nRecId
== EXC_ID_EOF
) ||
1006 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1008 eCurrent
= EXC_STATE_GLOBALS
;
1009 aIn
.SeekGlobalPosition();
1012 case 0x12: DocProtect(); break; // PROTECT [ 5678]
1013 case 0x13: DocPasssword(); break;
1014 case 0x19: WinProtection(); break;
1015 case 0x2F: // FILEPASS [ 2345 ]
1016 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
1017 if( eLastErr
!= ERRCODE_NONE
)
1018 eCurrent
= EXC_STATE_END
;
1020 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
1021 case 0x3D: Window1(); break;
1022 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1023 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ]
1024 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1026 // PALETTE follows XFs, but already needed while reading the XFs
1027 case EXC_ID_PALETTE
: rPal
.ReadPalette( maStrm
); break;
1033 case EXC_STATE_GLOBALS
:
1039 /* #i56376# evil hack: if EOF for globals is missing,
1040 simulate it. This hack works only for the bugdoc
1041 given in the issue, where the sheet substreams
1042 start directly after the EXTSST record. A future
1043 implementation should be more robust against
1045 if( (nRecId
== EXC_ID_EOF
) ||
1046 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1048 rNumFmtBfr
.CreateScFormats();
1049 rXFBfr
.CreateUserStyles();
1050 rPTableMgr
.ReadPivotCaches( maStrm
);
1051 rNameMgr
.ConvertAllTokens();
1052 eCurrent
= EXC_STATE_BEFORE_SHEET
;
1055 case 0x0E: Precision(); break; // PRECISION
1056 case 0x22: Rec1904(); break; // 1904 [ 2345 ]
1057 case 0x56: break; // BUILTINFMTCNT[ 34 ]
1058 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
1059 case 0xD3: SetHasBasic(); break;
1060 case 0xDE: Olesize(); break;
1062 case EXC_ID_CODENAME
: ReadCodeName( aIn
, true ); break;
1063 case EXC_ID_USESELFS
: ReadUsesElfs(); break;
1065 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
1066 case EXC_ID4_FORMAT
: rNumFmtBfr
.ReadFormat( maStrm
); break;
1067 case EXC_ID5_XF
: rXFBfr
.ReadXF( maStrm
); break;
1068 case EXC_ID_STYLE
: rXFBfr
.ReadStyle( maStrm
); break;
1070 case EXC_ID_SST
: rSst
.ReadSst( maStrm
); break;
1071 case EXC_ID_TABID
: rTabInfo
.ReadTabid( maStrm
); break;
1072 case EXC_ID_NAME
: rNameMgr
.ReadName( maStrm
); break;
1074 case EXC_ID_EXTERNSHEET
: rLinkMgr
.ReadExternsheet( maStrm
); break;
1075 case EXC_ID_SUPBOOK
: rLinkMgr
.ReadSupbook( maStrm
); break;
1076 case EXC_ID_XCT
: rLinkMgr
.ReadXct( maStrm
); break;
1077 case EXC_ID_CRN
: rLinkMgr
.ReadCrn( maStrm
); break;
1078 case EXC_ID_EXTERNNAME
: rLinkMgr
.ReadExternname( maStrm
, pFormConv
.get() ); break;
1080 case EXC_ID_MSODRAWINGGROUP
:rObjMgr
.ReadMsoDrawingGroup( maStrm
); break;
1082 case EXC_ID_SXIDSTM
: rPTableMgr
.ReadSxidstm( maStrm
); break;
1083 case EXC_ID_SXVS
: rPTableMgr
.ReadSxvs( maStrm
); break;
1084 case EXC_ID_DCONREF
: rPTableMgr
.ReadDconref( maStrm
); break;
1085 case EXC_ID_DCONNAME
: rPTableMgr
.ReadDConName( maStrm
); break;
1091 // prefetch for worksheet
1092 case EXC_STATE_SHEET_PRE
:
1096 // skip chart substream
1100 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1102 case EXC_ID_WINDOW2
: rTabViewSett
.ReadWindow2( maStrm
, false );break;
1103 case EXC_ID_SCL
: rTabViewSett
.ReadScl( maStrm
); break;
1104 case EXC_ID_PANE
: rTabViewSett
.ReadPane( maStrm
); break;
1105 case EXC_ID_SELECTION
: rTabViewSett
.ReadSelection( maStrm
); break;
1107 case EXC_ID2_DIMENSIONS
:
1108 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
1110 case EXC_ID_CODENAME
: ReadCodeName( aIn
, false ); bSheetHasCodeName
= true; break;
1112 case 0x0A: // EOF [ 2345 ]
1114 eCurrent
= EXC_STATE_SHEET
;
1116 GetDoc().GetName( GetCurrScTab(), sName
);
1117 if ( !bSheetHasCodeName
)
1119 nTabsWithNoCodeName
.push_back( GetCurrScTab() );
1124 GetDoc().GetCodeName( GetCurrScTab(), sCodeName
);
1125 aCodeNames
.push_back( sCodeName
);
1128 bSheetHasCodeName
= false; // reset
1130 aIn
.SeekGlobalPosition(); // and back to old position
1133 case 0x12: SheetProtect(); break;
1134 case 0x13: SheetPassword(); break;
1135 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1136 case 0x55: DefColWidth(); break;
1137 case 0x7D: Colinfo(); break; // COLINFO [ 345 ]
1138 case 0x81: Wsbool(); break; // WSBOOL [ 2345 ]
1139 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1140 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45 ]
1141 case 0x9B: FilterMode(); break; // FILTERMODE
1142 case EXC_ID_AUTOFILTERINFO
: AutoFilterInfo(); break;// AUTOFILTERINFO
1143 case EXC_ID_AUTOFILTER
: AutoFilter(); break; // AUTOFILTER
1144 case 0x0208: Row34(); break; // ROW [ 34 ]
1146 case EXC_ID3_ARRAY
: Array34(); break; // ARRAY [ 34 ]
1147 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
1148 case 0x0867: FeatHdr(); break; // FEATHDR
1149 case 0x0868: Feat(); break; // FEAT
1155 case EXC_STATE_SHEET
:
1159 // skip unknown substreams
1163 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1165 case EXC_ID_EOF
: Eof(); eCurrent
= EXC_STATE_BEFORE_SHEET
; break;
1168 case EXC_ID3_BLANK
: ReadBlank(); break;
1169 case EXC_ID2_INTEGER
: ReadInteger(); break;
1170 case EXC_ID2_NUMBER
:
1171 case EXC_ID3_NUMBER
: ReadNumber(); break;
1173 case EXC_ID3_LABEL
: ReadLabel(); break;
1174 case EXC_ID2_BOOLERR
:
1175 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
1176 case EXC_ID_RK
: ReadRk(); break;
1178 case EXC_ID2_FORMULA
:
1179 case EXC_ID3_FORMULA
:
1180 case EXC_ID4_FORMULA
: Formula25(); break;
1181 case EXC_ID_SHRFMLA
: Shrfmla(); break;
1182 case 0x000C: Calccount(); break; // CALCCOUNT
1183 case 0x0010: Delta(); break; // DELTA
1184 case 0x0011: Iteration(); break; // ITERATION
1186 case 0x00AE: Scenman(); break; // SCENMAN
1187 case 0x00AF: Scenario(); break; // SCENARIO
1188 case 0x00BD: Mulrk(); break; // MULRK [ 5 ]
1189 case 0x00BE: Mulblank(); break; // MULBLANK [ 5 ]
1190 case 0x00D6: Rstring(); break; // RSTRING [ 5 ]
1191 case 0x00E5: Cellmerging(); break; // CELLMERGING
1192 case 0x00FD: Labelsst(); break; // LABELSST [ 8 ]
1193 case 0x0236: TableOp(); break; // TABLE
1195 case EXC_ID_HORPAGEBREAKS
:
1196 case EXC_ID_VERPAGEBREAKS
: rPageSett
.ReadPageBreaks( maStrm
); break;
1198 case EXC_ID_FOOTER
: rPageSett
.ReadHeaderFooter( maStrm
); break;
1199 case EXC_ID_LEFTMARGIN
:
1200 case EXC_ID_RIGHTMARGIN
:
1201 case EXC_ID_TOPMARGIN
:
1202 case EXC_ID_BOTTOMMARGIN
: rPageSett
.ReadMargin( maStrm
); break;
1203 case EXC_ID_PRINTHEADERS
: rPageSett
.ReadPrintHeaders( maStrm
); break;
1204 case EXC_ID_PRINTGRIDLINES
: rPageSett
.ReadPrintGridLines( maStrm
); break;
1205 case EXC_ID_HCENTER
:
1206 case EXC_ID_VCENTER
: rPageSett
.ReadCenter( maStrm
); break;
1207 case EXC_ID_SETUP
: rPageSett
.ReadSetup( maStrm
); break;
1208 case EXC_ID8_IMGDATA
: rPageSett
.ReadImgData( maStrm
); break;
1210 case EXC_ID_MSODRAWING
: GetCurrSheetDrawing().ReadMsoDrawing( maStrm
); break;
1211 // #i61786# weird documents: OBJ without MSODRAWING -> read in BIFF5 format
1212 case EXC_ID_OBJ
: GetCurrSheetDrawing().ReadObj( maStrm
); break;
1213 case EXC_ID_NOTE
: GetCurrSheetDrawing().ReadNote( maStrm
); break;
1215 case EXC_ID_HLINK
: XclImpHyperlink::ReadHlink( maStrm
); break;
1216 case EXC_ID_LABELRANGES
: XclImpLabelranges::ReadLabelranges( maStrm
); break;
1218 case EXC_ID_CONDFMT
: rCondFmtMgr
.ReadCondfmt( maStrm
); break;
1219 case EXC_ID_CF
: rCondFmtMgr
.ReadCF( maStrm
); break;
1221 case EXC_ID_DVAL
: XclImpValidationManager::ReadDval( maStrm
); break;
1222 case EXC_ID_DV
: rValidMgr
.ReadDV( maStrm
); break;
1224 case EXC_ID_QSI
: rWQBfr
.ReadQsi( maStrm
); break;
1225 case EXC_ID_WQSTRING
: rWQBfr
.ReadWqstring( maStrm
); break;
1226 case EXC_ID_PQRY
: rWQBfr
.ReadParamqry( maStrm
); break;
1227 case EXC_ID_WQSETT
: rWQBfr
.ReadWqsettings( maStrm
); break;
1228 case EXC_ID_WQTABLES
: rWQBfr
.ReadWqtables( maStrm
); break;
1230 case EXC_ID_SXVIEW
: rPTableMgr
.ReadSxview( maStrm
); break;
1231 case EXC_ID_SXVD
: rPTableMgr
.ReadSxvd( maStrm
); break;
1232 case EXC_ID_SXVI
: rPTableMgr
.ReadSxvi( maStrm
); break;
1233 case EXC_ID_SXIVD
: rPTableMgr
.ReadSxivd( maStrm
); break;
1234 case EXC_ID_SXPI
: rPTableMgr
.ReadSxpi( maStrm
); break;
1235 case EXC_ID_SXDI
: rPTableMgr
.ReadSxdi( maStrm
); break;
1236 case EXC_ID_SXVDEX
: rPTableMgr
.ReadSxvdex( maStrm
); break;
1237 case EXC_ID_SXEX
: rPTableMgr
.ReadSxex( maStrm
); break;
1238 case EXC_ID_SHEETEXT
: rTabViewSett
.ReadTabBgColor( maStrm
, rPal
); break;
1239 case EXC_ID_SXVIEWEX9
: rPTableMgr
.ReadSxViewEx9( maStrm
); break;
1240 case EXC_ID_SXADDL
: rPTableMgr
.ReadSxAddl( maStrm
); break;
1249 if( eLastErr
== ERRCODE_NONE
)
1251 // In some strange circumstances the codename might be missing
1252 // # Create any missing Sheet CodeNames
1253 for ( const auto& rTab
: nTabsWithNoCodeName
)
1258 OUStringBuffer aBuf
;
1259 aBuf
.append("Sheet");
1260 aBuf
.append(static_cast<sal_Int32
>(nTab
++));
1261 OUString sTmpName
= aBuf
.makeStringAndClear();
1263 if ( std::find(aCodeNames
.begin(), aCodeNames
.end(), sTmpName
) == aCodeNames
.end() ) // generated codename not found
1266 GetDoc().SetCodeName( rTab
, sTmpName
);
1267 // Record newly used codename
1268 aCodeNames
.push_back(sTmpName
);
1273 // #i45843# Convert pivot tables before calculation, so they are available
1274 // for the GETPIVOTDATA function.
1275 if( GetBiff() == EXC_BIFF8
)
1276 GetPivotTableManager().ConvertPivotTables();
1278 ScDocumentImport
& rDoc
= GetDocImport();
1282 // Excel documents look much better without this call; better in the
1283 // sense that the row heights are identical to the original heights in
1285 if ( !pD
->IsAdjustHeightLocked())
1290 pD
->CalcAfterLoad(false);
1292 // import change tracking data
1293 XclImpChangeTrack
aImpChTr( GetRoot(), maStrm
);
1296 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
1297 if( rAddrConv
.IsTabTruncated() )
1298 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
1299 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
1300 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
1301 else if( rAddrConv
.IsColTruncated() )
1302 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
1304 if( GetBiff() == EXC_BIFF8
)
1305 GetPivotTableManager().MaybeRefreshPivotTables();
1311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */