LCOV - code coverage report
Current view: top level - sc/source/filter/excel - excdoc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 363 0.3 %
Date: 2012-08-25 Functions: 2 24 8.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1346 0.1 %

           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                 :            : #include "scitems.hxx"
      30                 :            : 
      31                 :            : #include <comphelper/processfactory.hxx>
      32                 :            : #include <svx/svdobj.hxx>
      33                 :            : #include <svx/svditer.hxx>
      34                 :            : #include <svx/svdpage.hxx>
      35                 :            : #include <editeng/lrspitem.hxx>
      36                 :            : #include <editeng/ulspitem.hxx>
      37                 :            : #include <svl/intitem.hxx>
      38                 :            : #include <svl/zformat.hxx>
      39                 :            : #include <sot/storage.hxx>
      40                 :            : #include <sfx2/objsh.hxx>
      41                 :            : #include <rtl/ustring.hxx>
      42                 :            : 
      43                 :            : #include "cell.hxx"
      44                 :            : #include "dociter.hxx"
      45                 :            : #include "document.hxx"
      46                 :            : #include "rangenam.hxx"
      47                 :            : #include "dbdata.hxx"
      48                 :            : #include "global.hxx"
      49                 :            : #include "globstr.hrc"
      50                 :            : #include "progress.hxx"
      51                 :            : #include "conditio.hxx"
      52                 :            : #include "dpobject.hxx"
      53                 :            : #include "attrib.hxx"
      54                 :            : #include "scextopt.hxx"
      55                 :            : #include "stlsheet.hxx"
      56                 :            : #include "stlpool.hxx"
      57                 :            : #include "olinetab.hxx"
      58                 :            : #include "unonames.hxx"
      59                 :            : #include "convuno.hxx"
      60                 :            : #include "patattr.hxx"
      61                 :            : #include "docoptio.hxx"
      62                 :            : #include "tabprotection.hxx"
      63                 :            : #include "postit.hxx"
      64                 :            : 
      65                 :            : #include "excdoc.hxx"
      66                 :            : #include "namebuff.hxx"
      67                 :            : #include "xeextlst.hxx"
      68                 :            : 
      69                 :            : #include "xcl97rec.hxx"
      70                 :            : #include "xcl97esc.hxx"
      71                 :            : #include "xetable.hxx"
      72                 :            : #include "xelink.hxx"
      73                 :            : #include "xename.hxx"
      74                 :            : #include "xepage.hxx"
      75                 :            : #include "xeview.hxx"
      76                 :            : #include "xecontent.hxx"
      77                 :            : #include "xeescher.hxx"
      78                 :            : #include "xepivot.hxx"
      79                 :            : #include "XclExpChangeTrack.hxx"
      80                 :            : 
      81                 :            : #include <math.h>
      82                 :            : 
      83                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      84                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      85                 :            : #include <oox/token/tokens.hxx>
      86                 :            : #include <boost/shared_ptr.hpp>
      87                 :            : 
      88                 :            : using ::rtl::OString;
      89                 :            : using namespace oox;
      90                 :            : 
      91                 :          0 : static String lcl_GetVbaTabName( SCTAB n )
      92                 :            : {
      93                 :          0 :     String  aRet( RTL_CONSTASCII_USTRINGPARAM( "__VBA__" ) );
      94 [ #  # ][ #  # ]:          0 :     aRet += String::CreateFromInt32( static_cast<sal_uInt16>(n) );
                 [ #  # ]
      95                 :          0 :     return aRet;
      96                 :            : }
      97                 :            : 
      98                 :            : 
      99                 :          0 : static void lcl_AddBookviews( XclExpRecordList<>& aRecList, ExcTable& self )
     100                 :            : {
     101         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlStartElementRecord( XML_bookViews ) );
     102         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpWindow1( self.GetRoot() ) );
     103         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlEndElementRecord( XML_bookViews ) );
     104                 :          0 : }
     105                 :            : 
     106                 :          0 : static void lcl_AddCalcPr( XclExpRecordList<>& aRecList, ExcTable& self )
     107                 :            : {
     108                 :          0 :     ScDocument& rDoc = self.GetDoc();
     109                 :            : 
     110         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlStartSingleElementRecord( XML_calcPr ) );
     111                 :            :     // OOXTODO: calcCompleted, calcId, calcMode, calcOnSave,
     112                 :            :     //          concurrentCalc, concurrentManualCount,
     113                 :            :     //          forceFullCalc, fullCalcOnLoad, fullPrecision
     114         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclCalccount( rDoc ) );
     115         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclRefmode( rDoc ) );
     116         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclIteration( rDoc ) );
     117         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclDelta( rDoc ) );
     118         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpBoolRecord(0x005F, true) ); // SAVERECALC
     119         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() );  // XML_calcPr
     120                 :          0 : }
     121                 :            : 
     122                 :          0 : static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& self )
     123                 :            : {
     124         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlStartSingleElementRecord( XML_workbookProtection ) );
     125                 :            : 
     126                 :          0 :     const ScDocProtection* pProtect = self.GetDoc().GetDocProtection();
     127 [ #  # ][ #  # ]:          0 :     if (pProtect && pProtect->isProtected())
                 [ #  # ]
     128                 :            :     {
     129         [ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
     130         [ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
     131 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
                 [ #  # ]
     132                 :            :     }
     133                 :            : 
     134         [ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() );   // XML_workbookProtection
     135                 :          0 : }
     136                 :            : 
     137                 :          0 : static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, const XclExpRoot& rRoot, SCTAB nScTab )
     138                 :            : {
     139                 :            :     // Scenarios
     140         [ #  # ]:          0 :     aRecList.AppendNewRecord( new ExcEScenarioManager( rRoot, nScTab ) );
     141                 :            :     // filter
     142         [ #  # ]:          0 :     aRecList.AppendRecord( rRoot.GetFilterManager().CreateRecord( nScTab ) );
     143                 :          0 : }
     144                 :            : 
     145                 :            : 
     146                 :          0 : ExcTable::ExcTable( const XclExpRoot& rRoot ) :
     147                 :            :     XclExpRoot( rRoot ),
     148                 :            :     mnScTab( SCTAB_GLOBAL ),
     149                 :            :     nExcTab( EXC_NOTAB ),
     150         [ #  # ]:          0 :     pTabNames( new NameBuffer( 0, 16 ) ),
     151 [ #  # ][ #  # ]:          0 :     mxNoteList( new XclExpNoteList )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     152                 :            : {
     153                 :          0 : }
     154                 :            : 
     155                 :            : 
     156                 :          0 : ExcTable::ExcTable( const XclExpRoot& rRoot, SCTAB nScTab ) :
     157                 :            :     XclExpRoot( rRoot ),
     158                 :            :     mnScTab( nScTab ),
     159 [ #  # ][ #  # ]:          0 :     nExcTab( rRoot.GetTabInfo().GetXclTab( nScTab ) ),
     160         [ #  # ]:          0 :     pTabNames( new NameBuffer( 0, 16 ) ),
     161 [ #  # ][ #  # ]:          0 :     mxNoteList( new XclExpNoteList )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     162                 :            : {
     163                 :          0 : }
     164                 :            : 
     165                 :            : 
     166 [ #  # ][ #  # ]:          0 : ExcTable::~ExcTable()
         [ #  # ][ #  # ]
     167                 :            : {
     168 [ #  # ][ #  # ]:          0 :     delete pTabNames;
     169         [ #  # ]:          0 : }
     170                 :            : 
     171                 :            : 
     172                 :          0 : void ExcTable::Add( XclExpRecordBase* pRec )
     173                 :            : {
     174                 :            :     OSL_ENSURE( pRec, "-ExcTable::Add(): pRec ist NULL!" );
     175                 :          0 :     aRecList.AppendNewRecord( pRec );
     176                 :          0 : }
     177                 :            : 
     178                 :            : 
     179                 :          0 : void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
     180                 :            : {
     181         [ #  # ]:          0 :     InitializeGlobals();
     182                 :            : 
     183         [ #  # ]:          0 :     RootData& rR = GetOldRoot();
     184                 :          0 :     ScDocument& rDoc = GetDoc();
     185         [ #  # ]:          0 :     XclExpTabInfo& rTabInfo = GetTabInfo();
     186                 :            : 
     187         [ #  # ]:          0 :     if ( GetBiff() <= EXC_BIFF5 )
     188 [ #  # ][ #  # ]:          0 :         Add( new ExcBofW );
                 [ #  # ]
     189                 :            :     else
     190 [ #  # ][ #  # ]:          0 :         Add( new ExcBofW8 );
                 [ #  # ]
     191                 :            : 
     192                 :            :     SCTAB   nC;
     193                 :          0 :     rtl::OUString aTmpString;
     194                 :          0 :     SCTAB  nScTabCount     = rTabInfo.GetScTabCount();
     195                 :          0 :     sal_uInt16  nExcTabCount    = rTabInfo.GetXclTabCount();
     196 [ #  # ][ #  # ]:          0 :     sal_uInt16  nCodenames      = static_cast< sal_uInt16 >( GetExtDocOptions().GetCodeNameCount() );
     197                 :            : 
     198         [ #  # ]:          0 :     SfxObjectShell* pShell = GetDocShell();
     199 [ #  # ][ #  # ]:          0 :     sal_uInt16 nWriteProtHash = pShell ? pShell->GetModifyPasswordHash() : 0;
     200 [ #  # ][ #  # ]:          0 :     bool bRecommendReadOnly = pShell && pShell->IsLoadReadonly();
                 [ #  # ]
     201                 :            : 
     202 [ #  # ][ #  # ]:          0 :     if( (nWriteProtHash > 0) || bRecommendReadOnly )
     203 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_WRITEPROT ) );
                 [ #  # ]
     204                 :            : 
     205                 :            :     // TODO: correct codepage for BIFF5?
     206 [ #  # ][ #  # ]:          0 :     sal_uInt16 nCodePage = XclTools::GetXclCodePage( (GetBiff() <= EXC_BIFF5) ? RTL_TEXTENCODING_MS_1252 : RTL_TEXTENCODING_UNICODE );
     207                 :            : 
     208         [ #  # ]:          0 :     if( GetBiff() <= EXC_BIFF5 )
     209                 :            :     {
     210 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_INTERFACEHDR ) );
                 [ #  # ]
     211 [ #  # ][ #  # ]:          0 :         Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
                 [ #  # ]
     212 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_TOOLBARHDR ) );
                 [ #  # ]
     213 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_TOOLBAREND ) );
                 [ #  # ]
     214 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) );
                 [ #  # ]
     215 [ #  # ][ #  # ]:          0 :         Add( new ExcDummy_00 );
                 [ #  # ]
     216                 :            :     }
     217                 :            :     else
     218                 :            :     {
     219 [ #  # ][ #  # ]:          0 :         if( IsDocumentEncrypted() )
     220 [ #  # ][ #  # ]:          0 :             Add( new XclExpFileEncryption( GetRoot() ) );
                 [ #  # ]
     221 [ #  # ][ #  # ]:          0 :         Add( new XclExpInterfaceHdr( nCodePage ) );
                 [ #  # ]
     222 [ #  # ][ #  # ]:          0 :         Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
                 [ #  # ]
     223 [ #  # ][ #  # ]:          0 :         Add( new XclExpInterfaceEnd );
                 [ #  # ]
     224 [ #  # ][ #  # ]:          0 :         Add( new XclExpWriteAccess );
                 [ #  # ]
     225                 :            :     }
     226                 :            : 
     227 [ #  # ][ #  # ]:          0 :     Add( new XclExpFileSharing( GetRoot(), nWriteProtHash, bRecommendReadOnly ) );
                 [ #  # ]
     228 [ #  # ][ #  # ]:          0 :     Add( new XclExpUInt16Record( EXC_ID_CODEPAGE, nCodePage ) );
                 [ #  # ]
     229                 :            : 
     230         [ #  # ]:          0 :     if( GetBiff() == EXC_BIFF8 )
     231                 :            :     {
     232 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord( EXC_ID_DSF, false ) );
                 [ #  # ]
     233 [ #  # ][ #  # ]:          0 :         Add( new XclExpEmptyRecord( EXC_ID_XL9FILE ) );
                 [ #  # ]
     234 [ #  # ][ #  # ]:          0 :         rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
     235         [ #  # ]:          0 :         Add( rR.pTabId );
     236 [ #  # ][ #  # ]:          0 :         if( HasVbaStorage() )
     237                 :            :         {
     238 [ #  # ][ #  # ]:          0 :             Add( new XclObproj );
                 [ #  # ]
     239 [ #  # ][ #  # ]:          0 :             const String& rCodeName = GetExtDocOptions().GetDocSettings().maGlobCodeName;
     240         [ #  # ]:          0 :             if( rCodeName.Len() )
     241 [ #  # ][ #  # ]:          0 :                 Add( new XclCodename( rCodeName ) );
                 [ #  # ]
     242                 :            :         }
     243                 :            :     }
     244                 :            : 
     245 [ #  # ][ #  # ]:          0 :     Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) );
                 [ #  # ]
     246                 :            : 
     247                 :            :     // erst Namen- und Tabellen-Eintraege aufbauen
     248         [ #  # ]:          0 :     String          aName;
     249                 :            : 
     250         [ #  # ]:          0 :     for( nC = 0 ; nC < nScTabCount ; nC++ )
     251 [ #  # ][ #  # ]:          0 :         if( rTabInfo.IsExportTab( nC ) )
     252                 :            :         {
     253         [ #  # ]:          0 :             rDoc.GetName( nC, aTmpString );
     254 [ #  # ][ #  # ]:          0 :             *pTabNames << aTmpString;
                 [ #  # ]
     255                 :            :         }
     256                 :            : 
     257         [ #  # ]:          0 :     if ( GetBiff() <= EXC_BIFF5 )
     258                 :            :     {
     259                 :            :         // global link table: EXTERNCOUNT, EXTERNSHEET, NAME
     260 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) );
                 [ #  # ]
     261 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_NAME ) );
                 [ #  # ]
     262                 :            :     }
     263                 :            : 
     264                 :            :     // document protection options
     265         [ #  # ]:          0 :     if( GetOutput() == EXC_OUTPUT_BINARY )
     266                 :            :     {
     267         [ #  # ]:          0 :         lcl_AddWorkbookProtection( aRecList, *this );
     268                 :            : 
     269         [ #  # ]:          0 :         if( GetBiff() == EXC_BIFF8 )
     270                 :            :         {
     271 [ #  # ][ #  # ]:          0 :             Add( new XclExpProt4Rev );
                 [ #  # ]
     272 [ #  # ][ #  # ]:          0 :             Add( new XclExpProt4RevPass );
                 [ #  # ]
     273                 :            :         }
     274                 :            : 
     275         [ #  # ]:          0 :         lcl_AddBookviews( aRecList, *this );
     276                 :            :     }
     277                 :            : 
     278 [ #  # ][ #  # ]:          0 :     Add( new XclExpXmlStartSingleElementRecord( XML_workbookPr ) );
                 [ #  # ]
     279 [ #  # ][ #  # ]:          0 :     if ( GetBiff() == EXC_BIFF8 && GetOutput() != EXC_OUTPUT_BINARY )
                 [ #  # ]
     280                 :            :     {
     281 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x0040, false, XML_backupFile ) );    // BACKUP
                 [ #  # ]
     282 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x008D, false, XML_showObjects ) );   // HIDEOBJ
                 [ #  # ]
     283                 :            :     }
     284                 :            : 
     285         [ #  # ]:          0 :     if ( GetBiff() == EXC_BIFF8 )
     286                 :            :     {
     287 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x0040, false) ); // BACKUP
                 [ #  # ]
     288 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x008D, false) ); // HIDEOBJ
                 [ #  # ]
     289                 :            :     }
     290                 :            : 
     291         [ #  # ]:          0 :     if( GetBiff() <= EXC_BIFF5 )
     292                 :            :     {
     293 [ #  # ][ #  # ]:          0 :         Add( new ExcDummy_040 );
                 [ #  # ]
     294 [ #  # ][ #  # ]:          0 :         Add( new Exc1904( rDoc ) );
                 [ #  # ]
     295 [ #  # ][ #  # ]:          0 :         Add( new ExcDummy_041 );
                 [ #  # ]
     296                 :            :     }
     297                 :            :     else
     298                 :            :     {
     299                 :            :         // BIFF8
     300 [ #  # ][ #  # ]:          0 :         Add( new Exc1904( rDoc ) );
                 [ #  # ]
     301 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord( 0x000E, !rDoc.GetDocOptions().IsCalcAsShown() ) );
         [ #  # ][ #  # ]
     302 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x01B7, false) ); // REFRESHALL
                 [ #  # ]
     303 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x00DA, false) ); // BOOKBOOL
                 [ #  # ]
     304                 :            :         // OOXTODO: The following /workbook/workbookPr attributes are mapped
     305                 :            :         //          to various BIFF records that are not currently supported:
     306                 :            :         //
     307                 :            :         //          XML_allowRefreshQuery:          QSISTAG 802h: fEnableRefresh
     308                 :            :         //          XML_autoCompressPictures:       COMPRESSPICTURES 89Bh: fAutoCompressPictures
     309                 :            :         //          XML_checkCompatibility:         COMPAT12 88Ch: fNoCompatChk
     310                 :            :         //          XML_codeName:                   "Calc"
     311                 :            :         //          XML_defaultThemeVersion:        ???
     312                 :            :         //          XML_filterPrivacy:              BOOKEXT 863h: fFilterPrivacy
     313                 :            :         //          XML_hidePivotFieldList:         BOOKBOOL DAh: fHidePivotTableFList
     314                 :            :         //          XML_promptedSolutions:          BOOKEXT 863h: fBuggedUserAboutSolution
     315                 :            :         //          XML_publishItems:               NAMEPUBLISH 893h: fPublished
     316                 :            :         //          XML_saveExternalLinkValues:     BOOKBOOL DAh: fNoSavSupp
     317                 :            :         //          XML_showBorderUnselectedTables: BOOKBOOL DAh: fHideBorderUnsels
     318                 :            :         //          XML_showInkAnnotation:          BOOKEXT 863h: fShowInkAnnotation
     319                 :            :         //          XML_showPivotChart:             PIVOTCHARTBITS 859h: fGXHide??
     320                 :            :         //          XML_updateLinks:                BOOKBOOL DAh: grbitUpdateLinks
     321                 :            :     }
     322 [ #  # ][ #  # ]:          0 :     Add( new XclExpXmlEndSingleElementRecord() );   // XML_workbookPr
                 [ #  # ]
     323                 :            : 
     324                 :            :     // Formatting: FONT, FORMAT, XF, STYLE, PALETTE
     325         [ #  # ]:          0 :     if( GetOutput() != EXC_OUTPUT_BINARY )
     326                 :            :     {
     327 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpXmlStyleSheet( *this ) );
                 [ #  # ]
     328                 :            :     }
     329                 :            :     else
     330                 :            :     {
     331 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_FONTLIST ) );
                 [ #  # ]
     332 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_FORMATLIST ) );
                 [ #  # ]
     333 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_XFLIST ) );
                 [ #  # ]
     334 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_PALETTE ) );
                 [ #  # ]
     335                 :            :     }
     336                 :            : 
     337                 :            : 
     338         [ #  # ]:          0 :     if( GetBiff() <= EXC_BIFF5 )
     339                 :            :     {
     340                 :            :         // Bundlesheet
     341         [ #  # ]:          0 :         for( nC = 0 ; nC < nScTabCount ; nC++ )
     342 [ #  # ][ #  # ]:          0 :             if( rTabInfo.IsExportTab( nC ) )
     343                 :            :             {
     344 [ #  # ][ #  # ]:          0 :                 ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet( rR, nC ) );
                 [ #  # ]
     345 [ #  # ][ #  # ]:          0 :                 aRecList.AppendRecord( xBoundsheet );
                 [ #  # ]
     346 [ #  # ][ #  # ]:          0 :                 rBoundsheetList.AppendRecord( xBoundsheet );
         [ #  # ][ #  # ]
     347                 :            :             }
     348                 :            :     }
     349                 :            :     else
     350                 :            :     {
     351                 :            :         // Pivot Cache
     352 [ #  # ][ #  # ]:          0 :         GetPivotTableManager().CreatePivotTables();
     353 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( GetPivotTableManager().CreatePivotCachesRecord() );
         [ #  # ][ #  # ]
     354                 :            : 
     355                 :            :         // Change tracking
     356         [ #  # ]:          0 :         if( rDoc.GetChangeTrack() )
     357                 :            :         {
     358 [ #  # ][ #  # ]:          0 :             rR.pUserBViewList = new XclExpUserBViewList( *rDoc.GetChangeTrack() );
     359         [ #  # ]:          0 :             Add( rR.pUserBViewList );
     360                 :            :         }
     361                 :            : 
     362                 :            :         // Natural Language Formulas Flag
     363 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpBoolRecord( EXC_ID_USESELFS, GetDoc().GetDocOptions().IsLookUpColRowNames() ) );
         [ #  # ][ #  # ]
     364                 :            : 
     365         [ #  # ]:          0 :         if( GetOutput() != EXC_OUTPUT_BINARY )
     366                 :            :         {
     367         [ #  # ]:          0 :             lcl_AddWorkbookProtection( aRecList, *this );
     368         [ #  # ]:          0 :             lcl_AddBookviews( aRecList, *this );
     369                 :            :         }
     370                 :            : 
     371                 :            :         // Bundlesheet
     372 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpXmlStartElementRecord( XML_sheets ) );
                 [ #  # ]
     373         [ #  # ]:          0 :         for( nC = 0 ; nC < nScTabCount ; nC++ )
     374 [ #  # ][ #  # ]:          0 :             if( rTabInfo.IsExportTab( nC ) )
     375                 :            :             {
     376 [ #  # ][ #  # ]:          0 :                 ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( rR, nC ) );
                 [ #  # ]
     377 [ #  # ][ #  # ]:          0 :                 aRecList.AppendRecord( xBoundsheet );
                 [ #  # ]
     378 [ #  # ][ #  # ]:          0 :                 rBoundsheetList.AppendRecord( xBoundsheet );
         [ #  # ][ #  # ]
     379                 :            :             }
     380 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpXmlEndElementRecord( XML_sheets ) );
                 [ #  # ]
     381                 :            : 
     382         [ #  # ]:          0 :         for( SCTAB nAdd = 0; nC < static_cast<SCTAB>(nCodenames) ; nC++, nAdd++ )
     383                 :            :         {
     384 [ #  # ][ #  # ]:          0 :             aTmpString = lcl_GetVbaTabName( nAdd );
                 [ #  # ]
     385 [ #  # ][ #  # ]:          0 :             ExcBoundsheetList::RecordRefType xBoundsheet( new ExcBundlesheet8( aTmpString ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     386 [ #  # ][ #  # ]:          0 :             aRecList.AppendRecord( xBoundsheet );
                 [ #  # ]
     387 [ #  # ][ #  # ]:          0 :             rBoundsheetList.AppendRecord( xBoundsheet );
                 [ #  # ]
     388         [ #  # ]:          0 :         }
     389                 :            : 
     390                 :            :         // COUNTRY - in BIFF8 in workbook globals
     391 [ #  # ][ #  # ]:          0 :         Add( new XclExpCountry( GetRoot() ) );
                 [ #  # ]
     392                 :            :         // link table: SUPBOOK, XCT, CRN, EXTERNNAME, EXTERNSHEET, NAME
     393 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) );
                 [ #  # ]
     394 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_NAME ) );
                 [ #  # ]
     395                 :            : 
     396         [ #  # ]:          0 :         if( GetOutput() != EXC_OUTPUT_BINARY )
     397         [ #  # ]:          0 :             lcl_AddCalcPr( aRecList, *this );
     398                 :            : 
     399 [ #  # ][ #  # ]:          0 :         Add( new XclExpRecalcId );
                 [ #  # ]
     400                 :            : 
     401                 :            :         // MSODRAWINGGROUP per-document data
     402 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( GetObjectManager().CreateDrawingGroup() );
         [ #  # ][ #  # ]
     403                 :            :         // Shared string table: SST, EXTSST
     404 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_SST ) );
                 [ #  # ]
     405                 :            : 
     406 [ #  # ][ #  # ]:          0 :         Add( new XclExpBookExt );
                 [ #  # ]
     407                 :            :     }
     408                 :            : 
     409 [ #  # ][ #  # ]:          0 :     Add( new ExcEof );
         [ #  # ][ #  # ]
     410                 :          0 : }
     411                 :            : 
     412                 :            : 
     413                 :          0 : void ExcTable::FillAsTable( SCTAB nCodeNameIdx )
     414                 :            : {
     415         [ #  # ]:          0 :     InitializeTable( mnScTab );
     416                 :            : 
     417         [ #  # ]:          0 :     RootData& rR = GetOldRoot();
     418                 :          0 :     XclBiff eBiff = GetBiff();
     419                 :          0 :     ScDocument& rDoc = GetDoc();
     420                 :            : 
     421                 :            :     OSL_ENSURE( (mnScTab >= 0L) && (mnScTab <= MAXTAB), "-ExcTable::Table(): mnScTab - no ordinary table!" );
     422                 :            :     OSL_ENSURE( nExcTab <= static_cast<sal_uInt16>(MAXTAB), "-ExcTable::Table(): nExcTab - no ordinary table!" );
     423                 :            : 
     424                 :            :     // create a new OBJ list for this sheet (may be used by notes, autofilter, data validation)
     425         [ #  # ]:          0 :     if( eBiff == EXC_BIFF8 )
     426 [ #  # ][ #  # ]:          0 :         GetObjectManager().StartSheet();
     427                 :            : 
     428                 :            :     // cell table: DEFROWHEIGHT, DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
     429 [ #  # ][ #  # ]:          0 :     mxCellTable.reset( new XclExpCellTable( GetRoot() ) );
                 [ #  # ]
     430                 :            : 
     431                 :            :     //export cell notes
     432 [ #  # ][ #  # ]:          0 :     ScNotes::iterator itr = rDoc.GetNotes(mnScTab)->begin();
     433 [ #  # ][ #  # ]:          0 :     ScNotes::iterator itrEnd = rDoc.GetNotes(mnScTab)->end();
     434 [ #  # ][ #  # ]:          0 :     for (; itr != itrEnd; ++itr)
                 [ #  # ]
     435                 :            :     {
     436                 :            :         // notes
     437         [ #  # ]:          0 :         const ScPostIt* pScNote = itr->second;
     438 [ #  # ][ #  # ]:          0 :         ScAddress aScPos( itr->first.first, itr->first.second, mnScTab );
     439 [ #  # ][ #  # ]:          0 :         mxNoteList->AppendNewRecord( new XclExpNote( GetRoot(), aScPos, pScNote, rtl::OUString() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     440                 :            :     }
     441                 :            : 
     442         [ #  # ]:          0 :     if( GetOutput() != EXC_OUTPUT_BINARY )
     443                 :            :     {
     444         [ #  # ]:          0 :         FillAsXmlTable( nCodeNameIdx );
     445                 :          0 :         return;
     446                 :            :     }
     447                 :            : 
     448                 :            : 
     449                 :            :     // WSBOOL needs data from page settings, create it here, add it later
     450 [ #  # ][ #  # ]:          0 :     boost::shared_ptr< XclExpPageSettings > xPageSett( new XclExpPageSettings( GetRoot() ) );
                 [ #  # ]
     451                 :          0 :     bool bFitToPages = xPageSett->GetPageData().mbFitToPages;
     452                 :            : 
     453         [ #  # ]:          0 :     if( eBiff <= EXC_BIFF5 )
     454                 :            :     {
     455 [ #  # ][ #  # ]:          0 :         Add( new ExcBof );
                 [ #  # ]
     456 [ #  # ][ #  # ]:          0 :         Add( new ExcDummy_02a );
                 [ #  # ]
     457                 :            :     }
     458                 :            :     else
     459                 :            :     {
     460 [ #  # ][ #  # ]:          0 :         Add( new ExcBof8 );
                 [ #  # ]
     461         [ #  # ]:          0 :         lcl_AddCalcPr( aRecList, *this );
     462                 :            :     }
     463                 :            : 
     464                 :            :     // GUTS (count & size of outline icons)
     465 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_GUTS ) );
                 [ #  # ]
     466                 :            :     // DEFROWHEIGHT, created by the cell table
     467 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID2_DEFROWHEIGHT ) );
                 [ #  # ]
     468                 :            : 
     469                 :            :     // COUNTRY - in BIFF5/7 in every worksheet
     470         [ #  # ]:          0 :     if( eBiff <= EXC_BIFF5 )
     471 [ #  # ][ #  # ]:          0 :         Add( new XclExpCountry( GetRoot() ) );
                 [ #  # ]
     472                 :            : 
     473 [ #  # ][ #  # ]:          0 :     Add( new XclExpWsbool( bFitToPages ) );
                 [ #  # ]
     474                 :            : 
     475                 :            :     // page settings (SETUP and various other records)
     476 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( xPageSett );
                 [ #  # ]
     477                 :            : 
     478         [ #  # ]:          0 :     const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnScTab);
     479 [ #  # ][ #  # ]:          0 :     if (pTabProtect && pTabProtect->isProtected())
         [ #  # ][ #  # ]
     480                 :            :     {
     481 [ #  # ][ #  # ]:          0 :         Add( new XclExpProtection(true) );
                 [ #  # ]
     482 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x00DD, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
         [ #  # ][ #  # ]
     483 [ #  # ][ #  # ]:          0 :         Add( new XclExpBoolRecord(0x0063, pTabProtect->isOptionEnabled(ScTableProtection::OBJECTS)) );
         [ #  # ][ #  # ]
     484 [ #  # ][ #  # ]:          0 :         Add( new XclExpPassHash(pTabProtect->getPasswordHash(PASSHASH_XL)) );
         [ #  # ][ #  # ]
                 [ #  # ]
     485                 :            :     }
     486                 :            : 
     487                 :            :     // local link table: EXTERNCOUNT, EXTERNSHEET
     488         [ #  # ]:          0 :     if( eBiff <= EXC_BIFF5 )
     489 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) );
                 [ #  # ]
     490                 :            : 
     491         [ #  # ]:          0 :     if ( eBiff == EXC_BIFF8 )
     492         [ #  # ]:          0 :         lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
     493                 :            : 
     494                 :            :     // cell table: DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
     495 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable );
                 [ #  # ]
     496                 :            : 
     497                 :            :     // MERGEDCELLS record, generated by the cell table
     498 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_MERGEDCELLS ) );
                 [ #  # ]
     499                 :            :     // label ranges
     500         [ #  # ]:          0 :     if( eBiff == EXC_BIFF8 )
     501 [ #  # ][ #  # ]:          0 :         Add( new XclExpLabelranges( GetRoot() ) );
                 [ #  # ]
     502                 :            :     // data validation (DVAL and list of DV records), generated by the cell table
     503 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_DVAL ) );
                 [ #  # ]
     504                 :            : 
     505         [ #  # ]:          0 :     if( eBiff == EXC_BIFF8 )
     506                 :            :     {
     507                 :            :         // all MSODRAWING and OBJ stuff of this sheet goes here
     508 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( GetObjectManager().ProcessDrawing( GetSdrPage( mnScTab ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     509                 :            :         // pivot tables
     510 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( GetPivotTableManager().CreatePivotTablesRecord( mnScTab ) );
         [ #  # ][ #  # ]
     511                 :            :     }
     512                 :            : 
     513                 :            :     // list of NOTE records, generated by the cell table
     514 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxNoteList );
                 [ #  # ]
     515                 :            : 
     516                 :            :     // sheet view settings: WINDOW2, SCL, PANE, SELECTION
     517 [ #  # ][ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
                 [ #  # ]
     518                 :            : 
     519         [ #  # ]:          0 :     if( eBiff == EXC_BIFF8 )
     520                 :            :     {
     521                 :            :         // sheet protection options
     522 [ #  # ][ #  # ]:          0 :         Add( new XclExpSheetProtectOptions( GetRoot(), mnScTab ) );
                 [ #  # ]
     523                 :            : 
     524                 :            :         // web queries
     525 [ #  # ][ #  # ]:          0 :         Add( new XclExpWebQueryBuffer( GetRoot() ) );
                 [ #  # ]
     526                 :            : 
     527                 :            :         // conditional formats
     528 [ #  # ][ #  # ]:          0 :         Add( new XclExpCondFormatBuffer( GetRoot(), XclExtLstRef() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     529                 :            : 
     530 [ #  # ][ #  # ]:          0 :         if( HasVbaStorage() )
     531 [ #  # ][ #  # ]:          0 :             if( nCodeNameIdx < GetExtDocOptions().GetCodeNameCount() )
                 [ #  # ]
     532 [ #  # ][ #  # ]:          0 :                 Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     533                 :            :     }
     534                 :            : 
     535                 :            :     // list of HLINK records, generated by the cell table
     536 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_HLINK ) );
                 [ #  # ]
     537                 :            : 
     538                 :            :     // change tracking
     539         [ #  # ]:          0 :     if( rR.pUserBViewList )
     540                 :            :     {
     541                 :          0 :         XclExpUserBViewList::const_iterator iter;
     542 [ #  # ][ #  # ]:          0 :         for ( iter = rR.pUserBViewList->begin(); iter != rR.pUserBViewList->end(); ++iter)
                 [ #  # ]
     543                 :            :         {
     544 [ #  # ][ #  # ]:          0 :             Add( new XclExpUsersViewBegin( (*iter)->GetGUID(), nExcTab ) );
                 [ #  # ]
     545 [ #  # ][ #  # ]:          0 :             Add( new XclExpUsersViewEnd );
                 [ #  # ]
     546                 :            :         }
     547                 :            :     }
     548                 :            : 
     549                 :            :     // EOF
     550 [ #  # ][ #  # ]:          0 :     Add( new ExcEof );
         [ #  # ][ #  # ]
     551                 :            : }
     552                 :            : 
     553                 :          0 : void ExcTable::FillAsXmlTable( SCTAB nCodeNameIdx )
     554                 :            : {
     555         [ #  # ]:          0 :     RootData& rR = GetOldRoot();
     556                 :            : 
     557                 :            :     // WSBOOL needs data from page settings, create it here, add it later
     558 [ #  # ][ #  # ]:          0 :     boost::shared_ptr< XclExpPageSettings > xPageSett( new XclExpPageSettings( GetRoot() ) );
                 [ #  # ]
     559 [ #  # ][ #  # ]:          0 :     XclExtLstRef xExtLst( new XclExtLst( GetRoot() ) );
                 [ #  # ]
     560                 :          0 :     bool bFitToPages = xPageSett->GetPageData().mbFitToPages;
     561                 :            : 
     562 [ #  # ][ #  # ]:          0 :     Add( new ExcBof8 );
                 [ #  # ]
     563                 :            : 
     564 [ #  # ][ #  # ]:          0 :     Add( new XclExpWsbool( bFitToPages, mnScTab, &GetFilterManager() ) );
         [ #  # ][ #  # ]
     565                 :            : 
     566                 :            :     // GUTS (count & size of outline icons)
     567 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_GUTS ) );
                 [ #  # ]
     568                 :            :     // DEFROWHEIGHT, created by the cell table
     569 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID2_DEFROWHEIGHT ) );
                 [ #  # ]
     570                 :            : 
     571 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID3_DIMENSIONS ) );
                 [ #  # ]
     572                 :            : 
     573                 :            :     // sheet view settings: WINDOW2, SCL, PANE, SELECTION
     574 [ #  # ][ #  # ]:          0 :     aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
                 [ #  # ]
     575                 :            : 
     576                 :            :     // cell table: DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
     577 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable );
                 [ #  # ]
     578                 :            : 
     579                 :            :     // label ranges
     580 [ #  # ][ #  # ]:          0 :     Add( new XclExpLabelranges( GetRoot() ) );
                 [ #  # ]
     581                 :            : 
     582                 :            :     // DFF not needed in MSOOXML export
     583                 :            : //    GetObjectManager().AddSdrPage();
     584                 :            : //    //! close Escher group shape and ESCHER_DgContainer
     585                 :            : //    //! opened by XclExpObjList ctor MSODRAWING
     586                 :            : //    rR.pObjRecs->EndSheet();
     587                 :            : //    // all MSODRAWING and OBJ stuff of this sheet goes here
     588                 :            : //    Add( rR.pObjRecs );
     589                 :            : 
     590                 :            :     // pivot tables
     591 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( GetPivotTableManager().CreatePivotTablesRecord( mnScTab ) );
         [ #  # ][ #  # ]
     592                 :            : 
     593                 :            :     // list of NOTE records, generated by the cell table
     594 [ #  # ][ #  # ]:          0 :     if( mxNoteList != NULL && !mxNoteList->IsEmpty() )
                 [ #  # ]
     595 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpComments( mnScTab, *mxNoteList ) );
                 [ #  # ]
     596                 :            : 
     597                 :            :     // web queries
     598 [ #  # ][ #  # ]:          0 :     Add( new XclExpWebQueryBuffer( GetRoot() ) );
                 [ #  # ]
     599                 :            : 
     600         [ #  # ]:          0 :     lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
     601                 :            : 
     602                 :            :     // MERGEDCELLS record, generated by the cell table
     603 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_MERGEDCELLS ) );
                 [ #  # ]
     604                 :            : 
     605                 :            :     // conditional formats
     606 [ #  # ][ #  # ]:          0 :     Add( new XclExpCondFormatBuffer( GetRoot(), xExtLst ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     607                 :            : 
     608 [ #  # ][ #  # ]:          0 :     if( HasVbaStorage() )
     609 [ #  # ][ #  # ]:          0 :         if( nCodeNameIdx < GetExtDocOptions().GetCodeNameCount() )
                 [ #  # ]
     610 [ #  # ][ #  # ]:          0 :             Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     611                 :            : 
     612                 :            :     // data validation (DVAL and list of DV records), generated by the cell table
     613 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_DVAL ) );
                 [ #  # ]
     614                 :            : 
     615                 :            :     // list of HLINK records, generated by the cell table
     616         [ #  # ]:          0 :     XclExpRecordRef xHyperlinks = mxCellTable->CreateRecord( EXC_ID_HLINK );
     617         [ #  # ]:          0 :     XclExpHyperlinkList* xHyperlinkList = dynamic_cast<XclExpHyperlinkList*>(xHyperlinks.get());
     618 [ #  # ][ #  # ]:          0 :     if( xHyperlinkList != NULL && !xHyperlinkList->IsEmpty() )
                 [ #  # ]
     619                 :            :     {
     620 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpXmlStartElementRecord( XML_hyperlinks ) );
                 [ #  # ]
     621 [ #  # ][ #  # ]:          0 :         aRecList.AppendRecord( xHyperlinks );
                 [ #  # ]
     622 [ #  # ][ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpXmlEndElementRecord( XML_hyperlinks ) );
                 [ #  # ]
     623                 :            :     }
     624                 :            : 
     625 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( xPageSett );
                 [ #  # ]
     626                 :            : 
     627                 :            :     // change tracking
     628         [ #  # ]:          0 :     if( rR.pUserBViewList )
     629                 :            :     {
     630                 :          0 :         XclExpUserBViewList::const_iterator iter;
     631 [ #  # ][ #  # ]:          0 :         for ( iter = rR.pUserBViewList->begin(); iter != rR.pUserBViewList->end(); ++iter )
                 [ #  # ]
     632                 :            :         {
     633 [ #  # ][ #  # ]:          0 :             Add( new XclExpUsersViewBegin( (*iter)->GetGUID(), nExcTab ) );
                 [ #  # ]
     634 [ #  # ][ #  # ]:          0 :             Add( new XclExpUsersViewEnd );
                 [ #  # ]
     635                 :            :         }
     636                 :            :     }
     637                 :            : 
     638                 :            :     // all MSODRAWING and OBJ stuff of this sheet goes here
     639 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( GetObjectManager().ProcessDrawing( GetSdrPage( mnScTab ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     640                 :            : 
     641 [ #  # ][ #  # ]:          0 :     aRecList.AppendRecord( xExtLst );
                 [ #  # ]
     642                 :            : 
     643                 :            :     // EOF
     644 [ #  # ][ #  # ]:          0 :     Add( new ExcEof );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     645                 :          0 : }
     646                 :            : 
     647                 :            : 
     648                 :          0 : void ExcTable::FillAsEmptyTable( SCTAB nCodeNameIdx )
     649                 :            : {
     650                 :          0 :     InitializeTable( mnScTab );
     651                 :            : 
     652 [ #  # ][ #  # ]:          0 :     if( HasVbaStorage() && (nCodeNameIdx < GetExtDocOptions().GetCodeNameCount()) )
                 [ #  # ]
     653                 :            :     {
     654         [ #  # ]:          0 :         if( GetBiff() <= EXC_BIFF5 )
     655                 :            :         {
     656         [ #  # ]:          0 :             Add( new ExcBof );
     657                 :            :         }
     658                 :            :         else
     659                 :            :         {
     660         [ #  # ]:          0 :             Add( new ExcBof8 );
     661         [ #  # ]:          0 :             Add( new XclCodename( GetExtDocOptions().GetCodeName( nCodeNameIdx ) ) );
     662                 :            :         }
     663                 :            :         // sheet view settings: WINDOW2, SCL, PANE, SELECTION
     664         [ #  # ]:          0 :         aRecList.AppendNewRecord( new XclExpTabViewSettings( GetRoot(), mnScTab ) );
     665         [ #  # ]:          0 :         Add( new ExcEof );
     666                 :            :     }
     667                 :          0 : }
     668                 :            : 
     669                 :            : 
     670                 :          0 : void ExcTable::Write( XclExpStream& rStrm )
     671                 :            : {
     672                 :          0 :     SetCurrScTab( mnScTab );
     673         [ #  # ]:          0 :     if( mxCellTable.get() )
     674                 :          0 :         mxCellTable->Finalize();
     675                 :          0 :     aRecList.Save( rStrm );
     676                 :          0 : }
     677                 :            : 
     678                 :            : 
     679                 :          0 : void ExcTable::WriteXml( XclExpXmlStream& rStrm )
     680                 :            : {
     681         [ #  # ]:          0 :     if (GetTabInfo().IsExportTab( mnScTab ) )
     682                 :            :     {
     683                 :            :         // worksheet export
     684 [ #  # ][ #  # ]:          0 :         String sSheetName = XclXmlUtils::GetStreamName( "xl/", "worksheets/sheet", mnScTab+1 );
     685                 :            : 
     686 [ #  # ][ #  # ]:          0 :         sax_fastparser::FSHelperPtr pWorksheet = rStrm.GetStreamForPath( sSheetName );
     687                 :            : 
     688 [ #  # ][ #  # ]:          0 :         rStrm.PushStream( pWorksheet );
                 [ #  # ]
     689                 :            : 
     690                 :            :         pWorksheet->startElement( XML_worksheet,
     691                 :            :                 XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
     692                 :            :                 FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
     693 [ #  # ][ #  # ]:          0 :                 FSEND );
                 [ #  # ]
     694                 :            :     }
     695                 :            : 
     696                 :          0 :     SetCurrScTab( mnScTab );
     697         [ #  # ]:          0 :     if( mxCellTable.get() )
     698                 :          0 :         mxCellTable->Finalize();
     699                 :          0 :     aRecList.SaveXml( rStrm );
     700                 :            : 
     701         [ #  # ]:          0 :     if (GetTabInfo().IsExportTab( mnScTab ) )
     702                 :            :     {
     703                 :          0 :         rStrm.GetCurrentStream()->endElement( XML_worksheet );
     704                 :          0 :         rStrm.PopStream();
     705                 :            :     }
     706                 :          0 : }
     707                 :            : 
     708                 :            : 
     709                 :          0 : ExcDocument::ExcDocument( const XclExpRoot& rRoot ) :
     710                 :            :     XclExpRoot( rRoot ),
     711                 :            :     aHeader( rRoot ),
     712 [ #  # ][ #  # ]:          0 :     pExpChangeTrack( NULL )
                 [ #  # ]
     713                 :            : {
     714                 :          0 : }
     715                 :            : 
     716                 :            : 
     717 [ #  # ][ #  # ]:          0 : ExcDocument::~ExcDocument()
                 [ #  # ]
     718                 :            : {
     719                 :          0 :     maTableList.RemoveAllRecords();    //! for the following assertion
     720 [ #  # ][ #  # ]:          0 :     delete pExpChangeTrack;
     721         [ #  # ]:          0 : }
     722                 :            : 
     723                 :            : 
     724                 :          0 : void ExcDocument::ReadDoc( void )
     725                 :            : {
     726                 :          0 :     InitializeConvert();
     727                 :            : 
     728                 :          0 :     aHeader.FillAsHeader( maBoundsheetList );
     729                 :            : 
     730                 :          0 :     SCTAB nScTab = 0, nScTabCount = GetTabInfo().GetScTabCount();
     731                 :          0 :     SCTAB nCodeNameIdx = 0, nCodeNameCount = GetExtDocOptions().GetCodeNameCount();
     732                 :            : 
     733         [ #  # ]:          0 :     for( ; nScTab < nScTabCount; ++nScTab )
     734                 :            :     {
     735         [ #  # ]:          0 :         if( GetTabInfo().IsExportTab( nScTab ) )
     736                 :            :         {
     737 [ #  # ][ #  # ]:          0 :             ExcTableList::RecordRefType xTab( new ExcTable( GetRoot(), nScTab ) );
                 [ #  # ]
     738 [ #  # ][ #  # ]:          0 :             maTableList.AppendRecord( xTab );
                 [ #  # ]
     739         [ #  # ]:          0 :             xTab->FillAsTable( nCodeNameIdx );
     740         [ #  # ]:          0 :             ++nCodeNameIdx;
     741                 :            :         }
     742                 :            :     }
     743         [ #  # ]:          0 :     for( ; nCodeNameIdx < nCodeNameCount; ++nScTab, ++nCodeNameIdx )
     744                 :            :     {
     745 [ #  # ][ #  # ]:          0 :         ExcTableList::RecordRefType xTab( new ExcTable( GetRoot(), nScTab ) );
                 [ #  # ]
     746 [ #  # ][ #  # ]:          0 :         maTableList.AppendRecord( xTab );
                 [ #  # ]
     747         [ #  # ]:          0 :         xTab->FillAsEmptyTable( nCodeNameIdx );
     748         [ #  # ]:          0 :     }
     749                 :            : 
     750         [ #  # ]:          0 :     if ( GetBiff() == EXC_BIFF8 )
     751                 :            :     {
     752                 :            :         // complete temporary Escher stream
     753                 :          0 :         GetObjectManager().EndDocument();
     754                 :            : 
     755                 :            :         // change tracking
     756         [ #  # ]:          0 :         if ( GetDoc().GetChangeTrack() )
     757         [ #  # ]:          0 :             pExpChangeTrack = new XclExpChangeTrack( GetRoot() );
     758                 :            :     }
     759                 :          0 : }
     760                 :            : 
     761                 :            : 
     762                 :          0 : void ExcDocument::Write( SvStream& rSvStrm )
     763                 :            : {
     764         [ #  # ]:          0 :     if( !maTableList.IsEmpty() )
     765                 :            :     {
     766         [ #  # ]:          0 :         InitializeSave();
     767                 :            : 
     768         [ #  # ]:          0 :         XclExpStream aXclStrm( rSvStrm, GetRoot() );
     769                 :            : 
     770         [ #  # ]:          0 :         aHeader.Write( aXclStrm );
     771                 :            : 
     772                 :            :         OSL_ENSURE( maTableList.GetSize() == maBoundsheetList.GetSize(),
     773                 :            :             "ExcDocument::Write - different number of sheets and BOUNDSHEET records" );
     774                 :            : 
     775         [ #  # ]:          0 :         for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < nTabCount; ++nTab )
     776                 :            :         {
     777                 :            :             // set current stream position in BOUNDSHEET record
     778         [ #  # ]:          0 :             ExcBoundsheetRef xBoundsheet = maBoundsheetList.GetRecord( nTab );
     779         [ #  # ]:          0 :             if( xBoundsheet.get() )
     780                 :          0 :                 xBoundsheet->SetStreamPos( aXclStrm.GetSvStreamPos() );
     781                 :            :             // write the table
     782 [ #  # ][ #  # ]:          0 :             maTableList.GetRecord( nTab )->Write( aXclStrm );
                 [ #  # ]
     783         [ #  # ]:          0 :         }
     784                 :            : 
     785                 :            :         // write the table stream positions into the BOUNDSHEET records
     786         [ #  # ]:          0 :         for( size_t nBSheet = 0, nBSheetCount = maBoundsheetList.GetSize(); nBSheet < nBSheetCount; ++nBSheet )
     787 [ #  # ][ #  # ]:          0 :             maBoundsheetList.GetRecord( nBSheet )->UpdateStreamPos( aXclStrm );
         [ #  # ][ #  # ]
     788                 :            :     }
     789         [ #  # ]:          0 :     if( pExpChangeTrack )
     790                 :          0 :         pExpChangeTrack->Write();
     791                 :          0 : }
     792                 :            : 
     793                 :          0 : void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
     794                 :            : {
     795         [ #  # ]:          0 :     SfxObjectShell* pDocShell = GetDocShell();
     796                 :            : 
     797                 :            :     using namespace ::com::sun::star;
     798 [ #  # ][ #  # ]:          0 :     uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
     799 [ #  # ][ #  # ]:          0 :     uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
     800                 :            : 
     801         [ #  # ]:          0 :     rStrm.exportDocumentProperties( xDocProps );
     802                 :            : 
     803         [ #  # ]:          0 :     sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
     804                 :            :     rWorkbook->startElement( XML_workbook,
     805                 :            :             XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
     806                 :            :             FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
     807         [ #  # ]:          0 :             FSEND );
     808                 :            :     rWorkbook->singleElement( XML_fileVersion,
     809                 :            :             XML_appName, "Calc",
     810                 :            :             // OOXTODO: XML_codeName
     811                 :            :             // OOXTODO: XML_lastEdited
     812                 :            :             // OOXTODO: XML_lowestEdited
     813                 :            :             // OOXTODO: XML_rupBuild
     814         [ #  # ]:          0 :             FSEND );
     815                 :            : 
     816         [ #  # ]:          0 :     if( !maTableList.IsEmpty() )
     817                 :            :     {
     818         [ #  # ]:          0 :         InitializeSave();
     819                 :            : 
     820         [ #  # ]:          0 :         aHeader.WriteXml( rStrm );
     821                 :            : 
     822         [ #  # ]:          0 :         for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < nTabCount; ++nTab )
     823                 :            :         {
     824                 :            :             // write the table
     825 [ #  # ][ #  # ]:          0 :             maTableList.GetRecord( nTab )->WriteXml( rStrm );
                 [ #  # ]
     826                 :            :         }
     827                 :            :     }
     828                 :            : 
     829         [ #  # ]:          0 :     if( pExpChangeTrack )
     830         [ #  # ]:          0 :         pExpChangeTrack->WriteXml( rStrm );
     831                 :            : 
     832         [ #  # ]:          0 :     rWorkbook->endElement( XML_workbook );
     833         [ #  # ]:          0 :     rWorkbook.reset();
     834                 :            : 
     835         [ #  # ]:          0 :     rStrm.commitStorage();
     836 [ +  - ][ +  - ]:         24 : }
     837                 :            : 
     838                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10