LCOV - code coverage report
Current view: top level - sc/source/filter/excel - impop.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 309 624 49.5 %
Date: 2012-08-25 Functions: 40 69 58.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 269 1023 26.3 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "imp_op.hxx"
      31                 :            : 
      32                 :            : #include <filter/msfilter/countryid.hxx>
      33                 :            : 
      34                 :            : #include "scitems.hxx"
      35                 :            : #include <editeng/eeitem.hxx>
      36                 :            : 
      37                 :            : #include <editeng/editdata.hxx>
      38                 :            : #include <editeng/editeng.hxx>
      39                 :            : #include <editeng/editobj.hxx>
      40                 :            : #include <editeng/editstat.hxx>
      41                 :            : #include <editeng/flditem.hxx>
      42                 :            : #include <svx/pageitem.hxx>
      43                 :            : #include <editeng/colritem.hxx>
      44                 :            : #include <sfx2/printer.hxx>
      45                 :            : #include <sfx2/docfile.hxx>
      46                 :            : #include <svl/zforlist.hxx>
      47                 :            : 
      48                 :            : #include <sfx2/objsh.hxx>
      49                 :            : #include "tools/urlobj.hxx"
      50                 :            : #include "docuno.hxx"
      51                 :            : 
      52                 :            : #include "cell.hxx"
      53                 :            : #include "document.hxx"
      54                 :            : #include "rangenam.hxx"
      55                 :            : #include "compiler.hxx"
      56                 :            : #include "patattr.hxx"
      57                 :            : #include "attrib.hxx"
      58                 :            : #include "globstr.hrc"
      59                 :            : #include "global.hxx"
      60                 :            : #include "markdata.hxx"
      61                 :            : #include "olinetab.hxx"
      62                 :            : #include "stlsheet.hxx"
      63                 :            : #include "stlpool.hxx"
      64                 :            : #include "viewopti.hxx"
      65                 :            : #include "docoptio.hxx"
      66                 :            : #include "scextopt.hxx"
      67                 :            : #include "editutil.hxx"
      68                 :            : #include "filtopt.hxx"
      69                 :            : #include "scerrors.hxx"
      70                 :            : #include "unonames.hxx"
      71                 :            : #include "paramisc.hxx"
      72                 :            : #include "postit.hxx"
      73                 :            : 
      74                 :            : #include "fapihelper.hxx"
      75                 :            : #include "xltools.hxx"
      76                 :            : #include "xltable.hxx"
      77                 :            : #include "xlview.hxx"
      78                 :            : #include "xltracer.hxx"
      79                 :            : #include "xihelper.hxx"
      80                 :            : #include "xipage.hxx"
      81                 :            : #include "xiview.hxx"
      82                 :            : #include "xilink.hxx"
      83                 :            : #include "xiescher.hxx"
      84                 :            : #include "xicontent.hxx"
      85                 :            : 
      86                 :            : #include "excimp8.hxx"
      87                 :            : #include "excform.hxx"
      88                 :            : 
      89                 :            : #if defined( WNT )
      90                 :            : #include <math.h>
      91                 :            : #else
      92                 :            : #include <stdlib.h>
      93                 :            : #endif
      94                 :            : 
      95                 :            : using namespace ::com::sun::star;
      96                 :            : 
      97                 :            : 
      98                 :            : const double ImportExcel::fExcToTwips =
      99                 :            :     ( double ) TWIPS_PER_CHAR / 256.0;
     100                 :            : 
     101                 :            : 
     102                 :         55 : ImportTyp::ImportTyp( ScDocument* pDoc, CharSet eQ )
     103                 :            : {
     104                 :         55 :     eQuellChar = eQ;
     105                 :         55 :     pD = pDoc;
     106                 :         55 : }
     107                 :            : 
     108                 :            : 
     109                 :         55 : ImportTyp::~ImportTyp()
     110                 :            : {
     111         [ -  + ]:         55 : }
     112                 :            : 
     113                 :            : 
     114                 :          0 : FltError ImportTyp::Read()
     115                 :            : {
     116                 :          0 :     return eERR_INTERN;
     117                 :            : }
     118                 :            : 
     119                 :            : 
     120                 :         55 : ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
     121                 :            :     ImportTyp( &rImpData.mrDoc, rImpData.meTextEnc ),
     122                 :            :     XclImpRoot( rImpData ),
     123                 :         55 :     maStrm( rStrm, GetRoot() ),
     124                 :            :     aIn( maStrm ),
     125   [ +  -  +  - ]:        110 :     maScOleSize( ScAddress::INITIALIZE_INVALID )
                 [ +  - ]
     126                 :            : {
     127                 :         55 :     mnLastRefIdx = 0;
     128                 :         55 :     nBdshtTab = 0;
     129                 :         55 :     nIxfeIndex = 0;     // zur Sicherheit auf 0
     130                 :            : 
     131                 :            :     // Root-Daten fuellen - nach new's ohne Root als Parameter
     132         [ +  - ]:         55 :     pExcRoot = &GetOldRoot();
     133                 :         55 :     pExcRoot->pIR = this;   // ExcRoot -> XclImpRoot
     134                 :         55 :     pExcRoot->eDateiTyp = BiffX;
     135 [ +  - ][ +  - ]:         55 :     pExcRoot->pExtSheetBuff = new ExtSheetBuffer( pExcRoot );   //&aExtSheetBuff;
     136 [ +  - ][ +  - ]:         55 :     pExcRoot->pShrfmlaBuff = new ShrfmlaBuffer( pExcRoot );     //&aShrfrmlaBuff;
     137 [ +  - ][ +  - ]:         55 :     pExcRoot->pExtNameBuff = new ExtNameBuff ( *this );
     138                 :            : 
     139 [ +  - ][ +  - ]:         55 :     pExtNameBuff = new NameBuffer( pExcRoot );          //prevent empty rootdata
     140                 :         55 :     pExtNameBuff->SetBase( 1 );
     141                 :            : 
     142 [ +  - ][ +  - ]:         55 :     pOutlineListBuffer = new XclImpOutlineListBuffer( );
     143                 :            : 
     144                 :            :     // ab Biff8
     145 [ +  - ][ +  - ]:         55 :     pFormConv = pExcRoot->pFmlaConverter = new ExcelToSc( GetRoot() );
     146                 :            : 
     147                 :         55 :     bTabTruncated = false;
     148                 :            : 
     149                 :            :     // Excel-Dokument per Default auf 31.12.1899, entspricht Excel-Einstellungen mit 1.1.1900
     150 [ +  - ][ +  - ]:         55 :     ScDocOptions aOpt = pD->GetDocOptions();
     151                 :         55 :     aOpt.SetDate( 30, 12, 1899 );
     152         [ +  - ]:         55 :     pD->SetDocOptions( aOpt );
     153 [ +  - ][ +  - ]:         55 :     pD->GetFormatTable()->ChangeNullDate( 30, 12, 1899 );
     154                 :            : 
     155 [ +  - ][ +  - ]:         55 :     ScDocOptions aDocOpt( pD->GetDocOptions() );
     156                 :         55 :     aDocOpt.SetIgnoreCase( sal_True );              // always in Excel
     157                 :         55 :     aDocOpt.SetFormulaRegexEnabled( false );    // regular expressions? what's that?
     158                 :         55 :     aDocOpt.SetLookUpColRowNames( false );      // default: no natural language refs
     159 [ +  - ][ +  - ]:         55 :     pD->SetDocOptions( aDocOpt );
                 [ +  - ]
     160                 :         55 : }
     161                 :            : 
     162                 :            : 
     163 [ +  - ][ +  - ]:         55 : ImportExcel::~ImportExcel( void )
     164                 :            : {
     165                 :         55 :     GetDoc().SetSrcCharSet( GetTextEncoding() );
     166                 :            : 
     167 [ +  - ][ +  - ]:         55 :     delete pExtNameBuff;
     168                 :            : 
     169 [ +  - ][ +  - ]:         55 :     delete pOutlineListBuffer;
     170                 :            : 
     171 [ +  - ][ +  - ]:         55 :     delete pFormConv;
     172         [ -  + ]:         55 : }
     173                 :            : 
     174                 :            : 
     175                 :          0 : void ImportExcel::ReadFileSharing()
     176                 :            : {
     177                 :            :     sal_uInt16 nRecommendReadOnly, nPasswordHash;
     178 [ #  # ][ #  # ]:          0 :     maStrm >> nRecommendReadOnly >> nPasswordHash;
     179                 :            : 
     180 [ #  # ][ #  # ]:          0 :     if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) )
     181                 :            :     {
     182 [ #  # ][ #  # ]:          0 :         if( SfxItemSet* pItemSet = GetMedium().GetItemSet() )
     183 [ #  # ][ #  # ]:          0 :             pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
                 [ #  # ]
     184                 :            : 
     185 [ #  # ][ #  # ]:          0 :         if( SfxObjectShell* pShell = GetDocShell() )
     186                 :            :         {
     187         [ #  # ]:          0 :             if( nRecommendReadOnly != 0 )
     188         [ #  # ]:          0 :                 pShell->SetLoadReadonly( sal_True );
     189         [ #  # ]:          0 :             if( nPasswordHash != 0 )
     190         [ #  # ]:          0 :                 pShell->SetModifyPasswordHash( nPasswordHash );
     191                 :            :         }
     192                 :            :     }
     193                 :          0 : }
     194                 :            : 
     195                 :       2445 : sal_uInt16 ImportExcel::ReadXFIndex( bool bBiff2 )
     196                 :            : {
     197                 :       2445 :     sal_uInt16 nXFIdx = 0;
     198         [ -  + ]:       2445 :     if( bBiff2 )
     199                 :            :     {
     200                 :          0 :         sal_uInt8 nXFIdx2 = 0;
     201         [ #  # ]:          0 :         maStrm >> nXFIdx2;
     202         [ #  # ]:          0 :         maStrm.Ignore( 2 );
     203                 :          0 :         nXFIdx = nXFIdx2 & 0x3F;
     204         [ #  # ]:          0 :         if( nXFIdx == 63 )
     205                 :          0 :             nXFIdx = nIxfeIndex;
     206                 :            :     }
     207                 :            :     else
     208         [ +  - ]:       2445 :         aIn >> nXFIdx;
     209                 :       2445 :     return nXFIdx;
     210                 :            : }
     211                 :            : 
     212                 :        165 : void ImportExcel::ReadDimensions()
     213                 :            : {
     214                 :        165 :     XclRange aXclUsedArea( ScAddress::UNINITIALIZED );
     215 [ -  + ][ -  + ]:        165 :     if( (maStrm.GetRecId() == EXC_ID2_DIMENSIONS) || (GetBiff() <= EXC_BIFF5) )
                 [ +  - ]
     216                 :            :     {
     217         [ #  # ]:          0 :         maStrm >> aXclUsedArea;
     218 [ #  # ][ #  # ]:          0 :         if( (aXclUsedArea.GetColCount() > 1) && (aXclUsedArea.GetRowCount() > 1) )
                 [ #  # ]
     219                 :            :         {
     220                 :            :             // Excel stores first unused row/column index
     221                 :          0 :             --aXclUsedArea.maLast.mnCol;
     222                 :          0 :             --aXclUsedArea.maLast.mnRow;
     223                 :            :             // create the Calc range
     224                 :          0 :             SCTAB nScTab = GetCurrScTab();
     225 [ #  # ][ #  # ]:          0 :             ScRange& rScUsedArea = GetExtDocOptions().GetOrCreateTabSettings( nScTab ).maUsedArea;
     226 [ #  # ][ #  # ]:          0 :             GetAddressConverter().ConvertRange( rScUsedArea, aXclUsedArea, nScTab, nScTab, false );
     227                 :            :             // if any error occurs in ConvertRange(), rScUsedArea keeps untouched
     228                 :            :         }
     229                 :            :     }
     230                 :            :     else
     231                 :            :     {
     232                 :            :         sal_uInt32 nXclRow1, nXclRow2;
     233 [ +  - ][ +  - ]:        165 :         maStrm >> nXclRow1 >> nXclRow2 >> aXclUsedArea.maFirst.mnCol >> aXclUsedArea.maLast.mnCol;
         [ +  - ][ +  - ]
     234         [ +  + ]:        291 :         if( (nXclRow1 < nXclRow2) && (aXclUsedArea.GetColCount() > 1) &&
           [ +  -  +  - ]
                 [ +  + ]
     235                 :        126 :             (nXclRow1 <= static_cast< sal_uInt32 >( GetScMaxPos().Row() )) )
     236                 :            :         {
     237                 :            :             // Excel stores first unused row/column index
     238                 :        126 :             --nXclRow2;
     239                 :        126 :             --aXclUsedArea.maLast.mnCol;
     240                 :            :             // convert row indexes to 16-bit values
     241                 :        126 :             aXclUsedArea.maFirst.mnRow = static_cast< sal_uInt16 >( nXclRow1 );
     242         [ +  - ]:        126 :             aXclUsedArea.maLast.mnRow = limit_cast< sal_uInt16 >( nXclRow2, aXclUsedArea.maFirst.mnRow, SAL_MAX_UINT16 );
     243                 :            :             // create the Calc range
     244                 :        126 :             SCTAB nScTab = GetCurrScTab();
     245 [ +  - ][ +  - ]:        126 :             ScRange& rScUsedArea = GetExtDocOptions().GetOrCreateTabSettings( nScTab ).maUsedArea;
     246 [ +  - ][ +  - ]:        165 :             GetAddressConverter().ConvertRange( rScUsedArea, aXclUsedArea, nScTab, nScTab, false );
     247                 :            :             // if any error occurs in ConvertRange(), rScUsedArea keeps untouched
     248                 :            :         }
     249                 :            :     }
     250                 :        165 : }
     251                 :            : 
     252                 :        238 : void ImportExcel::ReadBlank()
     253                 :            : {
     254                 :        238 :     XclAddress aXclPos;
     255         [ +  - ]:        238 :     aIn >> aXclPos;
     256                 :            : 
     257                 :        238 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     258 [ +  - ][ +  - ]:        238 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ +  - ]
     259                 :            :     {
     260         [ +  - ]:        238 :         sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_BLANK );
     261                 :            : 
     262 [ +  - ][ +  - ]:        238 :         GetXFRangeBuffer().SetBlankXF( aScPos, nXFIdx );
     263                 :            :     }
     264                 :        238 : }
     265                 :            : 
     266                 :          0 : void ImportExcel::ReadInteger()
     267                 :            : {
     268                 :          0 :     XclAddress aXclPos;
     269         [ #  # ]:          0 :     maStrm >> aXclPos;
     270                 :            : 
     271                 :          0 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     272 [ #  # ][ #  # ]:          0 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ #  # ]
     273                 :            :     {
     274         [ #  # ]:          0 :         sal_uInt16 nXFIdx = ReadXFIndex( true );
     275                 :            :         sal_uInt16 nValue;
     276         [ #  # ]:          0 :         maStrm >> nValue;
     277                 :            : 
     278 [ #  # ][ #  # ]:          0 :         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     279 [ #  # ][ #  # ]:          0 :         GetDoc().PutCell( aScPos, new ScValueCell( nValue ) );
                 [ #  # ]
     280                 :            :     }
     281                 :          0 : }
     282                 :            : 
     283                 :        243 : void ImportExcel::ReadNumber()
     284                 :            : {
     285                 :        243 :     XclAddress aXclPos;
     286         [ +  - ]:        243 :     maStrm >> aXclPos;
     287                 :            : 
     288                 :        243 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     289 [ +  - ][ +  - ]:        243 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ +  - ]
     290                 :            :     {
     291         [ +  - ]:        243 :         sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_NUMBER );
     292                 :            :         double fValue;
     293         [ +  - ]:        243 :         maStrm >> fValue;
     294                 :            : 
     295 [ +  - ][ +  - ]:        243 :         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     296 [ +  - ][ +  - ]:        243 :         GetDoc().PutCell( aScPos, new ScValueCell( fValue ) );
                 [ +  - ]
     297                 :            :     }
     298                 :        243 : }
     299                 :            : 
     300                 :          0 : void ImportExcel::ReadLabel()
     301                 :            : {
     302                 :          0 :     XclAddress aXclPos;
     303         [ #  # ]:          0 :     maStrm >> aXclPos;
     304                 :            : 
     305                 :          0 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     306 [ #  # ][ #  # ]:          0 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ #  # ]
     307                 :            :     {
     308                 :            :         /*  Record ID   BIFF    XF type     String type
     309                 :            :             0x0004      2-7     3 byte      8-bit length, byte string
     310                 :            :             0x0004      8       3 byte      16-bit length, unicode string
     311                 :            :             0x0204      2-7     2 byte      16-bit length, byte string
     312                 :            :             0x0204      8       2 byte      16-bit length, unicode string */
     313                 :          0 :         bool bBiff2 = maStrm.GetRecId() == EXC_ID2_LABEL;
     314         [ #  # ]:          0 :         sal_uInt16 nXFIdx = ReadXFIndex( bBiff2 );
     315 [ #  # ][ #  # ]:          0 :         XclStrFlags nFlags = (bBiff2 && (GetBiff() <= EXC_BIFF5)) ? EXC_STR_8BITLENGTH : EXC_STR_DEFAULT;
     316         [ #  # ]:          0 :         XclImpString aString;
     317                 :            : 
     318                 :            :         // #i63105# use text encoding from FONT record
     319                 :          0 :         rtl_TextEncoding eOldTextEnc = GetTextEncoding();
     320 [ #  # ][ #  # ]:          0 :         if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
                 [ #  # ]
     321 [ #  # ][ #  # ]:          0 :             SetTextEncoding( pFont->GetFontEncoding() );
     322         [ #  # ]:          0 :         aString.Read( maStrm, nFlags );
     323         [ #  # ]:          0 :         SetTextEncoding( eOldTextEnc );
     324                 :            : 
     325 [ #  # ][ #  # ]:          0 :         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     326 [ #  # ][ #  # ]:          0 :         if( ScBaseCell* pCell = XclImpStringHelper::CreateCell( GetRoot(), aString, nXFIdx ) )
     327 [ #  # ][ #  # ]:          0 :             GetDoc().PutCell( aScPos, pCell );
     328                 :            :     }
     329                 :          0 : }
     330                 :            : 
     331                 :          0 : void ImportExcel::ReadBoolErr()
     332                 :            : {
     333                 :          0 :     XclAddress aXclPos;
     334         [ #  # ]:          0 :     maStrm >> aXclPos;
     335                 :            : 
     336                 :          0 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     337 [ #  # ][ #  # ]:          0 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ #  # ]
     338                 :            :     {
     339         [ #  # ]:          0 :         sal_uInt16 nXFIdx = ReadXFIndex( maStrm.GetRecId() == EXC_ID2_BOOLERR );
     340                 :            :         sal_uInt8 nValue, nType;
     341 [ #  # ][ #  # ]:          0 :         maStrm >> nValue >> nType;
     342                 :            : 
     343         [ #  # ]:          0 :         if( nType == EXC_BOOLERR_BOOL )
     344 [ #  # ][ #  # ]:          0 :             GetXFRangeBuffer().SetBoolXF( aScPos, nXFIdx );
     345                 :            :         else
     346 [ #  # ][ #  # ]:          0 :             GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     347                 :            : 
     348                 :            :         double fValue;
     349         [ #  # ]:          0 :         const ScTokenArray* pScTokArr = ErrorToFormula( nType, nValue, fValue );
     350 [ #  # ][ #  # ]:          0 :         ScFormulaCell* pCell = new ScFormulaCell( pD, aScPos, pScTokArr );
     351         [ #  # ]:          0 :         pCell->SetHybridDouble( fValue );
     352 [ #  # ][ #  # ]:          0 :         GetDoc().PutCell( aScPos, pCell );
     353                 :            :     }
     354                 :          0 : }
     355                 :            : 
     356                 :       1964 : void ImportExcel::ReadRk()
     357                 :            : {
     358                 :       1964 :     XclAddress aXclPos;
     359         [ +  - ]:       1964 :     maStrm >> aXclPos;
     360                 :            : 
     361                 :       1964 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     362 [ +  - ][ +  - ]:       1964 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ +  - ]
     363                 :            :     {
     364         [ +  - ]:       1964 :         sal_uInt16 nXFIdx = ReadXFIndex( false );
     365                 :            :         sal_Int32 nRk;
     366         [ +  - ]:       1964 :         maStrm >> nRk;
     367                 :            : 
     368 [ +  - ][ +  - ]:       1964 :         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     369 [ +  - ][ +  - ]:       1964 :         GetDoc().PutCell( aScPos, new ScValueCell( XclTools::GetDoubleFromRK( nRk ) ) );
         [ +  - ][ +  - ]
     370                 :            :     }
     371                 :       1964 : }
     372                 :            : 
     373                 :            : 
     374                 :         49 : void ImportExcel::Window1()
     375                 :            : {
     376                 :         49 :     GetDocViewSettings().ReadWindow1( maStrm );
     377                 :         49 : }
     378                 :            : 
     379                 :            : 
     380                 :            : 
     381                 :            : 
     382                 :          0 : void ImportExcel::Row25( void )
     383                 :            : {
     384                 :            :     sal_uInt16  nRow, nRowHeight;
     385                 :            : 
     386         [ #  # ]:          0 :     aIn >> nRow;
     387         [ #  # ]:          0 :     aIn.Ignore( 4 );   // Mic und Mac ueberspringen
     388                 :            : 
     389         [ #  # ]:          0 :     if( ValidRow( nRow ) )
     390                 :            :     {
     391         [ #  # ]:          0 :         aIn >> nRowHeight;  // direkt in Twips angegeben
     392         [ #  # ]:          0 :         aIn.Ignore( 2 );
     393                 :            : 
     394         [ #  # ]:          0 :         if( GetBiff() == EXC_BIFF2 )
     395                 :            :         {// -------------------- BIFF2
     396         [ #  # ]:          0 :             pColRowBuff->SetHeight( nRow, nRowHeight );
     397                 :            :         }
     398                 :            :         else
     399                 :            :         {// -------------------- BIFF5
     400                 :            :             sal_uInt16  nGrbit;
     401                 :            : 
     402         [ #  # ]:          0 :             aIn.Ignore( 2 );   // reserved
     403         [ #  # ]:          0 :             aIn >> nGrbit;
     404                 :            : 
     405                 :          0 :             sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
     406         [ #  # ]:          0 :             pRowOutlineBuff->SetLevel( nRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
     407         [ #  # ]:          0 :             pColRowBuff->SetRowSettings( nRow, nRowHeight, nGrbit );
     408                 :            :         }
     409                 :            :     }
     410                 :          0 : }
     411                 :            : 
     412                 :            : 
     413                 :          0 : void ImportExcel::Bof2( void )
     414                 :            : {
     415                 :            :     sal_uInt16 nSubType;
     416         [ #  # ]:          0 :     maStrm.DisableDecryption();
     417         [ #  # ]:          0 :     maStrm.Ignore( 2 );
     418         [ #  # ]:          0 :     maStrm >> nSubType;
     419                 :            : 
     420         [ #  # ]:          0 :     if( nSubType == 0x0020 )        // Chart
     421                 :          0 :         pExcRoot->eDateiTyp = Biff2C;
     422         [ #  # ]:          0 :     else if( nSubType == 0x0040 )   // Macro
     423                 :          0 :         pExcRoot->eDateiTyp = Biff2M;
     424                 :            :     else                            // #i51490# Excel interprets invalid indexes as worksheet
     425                 :          0 :         pExcRoot->eDateiTyp = Biff2;
     426                 :          0 : }
     427                 :            : 
     428                 :            : 
     429                 :        165 : void ImportExcel::Eof( void )
     430                 :            : {
     431                 :            :     //  POST: darf nur nach einer GUELTIGEN Tabelle gerufen werden!
     432                 :        165 :     EndSheet();
     433                 :        165 :     IncCurrScTab();
     434                 :        165 : }
     435                 :            : 
     436                 :            : 
     437                 :          3 : void ImportExcel::SheetPassword( void )
     438                 :            : {
     439         [ -  + ]:          3 :     if (GetRoot().GetBiff() != EXC_BIFF8)
     440                 :          3 :         return;
     441                 :            : 
     442                 :          3 :     GetRoot().GetSheetProtectBuffer().ReadPasswordHash( aIn, GetCurrScTab() );
     443                 :            : }
     444                 :            : 
     445                 :            : 
     446                 :          0 : void ImportExcel::Externsheet( void )
     447                 :            : {
     448 [ #  # ][ #  # ]:          0 :     String aUrl, aTabName;
     449                 :            :     bool bSameWorkBook;
     450         [ #  # ]:          0 :     String aEncodedUrl( aIn.ReadByteString( false ) );
     451         [ #  # ]:          0 :     XclImpUrlHelper::DecodeUrl( aUrl, aTabName, bSameWorkBook, *pExcRoot->pIR, aEncodedUrl );
     452 [ #  # ][ #  # ]:          0 :     mnLastRefIdx = pExcRoot->pExtSheetBuff->Add( aUrl, aTabName, bSameWorkBook );
         [ #  # ][ #  # ]
     453                 :          0 : }
     454                 :            : 
     455                 :            : 
     456                 :         28 : void ImportExcel:: WinProtection( void )
     457                 :            : {
     458         [ -  + ]:         28 :     if (GetRoot().GetBiff() != EXC_BIFF8)
     459                 :         28 :         return;
     460                 :            : 
     461                 :         28 :     GetRoot().GetDocProtectBuffer().ReadWinProtect( aIn );
     462                 :            : }
     463                 :            : 
     464                 :            : 
     465                 :          0 : void ImportExcel::Columndefault( void )
     466                 :            : {// Default Cell Attributes
     467                 :            :     sal_uInt16  nColMic, nColMac;
     468                 :            :     sal_uInt8   nOpt0;
     469                 :            : 
     470 [ #  # ][ #  # ]:          0 :     aIn >> nColMic >> nColMac;
     471                 :            : 
     472                 :            :     OSL_ENSURE( aIn.GetRecLeft() == (sal_Size)(nColMac - nColMic) * 3 + 2,
     473                 :            :                 "ImportExcel::Columndefault - wrong record size" );
     474                 :            : 
     475                 :          0 :     nColMac--;
     476                 :            : 
     477         [ #  # ]:          0 :     if( nColMac > MAXCOL )
     478                 :          0 :         nColMac = static_cast<sal_uInt16>(MAXCOL);
     479                 :            : 
     480         [ #  # ]:          0 :     for( sal_uInt16 nCol = nColMic ; nCol <= nColMac ; nCol++ )
     481                 :            :     {
     482         [ #  # ]:          0 :         aIn >> nOpt0;
     483         [ #  # ]:          0 :         aIn.Ignore( 2 );   // nur 0. Attribut-Byte benutzt
     484                 :            : 
     485         [ #  # ]:          0 :         if( nOpt0 & 0x80 )  // Col hidden?
     486         [ #  # ]:          0 :             pColRowBuff->HideCol( nCol );
     487                 :            :     }
     488                 :          0 : }
     489                 :            : 
     490                 :            : 
     491                 :          0 : void ImportExcel::Array25( void )
     492                 :            : {
     493                 :            :     sal_uInt16      nFirstRow, nLastRow, nFormLen;
     494                 :            :     sal_uInt8       nFirstCol, nLastCol;
     495                 :            : 
     496 [ #  # ][ #  # ]:          0 :     aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol;
         [ #  # ][ #  # ]
     497                 :            : 
     498         [ #  # ]:          0 :     if( GetBiff() == EXC_BIFF2 )
     499                 :            :     {//                     BIFF2
     500         [ #  # ]:          0 :         aIn.Ignore( 1 );
     501         [ #  # ]:          0 :         nFormLen = aIn.ReaduInt8();
     502                 :            :     }
     503                 :            :     else
     504                 :            :     {//                     BIFF5
     505         [ #  # ]:          0 :         aIn.Ignore( 6 );
     506         [ #  # ]:          0 :         aIn >> nFormLen;
     507                 :            :     }
     508                 :            : 
     509         [ #  # ]:          0 :     if( ValidColRow( nLastCol, nLastRow ) )
     510                 :            :     {
     511                 :            :         // jetzt steht Lesemarke auf Formel, Laenge in nFormLen
     512                 :            :         const ScTokenArray* pErgebnis;
     513                 :            : 
     514                 :            :         pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
     515         [ #  # ]:          0 :                     static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
     516         [ #  # ]:          0 :         pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
     517                 :            : 
     518                 :            :         OSL_ENSURE( pErgebnis, "*ImportExcel::Array25(): ScTokenArray ist NULL!" );
     519                 :            : 
     520         [ #  # ]:          0 :         ScMarkData          aMarkData;
     521         [ #  # ]:          0 :         aMarkData.SelectOneTable( GetCurrScTab() );
     522                 :            :         pD->InsertMatrixFormula( static_cast<SCCOL>(nFirstCol),
     523                 :            :                 static_cast<SCROW>(nFirstRow), static_cast<SCCOL>(nLastCol),
     524         [ #  # ]:          0 :                 static_cast<SCROW>(nLastRow), aMarkData, EMPTY_STRING,
     525 [ #  # ][ #  # ]:          0 :                 pErgebnis );
                 [ #  # ]
     526                 :            :     }
     527                 :          0 : }
     528                 :            : 
     529                 :            : 
     530                 :         49 : void ImportExcel::Rec1904( void )
     531                 :            : {
     532                 :            :     sal_uInt16  n1904;
     533                 :            : 
     534         [ +  - ]:         49 :     aIn >> n1904;
     535                 :            : 
     536         [ -  + ]:         49 :     if( n1904 )
     537                 :            :     {// 1904 date system
     538 [ #  # ][ #  # ]:          0 :         ScDocOptions aOpt = pD->GetDocOptions();
     539                 :          0 :         aOpt.SetDate( 1, 1, 1904 );
     540         [ #  # ]:          0 :         pD->SetDocOptions( aOpt );
     541 [ #  # ][ #  # ]:          0 :         pD->GetFormatTable()->ChangeNullDate( 1, 1, 1904 );
                 [ #  # ]
     542                 :            :     }
     543                 :         49 : }
     544                 :            : 
     545                 :            : 
     546                 :          0 : void ImportExcel::Externname25( void )
     547                 :            : {
     548                 :            :     sal_uInt32      nRes;
     549                 :            :     sal_uInt16      nOpt;
     550                 :            : 
     551 [ #  # ][ #  # ]:          0 :     aIn >> nOpt >> nRes;
     552                 :            : 
     553         [ #  # ]:          0 :     String aName( aIn.ReadByteString( false ) );
     554                 :            : 
     555 [ #  # ][ #  # ]:          0 :     if( ( nOpt & 0x0001 ) || ( ( nOpt & 0xFFFE ) == 0x0000 ) )
     556                 :            :     {// external name
     557         [ #  # ]:          0 :         ScfTools::ConvertToScDefinedName( aName );
     558         [ #  # ]:          0 :         pExcRoot->pExtNameBuff->AddName( aName, mnLastRefIdx );
     559                 :            :     }
     560         [ #  # ]:          0 :     else if( nOpt & 0x0010 )
     561                 :            :     {// ole link
     562         [ #  # ]:          0 :         pExcRoot->pExtNameBuff->AddOLE( aName, mnLastRefIdx, nRes );        // nRes is storage ID
     563                 :            :     }
     564                 :            :     else
     565                 :            :     {// dde link
     566         [ #  # ]:          0 :         pExcRoot->pExtNameBuff->AddDDE( aName, mnLastRefIdx );
     567         [ #  # ]:          0 :     }
     568                 :          0 : }
     569                 :            : 
     570                 :            : 
     571                 :          0 : void ImportExcel::Colwidth( void )
     572                 :            : {// Column Width
     573                 :            :     sal_uInt8   nColFirst, nColLast;
     574                 :            :     sal_uInt16  nColWidth;
     575                 :            : 
     576 [ #  # ][ #  # ]:          0 :     aIn >> nColFirst >> nColLast >> nColWidth;
                 [ #  # ]
     577                 :            : 
     578                 :            : //! TODO: add a check for the unlikely case of changed MAXCOL (-> XclImpAddressConverter)
     579                 :            : //   if( nColLast > MAXCOL )
     580                 :            : //       nColLast = static_cast<sal_uInt16>(MAXCOL);
     581                 :            : 
     582         [ #  # ]:          0 :     sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
     583         [ #  # ]:          0 :     pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
     584                 :          0 : }
     585                 :            : 
     586                 :            : 
     587                 :          0 : void ImportExcel::Defrowheight2( void )
     588                 :            : {
     589                 :            :     sal_uInt16 nDefHeight;
     590         [ #  # ]:          0 :     maStrm >> nDefHeight;
     591                 :          0 :     nDefHeight &= 0x7FFF;
     592         [ #  # ]:          0 :     pColRowBuff->SetDefHeight( nDefHeight, EXC_DEFROW_UNSYNCED );
     593                 :          0 : }
     594                 :            : 
     595                 :            : 
     596                 :         36 : void ImportExcel::SheetProtect( void )
     597                 :            : {
     598         [ -  + ]:         36 :     if (GetRoot().GetBiff() != EXC_BIFF8)
     599                 :         36 :         return;
     600                 :            : 
     601                 :         36 :     GetRoot().GetSheetProtectBuffer().ReadProtect( aIn, GetCurrScTab() );
     602                 :            : }
     603                 :            : 
     604                 :         28 : void ImportExcel::DocProtect( void )
     605                 :            : {
     606         [ -  + ]:         28 :     if (GetRoot().GetBiff() != EXC_BIFF8)
     607                 :         28 :         return;
     608                 :            : 
     609                 :         28 :     GetRoot().GetDocProtectBuffer().ReadDocProtect( aIn );
     610                 :            : }
     611                 :            : 
     612                 :         28 : void ImportExcel::DocPasssword( void )
     613                 :            : {
     614         [ -  + ]:         28 :     if (GetRoot().GetBiff() != EXC_BIFF8)
     615                 :         28 :         return;
     616                 :            : 
     617                 :         28 :     GetRoot().GetDocProtectBuffer().ReadPasswordHash( aIn );
     618                 :            : }
     619                 :            : 
     620                 :         49 : void ImportExcel::Codepage( void )
     621                 :            : {
     622                 :         49 :     SetCodePage( maStrm.ReaduInt16() );
     623                 :         49 : }
     624                 :            : 
     625                 :            : 
     626                 :          0 : void ImportExcel::Ixfe( void )
     627                 :            : {
     628                 :          0 :     aIn >> nIxfeIndex;
     629                 :          0 : }
     630                 :            : 
     631                 :            : 
     632                 :        162 : void ImportExcel::DefColWidth( void )
     633                 :            : {
     634                 :            :     // stored as entire characters -> convert to 1/256 of characters (as in COLINFO)
     635                 :        162 :     double fDefWidth = 256.0 * maStrm.ReaduInt16();
     636                 :            : 
     637                 :            :     // #i3006# additional space for default width - Excel adds space depending on font size
     638                 :        162 :     long nFontHt = GetFontBuffer().GetAppFontData().mnHeight;
     639                 :        162 :     fDefWidth += XclTools::GetXclDefColWidthCorrection( nFontHt );
     640                 :            : 
     641                 :        162 :     sal_uInt16 nScWidth = XclTools::GetScColumnWidth( limit_cast< sal_uInt16 >( fDefWidth ), GetCharWidth() );
     642                 :        162 :     pColRowBuff->SetDefWidth( nScWidth );
     643                 :        162 : }
     644                 :            : 
     645                 :            : 
     646                 :          0 : void ImportExcel::Builtinfmtcnt( void )
     647                 :            : {
     648                 :          0 : }
     649                 :            : 
     650                 :            : 
     651                 :        291 : void ImportExcel::Colinfo( void )
     652                 :            : {// Column Formatting Information
     653                 :            :     sal_uInt16  nColFirst, nColLast, nColWidth, nXF;
     654                 :            :     sal_uInt16  nOpt;
     655                 :            : 
     656 [ +  - ][ +  - ]:        291 :     aIn >> nColFirst >> nColLast >> nColWidth >> nXF >> nOpt;
         [ +  - ][ +  - ]
                 [ +  - ]
     657                 :            : 
     658         [ +  - ]:        291 :     if( nColFirst > MAXCOL )
     659                 :        291 :         return;
     660                 :            : 
     661         [ -  + ]:        291 :     if( nColLast > MAXCOL )
     662                 :          0 :         nColLast = static_cast<sal_uInt16>(MAXCOL);
     663                 :            : 
     664                 :        291 :     bool bHidden = ::get_flag( nOpt, EXC_COLINFO_HIDDEN );
     665                 :        291 :     bool bCollapsed = ::get_flag( nOpt, EXC_COLINFO_COLLAPSED );
     666                 :        291 :     sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nOpt, 8, 3 );
     667         [ +  - ]:        291 :     pColOutlineBuff->SetLevelRange( nColFirst, nColLast, nLevel, bCollapsed );
     668                 :            : 
     669         [ +  + ]:        291 :     if( bHidden )
     670         [ +  - ]:          3 :         pColRowBuff->HideColRange( nColFirst, nColLast );
     671                 :            : 
     672         [ +  - ]:        291 :     sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
     673         [ +  - ]:        291 :     pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
     674         [ +  - ]:        291 :     pColRowBuff->SetDefaultXF( nColFirst, nColLast, nXF );
     675                 :            : }
     676                 :            : 
     677                 :            : 
     678                 :        165 : void ImportExcel::Wsbool( void )
     679                 :            : {
     680                 :            :     sal_uInt16 nFlags;
     681         [ +  - ]:        165 :     aIn >> nFlags;
     682                 :            : 
     683         [ +  - ]:        165 :     pRowOutlineBuff->SetButtonMode( ::get_flag( nFlags, EXC_WSBOOL_ROWBELOW ) );
     684         [ +  - ]:        165 :     pColOutlineBuff->SetButtonMode( ::get_flag( nFlags, EXC_WSBOOL_COLBELOW ) );
     685                 :            : 
     686         [ +  - ]:        165 :     GetPageSettings().SetFitToPages( ::get_flag( nFlags, EXC_WSBOOL_FITTOPAGE ) );
     687                 :        165 : }
     688                 :            : 
     689                 :            : 
     690                 :          0 : void ImportExcel::Boundsheet( void )
     691                 :            : {
     692                 :          0 :     sal_uInt16 nGrbit = 0;
     693                 :            : 
     694         [ #  # ]:          0 :     if( GetBiff() == EXC_BIFF5 )
     695                 :            :     {
     696         [ #  # ]:          0 :         aIn.DisableDecryption();
     697 [ #  # ][ #  # ]:          0 :         maSheetOffsets.push_back( aIn.ReaduInt32() );
     698         [ #  # ]:          0 :         aIn.EnableDecryption();
     699         [ #  # ]:          0 :         aIn >> nGrbit;
     700                 :            :     }
     701                 :            : 
     702 [ #  # ][ #  # ]:          0 :     rtl::OUString aName( aIn.ReadByteString( false ) );
                 [ #  # ]
     703                 :            : 
     704                 :          0 :     SCTAB nScTab = static_cast< SCTAB >( nBdshtTab );
     705         [ #  # ]:          0 :     if( nScTab > 0 )
     706                 :            :     {
     707                 :            :         OSL_ENSURE( !pD->HasTable( nScTab ), "ImportExcel::Boundsheet - sheet exists already" );
     708         [ #  # ]:          0 :         pD->MakeTable( nScTab );
     709                 :            :     }
     710                 :            : 
     711 [ #  # ][ #  # ]:          0 :     if( ( nGrbit & 0x0001 ) || ( nGrbit & 0x0002 ) )
     712         [ #  # ]:          0 :         pD->SetVisible( nScTab, false );
     713                 :            : 
     714 [ #  # ][ #  # ]:          0 :     if( !pD->RenameTab( nScTab, aName ) )
     715                 :            :     {
     716         [ #  # ]:          0 :         pD->CreateValidTabName( aName );
     717         [ #  # ]:          0 :         pD->RenameTab( nScTab, aName );
     718                 :            :     }
     719                 :            : 
     720                 :          0 :     nBdshtTab++;
     721                 :          0 : }
     722                 :            : 
     723                 :            : 
     724                 :         46 : void ImportExcel::Country( void )
     725                 :            : {
     726                 :            :     sal_uInt16 nUICountry, nDocCountry;
     727 [ +  - ][ +  - ]:         46 :     maStrm >> nUICountry >> nDocCountry;
     728                 :            : 
     729                 :            :     // Store system language in XclRoot
     730         [ +  - ]:         46 :     LanguageType eLanguage = ::msfilter::ConvertCountryToLanguage( static_cast< ::msfilter::CountryId >( nDocCountry ) );
     731         [ +  - ]:         46 :     if( eLanguage != LANGUAGE_DONTKNOW )
     732                 :         46 :         SetDocLanguage( eLanguage );
     733                 :            : 
     734                 :            :     // Set Excel UI language in add-in name translator
     735         [ +  - ]:         46 :     eLanguage = ::msfilter::ConvertCountryToLanguage( static_cast< ::msfilter::CountryId >( nUICountry ) );
     736         [ +  - ]:         46 :     if( eLanguage != LANGUAGE_DONTKNOW )
     737                 :         46 :         SetUILanguage( eLanguage );
     738                 :         46 : }
     739                 :            : 
     740                 :            : 
     741                 :         46 : void ImportExcel::ReadUsesElfs()
     742                 :            : {
     743         [ +  + ]:         46 :     if( maStrm.ReaduInt16() != 0 )
     744                 :            :     {
     745 [ +  - ][ +  - ]:         27 :         ScDocOptions aDocOpt = GetDoc().GetDocOptions();
     746                 :         27 :         aDocOpt.SetLookUpColRowNames( sal_True );
     747 [ +  - ][ +  - ]:         27 :         GetDoc().SetDocOptions( aDocOpt );
     748                 :            :     }
     749                 :         46 : }
     750                 :            : 
     751                 :            : 
     752                 :         49 : void ImportExcel::Hideobj( void )
     753                 :            : {
     754                 :            :     sal_uInt16      nHide;
     755                 :            :     ScVObjMode  eOle, eChart, eDraw;
     756                 :            : 
     757         [ +  - ]:         49 :     aIn >> nHide;
     758                 :            : 
     759 [ +  - ][ +  - ]:         49 :     ScViewOptions aOpts( pD->GetViewOptions() );
     760                 :            : 
     761      [ -  -  + ]:         49 :     switch( nHide )
     762                 :            :     {
     763                 :            :         case 1:                         // Placeholders
     764                 :          0 :             eOle   = VOBJ_MODE_SHOW;    // in Excel 97 werden nur Charts als Platzhalter angezeigt
     765                 :          0 :             eChart = VOBJ_MODE_SHOW;    //#i80528# VOBJ_MODE_DUMMY replaced by VOBJ_MODE_SHOW now
     766                 :          0 :             eDraw  = VOBJ_MODE_SHOW;
     767                 :          0 :             break;
     768                 :            :         case 2:                         // Hide all
     769                 :          0 :             eOle   = VOBJ_MODE_HIDE;
     770                 :          0 :             eChart = VOBJ_MODE_HIDE;
     771                 :          0 :             eDraw  = VOBJ_MODE_HIDE;
     772                 :          0 :             break;
     773                 :            :         default:                        // Show all
     774                 :         49 :             eOle   = VOBJ_MODE_SHOW;
     775                 :         49 :             eChart = VOBJ_MODE_SHOW;
     776                 :         49 :             eDraw  = VOBJ_MODE_SHOW;
     777                 :         49 :             break;
     778                 :            :     }
     779                 :            : 
     780                 :         49 :     aOpts.SetObjMode( VOBJ_TYPE_OLE,   eOle );
     781                 :         49 :     aOpts.SetObjMode( VOBJ_TYPE_CHART, eChart );
     782                 :         49 :     aOpts.SetObjMode( VOBJ_TYPE_DRAW,  eDraw );
     783                 :            : 
     784 [ +  - ][ +  - ]:         49 :     pD->SetViewOptions( aOpts );
     785                 :         49 : }
     786                 :            : 
     787                 :            : 
     788                 :          0 : void ImportExcel::Bundleheader( void )
     789                 :            : {
     790                 :          0 : }
     791                 :            : 
     792                 :            : 
     793                 :          0 : void ImportExcel::Standardwidth( void )
     794                 :            : {
     795                 :          0 :     sal_uInt16 nScWidth = XclTools::GetScColumnWidth( maStrm.ReaduInt16(), GetCharWidth() );
     796                 :          0 :     pColRowBuff->SetDefWidth( nScWidth, sal_True );
     797                 :          0 : }
     798                 :            : 
     799                 :            : 
     800                 :          0 : void ImportExcel::Shrfmla( void )
     801                 :            : {
     802                 :            :     sal_uInt16              nFirstRow, nLastRow, nLenExpr;
     803                 :            :     sal_uInt8               nFirstCol, nLastCol;
     804                 :            : 
     805 [ #  # ][ #  # ]:          0 :     aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol;
         [ #  # ][ #  # ]
     806         [ #  # ]:          0 :     aIn.Ignore( 2 );
     807         [ #  # ]:          0 :     aIn >> nLenExpr;
     808                 :            : 
     809                 :            :     // jetzt steht Lesemarke an der Formel
     810                 :            : 
     811                 :            :     const ScTokenArray* pErgebnis;
     812                 :            : 
     813         [ #  # ]:          0 :     pFormConv->Reset();
     814         [ #  # ]:          0 :     pFormConv->Convert( pErgebnis, maStrm, nLenExpr, true, FT_SharedFormula );
     815                 :            : 
     816                 :            : 
     817                 :            :     OSL_ENSURE( pErgebnis, "+ImportExcel::Shrfmla(): ScTokenArray ist NULL!" );
     818                 :            : 
     819                 :            :     pExcRoot->pShrfmlaBuff->Store( ScRange( static_cast<SCCOL>(nFirstCol),
     820                 :          0 :                 static_cast<SCROW>(nFirstRow), GetCurrScTab(),
     821                 :            :                 static_cast<SCCOL>(nLastCol), static_cast<SCROW>(nLastRow),
     822         [ #  # ]:          0 :                 GetCurrScTab()), *pErgebnis );
     823                 :          0 : }
     824                 :            : 
     825                 :            : 
     826                 :        426 : void ImportExcel::Mulrk( void )
     827                 :            : {
     828                 :        426 :     XclAddress aXclPos;
     829                 :            :     sal_uInt16  nXF;
     830                 :            :     sal_Int32   nRkNum;
     831                 :            : 
     832         [ +  - ]:        426 :     aIn >> aXclPos;
     833                 :            : 
     834 [ +  - ][ +  - ]:       2064 :     for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
         [ +  + ][ +  + ]
     835                 :            :     {
     836 [ +  - ][ +  - ]:       1638 :         aIn >> nXF >> nRkNum;
     837                 :            : 
     838                 :       1638 :         ScAddress aScPos( ScAddress::UNINITIALIZED );
     839 [ +  - ][ +  - ]:       1638 :         if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
                 [ +  - ]
     840                 :            :         {
     841 [ +  - ][ +  - ]:       1638 :             GetXFRangeBuffer().SetXF( aScPos, nXF );
     842 [ +  - ][ +  - ]:       1638 :             GetDoc().PutCell( aScPos, new ScValueCell( XclTools::GetDoubleFromRK( nRkNum ) ) );
         [ +  - ][ +  - ]
     843                 :            :         }
     844                 :            :     }
     845                 :        426 : }
     846                 :            : 
     847                 :            : 
     848                 :        330 : void ImportExcel::Mulblank( void )
     849                 :            : {
     850                 :        330 :     XclAddress aXclPos;
     851                 :            :     sal_uInt16  nXF;
     852                 :            : 
     853         [ +  - ]:        330 :     aIn >> aXclPos;
     854                 :            : 
     855 [ +  - ][ +  - ]:       2586 :     for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
         [ +  + ][ +  + ]
     856                 :            :     {
     857         [ +  - ]:       2256 :         aIn >> nXF;
     858                 :            : 
     859                 :       2256 :         ScAddress aScPos( ScAddress::UNINITIALIZED );
     860 [ +  - ][ +  - ]:       2256 :         if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
                 [ +  - ]
     861 [ +  - ][ +  - ]:       2256 :             GetXFRangeBuffer().SetBlankXF( aScPos, nXF );
     862                 :            :     }
     863                 :        330 : }
     864                 :            : 
     865                 :            : 
     866                 :          0 : void ImportExcel::Rstring( void )
     867                 :            : {
     868                 :          0 :     XclAddress aXclPos;
     869                 :            :     sal_uInt16 nXFIdx;
     870 [ #  # ][ #  # ]:          0 :     aIn >> aXclPos >> nXFIdx;
     871                 :            : 
     872                 :          0 :     ScAddress aScPos( ScAddress::UNINITIALIZED );
     873 [ #  # ][ #  # ]:          0 :     if( GetAddressConverter().ConvertAddress( aScPos, aXclPos, GetCurrScTab(), true ) )
                 [ #  # ]
     874                 :            :     {
     875                 :            :         // unformatted Unicode string with separate formatting information
     876         [ #  # ]:          0 :         XclImpString aString;
     877                 :            : 
     878                 :            :         // #i63105# use text encoding from FONT record
     879                 :          0 :         rtl_TextEncoding eOldTextEnc = GetTextEncoding();
     880 [ #  # ][ #  # ]:          0 :         if( const XclImpFont* pFont = GetXFBuffer().GetFont( nXFIdx ) )
                 [ #  # ]
     881 [ #  # ][ #  # ]:          0 :             SetTextEncoding( pFont->GetFontEncoding() );
     882         [ #  # ]:          0 :         aString.Read( maStrm );
     883         [ #  # ]:          0 :         SetTextEncoding( eOldTextEnc );
     884                 :            : 
     885                 :            :         // character formatting runs
     886         [ #  # ]:          0 :         if( !aString.IsRich() )
     887         [ #  # ]:          0 :             aString.ReadFormats( maStrm );
     888                 :            : 
     889 [ #  # ][ #  # ]:          0 :         GetXFRangeBuffer().SetXF( aScPos, nXFIdx );
     890 [ #  # ][ #  # ]:          0 :         if( ScBaseCell* pCell = XclImpStringHelper::CreateCell( *this, aString, nXFIdx ) )
     891 [ #  # ][ #  # ]:          0 :             GetDoc().PutCell( aScPos, pCell );
     892                 :            :     }
     893                 :          0 : }
     894                 :            : 
     895                 :            : 
     896                 :         30 : void ImportExcel::Cellmerging()
     897                 :            : {
     898         [ +  - ]:         30 :     XclImpAddressConverter& rAddrConv = GetAddressConverter();
     899                 :         30 :     SCTAB nScTab = GetCurrScTab();
     900                 :            : 
     901                 :            :     sal_uInt16 nCount;
     902         [ +  - ]:         30 :     maStrm >> nCount;
     903 [ +  + ][ +  - ]:         75 :     for( sal_uInt16 nIdx = 0; (nIdx < nCount) && (maStrm.GetRecLeft() >= 8); ++nIdx )
         [ +  - ][ +  + ]
     904                 :            :     {
     905                 :         45 :         XclRange aXclRange;
     906         [ +  - ]:         45 :         maStrm >> aXclRange;    // 16-bit rows and columns
     907                 :         45 :         ScRange aScRange( ScAddress::UNINITIALIZED );
     908 [ +  - ][ +  - ]:         45 :         if( rAddrConv.ConvertRange( aScRange, aXclRange, nScTab, nScTab, true ) )
     909 [ +  - ][ +  - ]:         45 :             GetXFRangeBuffer().SetMerge( aScRange.aStart.Col(), aScRange.aStart.Row(), aScRange.aEnd.Col(), aScRange.aEnd.Row() );
     910                 :            :     }
     911                 :         30 : }
     912                 :            : 
     913                 :            : 
     914                 :          0 : void ImportExcel::Olesize( void )
     915                 :            : {
     916                 :          0 :     XclRange aXclOleSize( ScAddress::UNINITIALIZED );
     917         [ #  # ]:          0 :     maStrm.Ignore( 2 );
     918         [ #  # ]:          0 :     aXclOleSize.Read( maStrm, false );
     919                 :            : 
     920                 :          0 :     SCTAB nScTab = GetCurrScTab();
     921 [ #  # ][ #  # ]:          0 :     GetAddressConverter().ConvertRange( maScOleSize, aXclOleSize, nScTab, nScTab, false );
     922                 :          0 : }
     923                 :            : 
     924                 :            : 
     925                 :       3255 : void ImportExcel::Row34( void )
     926                 :            : {
     927                 :            :     sal_uInt16  nRow, nRowHeight, nGrbit, nXF;
     928                 :            : 
     929         [ +  - ]:       3255 :     aIn >> nRow;
     930         [ +  - ]:       3255 :     aIn.Ignore( 4 );   // Mic und Mac ueberspringen
     931                 :            : 
     932                 :       3255 :     SCROW nScRow = static_cast< SCROW >( nRow );
     933                 :            : 
     934         [ +  - ]:       3255 :     if( ValidRow( nScRow ) )
     935                 :            :     {
     936         [ +  - ]:       3255 :         aIn >> nRowHeight;  // direkt in Twips angegeben
     937         [ +  - ]:       3255 :         aIn.Ignore( 4 );
     938                 :            : 
     939                 :       3255 :         nRowHeight = nRowHeight & 0x7FFF; // Bit 15: Row Height not changed manually
     940         [ -  + ]:       3255 :         if( !nRowHeight )
     941         [ #  # ]:          0 :             nRowHeight = (GetBiff() == EXC_BIFF2) ? 0x25 : 0x225;
     942                 :            : 
     943 [ +  - ][ +  - ]:       3255 :         aIn >> nGrbit >> nXF;
     944                 :            : 
     945                 :       3255 :         sal_uInt8 nLevel = ::extract_value< sal_uInt8 >( nGrbit, 0, 3 );
     946         [ +  - ]:       3255 :         pRowOutlineBuff->SetLevel( nScRow, nLevel, ::get_flag( nGrbit, EXC_ROW_COLLAPSED ) );
     947         [ +  - ]:       3255 :         pColRowBuff->SetRowSettings( nScRow, nRowHeight, nGrbit );
     948                 :            : 
     949         [ -  + ]:       3255 :         if( nGrbit & EXC_ROW_USEDEFXF )
     950 [ #  # ][ #  # ]:          0 :             GetXFRangeBuffer().SetRowDefXF( nScRow, nXF & EXC_ROW_XFMASK );
     951                 :            :     }
     952                 :       3255 : }
     953                 :            : 
     954                 :            : 
     955                 :          0 : void ImportExcel::Bof3( void )
     956                 :            : {
     957                 :            :     sal_uInt16 nSubType;
     958         [ #  # ]:          0 :     maStrm.DisableDecryption();
     959         [ #  # ]:          0 :     maStrm.Ignore( 2 );
     960         [ #  # ]:          0 :     maStrm >> nSubType;
     961                 :            : 
     962                 :            :     OSL_ENSURE( nSubType != 0x0100, "*ImportExcel::Bof3(): Biff3 als Workbook?!" );
     963         [ #  # ]:          0 :     if( nSubType == 0x0100 )        // Book
     964                 :          0 :         pExcRoot->eDateiTyp = Biff3W;
     965         [ #  # ]:          0 :     else if( nSubType == 0x0020 )   // Chart
     966                 :          0 :         pExcRoot->eDateiTyp = Biff3C;
     967         [ #  # ]:          0 :     else if( nSubType == 0x0040 )   // Macro
     968                 :          0 :         pExcRoot->eDateiTyp = Biff3M;
     969                 :            :     else                            // #i51490# Excel interprets invalid indexes as worksheet
     970                 :          0 :         pExcRoot->eDateiTyp = Biff3;
     971                 :          0 : }
     972                 :            : 
     973                 :            : 
     974                 :          6 : void ImportExcel::Array34( void )
     975                 :            : {
     976                 :            :     sal_uInt16                  nFirstRow, nLastRow, nFormLen;
     977                 :            :     sal_uInt8                   nFirstCol, nLastCol;
     978                 :            : 
     979 [ +  - ][ +  - ]:          6 :     aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol;
         [ +  - ][ +  - ]
     980 [ +  - ][ +  - ]:          6 :     aIn.Ignore( (GetBiff() >= EXC_BIFF5) ? 6 : 2 );
     981         [ +  - ]:          6 :     aIn >> nFormLen;
     982                 :            : 
     983         [ +  - ]:          6 :     if( ValidColRow( nLastCol, nLastRow ) )
     984                 :            :     {
     985                 :            :         // jetzt steht Lesemarke auf Formel, Laenge in nFormLen
     986                 :            :         const ScTokenArray* pErgebnis;
     987                 :            : 
     988                 :            :         pFormConv->Reset( ScAddress( static_cast<SCCOL>(nFirstCol),
     989         [ +  - ]:          6 :                     static_cast<SCROW>(nFirstRow), GetCurrScTab() ) );
     990         [ +  - ]:          6 :         pFormConv->Convert( pErgebnis, maStrm, nFormLen, true, FT_CellFormula);
     991                 :            : 
     992                 :            :         OSL_ENSURE( pErgebnis, "+ImportExcel::Array34(): ScTokenArray ist NULL!" );
     993                 :            : 
     994         [ +  - ]:          6 :         ScMarkData          aMarkData;
     995         [ +  - ]:          6 :         aMarkData.SelectOneTable( GetCurrScTab() );
     996                 :            :         pD->InsertMatrixFormula( static_cast<SCCOL>(nFirstCol),
     997                 :            :                 static_cast<SCROW>(nFirstRow), static_cast<SCCOL>(nLastCol),
     998         [ +  - ]:          6 :                 static_cast<SCROW>(nLastRow), aMarkData, EMPTY_STRING,
     999 [ +  - ][ +  - ]:          6 :                 pErgebnis);
                 [ +  - ]
    1000                 :            :     }
    1001                 :          6 : }
    1002                 :            : 
    1003                 :            : 
    1004                 :          0 : void ImportExcel::Externname34( void )
    1005                 :            : {
    1006                 :          0 : }
    1007                 :            : 
    1008                 :            : 
    1009                 :        165 : void ImportExcel::Defrowheight345( void )
    1010                 :            : {
    1011                 :            :     sal_uInt16 nFlags, nDefHeight;
    1012 [ +  - ][ +  - ]:        165 :     maStrm >> nFlags >> nDefHeight;
    1013         [ +  - ]:        165 :     pColRowBuff->SetDefHeight( nDefHeight, nFlags );
    1014                 :        165 : }
    1015                 :            : 
    1016                 :            : 
    1017                 :          0 : void ImportExcel::TableOp( void )
    1018                 :            : {
    1019                 :            :     sal_uInt16 nFirstRow, nLastRow;
    1020                 :            :     sal_uInt8 nFirstCol, nLastCol;
    1021                 :            :     sal_uInt16 nGrbit;
    1022                 :            :     sal_uInt16 nInpRow, nInpCol, nInpRow2, nInpCol2;
    1023                 :            : 
    1024 [ #  # ][ #  # ]:          0 :     aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol >> nGrbit
         [ #  # ][ #  # ]
                 [ #  # ]
    1025 [ #  # ][ #  # ]:          0 :         >> nInpRow >> nInpCol >> nInpRow2 >> nInpCol2;
         [ #  # ][ #  # ]
    1026                 :            : 
    1027         [ #  # ]:          0 :     if( ValidColRow( nLastCol, nLastRow ) )
    1028                 :            :     {
    1029 [ #  # ][ #  # ]:          0 :         if( nFirstCol && nFirstRow )
    1030                 :            :         {
    1031                 :          0 :             ScTabOpParam aTabOpParam;
    1032 [ #  # ][ #  # ]:          0 :             aTabOpParam.nMode = (nGrbit & EXC_TABLEOP_BOTH) ? 2 : ((nGrbit & EXC_TABLEOP_ROW) ? 1 : 0 );
    1033                 :          0 :             sal_uInt16 nCol = nFirstCol - 1;
    1034                 :          0 :             sal_uInt16 nRow = nFirstRow - 1;
    1035                 :          0 :             SCTAB nTab = GetCurrScTab();
    1036   [ #  #  #  # ]:          0 :             switch( aTabOpParam.nMode )
    1037                 :            :             {
    1038                 :            :                 case 0:     // COL
    1039                 :            :                     aTabOpParam.aRefFormulaCell.Set(
    1040                 :            :                             static_cast<SCCOL>(nFirstCol),
    1041                 :            :                             static_cast<SCROW>(nFirstRow - 1), nTab, false,
    1042                 :          0 :                             false, false );
    1043                 :            :                     aTabOpParam.aRefFormulaEnd.Set(
    1044                 :            :                             static_cast<SCCOL>(nLastCol),
    1045                 :            :                             static_cast<SCROW>(nFirstRow - 1), nTab, false,
    1046                 :          0 :                             false, false );
    1047                 :            :                     aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol),
    1048                 :            :                             static_cast<SCROW>(nInpRow), nTab, false, false,
    1049                 :          0 :                             false );
    1050                 :          0 :                     nRow++;
    1051                 :          0 :                 break;
    1052                 :            :                 case 1:     // ROW
    1053                 :            :                     aTabOpParam.aRefFormulaCell.Set(
    1054                 :            :                             static_cast<SCCOL>(nFirstCol - 1),
    1055                 :            :                             static_cast<SCROW>(nFirstRow), nTab, false, false,
    1056                 :          0 :                             false );
    1057                 :            :                     aTabOpParam.aRefFormulaEnd.Set(
    1058                 :            :                             static_cast<SCCOL>(nFirstCol - 1),
    1059                 :            :                             static_cast<SCROW>(nLastRow), nTab, false, false,
    1060                 :          0 :                             false );
    1061                 :            :                     aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol),
    1062                 :            :                             static_cast<SCROW>(nInpRow), nTab, false, false,
    1063                 :          0 :                             false );
    1064                 :          0 :                     nCol++;
    1065                 :          0 :                 break;
    1066                 :            :                 case 2:     // TWO-INPUT
    1067                 :            :                     aTabOpParam.aRefFormulaCell.Set(
    1068                 :            :                             static_cast<SCCOL>(nFirstCol - 1),
    1069                 :            :                             static_cast<SCROW>(nFirstRow - 1), nTab, false,
    1070                 :          0 :                             false, false );
    1071                 :            :                     aTabOpParam.aRefRowCell.Set( static_cast<SCCOL>(nInpCol),
    1072                 :            :                             static_cast<SCROW>(nInpRow), nTab, false, false,
    1073                 :          0 :                             false );
    1074                 :            :                     aTabOpParam.aRefColCell.Set( static_cast<SCCOL>(nInpCol2),
    1075                 :            :                             static_cast<SCROW>(nInpRow2), nTab, false, false,
    1076                 :          0 :                             false );
    1077                 :          0 :                 break;
    1078                 :            :             }
    1079                 :            : 
    1080         [ #  # ]:          0 :             ScMarkData aMarkData;
    1081         [ #  # ]:          0 :             aMarkData.SelectOneTable( nTab );
    1082                 :            :             pD->InsertTableOp( aTabOpParam, static_cast<SCCOL>(nCol),
    1083                 :            :                     static_cast<SCROW>(nRow), static_cast<SCCOL>(nLastCol),
    1084 [ #  # ][ #  # ]:          0 :                     static_cast<SCROW>(nLastRow), aMarkData );
    1085                 :            :         }
    1086                 :            :     }
    1087                 :            :     else
    1088                 :            :     {
    1089                 :          0 :         bTabTruncated = sal_True;
    1090 [ #  # ][ #  # ]:          0 :         GetTracer().TraceInvalidRow(nLastRow, MAXROW);
    1091                 :            :     }
    1092                 :          0 : }
    1093                 :            : 
    1094                 :            : 
    1095                 :          0 : void ImportExcel::Bof4( void )
    1096                 :            : {
    1097                 :            :     sal_uInt16 nSubType;
    1098         [ #  # ]:          0 :     maStrm.DisableDecryption();
    1099         [ #  # ]:          0 :     maStrm.Ignore( 2 );
    1100         [ #  # ]:          0 :     maStrm >> nSubType;
    1101                 :            : 
    1102         [ #  # ]:          0 :     if( nSubType == 0x0100 )        // Book
    1103                 :          0 :         pExcRoot->eDateiTyp = Biff4W;
    1104         [ #  # ]:          0 :     else if( nSubType == 0x0020 )   // Chart
    1105                 :          0 :         pExcRoot->eDateiTyp = Biff4C;
    1106         [ #  # ]:          0 :     else if( nSubType == 0x0040 )   // Macro
    1107                 :          0 :         pExcRoot->eDateiTyp = Biff4M;
    1108                 :            :     else                            // #i51490# Excel interprets invalid indexes as worksheet
    1109                 :          0 :         pExcRoot->eDateiTyp = Biff4;
    1110                 :          0 : }
    1111                 :            : 
    1112                 :            : 
    1113                 :        220 : void ImportExcel::Bof5( void )
    1114                 :            : {
    1115                 :            :     //POST: eDateiTyp = Typ der zu lesenden Datei
    1116                 :            :     sal_uInt16      nSubType, nVers;
    1117                 :            :     BiffTyp     eDatei;
    1118                 :            : 
    1119         [ +  - ]:        220 :     maStrm.DisableDecryption();
    1120 [ +  - ][ +  - ]:        220 :     maStrm >> nVers >> nSubType;
    1121                 :            : 
    1122   [ +  -  +  -  :        220 :     switch( nSubType )
                   +  + ]
    1123                 :            :     {
    1124                 :         52 :         case 0x0005:    eDatei = Biff5W;    break;  // workbook globals
    1125                 :          0 :         case 0x0006:    eDatei = Biff5V;    break;  // VB module
    1126                 :        141 :         case 0x0010:    eDatei = Biff5;     break;  // worksheet
    1127                 :          0 :         case 0x0020:    eDatei = Biff5C;    break;  // chart
    1128                 :         24 :         case 0x0040:    eDatei = Biff5M4;   break;  // macro sheet
    1129                 :            :         default:
    1130                 :          3 :             pExcRoot->eDateiTyp = BiffX;
    1131                 :        220 :             return;
    1132                 :            :     }
    1133                 :            : 
    1134 [ +  - ][ +  - ]:        217 :     if( nVers == 0x0600 && (GetBiff() == EXC_BIFF8) )
                 [ +  - ]
    1135                 :        217 :         eDatei = ( BiffTyp ) ( eDatei - Biff5 + Biff8 );
    1136                 :            : 
    1137                 :        217 :     pExcRoot->eDateiTyp = eDatei;
    1138                 :            : }
    1139                 :            : 
    1140                 :        165 : void ImportExcel::EndSheet( void )
    1141                 :            : {
    1142                 :        165 :     pExcRoot->pExtSheetBuff->Reset();
    1143                 :            : 
    1144         [ -  + ]:        165 :     if( GetBiff() <= EXC_BIFF5 )
    1145                 :            :     {
    1146                 :          0 :         pExcRoot->pExtNameBuff->Reset();
    1147                 :          0 :         mnLastRefIdx = 0;
    1148                 :            :     }
    1149                 :            : 
    1150                 :        165 :     FinalizeTable();
    1151                 :        165 : }
    1152                 :            : 
    1153                 :            : 
    1154                 :        165 : void ImportExcel::NeueTabelle( void )
    1155                 :            : {
    1156                 :        165 :     SCTAB nTab = GetCurrScTab();
    1157 [ -  + ][ -  + ]:        165 :     if( nTab > 0 && !pD->HasTable( nTab ) )
                 [ +  + ]
    1158                 :          0 :         pD->MakeTable( nTab );
    1159                 :            : 
    1160 [ +  + ][ -  + ]:        165 :     if (nTab == 0 && GetBiff() == EXC_BIFF2)
                 [ -  + ]
    1161                 :            :     {
    1162                 :            :         // For Excel 2.1 Worksheet file, we need to set the file name as the
    1163                 :            :         // sheet name.
    1164 [ #  # ][ #  # ]:          0 :         INetURLObject aURL(GetDocUrl());
    1165 [ #  # ][ #  # ]:          0 :         pD->RenameTab(0, aURL.getBase(), false);
                 [ #  # ]
    1166                 :            :     }
    1167                 :            : 
    1168                 :        165 :     pExcRoot->pShrfmlaBuff->Clear();
    1169                 :            : 
    1170                 :        165 :     InitializeTable( nTab );
    1171                 :            : 
    1172         [ +  - ]:        165 :     XclImpOutlineDataBuffer* pNewItem = new XclImpOutlineDataBuffer( GetRoot(), nTab );
    1173                 :        165 :     pOutlineListBuffer->push_back( pNewItem );
    1174                 :        165 :     pExcRoot->pColRowBuff = pColRowBuff = pNewItem->GetColRowBuff();
    1175                 :        165 :     pColOutlineBuff = pNewItem->GetColOutline();
    1176                 :        165 :     pRowOutlineBuff = pNewItem->GetRowOutline();
    1177                 :        165 : }
    1178                 :            : 
    1179                 :            : 
    1180                 :          0 : const ScTokenArray* ImportExcel::ErrorToFormula( sal_uInt8 bErrOrVal, sal_uInt8 nError, double& rVal )
    1181                 :            : {
    1182                 :          0 :     return pFormConv->GetBoolErr( XclTools::ErrorToEnum( rVal, bErrOrVal, nError ) );
    1183                 :            : }
    1184                 :            : 
    1185                 :            : 
    1186                 :          0 : void ImportExcel::AdjustRowHeight()
    1187                 :            : {
    1188                 :            :     /*  Speed up chart import: import all sheets without charts, then
    1189                 :            :         update row heights (here), last load all charts -> do not any longer
    1190                 :            :         update inside of ScDocShell::ConvertFrom() (causes update of existing
    1191                 :            :         charts during each and every change of row height). */
    1192         [ #  # ]:          0 :     if( ScModelObj* pDocObj = GetDocModelObj() )
    1193                 :          0 :         pDocObj->UpdateAllRowHeights();
    1194                 :          0 : }
    1195                 :            : 
    1196                 :            : 
    1197                 :         55 : void ImportExcel::PostDocLoad( void )
    1198                 :            : {
    1199                 :            :     /*  Set automatic page numbering in Default page style (default is "page number = 1").
    1200                 :            :         Otherwise hidden tables (i.e. for scenarios) which have Default page style will
    1201                 :            :         break automatic page numbering. */
    1202         [ +  - ]:         55 :     if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( ScGlobal::GetRscString( STR_STYLENAME_STANDARD ), SFX_STYLE_FAMILY_PAGE ) )
    1203 [ +  - ][ +  - ]:         55 :         pStyleSheet->GetItemSet().Put( SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, 0 ) );
    1204                 :            : 
    1205                 :            :     // outlines for all sheets, sets hidden rows and columns (#i11776# after filtered ranges)
    1206 [ +  - ][ +  - ]:        220 :     for (XclImpOutlineListBuffer::iterator itBuffer = pOutlineListBuffer->begin(); itBuffer != pOutlineListBuffer->end(); ++itBuffer)
         [ +  - ][ +  - ]
                 [ +  + ]
    1207 [ +  - ][ +  - ]:        165 :         itBuffer->Convert();
    1208                 :            : 
    1209                 :            :     // document view settings (before visible OLE area)
    1210                 :         55 :     GetDocViewSettings().Finalize();
    1211                 :            : 
    1212                 :            :     // process all drawing objects (including OLE, charts, controls; after hiding rows/columns; before visible OLE area)
    1213                 :         55 :     GetObjectManager().ConvertObjects();
    1214                 :            : 
    1215                 :            :     // visible area (used if this document is an embedded OLE object)
    1216         [ +  - ]:         55 :     if( SfxObjectShell* pDocShell = GetDocShell() )
    1217                 :            :     {
    1218                 :            :         // visible area if embedded
    1219                 :         55 :         const ScExtDocSettings& rDocSett = GetExtDocOptions().GetDocSettings();
    1220                 :         55 :         SCTAB nDisplScTab = rDocSett.mnDisplTab;
    1221                 :            : 
    1222                 :            :         /*  #i44077# If a new OLE object is inserted from file, there is no
    1223                 :            :             OLESIZE record in the Excel file. Calculate used area from file
    1224                 :            :             contents (used cells and drawing objects). */
    1225         [ +  - ]:         55 :         if( !maScOleSize.IsValid() )
    1226                 :            :         {
    1227                 :            :             // used area of displayed sheet (cell contents)
    1228 [ +  - ][ +  - ]:         55 :             if( const ScExtTabSettings* pTabSett = GetExtDocOptions().GetTabSettings( nDisplScTab ) )
                 [ +  + ]
    1229                 :         49 :                 maScOleSize = pTabSett->maUsedArea;
    1230                 :            :             // add all valid drawing objects
    1231 [ +  - ][ +  - ]:         55 :             ScRange aScObjArea = GetObjectManager().GetUsedArea( nDisplScTab );
    1232         [ +  + ]:         55 :             if( aScObjArea.IsValid() )
    1233         [ +  - ]:         55 :                 maScOleSize.ExtendTo( aScObjArea );
    1234                 :            :         }
    1235                 :            : 
    1236                 :            :         // valid size found - set it at the document
    1237         [ +  + ]:         55 :         if( maScOleSize.IsValid() )
    1238                 :            :         {
    1239                 :         46 :             pDocShell->SetVisArea( GetDoc().GetMMRect(
    1240                 :         46 :                 maScOleSize.aStart.Col(), maScOleSize.aStart.Row(),
    1241         [ +  - ]:         92 :                 maScOleSize.aEnd.Col(), maScOleSize.aEnd.Row(), nDisplScTab ) );
    1242                 :         46 :             GetDoc().SetVisibleTab( nDisplScTab );
    1243                 :            :         }
    1244                 :            :     }
    1245                 :            : 
    1246                 :            :     // open forms in alive mode (has no effect, if no controls in document)
    1247         [ +  - ]:         55 :     if( ScModelObj* pDocObj = GetDocModelObj() )
    1248 [ +  - ][ +  - ]:         55 :         pDocObj->setPropertyValue( CREATE_OUSTRING( SC_UNO_APPLYFMDES ), uno::Any( false ) );
    1249                 :            : 
    1250                 :            :     // enables extended options to be set to the view after import
    1251                 :         55 :     GetExtDocOptions().SetChanged( true );
    1252                 :            : 
    1253                 :            :     // root data owns the extended document options -> create a new object
    1254         [ +  - ]:         55 :     GetDoc().SetExtDocOptions( new ScExtDocOptions( GetExtDocOptions() ) );
    1255                 :            : 
    1256                 :         55 :     const SCTAB     nLast = pD->GetTableCount();
    1257                 :            :     const ScRange*      p;
    1258                 :            : 
    1259         [ -  + ]:         55 :     if( pExcRoot->pPrintRanges->HasRanges() )
    1260                 :            :     {
    1261         [ #  # ]:          0 :         for( SCTAB n = 0 ; n < nLast ; n++ )
    1262                 :            :         {
    1263                 :          0 :             p = pExcRoot->pPrintRanges->First(n);
    1264         [ #  # ]:          0 :             if( p )
    1265                 :            :             {
    1266                 :          0 :                 pD->ClearPrintRanges( n );
    1267         [ #  # ]:          0 :                 while( p )
    1268                 :            :                 {
    1269                 :          0 :                     pD->AddPrintRange( n, *p );
    1270                 :          0 :                     p = pExcRoot->pPrintRanges->Next();
    1271                 :            :                 }
    1272                 :            :             }
    1273                 :            :             else
    1274                 :            :             {
    1275                 :            :                 // #i4063# no print ranges -> print entire sheet
    1276                 :          0 :                 pD->SetPrintEntireSheet( n );
    1277                 :            :             }
    1278                 :            :         }
    1279                 :          0 :         GetTracer().TracePrintRange();
    1280                 :            :     }
    1281                 :            : 
    1282         [ -  + ]:         55 :     if( pExcRoot->pPrintTitles->HasRanges() )
    1283                 :            :     {
    1284         [ #  # ]:          0 :         for( SCTAB n = 0 ; n < nLast ; n++ )
    1285                 :            :         {
    1286                 :          0 :             p = pExcRoot->pPrintTitles->First(n);
    1287         [ #  # ]:          0 :             if( p )
    1288                 :            :             {
    1289                 :          0 :                 sal_Bool    bRowVirgin = sal_True;
    1290                 :          0 :                 sal_Bool    bColVirgin = sal_True;
    1291                 :            : 
    1292         [ #  # ]:          0 :                 while( p )
    1293                 :            :                 {
    1294 [ #  # ][ #  # ]:          0 :                     if( p->aStart.Col() == 0 && p->aEnd.Col() == MAXCOL && bRowVirgin )
         [ #  # ][ #  # ]
    1295                 :            :                     {
    1296                 :          0 :                         pD->SetRepeatRowRange( n, p );
    1297                 :          0 :                         bRowVirgin = false;
    1298                 :            :                     }
    1299                 :            : 
    1300 [ #  # ][ #  # ]:          0 :                     if( p->aStart.Row() == 0 && p->aEnd.Row() == MAXROW && bColVirgin )
         [ #  # ][ #  # ]
    1301                 :            :                     {
    1302                 :          0 :                         pD->SetRepeatColRange( n, p );
    1303                 :          0 :                         bColVirgin = false;
    1304                 :            :                     }
    1305                 :            : 
    1306                 :          0 :                     p = pExcRoot->pPrintTitles->Next();
    1307                 :            :                 }
    1308                 :            :             }
    1309                 :            :         }
    1310                 :            :     }
    1311                 :         55 : }
    1312                 :            : 
    1313                 :        165 : XclImpOutlineDataBuffer::XclImpOutlineDataBuffer( const XclImpRoot& rRoot, SCTAB nScTab ) :
    1314                 :            :     XclImpRoot( rRoot ),
    1315         [ +  - ]:        330 :     mxColOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Col() + 1 ) ),
    1316         [ +  - ]:        330 :     mxRowOutlineBuff( new XclImpOutlineBuffer( rRoot.GetXclMaxPos().Row() + 1 ) ),
    1317         [ +  - ]:        165 :     mxColRowBuff( new XclImpColRowSettings( rRoot ) ),
    1318         [ +  - ]:        990 :     mnScTab( nScTab )
           [ +  -  +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
    1319                 :            : {
    1320                 :        165 : }
    1321                 :            : 
    1322 [ +  - ][ +  - ]:        165 : XclImpOutlineDataBuffer::~XclImpOutlineDataBuffer()
                 [ +  - ]
    1323                 :            : {
    1324         [ -  + ]:        330 : }
    1325                 :            : 
    1326                 :        165 : void XclImpOutlineDataBuffer::Convert()
    1327                 :            : {
    1328                 :        165 :     mxColOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, sal_True )->GetColArray() );
    1329                 :        165 :     mxColOutlineBuff->MakeScOutline();
    1330                 :            : 
    1331                 :        165 :     mxRowOutlineBuff->SetOutlineArray( GetDoc().GetOutlineTable( mnScTab, sal_True )->GetRowArray() );
    1332                 :        165 :     mxRowOutlineBuff->MakeScOutline();
    1333                 :            : 
    1334                 :        165 :     mxColRowBuff->ConvertHiddenFlags( mnScTab );
    1335 [ +  - ][ +  - ]:        189 : }
    1336                 :            : 
    1337                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10