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 .
23 #include "document.hxx"
24 #include "scerrors.hxx"
25 #include "fprogressbar.hxx"
26 #include "xltracer.hxx"
27 #include "xltable.hxx"
28 #include "xihelper.hxx"
33 #include "xicontent.hxx"
34 #include "xiescher.hxx"
35 #include "xipivot.hxx"
36 #include "XclImpChangeTrack.hxx"
37 #include "documentimport.hxx"
41 #include "excimp8.hxx"
43 #include <boost/scoped_ptr.hpp>
45 FltError
ImportExcel::Read()
47 XclImpPageSettings
& rPageSett
= GetPageSettings();
48 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
49 XclImpPalette
& rPal
= GetPalette();
50 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
51 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
52 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
53 XclImpNameManager
& rNameMgr
= GetNameManager();
54 XclImpObjectManager
& rObjMgr
= GetObjectManager();
56 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
59 Z_BiffNull
, // not a valid Biff-Format
60 Z_Biff2
, // Biff2: only one table
62 Z_Biff3
, // Biff3: only one table
64 Z_Biff4
, // Biff4: only one table
65 Z_Biff4W
, // Biff4 Workbook: Globals
66 Z_Biff4T
, // Biff4 Workbook: a table itself
67 Z_Biff4E
, // Biff4 Workbook: between tables
69 Z_Biff5WPre
,// Biff5: Prefetch Workbook
70 Z_Biff5W
, // Biff5: Globals
71 Z_Biff5TPre
,// Biff5: Prefetch for Shrfmla/Array Formula
72 Z_Biff5T
, // Biff5: a table itself
73 Z_Biff5E
, // Biff5: between tables
74 Z_Biffn0
, // all Biffs: skip table till next EOF
77 Zustand eAkt
= Z_BiffNull
, ePrev
= Z_BiffNull
;
79 FltError eLastErr
= eERR_OK
;
81 sal_uInt16 nBofLevel
= 0;
83 OSL_ENSURE( &aIn
!= NULL
, "-ImportExcel::Read(): No Stream - what happened?!" );
85 boost::scoped_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
86 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
88 /* #i104057# Need to track a base position for progress bar calculation,
89 because sheet substreams may not be in order of sheets. */
90 sal_Size nProgressBasePos
= 0;
91 sal_Size nProgressBaseSize
= 0;
93 for (; eAkt
!= Z_Ende
; mnLastRecId
= nOpcode
)
95 if( eAkt
== Z_Biff5E
)
97 sal_uInt16 nScTab
= GetCurrScTab();
98 if( nScTab
< maSheetOffsets
.size() )
100 nProgressBaseSize
+= (aIn
.GetSvStreamPos() - nProgressBasePos
);
101 nProgressBasePos
= maSheetOffsets
[ nScTab
];
102 aIn
.StartNextRecord( nProgressBasePos
);
108 aIn
.StartNextRecord();
110 nOpcode
= aIn
.GetRecId();
114 // finalize table if EOF is missing
123 rNumFmtBfr
.CreateScFormats();
135 if( eAkt
!= Z_Biff5TPre
&& eAkt
!= Z_Biff5WPre
)
136 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
141 case Z_BiffNull
: // ------------------------------- Z_BiffNull -
150 // #i23425# don't rely on the record ID, but on the detected BIFF version
155 if( pExcRoot
->eDateiTyp
== Biff2
)
163 if( pExcRoot
->eDateiTyp
== Biff3
)
171 if( pExcRoot
->eDateiTyp
== Biff4
)
176 else if( pExcRoot
->eDateiTyp
== Biff4W
)
181 if( pExcRoot
->eDateiTyp
== Biff5W
)
187 aIn
.StoreGlobalPosition(); // store position
189 else if( pExcRoot
->eDateiTyp
== Biff5
)
191 // #i62752# possible to have BIFF5 sheet without globals
193 eAkt
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
195 aIn
.StoreGlobalPosition(); // store position
207 case Z_Biff2
: // ---------------------------------- Z_Biff2 -
211 case EXC_ID2_DIMENSIONS
:
212 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
214 case EXC_ID3_BLANK
: ReadBlank(); break;
215 case EXC_ID2_INTEGER
: ReadInteger(); break;
217 case EXC_ID3_NUMBER
: ReadNumber(); break;
219 case EXC_ID3_LABEL
: ReadLabel(); break;
220 case EXC_ID2_BOOLERR
:
221 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
222 case EXC_ID_RK
: ReadRk(); break;
224 case 0x06: Formula25(); break; // FORMULA [ 2 5]
225 case 0x08: Row25(); break; // ROW [ 2 5]
226 case 0x0A: // EOF [ 2345]
227 rNumFmtBfr
.CreateScFormats();
228 rNameMgr
.ConvertAllTokens();
233 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
234 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
235 case 0x18: rNameMgr
.ReadName( maStrm
); break;
236 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
237 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
238 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
239 case 0x20: Columndefault(); break; // COLUMNDEFAULT[ 2 ]
240 case 0x21: Array25(); break; // ARRAY [ 2 5]
241 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
242 case 0x24: Colwidth(); break; // COLWIDTH [ 2 ]
243 case 0x25: Defrowheight2(); break; // DEFAULTROWHEI[ 2 ]
247 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
248 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
249 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
250 case 0x2F: // FILEPASS [ 2345]
251 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
252 if( eLastErr
!= ERRCODE_NONE
)
255 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
256 case EXC_ID_EFONT
: rFontBfr
.ReadEfont( maStrm
); break;
257 case 0x3E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
258 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
259 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
260 case 0x43: rXFBfr
.ReadXF( maStrm
); break;
261 case 0x44: Ixfe(); break; // IXFE [ 2 ]
266 case Z_Biff3
: // ---------------------------------- Z_Biff3 -
270 // skip chart substream
274 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
276 case EXC_ID2_DIMENSIONS
:
277 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
279 case EXC_ID3_BLANK
: ReadBlank(); break;
280 case EXC_ID2_INTEGER
: ReadInteger(); break;
282 case EXC_ID3_NUMBER
: ReadNumber(); break;
284 case EXC_ID3_LABEL
: ReadLabel(); break;
285 case EXC_ID2_BOOLERR
:
286 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
287 case EXC_ID_RK
: ReadRk(); break;
289 case 0x0A: // EOF [ 2345]
290 rNumFmtBfr
.CreateScFormats();
291 rNameMgr
.ConvertAllTokens();
296 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
297 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
299 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
300 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
301 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
302 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
303 case 0x22: Rec1904(); break; // 1904 [ 2345]
307 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
308 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
309 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
310 case 0x2F: // FILEPASS [ 2345]
311 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
312 if( eLastErr
!= ERRCODE_NONE
)
315 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
316 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
317 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
318 case 0x56: break; // BUILTINFMTCNT[ 34 ]
319 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
320 case 0x7D: Colinfo(); break; // COLINFO [ 345]
321 case 0x8C: Country(); break; // COUNTRY [ 345]
322 case 0x92: rPal
.ReadPalette( maStrm
); break;
323 case 0x0206: Formula3(); break; // FORMULA [ 3 ]
324 case 0x0208: Row34(); break; // ROW [ 34 ]
325 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
326 case 0x0221: Array34(); break; // ARRAY [ 34 ]
327 case 0x0223: break; // EXTERNNAME [ 34 ]
328 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
329 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
330 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
331 case 0x0243: rXFBfr
.ReadXF( maStrm
); break;
332 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
337 case Z_Biff4
: // ---------------------------------- Z_Biff4 -
341 // skip chart substream
345 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
347 case EXC_ID2_DIMENSIONS
:
348 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
350 case EXC_ID3_BLANK
: ReadBlank(); break;
351 case EXC_ID2_INTEGER
: ReadInteger(); break;
353 case EXC_ID3_NUMBER
: ReadNumber(); break;
355 case EXC_ID3_LABEL
: ReadLabel(); break;
356 case EXC_ID2_BOOLERR
:
357 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
358 case EXC_ID_RK
: ReadRk(); break;
360 case 0x0A: // EOF [ 2345]
361 rNumFmtBfr
.CreateScFormats();
362 rNameMgr
.ConvertAllTokens();
366 case 0x12: SheetProtect(); break; // SHEET PROTECTION
368 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
369 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
371 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
372 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
373 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
374 case 0x22: Rec1904(); break; // 1904 [ 2345]
378 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
379 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
380 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
381 case 0x2F: // FILEPASS [ 2345]
382 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
383 if( eLastErr
!= ERRCODE_NONE
)
386 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
387 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
388 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
389 case 0x55: DefColWidth(); break;
390 case 0x56: break; // BUILTINFMTCNT[ 34 ]
391 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
392 case 0x7D: Colinfo(); break; // COLINFO [ 345]
393 case 0x8C: Country(); break; // COUNTRY [ 345]
394 case 0x92: rPal
.ReadPalette( maStrm
); break;
395 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
396 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
397 case 0x0208: Row34(); break; // ROW [ 34 ]
398 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
399 case 0x0221: Array34(); break; // ARRAY [ 34 ]
400 case 0x0223: break; // EXTERNNAME [ 34 ]
401 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
402 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
403 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
404 case 0x0406: Formula4(); break; // FORMULA [ 4 ]
405 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
406 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
407 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
412 case Z_Biff4W
: // --------------------------------- Z_Biff4W -
416 case 0x0A: // EOF [ 2345]
417 rNameMgr
.ConvertAllTokens();
420 case 0x12: DocProtect(); break; // PROTECT [ 5]
421 case 0x2F: // FILEPASS [ 2345]
422 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
423 if( eLastErr
!= ERRCODE_NONE
)
426 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
427 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
428 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
429 case 0x55: DefColWidth(); break;
430 case 0x56: break; // BUILTINFMTCNT[ 34 ]
431 case 0x8C: Country(); break; // COUNTRY [ 345]
432 case 0x8F: break; // BUNDLEHEADER [ 4 ]
433 case 0x92: rPal
.ReadPalette( maStrm
); break;
434 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
435 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
436 case 0x0223: break; // EXTERNNAME [ 34 ]
437 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
438 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
439 case 0x0409: // BOF [ 4 ]
441 if( pExcRoot
->eDateiTyp
== Biff4
)
449 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
450 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
451 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
457 case Z_Biff4T
: // --------------------------------- Z_Biff4T -
461 // skip chart substream
465 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
467 case EXC_ID2_DIMENSIONS
:
468 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
470 case EXC_ID3_BLANK
: ReadBlank(); break;
471 case EXC_ID2_INTEGER
: ReadInteger(); break;
473 case EXC_ID3_NUMBER
: ReadNumber(); break;
475 case EXC_ID3_LABEL
: ReadLabel(); break;
476 case EXC_ID2_BOOLERR
:
477 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
478 case EXC_ID_RK
: ReadRk(); break;
480 case 0x0A: // EOF [ 2345]
481 rNameMgr
.ConvertAllTokens();
485 case 0x12: SheetProtect(); break; // SHEET PROTECTION
487 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
489 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
490 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
491 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
492 case 0x2F: // FILEPASS [ 2345]
493 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
494 if( eLastErr
!= ERRCODE_NONE
)
497 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
498 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
499 case 0x55: DefColWidth(); break;
500 case 0x56: break; // BUILTINFMTCNT[ 34 ]
501 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
502 case 0x7D: Colinfo(); break; // COLINFO [ 345]
503 case 0x8C: Country(); break; // COUNTRY [ 345]
504 case 0x8F: break; // BUNDLEHEADER [ 4 ]
505 case 0x92: rPal
.ReadPalette( maStrm
); break;
506 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
507 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
508 case 0x0208: Row34(); break; // ROW [ 34 ]
509 case 0x0218: rNameMgr
.ReadName( maStrm
); break;
510 case 0x0221: Array34(); break;
511 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
512 case 0x0231: rFontBfr
.ReadFont( maStrm
); break;
513 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
514 case 0x0406: Formula4(); break;
515 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
516 case 0x0443: rXFBfr
.ReadXF( maStrm
); break;
517 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
523 case Z_Biff4E
: // --------------------------------- Z_Biff4E -
527 case 0x0A: // EOF [ 2345]
530 case 0x8F: break; // BUNDLEHEADER [ 4 ]
531 case 0x0409: // BOF [ 4 ]
534 if( pExcRoot
->eDateiTyp
== Biff4
)
548 case Z_Biff5WPre
: // ------------------------------ Z_Biff5WPre -
552 case 0x0A: // EOF [ 2345]
554 aIn
.SeekGlobalPosition(); // und zurueck an alte Position
556 case 0x12: DocProtect(); break; // PROTECT [ 5]
557 case 0x2F: // FILEPASS [ 2345]
558 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
559 if( eLastErr
!= ERRCODE_NONE
)
562 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
563 case 0x3D: Window1(); break;
564 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
565 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5]
566 case 0x8C: Country(); break; // COUNTRY [ 345]
567 // PALETTE follows XFs, but already needed while reading the XFs
568 case 0x92: rPal
.ReadPalette( maStrm
); break;
572 case Z_Biff5W
: // --------------------------------- Z_Biff5W -
576 case 0x0A: // EOF [ 2345]
577 rNumFmtBfr
.CreateScFormats();
578 rXFBfr
.CreateUserStyles();
579 rNameMgr
.ConvertAllTokens();
582 case 0x18: rNameMgr
.ReadName( maStrm
); break;
583 case 0x1E: rNumFmtBfr
.ReadFormat( maStrm
); break;
584 case 0x22: Rec1904(); break; // 1904 [ 2345]
585 case 0x31: rFontBfr
.ReadFont( maStrm
); break;
586 case 0x56: break; // BUILTINFMTCNT[ 34 ]
587 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345]
588 case 0xDE: Olesize(); break;
589 case 0xE0: rXFBfr
.ReadXF( maStrm
); break;
590 case 0x0293: rXFBfr
.ReadStyle( maStrm
); break;
591 case 0x041E: rNumFmtBfr
.ReadFormat( maStrm
); break;
597 case Z_Biff5TPre
: // ------------------------------- Z_Biff5Pre -
599 if( nOpcode
== 0x0809 )
601 else if( (nOpcode
== 0x000A) && nBofLevel
)
603 else if( !nBofLevel
) // don't read chart records
607 case EXC_ID2_DIMENSIONS
:
608 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
609 case 0x08: Row25(); break; // ROW [ 2 5]
610 case 0x0A: // EOF [ 2345]
612 aIn
.SeekGlobalPosition(); // und zurueck an alte Position
614 case 0x12: SheetProtect(); break; // SHEET PROTECTION
616 case 0x1B: rPageSett
.ReadPageBreaks( maStrm
); break;
617 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
618 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
619 case 0x21: Array25(); break; // ARRAY [ 2 5]
620 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
621 case 0x41: rTabViewSett
.ReadPane( maStrm
); break;
622 case 0x42: Codepage(); break; // CODEPAGE [ 2345]
623 case 0x55: DefColWidth(); break;
624 case 0x7D: Colinfo(); break; // COLINFO [ 345]
625 case 0x81: Wsbool(); break; // WSBOOL [ 2345]
626 case 0x8C: Country(); break; // COUNTRY [ 345]
627 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
628 case 0x0208: Row34(); break; // ROW [ 34 ]
629 case 0x0221: Array34(); break; // ARRAY [ 34 ]
630 case 0x0223: break; // EXTERNNAME [ 34 ]
631 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
632 case 0x023E: rTabViewSett
.ReadWindow2( maStrm
, false );break;
638 case Z_Biff5T
: // --------------------------------- Z_Biff5T -
643 case EXC_ID3_BLANK
: ReadBlank(); break;
644 case EXC_ID2_INTEGER
: ReadInteger(); break;
646 case EXC_ID3_NUMBER
: ReadNumber(); break;
648 case EXC_ID3_LABEL
: ReadLabel(); break;
649 case EXC_ID2_BOOLERR
:
650 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
651 case EXC_ID_RK
: ReadRk(); break;
653 case EXC_ID2_FORMULA
:
654 case EXC_ID3_FORMULA
:
655 case EXC_ID4_FORMULA
: Formula25(); break;
656 case EXC_ID_SHRFMLA
: Shrfmla(); break;
657 case 0x0A: Eof(); eAkt
= Z_Biff5E
; break;
659 case 0x15: rPageSett
.ReadHeaderFooter( maStrm
); break;
660 case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
661 case 0x1C: GetCurrSheetDrawing().ReadNote( maStrm
);break;
662 case 0x1D: rTabViewSett
.ReadSelection( maStrm
); break;
663 case 0x23: Externname25(); break; // EXTERNNAME [ 2 5]
667 case 0x29: rPageSett
.ReadMargin( maStrm
); break;
668 case 0x2A: rPageSett
.ReadPrintHeaders( maStrm
); break;
669 case 0x2B: rPageSett
.ReadPrintGridLines( maStrm
); break;
670 case 0x2F: // FILEPASS [ 2345]
671 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
672 if( eLastErr
!= ERRCODE_NONE
)
675 case 0x5D: GetCurrSheetDrawing().ReadObj( maStrm
);break;
677 case 0x84: rPageSett
.ReadCenter( maStrm
); break;
678 case 0xA0: rTabViewSett
.ReadScl( maStrm
); break;
679 case 0xA1: rPageSett
.ReadSetup( maStrm
); break;
680 case 0xBD: Mulrk(); break; // MULRK [ 5]
681 case 0xBE: Mulblank(); break; // MULBLANK [ 5]
682 case 0xD6: Rstring(); break; // RSTRING [ 5]
683 case 0x00E5: Cellmerging(); break; // #i62300#
684 case 0x0236: TableOp(); break; // TABLE [ 5]
685 case 0x0809: // BOF [ 5]
686 XclTools::SkipSubStream( maStrm
);
693 case Z_Biff5E
: // --------------------------------- Z_Biff5E -
697 case 0x0809: // BOF [ 5]
700 switch( pExcRoot
->eDateiTyp
)
704 eAkt
= Z_Biff5TPre
; // Shrfmla Prefetch, Row-Prefetch
706 aIn
.StoreGlobalPosition(); // store position
708 case Biff5C
: // chart sheet
709 GetCurrSheetDrawing().ReadTabChart( maStrm
);
711 GetTracer().TraceChartOnlySheet();
715 pD
->SetVisible( GetCurrScTab(), false );
719 OSL_ENSURE( pExcRoot
->eDateiTyp
!= Biff5W
,
720 "+ImportExcel::Read(): Doppel-Whopper-Workbook!" );
727 case Z_Biffn0
: // --------------------------------- Z_Biffn0 -
731 case 0x0A: // EOF [ 2345]
740 case Z_Ende
: // ----------------------------------- Z_Ende -
741 OSL_FAIL( "*ImportExcel::Read(): Not possible state!" );
743 default: OSL_FAIL( "-ImportExcel::Read(): state forgotten!" );
747 if( eLastErr
== eERR_OK
)
751 GetDocImport().finalize();
755 pD
->CalcAfterLoad(false);
757 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
758 if( rAddrConv
.IsTabTruncated() )
759 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
760 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
761 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
762 else if( rAddrConv
.IsColTruncated() )
763 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
769 FltError
ImportExcel8::Read()
771 #ifdef EXC_INCL_DUMPER
773 Biff8RecDumper
aDumper( GetRoot(), sal_True
);
774 if( aDumper
.Dump( aIn
) )
775 return ERRCODE_ABORT
;
778 // read the entire BIFF8 stream
779 // don't look too close - this stuff seriously needs to be reworked
781 XclImpPageSettings
& rPageSett
= GetPageSettings();
782 XclImpTabViewSettings
& rTabViewSett
= GetTabViewSettings();
783 XclImpPalette
& rPal
= GetPalette();
784 XclImpFontBuffer
& rFontBfr
= GetFontBuffer();
785 XclImpNumFmtBuffer
& rNumFmtBfr
= GetNumFmtBuffer();
786 XclImpXFBuffer
& rXFBfr
= GetXFBuffer();
787 XclImpSst
& rSst
= GetSst();
788 XclImpTabInfo
& rTabInfo
= GetTabInfo();
789 XclImpNameManager
& rNameMgr
= GetNameManager();
790 XclImpLinkManager
& rLinkMgr
= GetLinkManager();
791 XclImpObjectManager
& rObjMgr
= GetObjectManager();
792 // call to GetCurrSheetDrawing() cannot be cached (changes in new sheets)
793 XclImpCondFormatManager
& rCondFmtMgr
= GetCondFormatManager();
794 XclImpValidationManager
& rValidMgr
= GetValidationManager();
795 XclImpPivotTableManager
& rPTableMgr
= GetPivotTableManager();
796 XclImpWebQueryBuffer
& rWQBfr
= GetWebQueryBuffer();
798 bool bInUserView
= false; // true = In USERSVIEW(BEGIN|END) record block.
802 EXC_STATE_BEFORE_GLOBALS
, /// Before workbook globals (wait for initial BOF).
803 EXC_STATE_GLOBALS_PRE
, /// Prefetch for workbook globals.
804 EXC_STATE_GLOBALS
, /// Workbook globals.
805 EXC_STATE_BEFORE_SHEET
, /// Before worksheet (wait for new worksheet BOF).
806 EXC_STATE_SHEET_PRE
, /// Prefetch for worksheet.
807 EXC_STATE_SHEET
, /// Worksheet.
808 EXC_STATE_END
/// Stop reading.
811 XclImpReadState eAkt
= EXC_STATE_BEFORE_GLOBALS
;
813 FltError eLastErr
= eERR_OK
;
815 boost::scoped_ptr
< ScfSimpleProgressBar
> pProgress( new ScfSimpleProgressBar(
816 aIn
.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC
) );
818 /* #i104057# Need to track a base position for progress bar calculation,
819 because sheet substreams may not be in order of sheets. */
820 sal_Size nProgressBasePos
= 0;
821 sal_Size nProgressBaseSize
= 0;
823 bool bSheetHasCodeName
= false;
825 std::vector
<OUString
> aCodeNames
;
826 std::vector
< SCTAB
> nTabsWithNoCodeName
;
828 sal_uInt16 nRecId
= 0;
830 for (; eAkt
!= EXC_STATE_END
; mnLastRecId
= nRecId
)
832 if( eAkt
== EXC_STATE_BEFORE_SHEET
)
834 sal_uInt16 nScTab
= GetCurrScTab();
835 if( nScTab
< maSheetOffsets
.size() )
837 nProgressBaseSize
+= (maStrm
.GetSvStreamPos() - nProgressBasePos
);
838 nProgressBasePos
= maSheetOffsets
[ nScTab
];
840 // i#115255 fdo#40304 BOUNDSHEET doesn't point to a valid
841 // BOF record position. Scan the records manually (from
842 // the BOUNDSHEET position) until we find a BOF. Some 3rd
843 // party Russian programs generate invalid xls docs with
844 // this kind of silliness.
845 if (aIn
.PeekRecId(nProgressBasePos
) == EXC_ID5_BOF
)
846 // BOUNDSHEET points to a valid BOF record. Good.
847 aIn
.StartNextRecord(nProgressBasePos
);
851 while (bValid
&& aIn
.GetRecId() != EXC_ID5_BOF
)
852 bValid
= aIn
.StartNextRecord();
855 // Safeguard ourselves from potential infinite loop.
856 eAkt
= EXC_STATE_END
;
859 // import only 256 sheets
860 if( nScTab
> GetScMaxPos().Tab() )
862 if( maStrm
.GetRecId() != EXC_ID_EOF
)
863 XclTools::SkipSubStream( maStrm
);
864 // #i29930# show warning box
865 GetAddressConverter().CheckScTab( nScTab
, true );
866 eAkt
= EXC_STATE_END
;
870 // #i109800# SHEET record may point to any record inside the
872 bool bIsBof
= maStrm
.GetRecId() == EXC_ID5_BOF
;
874 Bof5(); // read the BOF record
876 pExcRoot
->eDateiTyp
= Biff8
; // on missing BOF, assume a standard worksheet
878 switch( pExcRoot
->eDateiTyp
)
880 case Biff8
: // worksheet
881 case Biff8M4
: // macro sheet
882 eAkt
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
884 if( bIsBof
) maStrm
.StartNextRecord();
885 maStrm
.StoreGlobalPosition();
887 case Biff8C
: // chart sheet
888 GetCurrSheetDrawing().ReadTabChart( maStrm
);
890 GetTracer().TraceChartOnlySheet();
892 case Biff8W
: // workbook
893 OSL_FAIL( "ImportExcel8::Read - double workbook globals" );
895 case Biff8V
: // VB module
897 // TODO: do not create a sheet in the Calc document
898 pD
->SetVisible( nScTab
, false );
899 XclTools::SkipSubStream( maStrm
);
905 eAkt
= EXC_STATE_END
;
908 aIn
.StartNextRecord();
912 // #i63591# finalize table if EOF is missing
915 case EXC_STATE_SHEET_PRE
:
916 eAkt
= EXC_STATE_SHEET
;
917 aIn
.SeekGlobalPosition();
918 continue; // next iteration in while loop
919 case EXC_STATE_SHEET
:
921 eAkt
= EXC_STATE_END
;
924 eAkt
= EXC_STATE_END
;
928 if( eAkt
== EXC_STATE_END
)
931 if( eAkt
!= EXC_STATE_SHEET_PRE
&& eAkt
!= EXC_STATE_GLOBALS_PRE
)
932 pProgress
->ProgressAbs( nProgressBaseSize
+ aIn
.GetSvStreamPos() - nProgressBasePos
);
934 nRecId
= aIn
.GetRecId();
936 /* #i39464# Ignore records between USERSVIEWBEGIN and USERSVIEWEND
937 completely (user specific view settings). Otherwise view settings
938 and filters are loaded multiple times, which at least causes
939 problems in auto-filters. */
942 case EXC_ID_USERSVIEWBEGIN
:
943 OSL_ENSURE( !bInUserView
, "ImportExcel8::Read - nested user view settings" );
946 case EXC_ID_USERSVIEWEND
:
947 OSL_ENSURE( bInUserView
, "ImportExcel8::Read - not in user view settings" );
952 if( !bInUserView
) switch( eAkt
)
955 // before workbook globals: wait for initial workbook globals BOF
956 case EXC_STATE_BEFORE_GLOBALS
:
958 if( nRecId
== EXC_ID5_BOF
)
960 OSL_ENSURE( GetBiff() == EXC_BIFF8
, "ImportExcel8::Read - wrong BIFF version" );
962 if( pExcRoot
->eDateiTyp
== Biff8W
)
964 eAkt
= EXC_STATE_GLOBALS_PRE
;
965 maStrm
.StoreGlobalPosition();
968 else if( pExcRoot
->eDateiTyp
== Biff8
)
970 // #i62752# possible to have BIFF8 sheet without globals
972 eAkt
= EXC_STATE_SHEET_PRE
; // Shrfmla Prefetch, Row-Prefetch
973 bSheetHasCodeName
= false; // reset
974 aIn
.StoreGlobalPosition();
980 // prefetch for workbook globals
981 case EXC_STATE_GLOBALS_PRE
:
987 /* #i56376# evil hack: if EOF for globals is missing,
988 simulate it. This hack works only for the bugdoc
989 given in the issue, where the sheet substreams
990 start directly after the EXTSST record. A future
991 implementation should be more robust against
993 if( (nRecId
== EXC_ID_EOF
) ||
994 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
996 eAkt
= EXC_STATE_GLOBALS
;
997 aIn
.SeekGlobalPosition();
1000 case 0x12: DocProtect(); break; // PROTECT [ 5678]
1001 case 0x13: DocPasssword(); break;
1002 case 0x19: WinProtection(); break;
1003 case 0x2F: // FILEPASS [ 2345 ]
1004 eLastErr
= XclImpDecryptHelper::ReadFilepass( maStrm
);
1005 if( eLastErr
!= ERRCODE_NONE
)
1006 eAkt
= EXC_STATE_END
;
1008 case EXC_ID_FILESHARING
: ReadFileSharing(); break;
1009 case 0x3D: Window1(); break;
1010 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1011 case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ]
1012 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1014 // PALETTE follows XFs, but already needed while reading the XFs
1015 case EXC_ID_PALETTE
: rPal
.ReadPalette( maStrm
); break;
1021 case EXC_STATE_GLOBALS
:
1027 /* #i56376# evil hack: if EOF for globals is missing,
1028 simulate it. This hack works only for the bugdoc
1029 given in the issue, where the sheet substreams
1030 start directly after the EXTSST record. A future
1031 implementation should be more robust against
1033 if( (nRecId
== EXC_ID_EOF
) ||
1034 ((nRecId
== EXC_ID_EXTSST
) && (maStrm
.GetNextRecId() == EXC_ID5_BOF
)) )
1036 rNumFmtBfr
.CreateScFormats();
1037 rXFBfr
.CreateUserStyles();
1038 rPTableMgr
.ReadPivotCaches( maStrm
);
1039 rNameMgr
.ConvertAllTokens();
1040 eAkt
= EXC_STATE_BEFORE_SHEET
;
1043 case 0x0E: Precision(); break; // PRECISION
1044 case 0x22: Rec1904(); break; // 1904 [ 2345 ]
1045 case 0x56: break; // BUILTINFMTCNT[ 34 ]
1046 case 0x8D: Hideobj(); break; // HIDEOBJ [ 345 ]
1047 case 0xD3: SetHasBasic(); break;
1048 case 0xDE: Olesize(); break;
1050 case EXC_ID_CODENAME
: ReadCodeName( aIn
, true ); break;
1051 case EXC_ID_USESELFS
: ReadUsesElfs(); break;
1053 case EXC_ID2_FONT
: rFontBfr
.ReadFont( maStrm
); break;
1054 case EXC_ID4_FORMAT
: rNumFmtBfr
.ReadFormat( maStrm
); break;
1055 case EXC_ID5_XF
: rXFBfr
.ReadXF( maStrm
); break;
1056 case EXC_ID_STYLE
: rXFBfr
.ReadStyle( maStrm
); break;
1058 case EXC_ID_SST
: rSst
.ReadSst( maStrm
); break;
1059 case EXC_ID_TABID
: rTabInfo
.ReadTabid( maStrm
); break;
1060 case EXC_ID_NAME
: rNameMgr
.ReadName( maStrm
); break;
1062 case EXC_ID_EXTERNSHEET
: rLinkMgr
.ReadExternsheet( maStrm
); break;
1063 case EXC_ID_SUPBOOK
: rLinkMgr
.ReadSupbook( maStrm
); break;
1064 case EXC_ID_XCT
: rLinkMgr
.ReadXct( maStrm
); break;
1065 case EXC_ID_CRN
: rLinkMgr
.ReadCrn( maStrm
); break;
1066 case EXC_ID_EXTERNNAME
: rLinkMgr
.ReadExternname( maStrm
, pFormConv
); break;
1068 case EXC_ID_MSODRAWINGGROUP
:rObjMgr
.ReadMsoDrawingGroup( maStrm
); break;
1070 case EXC_ID_SXIDSTM
: rPTableMgr
.ReadSxidstm( maStrm
); break;
1071 case EXC_ID_SXVS
: rPTableMgr
.ReadSxvs( maStrm
); break;
1072 case EXC_ID_DCONREF
: rPTableMgr
.ReadDconref( maStrm
); break;
1073 case EXC_ID_DCONNAME
: rPTableMgr
.ReadDConName( maStrm
); break;
1079 // prefetch for worksheet
1080 case EXC_STATE_SHEET_PRE
:
1084 // skip chart substream
1088 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1090 case EXC_ID_WINDOW2
: rTabViewSett
.ReadWindow2( maStrm
, false );break;
1091 case EXC_ID_SCL
: rTabViewSett
.ReadScl( maStrm
); break;
1092 case EXC_ID_PANE
: rTabViewSett
.ReadPane( maStrm
); break;
1093 case EXC_ID_SELECTION
: rTabViewSett
.ReadSelection( maStrm
); break;
1095 case EXC_ID2_DIMENSIONS
:
1096 case EXC_ID3_DIMENSIONS
: ReadDimensions(); break;
1098 case EXC_ID_CODENAME
: ReadCodeName( aIn
, false ); bSheetHasCodeName
= true; break;
1100 case 0x0A: // EOF [ 2345 ]
1102 eAkt
= EXC_STATE_SHEET
;
1104 GetDoc().GetName( GetCurrScTab(), sName
);
1105 if ( !bSheetHasCodeName
)
1107 nTabsWithNoCodeName
.push_back( GetCurrScTab() );
1108 OSL_TRACE("No Codename for %d", GetCurrScTab() );
1113 GetDoc().GetCodeName( GetCurrScTab(), sCodeName
);
1114 OSL_TRACE("Have CodeName %s for SheetName %s",
1115 OUStringToOString( sCodeName
, RTL_TEXTENCODING_UTF8
).getStr(), OUStringToOString( sName
, RTL_TEXTENCODING_UTF8
).getStr() );
1116 aCodeNames
.push_back( sCodeName
);
1119 bSheetHasCodeName
= false; // reset
1121 aIn
.SeekGlobalPosition(); // and back to old position
1124 case 0x12: SheetProtect(); break;
1125 case 0x13: SheetPassword(); break;
1126 case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
1127 case 0x55: DefColWidth(); break;
1128 case 0x7D: Colinfo(); break; // COLINFO [ 345 ]
1129 case 0x81: Wsbool(); break; // WSBOOL [ 2345 ]
1130 case 0x8C: Country(); break; // COUNTRY [ 345 ]
1131 case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45 ]
1132 case 0x9B: FilterMode(); break; // FILTERMODE
1133 case EXC_ID_AUTOFILTERINFO
: AutoFilterInfo(); break;// AUTOFILTERINFO
1134 case EXC_ID_AUTOFILTER
: AutoFilter(); break; // AUTOFILTER
1135 case 0x0208: Row34(); break; // ROW [ 34 ]
1137 case EXC_ID3_ARRAY
: Array34(); break; // ARRAY [ 34 ]
1138 case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345 ]
1139 case 0x0867: FeatHdr(); break; // FEATHDR
1140 case 0x0868: Feat(); break; // FEAT
1146 case EXC_STATE_SHEET
:
1150 // skip unknown substreams
1154 case EXC_ID5_BOF
: XclTools::SkipSubStream( maStrm
); break;
1156 case EXC_ID_EOF
: Eof(); eAkt
= EXC_STATE_BEFORE_SHEET
; break;
1159 case EXC_ID3_BLANK
: ReadBlank(); break;
1160 case EXC_ID2_INTEGER
: ReadInteger(); break;
1161 case EXC_ID2_NUMBER
:
1162 case EXC_ID3_NUMBER
: ReadNumber(); break;
1164 case EXC_ID3_LABEL
: ReadLabel(); break;
1165 case EXC_ID2_BOOLERR
:
1166 case EXC_ID3_BOOLERR
: ReadBoolErr(); break;
1167 case EXC_ID_RK
: ReadRk(); break;
1169 case EXC_ID2_FORMULA
:
1170 case EXC_ID3_FORMULA
:
1171 case EXC_ID4_FORMULA
: Formula25(); break;
1172 case EXC_ID_SHRFMLA
: Shrfmla(); break;
1173 case 0x000C: Calccount(); break; // CALCCOUNT
1174 case 0x0010: Delta(); break; // DELTA
1175 case 0x0011: Iteration(); break; // ITERATION
1177 case 0x00AE: Scenman(); break; // SCENMAN
1178 case 0x00AF: Scenario(); break; // SCENARIO
1179 case 0x00BD: Mulrk(); break; // MULRK [ 5 ]
1180 case 0x00BE: Mulblank(); break; // MULBLANK [ 5 ]
1181 case 0x00D6: Rstring(); break; // RSTRING [ 5 ]
1182 case 0x00E5: Cellmerging(); break; // CELLMERGING
1183 case 0x00FD: Labelsst(); break; // LABELSST [ 8 ]
1184 case 0x0236: TableOp(); break; // TABLE
1186 case EXC_ID_HORPAGEBREAKS
:
1187 case EXC_ID_VERPAGEBREAKS
: rPageSett
.ReadPageBreaks( maStrm
); break;
1189 case EXC_ID_FOOTER
: rPageSett
.ReadHeaderFooter( maStrm
); break;
1190 case EXC_ID_LEFTMARGIN
:
1191 case EXC_ID_RIGHTMARGIN
:
1192 case EXC_ID_TOPMARGIN
:
1193 case EXC_ID_BOTTOMMARGIN
: rPageSett
.ReadMargin( maStrm
); break;
1194 case EXC_ID_PRINTHEADERS
: rPageSett
.ReadPrintHeaders( maStrm
); break;
1195 case EXC_ID_PRINTGRIDLINES
: rPageSett
.ReadPrintGridLines( maStrm
); break;
1196 case EXC_ID_HCENTER
:
1197 case EXC_ID_VCENTER
: rPageSett
.ReadCenter( maStrm
); break;
1198 case EXC_ID_SETUP
: rPageSett
.ReadSetup( maStrm
); break;
1199 case EXC_ID8_IMGDATA
: rPageSett
.ReadImgData( maStrm
); break;
1201 case EXC_ID_MSODRAWING
: GetCurrSheetDrawing().ReadMsoDrawing( maStrm
); break;
1202 // #i61786# weird documents: OBJ without MSODRAWING -> read in BIFF5 format
1203 case EXC_ID_OBJ
: GetCurrSheetDrawing().ReadObj( maStrm
); break;
1204 case EXC_ID_NOTE
: GetCurrSheetDrawing().ReadNote( maStrm
); break;
1206 case EXC_ID_HLINK
: XclImpHyperlink::ReadHlink( maStrm
); break;
1207 case EXC_ID_LABELRANGES
: XclImpLabelranges::ReadLabelranges( maStrm
); break;
1209 case EXC_ID_CONDFMT
: rCondFmtMgr
.ReadCondfmt( maStrm
); break;
1210 case EXC_ID_CF
: rCondFmtMgr
.ReadCF( maStrm
); break;
1212 case EXC_ID_DVAL
: XclImpValidationManager::ReadDval( maStrm
); break;
1213 case EXC_ID_DV
: rValidMgr
.ReadDV( maStrm
); break;
1215 case EXC_ID_QSI
: rWQBfr
.ReadQsi( maStrm
); break;
1216 case EXC_ID_WQSTRING
: rWQBfr
.ReadWqstring( maStrm
); break;
1217 case EXC_ID_PQRY
: rWQBfr
.ReadParamqry( maStrm
); break;
1218 case EXC_ID_WQSETT
: rWQBfr
.ReadWqsettings( maStrm
); break;
1219 case EXC_ID_WQTABLES
: rWQBfr
.ReadWqtables( maStrm
); break;
1221 case EXC_ID_SXVIEW
: rPTableMgr
.ReadSxview( maStrm
); break;
1222 case EXC_ID_SXVD
: rPTableMgr
.ReadSxvd( maStrm
); break;
1223 case EXC_ID_SXVI
: rPTableMgr
.ReadSxvi( maStrm
); break;
1224 case EXC_ID_SXIVD
: rPTableMgr
.ReadSxivd( maStrm
); break;
1225 case EXC_ID_SXPI
: rPTableMgr
.ReadSxpi( maStrm
); break;
1226 case EXC_ID_SXDI
: rPTableMgr
.ReadSxdi( maStrm
); break;
1227 case EXC_ID_SXVDEX
: rPTableMgr
.ReadSxvdex( maStrm
); break;
1228 case EXC_ID_SXEX
: rPTableMgr
.ReadSxex( maStrm
); break;
1229 case EXC_ID_SHEETEXT
: rTabViewSett
.ReadTabBgColor( maStrm
, rPal
); break;
1230 case EXC_ID_SXVIEWEX9
: rPTableMgr
.ReadSxViewEx9( maStrm
); break;
1239 if( eLastErr
== eERR_OK
)
1241 // In some strange circumstances a the codename might be missing
1242 // # Create any missing Sheet CodeNames
1243 std::vector
< SCTAB
>::iterator it_end
= nTabsWithNoCodeName
.end();
1244 for ( std::vector
< SCTAB
>::iterator it
= nTabsWithNoCodeName
.begin(); it
!= it_end
; ++it
)
1247 OSL_TRACE("Trying to find suitable codename for %d", *it
);
1250 OUStringBuffer aBuf
;
1251 aBuf
.appendAscii("Sheet");
1252 aBuf
.append(static_cast<sal_Int32
>(nTab
++));
1253 OUString sTmpName
= aBuf
.makeStringAndClear();
1254 std::vector
<OUString
>::iterator codeName_It
= aCodeNames
.begin();
1255 std::vector
<OUString
>::iterator codeName_It_end
= aCodeNames
.end();
1256 // search for codename
1257 for ( ; codeName_It
!= codeName_It_end
; ++codeName_It
)
1259 if ( *codeName_It
== sTmpName
)
1263 if ( codeName_It
== codeName_It_end
) // generated codename not found
1265 OSL_TRACE("Using generated codename %s", OUStringToOString( sTmpName
, RTL_TEXTENCODING_UTF8
).getStr() );
1267 GetDoc().SetCodeName( *it
, sTmpName
);
1268 // Record newly used codename
1269 aCodeNames
.push_back(sTmpName
);
1270 // Record those we have created so they can be created in
1272 maAutoGeneratedCodeNames
.push_back( sTmpName
);
1277 // #i45843# Convert pivot tables before calculation, so they are available
1278 // for the GETPIVOTDATA function.
1279 if( GetBiff() == EXC_BIFF8
)
1280 GetPivotTableManager().ConvertPivotTables();
1282 ScDocumentImport
& rDoc
= GetDocImport();
1286 // Excel documents look much better without this call; better in the
1287 // sense that the row heights are identical to the original heights in
1289 if (pD
->IsAdjustHeightEnabled())
1294 pD
->CalcAfterLoad(false);
1296 // import change tracking data
1297 XclImpChangeTrack
aImpChTr( GetRoot(), maStrm
);
1300 const XclImpAddressConverter
& rAddrConv
= GetAddressConverter();
1301 if( rAddrConv
.IsTabTruncated() )
1302 eLastErr
= SCWARN_IMPORT_SHEET_OVERFLOW
;
1303 else if( bTabTruncated
|| rAddrConv
.IsRowTruncated() )
1304 eLastErr
= SCWARN_IMPORT_ROW_OVERFLOW
;
1305 else if( rAddrConv
.IsColTruncated() )
1306 eLastErr
= SCWARN_IMPORT_COLUMN_OVERFLOW
;
1308 if( GetBiff() == EXC_BIFF8
)
1309 GetPivotTableManager().MaybeRefreshPivotTables();
1315 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */