LibreOffice Module sc (master)  1
impop.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <memory>
21 #include <imp_op.hxx>
22 
24 
25 #include <scitems.hxx>
26 
27 #include <o3tl/safeint.hxx>
28 #include <sfx2/docfile.hxx>
29 #include <svx/svxids.hrc>
30 #include <svl/numformat.hxx>
31 #include <svl/zforlist.hxx>
32 #include <unotools/configmgr.hxx>
33 #include <sal/log.hxx>
34 
35 #include <sfx2/objsh.hxx>
36 #include <tools/urlobj.hxx>
37 #include <docuno.hxx>
38 
39 #include <formulacell.hxx>
40 #include <document.hxx>
41 #include <globstr.hrc>
42 #include <scresid.hxx>
43 #include <global.hxx>
44 #include <olinetab.hxx>
45 #include <stlpool.hxx>
46 #include <viewopti.hxx>
47 #include <docoptio.hxx>
48 #include <scextopt.hxx>
49 #include <unonames.hxx>
50 #include <paramisc.hxx>
51 #include <colrowst.hxx>
52 #include <otlnbuff.hxx>
53 #include <xistyle.hxx>
54 
55 #include <namebuff.hxx>
56 #include <xltools.hxx>
57 #include <xltable.hxx>
58 #include <xltracer.hxx>
59 #include <xihelper.hxx>
60 #include <xipage.hxx>
61 #include <xiview.hxx>
62 #include <xiescher.hxx>
63 #include <xicontent.hxx>
64 
65 #include <excform.hxx>
66 #include <documentimport.hxx>
67 
68 #if defined(_WIN32)
69 #include <math.h>
70 #endif
71 
72 using namespace ::com::sun::star;
73 
74 ImportTyp::ImportTyp(ScDocument& rDoc, rtl_TextEncoding eQ)
75  : eQuellChar(eQ)
76  , rD(rDoc)
77 
78 {
79 }
80 
82 {
83 }
84 
86  ImportTyp( rImpData.mrDoc, rImpData.meTextEnc ),
87  XclImpRoot( rImpData ),
88  maStrm( rStrm, GetRoot() ),
89  aIn( maStrm ),
90  maScOleSize( ScAddress::INITIALIZE_INVALID ),
91  pColOutlineBuff(nullptr),
92  pRowOutlineBuff(nullptr),
93  pColRowBuff(nullptr),
94  mpLastFormula(nullptr),
95  mnLastRefIdx( 0 ),
96  mnIxfeIndex( 0 ),
97  mnLastRecId(0),
98  mbBiff2HasXfs(false),
99  mbBiff2HasXfsValid(false)
100 {
101  nBdshtTab = 0;
102 
103  // fill in root data - after new's without root as parameter
104  pExcRoot = &GetOldRoot();
105  pExcRoot->pIR = this; // ExcRoot -> XclImpRoot
107  pExcRoot->pExtSheetBuff.reset( new ExtSheetBuffer( pExcRoot ) ); //&aExtSheetBuff;
108  pExcRoot->pShrfmlaBuff.reset( new SharedFormulaBuffer( pExcRoot ) ); //&aShrfrmlaBuff;
109  pExcRoot->pExtNameBuff.reset( new ExtNameBuff ( *this ) );
110 
112 
113  // from Biff8 on
114  pFormConv.reset(new ExcelToSc( GetRoot() ));
116 
117  bTabTruncated = false;
118 
119  // Excel document per Default on 31.12.1899, accords to Excel settings with 1.1.1900
120  ScDocOptions aOpt = rD.GetDocOptions();
121  aOpt.SetDate( 30, 12, 1899 );
122  rD.SetDocOptions( aOpt );
123  rD.GetFormatTable()->ChangeNullDate( 30, 12, 1899 );
124 
125  ScDocOptions aDocOpt( rD.GetDocOptions() );
126  aDocOpt.SetIgnoreCase( true ); // always in Excel
127  aDocOpt.SetFormulaRegexEnabled( false ); // regular expressions? what's that?
128  aDocOpt.SetFormulaWildcardsEnabled( true ); // Excel uses wildcard expressions
129  aDocOpt.SetLookUpColRowNames( false ); // default: no natural language refs
130  rD.SetDocOptions( aDocOpt );
131 }
132 
134 {
136 
137  pOutlineListBuffer.reset();
138 
139  pFormConv.reset();
140 }
141 
142 void ImportExcel::SetLastFormula( SCCOL nCol, SCROW nRow, double fVal, sal_uInt16 nXF, ScFormulaCell* pCell )
143 {
144  LastFormulaMapType::iterator it = maLastFormulaCells.find(nCol);
145  if (it == maLastFormulaCells.end())
146  {
147  std::pair<LastFormulaMapType::iterator, bool> r =
148  maLastFormulaCells.emplace(nCol, LastFormula());
149  it = r.first;
150  }
151 
152  it->second.mnCol = nCol;
153  it->second.mnRow = nRow;
154  it->second.mpCell = pCell;
155  it->second.mfValue = fVal;
156  it->second.mnXF = nXF;
157 
158  mpLastFormula = &it->second;
159 }
160 
162 {
163  sal_uInt16 nRecommendReadOnly, nPasswordHash;
164  nRecommendReadOnly = maStrm.ReaduInt16();
165  nPasswordHash = maStrm.ReaduInt16();
166 
167  if((nRecommendReadOnly == 0) && (nPasswordHash == 0))
168  return;
169 
170  if( SfxItemSet* pItemSet = GetMedium().GetItemSet() )
171  pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, true ) );
172 
173  if( SfxObjectShell* pShell = GetDocShell() )
174  {
175  if( nRecommendReadOnly != 0 )
176  pShell->SetLoadReadonly( true );
177  if( nPasswordHash != 0 )
178  pShell->SetModifyPasswordHash( nPasswordHash );
179  }
180 }
181 
182 sal_uInt16 ImportExcel::ReadXFIndex( const ScAddress& rScPos, bool bBiff2 )
183 {
184  sal_uInt16 nXFIdx = 0;
185  if( bBiff2 )
186  {
187  /* #i71453# On first call, check if the file contains XF records (by
188  trying to access the first XF with index 0). If there are no XFs,
189  the explicit formatting information contained in each cell record
190  will be used instead. */
191  if( !mbBiff2HasXfsValid )
192  {
193  mbBiff2HasXfsValid = true;
194  mbBiff2HasXfs = GetXFBuffer().GetXF( 0 ) != nullptr;
195  }
196  // read formatting information (includes the XF identifier)
197  sal_uInt8 nFlags1, nFlags2, nFlags3;
198  nFlags1 = maStrm.ReaduInt8();
199  nFlags2 = maStrm.ReaduInt8();
200  nFlags3 = maStrm.ReaduInt8();
201  /* If the file contains XFs, extract and set the XF identifier,
202  otherwise get the explicit formatting. */
203  if( mbBiff2HasXfs )
204  {
205  nXFIdx = ::extract_value< sal_uInt16 >( nFlags1, 0, 6 );
206  /* If the identifier is equal to 63, then the real identifier is
207  contained in the preceding IXFE record (stored in mnBiff2XfId). */
208  if( nXFIdx == 63 )
209  nXFIdx = mnIxfeIndex;
210  }
211  else
212  {
213  /* Let the XclImpXF class do the conversion of the imported
214  formatting. The XF buffer is empty, therefore will not do any
215  conversion based on the XF index later on. */
216  XclImpXF::ApplyPatternForBiff2CellFormat( GetRoot(), rScPos, nFlags1, nFlags2, nFlags3 );
217  }
218  }
219  else
220  nXFIdx = aIn.ReaduInt16();
221  return nXFIdx;
222 }
223 
225 {
226  XclRange aXclUsedArea;
227  if( (maStrm.GetRecId() == EXC_ID2_DIMENSIONS) || (GetBiff() <= EXC_BIFF5) )
228  {
229  maStrm >> aXclUsedArea;
230  if( (aXclUsedArea.GetColCount() > 1) && (aXclUsedArea.GetRowCount() > 1) )
231  {
232  // Excel stores first unused row/column index
233  --aXclUsedArea.maLast.mnCol;
234  --aXclUsedArea.maLast.mnRow;
235  // create the Calc range
236  SCTAB nScTab = GetCurrScTab();
237  ScRange& rScUsedArea = GetExtDocOptions().GetOrCreateTabSettings( nScTab ).maUsedArea;
238  GetAddressConverter().ConvertRange( rScUsedArea, aXclUsedArea, nScTab, nScTab, false );
239  // if any error occurs in ConvertRange(), rScUsedArea keeps untouched
240  }
241  }
242  else
243  {
244  sal_uInt32 nXclRow1 = 0, nXclRow2 = 0;
245  nXclRow1 = maStrm.ReaduInt32();
246  nXclRow2 = maStrm.ReaduInt32();
247  aXclUsedArea.maFirst.mnCol = maStrm.ReaduInt16();
248  aXclUsedArea.maLast.mnCol = maStrm.ReaduInt16();
249  if( (nXclRow1 < nXclRow2) && (aXclUsedArea.GetColCount() > 1) &&
250  (nXclRow1 <= o3tl::make_unsigned( GetScMaxPos().Row() )) )
251  {
252  // Excel stores first unused row/column index
253  --nXclRow2;
254  --aXclUsedArea.maLast.mnCol;
255  // convert row indexes to 16-bit values
256  aXclUsedArea.maFirst.mnRow = static_cast< sal_uInt16 >( nXclRow1 );
257  aXclUsedArea.maLast.mnRow = limit_cast< sal_uInt16 >( nXclRow2, aXclUsedArea.maFirst.mnRow, SAL_MAX_UINT16 );
258  // create the Calc range
259  SCTAB nScTab = GetCurrScTab();
260  ScRange& rScUsedArea = GetExtDocOptions().GetOrCreateTabSettings( nScTab ).maUsedArea;
261  GetAddressConverter().ConvertRange( rScUsedArea, aXclUsedArea, nScTab, nScTab, false );
262  // if any error occurs in ConvertRange(), rScUsedArea keeps untouched
263  }
264  }
265 }
266 
268 {
269  XclAddress aXclPos;
270  aIn >> aXclPos;
271 
273  if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
274  {
275  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BLANK );
276 
277  GetXFRangeBuffer().SetBlankXF( aScPos, nXFIdx );
278  }
279 }
280 
282 {
283  XclAddress aXclPos;
284  maStrm >> aXclPos;
285 
287  if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
288  {
289  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, true );
290  sal_uInt16 nValue;
291  nValue = maStrm.ReaduInt16();
292 
293  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
294  GetDocImport().setNumericCell(aScPos, nValue);
295  }
296 }
297 
299 {
300  XclAddress aXclPos;
301  maStrm >> aXclPos;
302 
304  if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
305  {
306  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_NUMBER );
307  double fValue;
308  fValue = maStrm.ReadDouble();
309 
310  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
311  GetDocImport().setNumericCell(aScPos, fValue);
312  }
313 }
314 
316 {
317  XclAddress aXclPos;
318  maStrm >> aXclPos;
319 
321  if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
322  return;
323 
324  /* Record ID BIFF XF type String type
325  0x0004 2-7 3 byte 8-bit length, byte string
326  0x0004 8 3 byte 16-bit length, unicode string
327  0x0204 2-7 2 byte 16-bit length, byte string
328  0x0204 8 2 byte 16-bit length, unicode string */
329  bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL;
330  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, bBiff2 );
332  XclImpString aString;
333 
334  // #i63105# use text encoding from FONT record
335  rtl_TextEncoding eOldTextEnc = GetTextEncoding();
336  if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
337  SetTextEncoding( pFont->GetFontEncoding() );
338  aString.Read( maStrm, nFlags );
339  SetTextEncoding( eOldTextEnc );
340 
341  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
342  XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, GetRoot(), aString, nXFIdx);
343 }
344 
346 {
347  XclAddress aXclPos;
348  maStrm >> aXclPos;
349 
351  if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
352  return;
353 
354  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, maStrm.GetRecId() == EXC_ID2_BOOLERR );
356  nValue = maStrm.ReaduInt8();
357  nType = maStrm.ReaduInt8();
358 
359  if( nType == EXC_BOOLERR_BOOL )
360  GetXFRangeBuffer().SetBoolXF( aScPos, nXFIdx );
361  else
362  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
363 
364  double fValue;
365  std::unique_ptr<ScTokenArray> pScTokArr = ErrorToFormula( nType != EXC_BOOLERR_BOOL, nValue, fValue );
366  ScFormulaCell* pCell = pScTokArr
367  ? new ScFormulaCell(rD, aScPos, std::move(pScTokArr))
368  : new ScFormulaCell(rD, aScPos);
369  pCell->SetHybridDouble( fValue );
370  GetDocImport().setFormulaCell(aScPos, pCell);
371 }
372 
374 {
375  XclAddress aXclPos;
376  maStrm >> aXclPos;
377 
379  if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
380  {
381  sal_uInt16 nXFIdx = ReadXFIndex( aScPos, false );
382  sal_Int32 nRk;
383  nRk = maStrm.ReadInt32();
384 
385  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
387  }
388 }
389 
391 {
393 }
394 
396 {
397  sal_uInt16 nRow, nRowHeight;
398 
399  nRow = aIn.ReaduInt16();
400  aIn.Ignore( 4 );
401 
402  if( !GetRoot().GetDoc().ValidRow( nRow ) )
403  return;
404 
405  nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
406  aIn.Ignore( 2 );
407 
408  if( GetBiff() == EXC_BIFF2 )
409  {// -------------------- BIFF2
410  pColRowBuff->SetHeight( nRow, nRowHeight );
411  }
412  else
413  {// -------------------- BIFF5
414  sal_uInt16 nGrbit;
415 
416  aIn.Ignore( 2 ); // reserved
417  nGrbit = aIn.ReaduInt16();
418 
419  sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
420  pRowOutlineBuff->SetLevel( nRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
421  pColRowBuff->SetRowSettings( nRow, nRowHeight, nGrbit );
422  }
423 }
424 
426 {
427  sal_uInt16 nSubType;
429  maStrm.Ignore( 2 );
430  nSubType = maStrm.ReaduInt16();
431 
432  if( nSubType == 0x0020 ) // Chart
434  else if( nSubType == 0x0040 ) // Macro
436  else // #i51490# Excel interprets invalid indexes as worksheet
438 }
439 
441 {
442  // POST: cannot be called after an invalid table!
443  EndSheet();
444  IncCurrScTab();
445 }
446 
448 {
449  if (GetRoot().GetBiff() != EXC_BIFF8)
450  return;
451 
453 }
454 
456 {
457  OUString aUrl, aTabName;
458  bool bSameWorkBook;
459  OUString aEncodedUrl( aIn.ReadByteString( false ) );
460  XclImpUrlHelper::DecodeUrl( aUrl, aTabName, bSameWorkBook, *pExcRoot->pIR, aEncodedUrl );
461  mnLastRefIdx = pExcRoot->pExtSheetBuff->Add( aUrl, aTabName, bSameWorkBook );
462 }
463 
465 {
466  if (GetRoot().GetBiff() != EXC_BIFF8)
467  return;
468 
470 }
471 
473 {// Default Cell Attributes
474  sal_uInt16 nColMic, nColMac;
475  sal_uInt8 nOpt0;
476 
477  nColMic = aIn.ReaduInt16();
478  nColMac = aIn.ReaduInt16();
479 
480  OSL_ENSURE( aIn.GetRecLeft() == static_cast<std::size_t>(nColMac - nColMic) * 3 + 2,
481  "ImportExcel::Columndefault - wrong record size" );
482 
483  nColMac--;
484 
485  if( nColMac > rD.MaxCol() )
486  nColMac = static_cast<sal_uInt16>(rD.MaxCol());
487 
488  for( sal_uInt16 nCol = nColMic ; nCol <= nColMac ; nCol++ )
489  {
490  nOpt0 = aIn.ReaduInt8();
491  aIn.Ignore( 2 ); // only 0. Attribute-Byte used
492 
493  if( nOpt0 & 0x80 ) // Col hidden?
494  pColRowBuff->HideCol( nCol );
495  }
496 }
497 
499 {
500  sal_uInt16 nFormLen;
501  sal_uInt16 nFirstRow = aIn.ReaduInt16();
502  sal_uInt16 nLastRow = aIn.ReaduInt16();
503  sal_uInt8 nFirstCol = aIn.ReaduInt8();
504  sal_uInt8 nLastCol = aIn.ReaduInt8();
505 
506  if( GetBiff() == EXC_BIFF2 )
507  {// BIFF2
508  aIn.Ignore( 1 );
509  nFormLen = aIn.ReaduInt8();
510  }
511  else
512  {// BIFF5
513  aIn.Ignore( 6 );
514  nFormLen = aIn.ReaduInt16();
515  }
516 
517  std::unique_ptr<ScTokenArray> pResult;
518 
519  if (GetRoot().GetDoc().ValidColRow(nLastCol, nLastRow))
520  {
521  // the read mark is now on the formula, length in nFormLen
522 
523  pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
524  static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
525  pFormConv->Convert(pResult, maStrm, nFormLen, true);
526 
527  SAL_WARN_IF(!pResult, "sc", "*ImportExcel::Array25(): ScTokenArray is NULL!");
528  }
529 
530  if (pResult)
531  {
532  ScDocumentImport& rDoc = GetDocImport();
533  ScRange aArrayRange(nFirstCol, nFirstRow, GetCurrScTab(), nLastCol, nLastRow, GetCurrScTab());
534  rDoc.setMatrixCells(aArrayRange, *pResult, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
535  }
536 }
537 
539 {
540  sal_uInt16 n1904;
541 
542  n1904 = aIn.ReaduInt16();
543 
544  if( n1904 )
545  {// 1904 date system
546  ScDocOptions aOpt = rD.GetDocOptions();
547  aOpt.SetDate( 1, 1, 1904 );
548  rD.SetDocOptions( aOpt );
549  rD.GetFormatTable()->ChangeNullDate( 1, 1, 1904 );
550  }
551 }
552 
554 {
555  sal_uInt32 nRes;
556  sal_uInt16 nOpt;
557 
558  nOpt = aIn.ReaduInt16();
559  nRes = aIn.ReaduInt32();
560 
561  aIn.ReadByteString( false ); // name
562 
563  if( ( nOpt & 0x0001 ) || ( ( nOpt & 0xFFFE ) == 0x0000 ) )
564  {// external name
565  pExcRoot->pExtNameBuff->AddName( mnLastRefIdx );
566  }
567  else if( nOpt & 0x0010 )
568  {// ole link
569  pExcRoot->pExtNameBuff->AddOLE( mnLastRefIdx, nRes ); // nRes is storage ID
570  }
571  else
572  {// dde link
573  pExcRoot->pExtNameBuff->AddDDE( mnLastRefIdx );
574  }
575 }
576 
578 {// Column Width
579  sal_uInt8 nColFirst, nColLast;
580  sal_uInt16 nColWidth;
581 
582  nColFirst = aIn.ReaduInt8();
583  nColLast = aIn.ReaduInt8();
584  nColWidth = aIn.ReaduInt16();
585 
586 //TODO: add a check for the unlikely case of changed MAXCOL (-> XclImpAddressConverter)
587 // if( nColLast > rD.MaxCol() )
588 // nColLast = static_cast<sal_uInt16>(rD.MaxCol());
589 
590  sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
591  pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
592 }
593 
595 {
596  sal_uInt16 nDefHeight;
597  nDefHeight = maStrm.ReaduInt16();
598  nDefHeight &= 0x7FFF;
600 }
601 
603 {
604  if (GetRoot().GetBiff() != EXC_BIFF8)
605  return;
606 
608 }
609 
611 {
612  if (GetRoot().GetBiff() != EXC_BIFF8)
613  return;
614 
616 }
617 
619 {
620  if (GetRoot().GetBiff() != EXC_BIFF8)
621  return;
622 
624 }
625 
627 {
629 }
630 
632 {
634 }
635 
637 {
638  // stored as entire characters -> convert to 1/256 of characters (as in COLINFO)
639  double fDefWidth = 256.0 * maStrm.ReaduInt16();
640 
641  if (!pColRowBuff)
642  {
643  SAL_WARN("sc", "*ImportExcel::DefColWidth(): pColRowBuff is NULL!");
644  return;
645  }
646 
647  // #i3006# additional space for default width - Excel adds space depending on font size
649  fDefWidth += XclTools::GetXclDefColWidthCorrection( nFontHt );
650 
651  sal_uInt16 nScWidth = XclTools::GetScColumnWidth( limit_cast< sal_uInt16 >( fDefWidth ), GetCharWidth() );
652  pColRowBuff->SetDefWidth( nScWidth );
653 }
654 
656 {// Column Formatting Information
657  sal_uInt16 nColFirst, nColLast, nColWidth, nXF;
658  sal_uInt16 nOpt;
659 
660  nColFirst = aIn.ReaduInt16();
661  nColLast = aIn.ReaduInt16();
662  nColWidth = aIn.ReaduInt16();
663  nXF = aIn.ReaduInt16();
664  nOpt = aIn.ReaduInt16();
665 
666  if( nColFirst > rD.MaxCol() )
667  return;
668 
669  if( nColLast > rD.MaxCol() )
670  nColLast = static_cast<sal_uInt16>(rD.MaxCol());
671 
672  bool bHidden = ::get_flag( nOpt, EXC_COLINFO_HIDDEN );
673  bool bCollapsed = ::get_flag( nOpt, EXC_COLINFO_COLLAPSED );
674  sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nOpt, 8, 3 );
675  pColOutlineBuff->SetLevelRange( nColFirst, nColLast, nLevel, bCollapsed );
676 
677  if( bHidden )
678  pColRowBuff->HideColRange( nColFirst, nColLast );
679 
680  sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
681  pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
682  pColRowBuff->SetDefaultXF( nColFirst, nColLast, nXF );
683 }
684 
686 {
687  sal_uInt16 nFlags;
688  nFlags = aIn.ReaduInt16();
689 
692 
694 }
695 
697 {
698  sal_uInt16 nGrbit = 0;
699 
700  if( GetBiff() == EXC_BIFF5 )
701  {
703  maSheetOffsets.push_back( aIn.ReaduInt32() );
705  nGrbit = aIn.ReaduInt16();
706  }
707 
708  OUString aName( aIn.ReadByteString( false ) );
709 
710  SCTAB nScTab = nBdshtTab;
711  if( nScTab > 0 )
712  {
713  OSL_ENSURE( !rD.HasTable( nScTab ), "ImportExcel::Boundsheet - sheet exists already" );
714  rD.MakeTable( nScTab );
715  }
716 
717  if( ( nGrbit & 0x0001 ) || ( nGrbit & 0x0002 ) )
718  rD.SetVisible( nScTab, false );
719 
720  if( !rD.RenameTab( nScTab, aName ) )
721  {
723  rD.RenameTab( nScTab, aName );
724  }
725 
726  nBdshtTab++;
727 }
728 
730 {
731  sal_uInt16 nUICountry, nDocCountry;
732  nUICountry = maStrm.ReaduInt16();
733  nDocCountry = maStrm.ReaduInt16();
734 
735  // Store system language in XclRoot
736  LanguageType eLanguage = ::msfilter::ConvertCountryToLanguage( static_cast< ::msfilter::CountryId >( nDocCountry ) );
737  if( eLanguage != LANGUAGE_DONTKNOW )
738  SetDocLanguage( eLanguage );
739 
740  // Set Excel UI language in add-in name translator
741  eLanguage = ::msfilter::ConvertCountryToLanguage( static_cast< ::msfilter::CountryId >( nUICountry ) );
742  if( eLanguage != LANGUAGE_DONTKNOW )
743  SetUILanguage( eLanguage );
744 }
745 
747 {
748  if( maStrm.ReaduInt16() != 0 )
749  {
750  ScDocOptions aDocOpt = GetDoc().GetDocOptions();
751  aDocOpt.SetLookUpColRowNames( true );
752  GetDoc().SetDocOptions( aDocOpt );
753  }
754 }
755 
757 {
758  sal_uInt16 nHide;
759  ScVObjMode eOle, eChart, eDraw;
760 
761  nHide = aIn.ReaduInt16();
762 
763  ScViewOptions aOpts( rD.GetViewOptions() );
764 
765  switch( nHide )
766  {
767  case 1: // Placeholders
768  eOle = VOBJ_MODE_SHOW; // in Excel 97 only charts as place holder are displayed
769  eChart = VOBJ_MODE_SHOW; //#i80528# VOBJ_MODE_DUMMY replaced by VOBJ_MODE_SHOW now
770  eDraw = VOBJ_MODE_SHOW;
771  break;
772  case 2: // Hide all
773  eOle = VOBJ_MODE_HIDE;
774  eChart = VOBJ_MODE_HIDE;
775  eDraw = VOBJ_MODE_HIDE;
776  break;
777  default: // Show all
778  eOle = VOBJ_MODE_SHOW;
779  eChart = VOBJ_MODE_SHOW;
780  eDraw = VOBJ_MODE_SHOW;
781  break;
782  }
783 
784  aOpts.SetObjMode( VOBJ_TYPE_OLE, eOle );
785  aOpts.SetObjMode( VOBJ_TYPE_CHART, eChart );
786  aOpts.SetObjMode( VOBJ_TYPE_DRAW, eDraw );
787 
788  rD.SetViewOptions( aOpts );
789 }
790 
792 {
793  sal_uInt16 nScWidth = XclTools::GetScColumnWidth( maStrm.ReaduInt16(), GetCharWidth() );
794  if (!pColRowBuff)
795  {
796  SAL_WARN("sc", "*ImportExcel::Standardwidth(): pColRowBuff is NULL!");
797  return;
798  }
799  pColRowBuff->SetDefWidth( nScWidth, true );
800 }
801 
803 {
804  switch (mnLastRecId)
805  {
806  case EXC_ID2_FORMULA:
807  case EXC_ID3_FORMULA:
808  case EXC_ID4_FORMULA:
809  // This record MUST immediately follow a FORMULA record.
810  break;
811  default:
812  return;
813  }
814 
815  if (!mpLastFormula)
816  // The last FORMULA record should have left this data.
817  return;
818 
819  aIn.Ignore( 8 );
820  sal_uInt16 nLenExpr = aIn.ReaduInt16();
821 
822  // read mark is now on the formula
823 
824  std::unique_ptr<ScTokenArray> pResult;
825 
826  // The shared range in this record is erroneous more than half the time.
827  // Don't ever rely on it. Use the one from the formula cell above.
828  SCCOL nCol1 = mpLastFormula->mnCol;
829  SCROW nRow1 = mpLastFormula->mnRow;
830 
831  ScAddress aPos(nCol1, nRow1, GetCurrScTab());
832  pFormConv->Reset(aPos);
833  pFormConv->Convert( pResult, maStrm, nLenExpr, true, FT_SharedFormula );
834 
835  if (!pResult)
836  {
837  SAL_WARN("sc", "+ImportExcel::Shrfmla(): ScTokenArray is NULL!");
838  return;
839  }
840 
841  pExcRoot->pShrfmlaBuff->Store(aPos, *pResult);
842 
843  // Create formula cell for the last formula record.
844 
845  ScDocumentImport& rDoc = GetDocImport();
846 
847  ScFormulaCell* pCell = new ScFormulaCell(rD, aPos, std::move(pResult));
848  pCell->GetCode()->WrapReference(aPos, EXC_MAXCOL8, EXC_MAXROW8);
849  rDoc.getDoc().CheckLinkFormulaNeedingCheck( *pCell->GetCode());
850  rDoc.getDoc().EnsureTable(aPos.Tab());
851  rDoc.setFormulaCell(aPos, pCell);
852  pCell->SetNeedNumberFormat(false);
853  if (std::isfinite(mpLastFormula->mfValue))
855 
857  mpLastFormula->mpCell = pCell;
858 }
859 
861 {
862  /* rw (2 bytes): An Rw structure that specifies the row containing the
863  cells with numeric data.
864 
865  colFirst (2 bytes): A Col structure that specifies the first column in
866  the series of numeric cells within the sheet. The value of colFirst.col
867  MUST be less than or equal to 254.
868 
869  rgrkrec (variable): An array of RkRec structures. Each element in the
870  array specifies an RkRec in the row. The number of entries in the array
871  MUST be equal to the value given by the following formula:
872 
873  Number of entries in rgrkrec = (colLast.col – colFirst.col +1)
874 
875  colLast (2 bytes): A Col structure that specifies the last column in
876  the set of numeric cells within the sheet. This colLast.col value MUST
877  be greater than the colFirst.col value. */
878 
879  XclAddress aXclPos;
880  aIn >> aXclPos;
881 
882  XclAddress aCurrXclPos(aXclPos);
883  while (true)
884  {
885  if (aXclPos.mnCol > aCurrXclPos.mnCol)
886  break;
887  if (aIn.GetRecLeft() <= 2)
888  break;
889 
890  sal_uInt16 nXF = aIn.ReaduInt16();
891  sal_Int32 nRkNum = aIn.ReadInt32();
892 
894  if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
895  {
896  GetXFRangeBuffer().SetXF( aScPos, nXF );
898  }
899  ++aCurrXclPos.mnCol;
900  }
901 }
902 
904 {
905  /* rw (2 bytes): An Rw structure that specifies a row containing the blank
906  cells.
907 
908  colFirst (2 bytes): A Col structure that specifies the first column in
909  the series of blank cells within the sheet. The value of colFirst.col
910  MUST be less than or equal to 254.
911 
912  rgixfe (variable): An array of IXFCell structures. Each element of this
913  array contains an IXFCell structure corresponding to a blank cell in the
914  series. The number of entries in the array MUST be equal to the value
915  given by the following formula:
916 
917  Number of entries in rgixfe = (colLast.col – colFirst.col +1)
918 
919  colLast (2 bytes): A Col structure that specifies the last column in
920  the series of blank cells within the sheet. This colLast.col value MUST
921  be greater than colFirst.col value. */
922 
923  XclAddress aXclPos;
924  aIn >> aXclPos;
925 
926  XclAddress aCurrXclPos(aXclPos);
927  while (true)
928  {
929  if (aXclPos.mnCol > aCurrXclPos.mnCol)
930  break;
931  if (aIn.GetRecLeft() <= 2)
932  break;
933 
934  sal_uInt16 nXF = aIn.ReaduInt16();
935 
937  if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
938  GetXFRangeBuffer().SetBlankXF( aScPos, nXF );
939  ++aCurrXclPos.mnCol;
940  }
941 }
942 
944 {
945  XclAddress aXclPos;
946  sal_uInt16 nXFIdx;
947  aIn >> aXclPos;
948  nXFIdx = aIn.ReaduInt16();
949 
951  if( !GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
952  return;
953 
954  // unformatted Unicode string with separate formatting information
955  XclImpString aString;
956  aString.Read( maStrm );
957 
958  // character formatting runs
959  if( !aString.IsRich() )
960  aString.ReadFormats( maStrm );
961 
962  GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
963  XclImpStringHelper::SetToDocument(GetDocImport(), aScPos, *this, aString, nXFIdx);
964 }
965 
967 {
969  SCTAB nScTab = GetCurrScTab();
970 
971  sal_uInt16 nCount = maStrm.ReaduInt16();
972  sal_uInt16 nIdx = 0;
973  while (true)
974  {
975  if (maStrm.GetRecLeft() < 8)
976  break;
977  if (nIdx >= nCount)
978  break;
979  XclRange aXclRange;
980  maStrm >> aXclRange; // 16-bit rows and columns
981  ScRange aScRange( ScAddress::UNINITIALIZED );
982  if( rAddrConv.ConvertRange( aScRange, aXclRange, nScTab, nScTab, true ) )
983  GetXFRangeBuffer().SetMerge( aScRange.aStart.Col(), aScRange.aStart.Row(), aScRange.aEnd.Col(), aScRange.aEnd.Row() );
984  ++nIdx;
985  }
986 }
987 
989 {
990  XclRange aXclOleSize( ScAddress::UNINITIALIZED );
991  maStrm.Ignore( 2 );
992  aXclOleSize.Read( maStrm, false );
993 
994  SCTAB nScTab = GetCurrScTab();
995  GetAddressConverter().ConvertRange( maScOleSize, aXclOleSize, nScTab, nScTab, false );
996 }
997 
999 {
1000  sal_uInt16 nRow, nRowHeight, nGrbit, nXF;
1001 
1002  nRow = aIn.ReaduInt16();
1003  aIn.Ignore( 4 );
1004 
1005  SCROW nScRow = static_cast< SCROW >( nRow );
1006 
1007  if( !GetRoot().GetDoc().ValidRow( nScRow ) )
1008  return;
1009 
1010  nRowHeight = aIn.ReaduInt16(); // specify direct in Twips
1011  aIn.Ignore( 4 );
1012 
1013  nRowHeight = nRowHeight & 0x7FFF; // Bit 15: Row Height not changed manually
1014  if( !nRowHeight )
1015  nRowHeight = (GetBiff() == EXC_BIFF2) ? 0x25 : 0x225;
1016 
1017  nGrbit = aIn.ReaduInt16();
1018  nXF = aIn.ReaduInt16();
1019 
1020  sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
1021  pRowOutlineBuff->SetLevel( nScRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
1022  pColRowBuff->SetRowSettings( nScRow, nRowHeight, nGrbit );
1023 
1024  if( nGrbit & EXC_ROW_USEDEFXF )
1025  GetXFRangeBuffer().SetRowDefXF( nScRow, nXF & EXC_ROW_XFMASK );
1026 }
1027 
1029 {
1030  sal_uInt16 nSubType;
1032  maStrm.Ignore( 2 );
1033  nSubType = maStrm.ReaduInt16();
1034 
1035  OSL_ENSURE( nSubType != 0x0100, "*ImportExcel::Bof3(): Biff3 as Workbook?!" );
1036  if( nSubType == 0x0100 ) // Book
1038  else if( nSubType == 0x0020 ) // Chart
1040  else if( nSubType == 0x0040 ) // Macro
1042  else // #i51490# Excel interprets invalid indexes as worksheet
1044 }
1045 
1047 {
1048  sal_uInt16 nFirstRow, nLastRow, nFormLen;
1049  sal_uInt8 nFirstCol, nLastCol;
1050 
1051  nFirstRow = aIn.ReaduInt16();
1052  nLastRow = aIn.ReaduInt16();
1053  nFirstCol = aIn.ReaduInt8();
1054  nLastCol = aIn.ReaduInt8();
1055  aIn.Ignore( (GetBiff() >= EXC_BIFF5) ? 6 : 2 );
1056  nFormLen = aIn.ReaduInt16();
1057 
1058  std::unique_ptr<ScTokenArray> pResult;
1059 
1060  if( GetRoot().GetDoc().ValidColRow( nLastCol, nLastRow ) )
1061  {
1062  // the read mark is now on the formula, length in nFormLen
1063 
1064  pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
1065  static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
1066  pFormConv->Convert( pResult, maStrm, nFormLen, true );
1067 
1068  SAL_WARN_IF(!pResult, "sc", "+ImportExcel::Array34(): ScTokenArray is NULL!");
1069  }
1070 
1071  if (pResult)
1072  {
1073  ScDocumentImport& rDoc = GetDocImport();
1074  ScRange aArrayRange(nFirstCol, nFirstRow, GetCurrScTab(), nLastCol, nLastRow, GetCurrScTab());
1075  rDoc.setMatrixCells(aArrayRange, *pResult, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1);
1076  }
1077 }
1078 
1080 {
1081  sal_uInt16 nFlags, nDefHeight;
1082  nFlags = maStrm.ReaduInt16();
1083  nDefHeight = maStrm.ReaduInt16();
1084 
1085  if (!pColRowBuff)
1086  {
1087  SAL_WARN("sc", "*ImportExcel::Defrowheight345(): pColRowBuff is NULL!");
1088  return;
1089  }
1090 
1091  pColRowBuff->SetDefHeight( nDefHeight, nFlags );
1092 }
1093 
1095 {
1096  sal_uInt16 nFirstRow = aIn.ReaduInt16();
1097  sal_uInt16 nLastRow = aIn.ReaduInt16();
1098  sal_uInt8 nFirstCol = aIn.ReaduInt8();
1099  sal_uInt8 nLastCol = aIn.ReaduInt8();
1100  sal_uInt16 nGrbit = aIn.ReaduInt16();
1101  sal_uInt16 nInpRow = aIn.ReaduInt16();
1102  sal_uInt16 nInpCol = aIn.ReaduInt16();
1103  sal_uInt16 nInpRow2 = aIn.ReaduInt16();
1104  sal_uInt16 nInpCol2 = aIn.ReaduInt16();
1105 
1107  {
1108  //shrink to smallish arbitrary value to not timeout
1109  nLastRow = std::min<sal_uInt16>(nLastRow, MAXROW_30 / 2);
1110  }
1111 
1112  if( GetRoot().GetDoc().ValidColRow( nLastCol, nLastRow ) )
1113  {
1114  if( nFirstCol && nFirstRow )
1115  {
1116  ScTabOpParam aTabOpParam;
1118  sal_uInt16 nCol = nFirstCol - 1;
1119  sal_uInt16 nRow = nFirstRow - 1;
1120  SCTAB nTab = GetCurrScTab();
1121  switch (aTabOpParam.meMode)
1122  {
1123  case ScTabOpParam::Column:
1124  aTabOpParam.aRefFormulaCell.Set(
1125  static_cast<SCCOL>(nFirstCol),
1126  static_cast<SCROW>(nFirstRow - 1), nTab, false,
1127  false, false );
1128  aTabOpParam.aRefFormulaEnd.Set(
1129  static_cast<SCCOL>(nLastCol),
1130  static_cast<SCROW>(nFirstRow - 1), nTab, false,
1131  false, false );
1132  aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol),
1133  static_cast<SCROW>(nInpRow), nTab, false, false,
1134  false );
1135  nRow++;
1136  break;
1137  case ScTabOpParam::Row:
1138  aTabOpParam.aRefFormulaCell.Set(
1139  static_cast<SCCOL>(nFirstCol - 1),
1140  static_cast<SCROW>(nFirstRow), nTab, false, false,
1141  false );
1142  aTabOpParam.aRefFormulaEnd.Set(
1143  static_cast<SCCOL>(nFirstCol - 1),
1144  static_cast<SCROW>(nLastRow), nTab, false, false,
1145  false );
1146  aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol),
1147  static_cast<SCROW>(nInpRow), nTab, false, false,
1148  false );
1149  nCol++;
1150  break;
1151  case ScTabOpParam::Both: // TWO-INPUT
1152  aTabOpParam.aRefFormulaCell.Set(
1153  static_cast<SCCOL>(nFirstCol - 1),
1154  static_cast<SCROW>(nFirstRow - 1), nTab, false,
1155  false, false );
1156  aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol),
1157  static_cast<SCROW>(nInpRow), nTab, false, false,
1158  false );
1159  aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol2),
1160  static_cast<SCROW>(nInpRow2), nTab, false, false,
1161  false );
1162  break;
1163  }
1164 
1165  ScDocumentImport& rDoc = GetDocImport();
1166  ScRange aTabOpRange(nCol, nRow, nTab, nLastCol, nLastRow, nTab);
1167  rDoc.setTableOpCells(aTabOpRange, aTabOpParam);
1168  }
1169  }
1170  else
1171  {
1172  bTabTruncated = true;
1173  GetTracer().TraceInvalidRow(nLastRow, rD.MaxRow());
1174  }
1175 }
1176 
1178 {
1179  sal_uInt16 nSubType;
1181  maStrm.Ignore( 2 );
1182  nSubType = maStrm.ReaduInt16();
1183 
1184  if( nSubType == 0x0100 ) // Book
1186  else if( nSubType == 0x0020 ) // Chart
1188  else if( nSubType == 0x0040 ) // Macro
1190  else // #i51490# Excel interprets invalid indexes as worksheet
1192 }
1193 
1195 {
1196  //POST: eDateiTyp = Type of the file to be read
1197  sal_uInt16 nSubType, nVers;
1198  BiffTyp eDatei;
1199 
1201  nVers = maStrm.ReaduInt16();
1202  nSubType = maStrm.ReaduInt16( );
1203 
1204  switch( nSubType )
1205  {
1206  case 0x0005: eDatei = Biff5W; break; // workbook globals
1207  case 0x0006: eDatei = Biff5V; break; // VB module
1208  case 0x0010: eDatei = Biff5; break; // worksheet
1209  case 0x0020: eDatei = Biff5C; break; // chart
1210  case 0x0040: eDatei = Biff5M4; break; // macro sheet
1211  default:
1213  return;
1214  }
1215 
1216  if( nVers == 0x0600 && (GetBiff() == EXC_BIFF8) )
1217  eDatei = static_cast<BiffTyp>( eDatei - Biff5 + Biff8 );
1218 
1219  pExcRoot->eDateiTyp = eDatei;
1220 }
1221 
1223 {
1224  pExcRoot->pExtSheetBuff->Reset();
1225 
1226  if( GetBiff() <= EXC_BIFF5 )
1227  {
1228  pExcRoot->pExtNameBuff->Reset();
1229  mnLastRefIdx = 0;
1230  }
1231 
1232  FinalizeTable();
1233 }
1234 
1236 {
1237  SCTAB nTab = GetCurrScTab();
1238  if( nTab > 0 && !rD.HasTable( nTab ) )
1239  rD.MakeTable( nTab );
1240 
1241  if (nTab == 0 && GetBiff() == EXC_BIFF2)
1242  {
1243  // For Excel 2.1 Worksheet file, we need to set the file name as the
1244  // sheet name.
1246  rD.RenameTab(0, aURL.getBase());
1247  }
1248 
1249  pExcRoot->pShrfmlaBuff->Clear();
1250  maLastFormulaCells.clear();
1251  mpLastFormula = nullptr;
1252 
1253  InitializeTable( nTab );
1254 
1255  XclImpOutlineDataBuffer* pNewItem = new XclImpOutlineDataBuffer( GetRoot(), nTab );
1256  pOutlineListBuffer->push_back( std::unique_ptr<XclImpOutlineDataBuffer>(pNewItem) );
1257  pExcRoot->pColRowBuff = pColRowBuff = pNewItem->GetColRowBuff();
1258  pColOutlineBuff = pNewItem->GetColOutline();
1259  pRowOutlineBuff = pNewItem->GetRowOutline();
1260 }
1261 
1262 std::unique_ptr<ScTokenArray> ImportExcel::ErrorToFormula( bool bErrOrVal, sal_uInt8 nError, double& rVal )
1263 {
1264  return pFormConv->GetBoolErr( XclTools::ErrorToEnum( rVal, bErrOrVal, nError ) );
1265 }
1266 
1268 {
1269  /* Speed up chart import: import all sheets without charts, then
1270  update row heights (here), last load all charts -> do not any longer
1271  update inside of ScDocShell::ConvertFrom() (causes update of existing
1272  charts during each and every change of row height). */
1273  if( ScModelObj* pDocObj = GetDocModelObj() )
1274  pDocObj->UpdateAllRowHeights();
1275 }
1276 
1278 {
1279  /* Set automatic page numbering in Default page style (default is "page number = 1").
1280  Otherwise hidden tables (i.e. for scenarios) which have Default page style will
1281  break automatic page numbering. */
1282  if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( ScResId( STR_STYLENAME_STANDARD ), SfxStyleFamily::Page ) )
1283  pStyleSheet->GetItemSet().Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 0 ) );
1284 
1285  // outlines for all sheets, sets hidden rows and columns (#i11776# after filtered ranges)
1286  for (auto& rxBuffer : *pOutlineListBuffer)
1287  rxBuffer->Convert();
1288 
1289  // document view settings (before visible OLE area)
1291 
1292  // process all drawing objects (including OLE, charts, controls; after hiding rows/columns; before visible OLE area)
1294 
1295  // visible area (used if this document is an embedded OLE object)
1296  if( SfxObjectShell* pDocShell = GetDocShell() )
1297  {
1298  // visible area if embedded
1299  const ScExtDocSettings& rDocSett = GetExtDocOptions().GetDocSettings();
1300  SCTAB nDisplScTab = rDocSett.mnDisplTab;
1301 
1302  /* #i44077# If a new OLE object is inserted from file, there is no
1303  OLESIZE record in the Excel file. Calculate used area from file
1304  contents (used cells and drawing objects). */
1305  if( !maScOleSize.IsValid() )
1306  {
1307  // used area of displayed sheet (cell contents)
1308  if( const ScExtTabSettings* pTabSett = GetExtDocOptions().GetTabSettings( nDisplScTab ) )
1309  maScOleSize = pTabSett->maUsedArea;
1310  // add all valid drawing objects
1311  ScRange aScObjArea = GetObjectManager().GetUsedArea( nDisplScTab );
1312  if( aScObjArea.IsValid() )
1313  maScOleSize.ExtendTo( aScObjArea );
1314  }
1315 
1316  // valid size found - set it at the document
1317  if( maScOleSize.IsValid() )
1318  {
1319  pDocShell->SetVisArea( GetDoc().GetMMRect(
1321  maScOleSize.aEnd.Col(), maScOleSize.aEnd.Row(), nDisplScTab ) );
1322  GetDoc().SetVisibleTab( nDisplScTab );
1323  }
1324  }
1325 
1326  // open forms in alive mode (has no effect, if no controls in document)
1327  if( ScModelObj* pDocObj = GetDocModelObj() )
1328  pDocObj->setPropertyValue( SC_UNO_APPLYFMDES, uno::Any( false ) );
1329 
1330  // enables extended options to be set to the view after import
1331  GetExtDocOptions().SetChanged( true );
1332 
1333  // root data owns the extended document options -> create a new object
1334  GetDoc().SetExtDocOptions( std::make_unique<ScExtDocOptions>( GetExtDocOptions() ) );
1335 
1336  const SCTAB nLast = rD.GetTableCount();
1337  const ScRange* p;
1338 
1339  if( pExcRoot->pPrintRanges->HasRanges() )
1340  {
1341  for( SCTAB n = 0 ; n < nLast ; n++ )
1342  {
1343  p = pExcRoot->pPrintRanges->First(n);
1344  if( p )
1345  {
1346  rD.ClearPrintRanges( n );
1347  while( p )
1348  {
1349  rD.AddPrintRange( n, *p );
1350  p = pExcRoot->pPrintRanges->Next();
1351  }
1352  }
1353  else
1354  {
1355  // #i4063# no print ranges -> print entire sheet
1357  }
1358  }
1360  }
1361 
1362  if( !pExcRoot->pPrintTitles->HasRanges() )
1363  return;
1364 
1365  for( SCTAB n = 0 ; n < nLast ; n++ )
1366  {
1367  p = pExcRoot->pPrintTitles->First(n);
1368  if( p )
1369  {
1370  bool bRowVirgin = true;
1371  bool bColVirgin = true;
1372 
1373  while( p )
1374  {
1375  if( p->aStart.Col() == 0 && p->aEnd.Col() == rD.MaxCol() && bRowVirgin )
1376  {
1377  rD.SetRepeatRowRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
1378  bRowVirgin = false;
1379  }
1380 
1381  if( p->aStart.Row() == 0 && p->aEnd.Row() == rD.MaxRow() && bColVirgin )
1382  {
1383  rD.SetRepeatColRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
1384  bColVirgin = false;
1385  }
1386 
1387  p = pExcRoot->pPrintTitles->Next();
1388  }
1389  }
1390  }
1391 }
1392 
1394  XclImpRoot( rRoot ),
1395  mxColOutlineBuff( std::make_shared<XclImpOutlineBuffer>( rRoot.GetXclMaxPos().Col() + 1 ) ),
1396  mxRowOutlineBuff( std::make_shared<XclImpOutlineBuffer>( rRoot.GetXclMaxPos().Row() + 1 ) ),
1397  mxColRowBuff( std::make_shared<XclImpColRowSettings>( rRoot ) ),
1398  mnScTab( nScTab )
1399 {
1400 }
1401 
1403 {
1404 }
1405 
1407 {
1408  mxColOutlineBuff->SetOutlineArray( &GetDoc().GetOutlineTable( mnScTab, true )->GetColArray() );
1409  mxColOutlineBuff->MakeScOutline();
1410 
1411  mxRowOutlineBuff->SetOutlineArray( &GetDoc().GetOutlineTable( mnScTab, true )->GetRowArray() );
1412  mxRowOutlineBuff->MakeScOutline();
1413 
1414  mxColRowBuff->ConvertHiddenFlags( mnScTab );
1415 }
1416 
1417 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetChanged(bool bChanged)
If set to true, the data will be copied to the view data after import.
Definition: scextopt.cxx:165
RootData * pExcRoot
Definition: imp_op.hxx:87
void Set(const ScAddress &rAdr, bool bNewRelCol, bool bNewRelRow, bool bNewRelTab)
Definition: address.hxx:920
void AdjustRowHeight()
Definition: impop.cxx:1267
XclImpColRowSettings * GetColRowBuff() const
Definition: imp_op.hxx:59
virtual ~ImportExcel() override
Definition: impop.cxx:133
const sal_uInt16 EXC_TABLEOP_BOTH
Definition: xltable.hxx:129
const sal_uInt16 EXC_ID3_FORMULA
Definition: xltable.hxx:61
const sal_uInt16 EXC_ID2_DIMENSIONS
Definition: xltable.hxx:32
void SheetProtect()
Definition: impop.cxx:602
URL aURL
XclImpStream maStrm
Definition: imp_op.hxx:89
ScDocumentImport & GetDocImport()
Definition: xiroot.cxx:292
rtl_TextEncoding GetTextEncoding() const
Returns the text encoding to import/export byte strings.
Definition: xlroot.hxx:146
ScAddress aStart
Definition: address.hxx:499
void ReadFormats(XclImpStream &rStrm)
Reads and appends the formatting information (run count and runs) from stream.
Definition: xistring.hxx:46
sal_Int32 ReadInt32()
Definition: xistream.cxx:667
void SetDefHeight(sal_uInt16 nDefHeight, sal_uInt16 nFlags)
Definition: colrowst.cxx:100
static XclBoolError ErrorToEnum(double &rfDblValue, bool bErrOrBool, sal_uInt8 nValue)
Gets a translated error code or Boolean value from Excel error codes.
Definition: xltools.cxx:247
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
const SCROW MAXROW_30
Definition: address.hxx:90
void ReadProtect(XclImpStream &rStrm, SCTAB nTab)
Definition: xicontent.cxx:1327
void ReadUsesElfs()
Definition: impop.cxx:746
std::unique_ptr< SharedFormulaBuffer > pShrfmlaBuff
Definition: root.hxx:49
static double GetXclDefColWidthCorrection(tools::Long nXclDefFontHeight)
Returns a correction value to convert column widths from/to default column widths.
Definition: xltools.cxx:321
sal_uInt16 GetRecId() const
Returns the current record ID.
Definition: xistream.hxx:353
SCROW Row() const
Definition: address.hxx:261
void Columndefault()
Definition: impop.cxx:472
std::unique_ptr< ScRangeListTabs > pPrintRanges
Definition: root.hxx:56
Stores all data of an Excel font and provides import of FONT records.
Definition: xistyle.hxx:70
const sal_uInt16 EXC_ID2_LABEL
Definition: xltable.hxx:47
XclStrFlags
Flags used to specify import/export mode of strings.
Definition: xlstring.hxx:28
Stores global buffers and data needed for Excel import filter.
Definition: xiroot.hxx:63
void Externsheet()
Definition: impop.cxx:455
std::unique_ptr< ScTokenArray > ErrorToFormula(bool bErrOrVal, sal_uInt8 nError, double &rVal)
Definition: impop.cxx:1262
void Row34()
Definition: impop.cxx:998
XclImpOutlineBuffer * GetRowOutline() const
Definition: imp_op.hxx:61
void SetRowSettings(SCROW nRow, sal_uInt16 nHeight, sal_uInt16 nFlags)
Definition: colrowst.cxx:133
void DocPassword()
Definition: impop.cxx:618
std::vector< std::unique_ptr< XclImpOutlineDataBuffer > > XclImpOutlineListBuffer
Definition: imp_op.hxx:101
void Standardwidth()
Definition: impop.cxx:791
OUString getBase(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
#define SC_UNO_APPLYFMDES
Definition: unonames.hxx:534
const sal_uInt16 EXC_ID2_FORMULA
Definition: xltable.hxx:60
ScTokenArray * GetCode()
long Long
const sal_uInt16 EXC_ROW_USEDEFXF
Definition: xltable.hxx:85
void ExtendTo(const ScRange &rRange)
Definition: address.cxx:1604
const sal_uInt16 EXC_DEFROW_UNSYNCED
Definition: xltable.hxx:114
SC_DLLPUBLIC void ClearPrintRanges(SCTAB nTab)
Removes all print ranges.
Definition: document.cxx:6329
sal_Int64 n
void Country()
Definition: impop.cxx:729
void Bof2()
Definition: impop.cxx:425
XclImpXFRangeBuffer & GetXFRangeBuffer() const
Returns the buffer of XF index ranges for a sheet.
Definition: xiroot.cxx:161
void Read(XclImpStream &rStrm, XclStrFlags nFlags=XclStrFlags::NONE)
Reads a complete string from the passed stream.
Definition: xistring.cxx:41
ScRange maUsedArea
Used area in the sheet (columns/rows only).
Definition: scextopt.hxx:49
void Boundsheet()
Definition: impop.cxx:696
void ConvertObjects()
Inserts all objects into the Calc document.
Definition: xiescher.cxx:4374
sal_uInt16 mnHeight
Font color.
Definition: xlstyle.hxx:290
const ScExtDocSettings & GetDocSettings() const
Definition: scextopt.cxx:170
void Colwidth()
Definition: impop.cxx:577
SC_DLLPUBLIC void SetRepeatColRange(SCTAB nTab, std::unique_ptr< ScRange > pNew)
Definition: document.cxx:6347
void Row25()
Definition: impop.cxx:395
ScAddress aEnd
Definition: address.hxx:500
ScRange GetUsedArea(SCTAB nScTab) const
Returns the used area in the sheet with the passed index.
Definition: xiescher.cxx:4405
XclAddress maLast
Definition: xladdress.hxx:60
sal_uInt32 mnRow
Definition: xladdress.hxx:32
LastFormula * mpLastFormula
Definition: imp_op.hxx:105
ReturnType limit_cast(Type nValue, ReturnType nMin, ReturnType nMax)
Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits...
Definition: ftools.hxx:63
bool IsRich() const
Returns true, if the string contains formatting information.
Definition: xistring.hxx:56
void SetLevel(SCSIZE nIndex, sal_uInt8 nVal, bool bCollapsed)
Definition: exctools.cxx:75
XclAddress maFirst
Definition: xladdress.hxx:59
void Defrowheight2()
Definition: impop.cxx:594
std::shared_ptr< T > make_shared(Args &&...args)
XclImpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xiroot.cxx:194
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:277
void Ixfe()
Definition: impop.cxx:631
SCTAB nBdshtTab
Definition: imp_op.hxx:111
void HideColRange(SCCOL nCol1, SCCOL nCol2)
Definition: colrowst.cxx:91
RootData & GetOldRoot() const
Returns old RootData struct.
Definition: xlroot.hxx:137
Accessor class to ScDocument.
ScfUInt32Vec maSheetOffsets
Definition: imp_op.hxx:92
static void SetToDocument(ScDocumentImport &rDoc, const ScAddress &rPos, const XclImpRoot &rRoot, const XclImpString &rString, sal_uInt16 nXFIndex)
Definition: xihelper.cxx:223
XclImpColRowSettings * pColRowBuff
Definition: imp_op.hxx:99
void Olesize()
Definition: impop.cxx:988
SC_DLLPUBLIC void SetVisible(SCTAB nTab, bool bVisible)
Definition: document.cxx:901
const XclImpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xiroot.hxx:131
void ReadNumber()
Definition: impop.cxx:298
void DocProtect()
Definition: impop.cxx:610
void SetMerge(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2)
Inserts a complete merged cell range.
Definition: xistyle.cxx:1978
void SetButtonMode(bool bRightOrUnder)
Definition: exctools.cxx:147
void Externname25()
Definition: impop.cxx:553
static void ApplyPatternForBiff2CellFormat(const XclImpRoot &rRoot, const ScAddress &rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3)
Converts formatting information from BIFF2 cell record data directly.
Definition: xistyle.cxx:1426
BiffTyp
Definition: flttypes.hxx:22
virtual ~ImportTyp()
Definition: impop.cxx:81
XclImpPageSettings & GetPageSettings() const
Returns the page settings of the current sheet.
Definition: xiroot.cxx:248
Provides functions to convert Excel cell addresses to Calc cell addresses.
Definition: xihelper.hxx:41
void Array25()
Definition: impop.cxx:498
void ReadWinProtect(XclImpStream &rStrm)
document windows properties protection flag
Definition: xicontent.cxx:1271
SC_DLLPUBLIC void CheckLinkFormulaNeedingCheck(const ScTokenArray &rCode)
Check token array and set link check if ocDde/ocWebservice is contained.
Definition: documen8.cxx:1156
void ReadFileSharing()
Definition: impop.cxx:161
XclImpOutlineBfrRef mxRowOutlineBuff
Definition: imp_op.hxx:69
XclImpOutlineBuffer * pColOutlineBuff
Definition: imp_op.hxx:97
ScDocument & rD
Definition: imp_op.hxx:46
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:853
void SetXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index.
Definition: xistyle.cxx:1925
MS Excel 4.0.
Definition: xlconst.hxx:34
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:872
#define SAL_MAX_UINT16
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
ScStyleSheetPool & GetStyleSheetPool() const
Returns the style sheet pool of the Calc document.
Definition: xlroot.cxx:298
const OUString & GetDocUrl() const
Returns the document URL of the imported/exported file.
Definition: xlroot.hxx:170
static bool IsFuzzing()
void Rec1904()
Definition: impop.cxx:538
int nCount
void Bof3()
Definition: impop.cxx:1028
void SetLookUpColRowNames(bool bVal)
Definition: docoptio.hxx:52
void SetIgnoreCase(bool bVal)
Definition: docoptio.hxx:58
virtual void PostDocLoad()
Definition: impop.cxx:1277
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Definition: document.cxx:191
SCTAB Tab() const
Definition: address.hxx:270
const sal_uInt8 EXC_BOOLERR_BOOL
Definition: xltable.hxx:56
void TraceInvalidRow(sal_uInt32 nRow, sal_uInt32 nMaxrow)
Definition: xltracer.cxx:53
XclImpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
Definition: xiroot.cxx:156
ImportExcel(XclImpRootData &rImpData, SvStream &rStrm)
Definition: impop.cxx:85
virtual ~XclImpOutlineDataBuffer() override
Definition: impop.cxx:1402
ScRefAddress aRefRowCell
Definition: paramisc.hxx:51
void SetNeedNumberFormat(bool bVal)
void ReadLabel()
Definition: impop.cxx:315
void TableOp()
Definition: impop.cxx:1094
void SetSrcCharSet(rtl_TextEncoding eNew)
Definition: document.hxx:2062
void DisableDecryption()
Switches usage of current decryption algorithm off.
Definition: xistream.hxx:334
const XclFontData & GetAppFontData() const
Returns the application font data of this file, needed i.e.
Definition: xistyle.hxx:168
std::unique_ptr< ScRangeListTabs > pPrintTitles
Definition: root.hxx:57
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1947
void setMatrixCells(const ScRange &rRange, const ScTokenArray &rArray, formula::FormulaGrammar::Grammar eGrammar)
void WrapReference(const ScAddress &rPos, SCCOL nMaxCol, SCROW nMaxRow)
Definition: token.cxx:5281
bool mbBiff2HasXfs
Definition: imp_op.hxx:116
ScExtTabSettings & GetOrCreateTabSettings(SCTAB nTab)
Definition: scextopt.cxx:190
SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab)
Definition: document.hxx:859
ScFormulaCell * mpCell
Definition: imp_op.hxx:83
void ReadPasswordHash(XclImpStream &rStrm)
Definition: xicontent.cxx:1276
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:871
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:441
void Read(XclImpStream &rStrm, bool bCol16Bit=true)
Definition: xladdress.cxx:46
static sal_uInt16 GetScColumnWidth(sal_uInt16 nXclWidth, tools::Long nScCharWidth)
Returns the Calc column width (twips) for the passed Excel width.
Definition: xltools.cxx:307
Parameter for data table aka multiple operations.
Definition: paramisc.hxx:45
void SetBlankXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for blank cells.
Definition: xistyle.cxx:1930
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
void SetDefWidth(sal_uInt16 nDefWidth, bool bStdWidthRec=false)
Definition: colrowst.cxx:50
void Window1()
Definition: impop.cxx:390
void SetWidthRange(SCCOL nCol1, SCCOL nCol2, sal_uInt16 nWidth)
Definition: colrowst.cxx:65
void Shrfmla()
Definition: impop.cxx:802
static double GetDoubleFromRK(sal_Int32 nRKValue)
GUID of file moniker (HLINK record).
Definition: xltools.cxx:98
void Mulblank()
Definition: impop.cxx:903
std::unique_ptr< ExcelToSc > pFormConv
Visible range if embedded.
Definition: imp_op.hxx:95
void Bof5()
Definition: impop.cxx:1194
ScExtDocOptions & GetExtDocOptions() const
Returns the extended document options.
Definition: xlroot.cxx:420
Extended settings for the document, used in import/export filters.
Definition: scextopt.hxx:27
sal_Int16 SCCOL
Definition: types.hxx:21
ScModelObj * GetDocModelObj() const
Returns the object model of the Calc document.
Definition: xlroot.cxx:287
double ReadDouble()
Definition: xistream.cxx:703
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1967
void Eof()
Definition: impop.cxx:440
SC_DLLPUBLIC void CreateValidTabName(OUString &rName) const
Definition: document.cxx:392
XclImpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xiroot.cxx:119
void SetDate(sal_uInt16 nD, sal_uInt16 nM, sal_Int16 nY)
Definition: docoptio.hxx:68
ScRefAddress aRefFormulaCell
Definition: paramisc.hxx:49
void ChangeNullDate(sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void SetUILanguage(LanguageType eLang)
Sets the UI language, i.e.
Definition: xlroot.hxx:251
void SetDocLanguage(LanguageType eLang)
Sets the document language.
Definition: xlroot.hxx:249
bool bTabTruncated
Definition: imp_op.hxx:113
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
void Hideobj()
Definition: impop.cxx:756
void FinalizeTable()
Is called when import filter stops importing a single sheet (all BIFF versions).
Definition: xiroot.cxx:111
const SCROW EXC_MAXROW8
Definition: xlconst.hxx:65
XclImpOutlineBfrRef mxColOutlineBuff
Definition: imp_op.hxx:68
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
#define LANGUAGE_DONTKNOW
void ReadWindow1(XclImpStream &rStrm)
Reads a WINDOW1 record.
Definition: xiview.cxx:39
const sal_uInt16 EXC_ROW_COLLAPSED
Definition: xltable.hxx:82
const sal_uInt16 EXC_ID4_FORMULA
Definition: xltable.hxx:62
sal_uInt16 mnCol
Definition: xladdress.hxx:31
void Rstring()
Definition: impop.cxx:943
void SetRowDefXF(SCROW nScRow, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a row.
Definition: xistyle.cxx:1940
void SetTextEncoding(rtl_TextEncoding eTextEnc)
Sets the text encoding to import/export byte strings.
Definition: xlroot.cxx:200
A 2D cell address struct with Excel column and row indexes.
Definition: xladdress.hxx:29
SC_DLLPUBLIC void AddPrintRange(SCTAB nTab, const ScRange &rNew)
Adds a new print ranges.
Definition: document.cxx:6335
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_FIRSTPAGENO(177)
const ScExtTabSettings * GetTabSettings(SCTAB nTab) const
Definition: scextopt.cxx:180
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
bool IsValid() const
Definition: address.hxx:546
void setTableOpCells(const ScRange &rRange, const ScTabOpParam &rParam)
sal_uInt16 ReaduInt16()
Definition: xistream.cxx:649
void ReadDocProtect(XclImpStream &rStrm)
document structure protection flag
Definition: xicontent.cxx:1266
Extended settings for a sheet, used in import/export filters.
Definition: scextopt.hxx:47
void SetHeight(SCROW nRow, sal_uInt16 nHeight)
Definition: colrowst.cxx:112
void EnableDecryption(bool bEnable=true)
Switches usage of current decryption algorithm on/off.
Definition: xistream.cxx:522
SCCOL Col() const
Definition: address.hxx:266
XclTracer & GetTracer() const
Returns the filter tracer.
Definition: xlroot.cxx:425
SC_DLLPUBLIC void SetRepeatRowRange(SCTAB nTab, std::unique_ptr< ScRange > pNew)
Definition: document.cxx:6353
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:160
SC_DLLPUBLIC void EnsureTable(SCTAB nTab)
Definition: documen2.cxx:540
void Defrowheight345()
Definition: impop.cxx:1079
SC_DLLPUBLIC const ScViewOptions & GetViewOptions() const
Definition: documen3.cxx:1961
void SetFitToPages(bool bFitToPages)
Sets or clears the fit-to-pages setting (contained in WSBOOL record).
Definition: xipage.hxx:60
sal_uInt16 ReadXFIndex(const ScAddress &rScPos, bool bBiff2)
Definition: impop.cxx:182
void ReadBlank()
Definition: impop.cxx:267
XclImpXF * GetXF(sal_uInt16 nXFIndex)
Returns the object that stores all contents of an XF record.
Definition: xistyle.hxx:495
bool ValidColRow(SCCOL nCol, SCROW nRow) const
Definition: document.hxx:876
sal_uInt16 GetColCount() const
Definition: xladdress.hxx:71
void NewTable()
Definition: impop.cxx:1235
std::unique_ptr< XclImpOutlineListBuffer > pOutlineListBuffer
Definition: imp_op.hxx:102
std::size_t GetRecLeft()
Returns remaining data size of the whole record without record headers.
Definition: xistream.cxx:582
void SetCodePage(sal_uInt16 nCodePage)
Sets a code page read from a CODEPAGE record for byte string import.
Definition: xiroot.cxx:89
void setFormulaCell(const ScAddress &rPos, const OUString &rFormula, formula::FormulaGrammar::Grammar eGrammar, const double *pResult=nullptr)
sal_Int32 SCROW
Definition: types.hxx:17
const sal_uInt16 EXC_TABLEOP_ROW
Definition: xltable.hxx:128
const sal_uInt16 EXC_WSBOOL_ROWBELOW
Definition: xlconst.hxx:184
void ReadPasswordHash(XclImpStream &rStrm, SCTAB nTab)
Definition: xicontent.cxx:1363
const sal_uInt16 EXC_ID2_BLANK
Definition: xltable.hxx:36
bool ValidRow(SCROW nRow) const
Definition: document.hxx:875
OUString ReadByteString(bool b16BitLen)
Reads 8/16 bit string length, character array and returns the string.
Definition: xistream.cxx:959
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1953
void SetBoolXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for boolean cells.
Definition: xistyle.cxx:1935
void Cellmerging()
Definition: impop.cxx:966
void SetLevelRange(SCSIZE nF, SCSIZE nL, sal_uInt8 nVal, bool bCollapsed)
Definition: exctools.cxx:135
ScRange maScOleSize
Definition: imp_op.hxx:93
std::unique_ptr< ExtNameBuff > pExtNameBuff
Definition: root.hxx:50
#define SAL_WARN_IF(condition, area, stream)
void WinProtection()
Definition: impop.cxx:464
void Ignore(std::size_t nBytes)
Seeks forward inside the current record.
Definition: xistream.cxx:798
unsigned char sal_uInt8
sal_uInt8 ReaduInt8()
Definition: xistream.cxx:617
void IncCurrScTab()
Increases the current Calc sheet index by 1.
Definition: xlroot.hxx:260
const sal_uInt16 EXC_ID2_BOOLERR
Definition: xltable.hxx:53
void Mulrk()
Definition: impop.cxx:860
void SetResultDouble(double n)
For import only: set a double result.
XclImpRoot * pIR
Definition: root.hxx:63
XclImpColRowSettRef mxColRowBuff
Definition: imp_op.hxx:70
void Array34()
Definition: impop.cxx:1046
OUString aName
ScRefAddress aRefColCell
Definition: paramisc.hxx:52
XclImpOutlineBuffer * pRowOutlineBuff
Definition: imp_op.hxx:98
XclImpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Definition: xiroot.cxx:146
void HideCol(SCCOL nCol)
Definition: colrowst.cxx:83
Always use UCS-2 characters (default: try to compress). BIFF8 only.
void Finalize()
Sets the view settings at the document.
Definition: xiview.cxx:63
Store and manage shared formula tokens.
Definition: namebuff.hxx:59
void * p
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
const sal_uInt16 EXC_COLINFO_HIDDEN
Definition: xltable.hxx:142
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:140
sal_Int16 mnLastRefIdx
Definition: imp_op.hxx:107
const sal_uInt16 EXC_ROW_XFMASK
Definition: xltable.hxx:88
bool ConvertRange(ScRange &rScRange, const XclRange &rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn)
Converts the passed Excel cell range to a Calc cell range.
Definition: xihelper.cxx:101
XclImpOutlineBuffer * GetColOutline() const
Definition: imp_op.hxx:60
void Colinfo()
Definition: impop.cxx:655
ExcelToSc * pFmlaConverter
Definition: root.hxx:51
SC_DLLPUBLIC void SetPrintEntireSheet(SCTAB nTab)
Marks the specified sheet to be printed completely.
Definition: document.cxx:6341
void SetLastFormula(SCCOL nCol, SCROW nRow, double fVal, sal_uInt16 nXF, ScFormulaCell *pCell)
False = mbBiff2HasXfs is undetermined yet.
Definition: impop.cxx:142
const ScAddress & GetScMaxPos() const
Returns the highest possible cell address in a Calc document.
Definition: xlroot.hxx:242
void SetHybridDouble(double n)
For import only: set a double result.
void Bof4()
Definition: impop.cxx:1177
void TracePrintRange()
Definition: xltracer.cxx:65
XclImpDocViewSettings & GetDocViewSettings() const
Returns the view settings of the entire document.
Definition: xiroot.cxx:253
ScVObjMode
Definition: global.hxx:377
bool ValidColRow(SCCOL nCol, SCROW nRow, SCCOL nMaxCol, SCROW nMaxRow)
Definition: address.hxx:114
bool ValidRow(SCROW nRow, SCROW nMaxRow)
Definition: address.hxx:98
void ReadInteger()
Definition: impop.cxx:281
#define SAL_WARN(area, stream)
void Codepage()
Definition: impop.cxx:626
virtual void EndSheet()
Definition: impop.cxx:1222
const SCCOL EXC_MAXCOL8
Definition: xlconst.hxx:64
SfxObjectShell * GetDocShell() const
Returns the object shell of the Calc document.
Definition: xlroot.cxx:282
SC_DLLPUBLIC void MakeTable(SCTAB nTab, bool _bNeedsNameCheck=true)
Definition: document.cxx:168
void SheetPassword()
Definition: impop.cxx:447
ScRefAddress aRefFormulaEnd
Definition: paramisc.hxx:50
SC_DLLPUBLIC void SetExtDocOptions(std::unique_ptr< ScExtDocOptions > pNewOptions)
Definition: documen3.cxx:2029
void setNumericCell(const ScAddress &rPos, double fVal)
void Wsbool()
Definition: impop.cxx:685
sal_uInt16 mnLastRecId
Current XF identifier from IXFE record.
Definition: imp_op.hxx:109
XclImpStream & aIn
Definition: imp_op.hxx:90
const sal_uInt16 EXC_WSBOOL_COLBELOW
Definition: xlconst.hxx:185
const sal_uInt16 EXC_COLINFO_COLLAPSED
Definition: xltable.hxx:144
BiffTyp eDateiTyp
Definition: root.hxx:47
XclImpColRowSettings * pColRowBuff
Definition: root.hxx:52
void SetDefaultXF(SCCOL nScCol1, SCCOL nScCol2, sal_uInt16 nXFIndex)
Definition: colrowst.cxx:166
void InitializeTable(SCTAB nScTab)
Is called when import filter starts importing a single sheet (all BIFF versions). ...
Definition: xiroot.cxx:95
bool mbBiff2HasXfsValid
Select XF formatting or direct formatting in BIFF2.
Definition: imp_op.hxx:117
Access to global data from other classes.
Definition: xiroot.hxx:125
tools::Long GetCharWidth() const
Returns the width of the '0' character (default font) for the current printer (twips).
Definition: xlroot.hxx:156
const sal_uInt16 EXC_WSBOOL_FITTOPAGE
Definition: xlconst.hxx:186
sal_uInt32 ReaduInt32()
Definition: xistream.cxx:685
XclImpSheetProtectBuffer & GetSheetProtectBuffer() const
Returns the sheet protection options of the current sheet.
Definition: xiroot.cxx:236
This class represents an unformatted or formatted string and provides importing from stream...
Definition: xistring.hxx:30
void ReadBoolErr()
Definition: impop.cxx:345
XclImpDocProtectBuffer & GetDocProtectBuffer() const
Returns the document protection options.
Definition: xiroot.cxx:242
sal_uInt16 mnIxfeIndex
Definition: imp_op.hxx:108
std::unique_ptr< ExtSheetBuffer > pExtSheetBuff
Definition: root.hxx:48
SfxMedium & GetMedium() const
Returns the medium to import from.
Definition: xlroot.hxx:168
void ReadDimensions()
Definition: impop.cxx:224
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:57
sal_Int16 SCTAB
Definition: types.hxx:22
void DefColWidth()
Definition: impop.cxx:636
void ReadRk()
Definition: impop.cxx:373
LastFormulaMapType maLastFormulaCells
Definition: imp_op.hxx:104
sal_Int16 nValue
SCTAB mnDisplTab
Index of displayed sheet.
Definition: scextopt.hxx:32
XclImpOutlineDataBuffer(const XclImpRoot &rRoot, SCTAB nScTab)
Definition: impop.cxx:1393
const sal_uInt16 EXC_ID2_NUMBER
Definition: xltable.hxx:43
ScDocument & getDoc()
static void DecodeUrl(OUString &rUrl, OUString &rTabName, bool &rbSameWb, const XclImpRoot &rRoot, const OUString &rEncodedUrl)
Decodes an encoded external document URL with optional sheet name.
Definition: xihelper.cxx:603
ImportTyp(ScDocument &, rtl_TextEncoding eSrc)
Definition: impop.cxx:74