LCOV - code coverage report
Current view: top level - sc/source/filter/oox - worksheetfragment.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 103 366 28.1 %
Date: 2012-08-25 Functions: 14 38 36.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 96 645 14.9 %

           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 "worksheetfragment.hxx"
      30                 :            : 
      31                 :            : #include "oox/core/filterbase.hxx"
      32                 :            : #include "oox/core/relations.hxx"
      33                 :            : #include "oox/helper/attributelist.hxx"
      34                 :            : #include "addressconverter.hxx"
      35                 :            : #include "autofilterbuffer.hxx"
      36                 :            : #include "autofiltercontext.hxx"
      37                 :            : #include "biffinputstream.hxx"
      38                 :            : #include "commentsfragment.hxx"
      39                 :            : #include "condformatcontext.hxx"
      40                 :            : #include "drawingfragment.hxx"
      41                 :            : #include "drawingmanager.hxx"
      42                 :            : #include "externallinkbuffer.hxx"
      43                 :            : #include "pagesettings.hxx"
      44                 :            : #include "pivottablefragment.hxx"
      45                 :            : #include "querytablefragment.hxx"
      46                 :            : #include "scenariobuffer.hxx"
      47                 :            : #include "scenariocontext.hxx"
      48                 :            : #include "sheetdatabuffer.hxx"
      49                 :            : #include "sheetdatacontext.hxx"
      50                 :            : #include "tablefragment.hxx"
      51                 :            : #include "extlstcontext.hxx"
      52                 :            : #include "viewsettings.hxx"
      53                 :            : #include "workbooksettings.hxx"
      54                 :            : #include "worksheetsettings.hxx"
      55                 :            : 
      56                 :            : namespace oox {
      57                 :            : namespace xls {
      58                 :            : 
      59                 :            : // ============================================================================
      60                 :            : 
      61                 :            : using namespace ::com::sun::star::table;
      62                 :            : using namespace ::com::sun::star::uno;
      63                 :            : using namespace ::oox::core;
      64                 :            : 
      65                 :            : using ::rtl::OUString;
      66                 :            : using ::rtl::OUStringBuffer;
      67                 :            : 
      68                 :            : // ============================================================================
      69                 :            : 
      70                 :            : namespace {
      71                 :            : 
      72                 :            : const sal_uInt16 BIFF_COLINFO_HIDDEN        = 0x0001;
      73                 :            : const sal_uInt16 BIFF_COLINFO_SHOWPHONETIC  = 0x0008;
      74                 :            : const sal_uInt16 BIFF_COLINFO_COLLAPSED     = 0x1000;
      75                 :            : 
      76                 :            : const sal_uInt16 BIFF_DEFROW_CUSTOMHEIGHT   = 0x0001;
      77                 :            : const sal_uInt16 BIFF_DEFROW_HIDDEN         = 0x0002;
      78                 :            : const sal_uInt16 BIFF_DEFROW_THICKTOP       = 0x0004;
      79                 :            : const sal_uInt16 BIFF_DEFROW_THICKBOTTOM    = 0x0008;
      80                 :            : const sal_uInt16 BIFF2_DEFROW_DEFHEIGHT     = 0x8000;
      81                 :            : const sal_uInt16 BIFF2_DEFROW_MASK          = 0x7FFF;
      82                 :            : 
      83                 :            : const sal_uInt32 BIFF_DATAVAL_STRINGLIST    = 0x00000080;
      84                 :            : const sal_uInt32 BIFF_DATAVAL_ALLOWBLANK    = 0x00000100;
      85                 :            : const sal_uInt32 BIFF_DATAVAL_NODROPDOWN    = 0x00000200;
      86                 :            : const sal_uInt32 BIFF_DATAVAL_SHOWINPUT     = 0x00040000;
      87                 :            : const sal_uInt32 BIFF_DATAVAL_SHOWERROR     = 0x00080000;
      88                 :            : 
      89                 :            : const sal_uInt32 BIFF_SHRFEATHEAD_SHEETPROT = 2;
      90                 :            : 
      91                 :            : const sal_Int32 BIFF12_OLEOBJECT_CONTENT    = 1;
      92                 :            : const sal_Int32 BIFF12_OLEOBJECT_ICON       = 4;
      93                 :            : const sal_Int32 BIFF12_OLEOBJECT_ALWAYS     = 1;
      94                 :            : const sal_Int32 BIFF12_OLEOBJECT_ONCALL     = 3;
      95                 :            : const sal_uInt16 BIFF12_OLEOBJECT_LINKED    = 0x0001;
      96                 :            : const sal_uInt16 BIFF12_OLEOBJECT_AUTOLOAD  = 0x0002;
      97                 :            : 
      98                 :            : } // namespace
      99                 :            : 
     100                 :            : // ============================================================================
     101                 :            : 
     102                 :          0 : DataValidationsContext::DataValidationsContext( WorksheetFragmentBase& rFragment ) :
     103                 :          0 :     WorksheetContextBase( rFragment )
     104                 :            : {
     105                 :          0 : }
     106                 :            : 
     107                 :          0 : ContextHandlerRef DataValidationsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     108                 :            : {
     109      [ #  #  # ]:          0 :     switch( getCurrentElement() )
     110                 :            :     {
     111                 :            :         case XLS_TOKEN( dataValidations ):
     112         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( dataValidation ) )
     113                 :            :             {
     114                 :          0 :                 importDataValidation( rAttribs );
     115                 :          0 :                 return this;
     116                 :            :             }
     117                 :          0 :         break;
     118                 :            :         case XLS_TOKEN( dataValidation ):
     119         [ #  # ]:          0 :             switch( nElement )
     120                 :            :             {
     121                 :            :                 case XLS_TOKEN( formula1 ):
     122                 :            :                 case XLS_TOKEN( formula2 ):
     123                 :          0 :                     return this;    // collect formulas in onCharacters()
     124                 :            :             }
     125                 :          0 :         break;
     126                 :            :     }
     127                 :          0 :     return 0;
     128                 :            : }
     129                 :            : 
     130                 :          0 : void DataValidationsContext::onCharacters( const OUString& rChars )
     131                 :            : {
     132         [ #  # ]:          0 :     if( mxValModel.get() ) switch( getCurrentElement() )
              [ #  #  # ]
     133                 :            :     {
     134                 :            :         case XLS_TOKEN( formula1 ):
     135 [ #  # ][ #  # ]:          0 :             mxValModel->maTokens1 = getFormulaParser().importFormula( mxValModel->maRanges.getBaseAddress(), rChars );
         [ #  # ][ #  # ]
     136                 :            :             // process string list of a list validation (convert to list of string tokens)
     137         [ #  # ]:          0 :             if( mxValModel->mnType == XML_list )
     138                 :          0 :                 getFormulaParser().convertStringToStringList( mxValModel->maTokens1, ',', true );
     139                 :          0 :         break;
     140                 :            :         case XLS_TOKEN( formula2 ):
     141 [ #  # ][ #  # ]:          0 :             mxValModel->maTokens2 = getFormulaParser().importFormula( mxValModel->maRanges.getBaseAddress(), rChars );
         [ #  # ][ #  # ]
     142                 :          0 :         break;
     143                 :            :     }
     144                 :          0 : }
     145                 :            : 
     146                 :          0 : void DataValidationsContext::onEndElement()
     147                 :            : {
     148 [ #  # ][ #  # ]:          0 :     if( isCurrentElement( XLS_TOKEN( dataValidation ) ) && mxValModel.get() )
                 [ #  # ]
     149                 :            :     {
     150                 :          0 :         setValidation( *mxValModel );
     151                 :          0 :         mxValModel.reset();
     152                 :            :     }
     153                 :          0 : }
     154                 :            : 
     155                 :            : 
     156                 :          0 : ContextHandlerRef DataValidationsContext::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
     157                 :            : {
     158         [ #  # ]:          0 :     if( nRecId == BIFF12_ID_DATAVALIDATION )
     159                 :          0 :         importDataValidation( rStrm );
     160                 :          0 :     return 0;
     161                 :            : }
     162                 :            : 
     163                 :          0 : void DataValidationsContext::importDataValidation( const AttributeList& rAttribs )
     164                 :            : {
     165         [ #  # ]:          0 :     mxValModel.reset( new ValidationModel );
     166 [ #  # ][ #  # ]:          0 :     getAddressConverter().convertToCellRangeList( mxValModel->maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
                 [ #  # ]
     167         [ #  # ]:          0 :     mxValModel->maInputTitle   = rAttribs.getXString( XML_promptTitle, OUString() );
     168         [ #  # ]:          0 :     mxValModel->maInputMessage = rAttribs.getXString( XML_prompt, OUString() );
     169         [ #  # ]:          0 :     mxValModel->maErrorTitle   = rAttribs.getXString( XML_errorTitle, OUString() );
     170         [ #  # ]:          0 :     mxValModel->maErrorMessage = rAttribs.getXString( XML_error, OUString() );
     171                 :          0 :     mxValModel->mnType         = rAttribs.getToken( XML_type, XML_none );
     172                 :          0 :     mxValModel->mnOperator     = rAttribs.getToken( XML_operator, XML_between );
     173                 :          0 :     mxValModel->mnErrorStyle   = rAttribs.getToken( XML_errorStyle, XML_stop );
     174                 :          0 :     mxValModel->mbShowInputMsg = rAttribs.getBool( XML_showInputMessage, false );
     175                 :          0 :     mxValModel->mbShowErrorMsg = rAttribs.getBool( XML_showErrorMessage, false );
     176                 :            :     /*  The attribute showDropDown@dataValidation is in fact a "suppress
     177                 :            :         dropdown" flag, as it was in the BIFF format! ECMA specification
     178                 :            :         and attribute name are plain wrong! */
     179                 :          0 :     mxValModel->mbNoDropDown   = rAttribs.getBool( XML_showDropDown, false );
     180                 :          0 :     mxValModel->mbAllowBlank   = rAttribs.getBool( XML_allowBlank, false );
     181                 :          0 : }
     182                 :            : 
     183                 :          0 : void DataValidationsContext::importDataValidation( SequenceInputStream& rStrm )
     184                 :            : {
     185         [ #  # ]:          0 :     ValidationModel aModel;
     186                 :            : 
     187                 :            :     sal_uInt32 nFlags;
     188         [ #  # ]:          0 :     BinRangeList aRanges;
     189 [ #  # ][ #  # ]:          0 :     rStrm >> nFlags >> aRanges >> aModel.maErrorTitle >> aModel.maErrorMessage >> aModel.maInputTitle >> aModel.maInputMessage;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     190                 :            : 
     191                 :            :     // equal flags in all BIFFs
     192         [ #  # ]:          0 :     aModel.setBiffType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
     193         [ #  # ]:          0 :     aModel.setBiffOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
     194         [ #  # ]:          0 :     aModel.setBiffErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
     195                 :          0 :     aModel.mbAllowBlank   = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
     196                 :          0 :     aModel.mbNoDropDown   = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
     197                 :          0 :     aModel.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
     198                 :          0 :     aModel.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
     199                 :            : 
     200                 :            :     // cell range list
     201 [ #  # ][ #  # ]:          0 :     getAddressConverter().convertToCellRangeList( aModel.maRanges, aRanges, getSheetIndex(), true );
                 [ #  # ]
     202                 :            : 
     203                 :            :     // condition formula(s)
     204         [ #  # ]:          0 :     FormulaParser& rParser = getFormulaParser();
     205         [ #  # ]:          0 :     CellAddress aBaseAddr = aModel.maRanges.getBaseAddress();
     206 [ #  # ][ #  # ]:          0 :     aModel.maTokens1 = rParser.importFormula( aBaseAddr, FORMULATYPE_VALIDATION, rStrm );
                 [ #  # ]
     207 [ #  # ][ #  # ]:          0 :     aModel.maTokens2 = rParser.importFormula( aBaseAddr, FORMULATYPE_VALIDATION, rStrm );
                 [ #  # ]
     208                 :            :     // process string list of a list validation (convert to list of string tokens)
     209 [ #  # ][ #  # ]:          0 :     if( (aModel.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
                 [ #  # ]
     210         [ #  # ]:          0 :         rParser.convertStringToStringList( aModel.maTokens1, ',', true );
     211                 :            : 
     212                 :            :     // set validation data
     213 [ #  # ][ #  # ]:          0 :     setValidation( aModel );
     214                 :          0 : }
     215                 :            : 
     216                 :            : // ============================================================================
     217                 :            : 
     218                 :         60 : WorksheetFragment::WorksheetFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
     219                 :         60 :     WorksheetFragmentBase( rHelper, rFragmentPath )
     220                 :            : {
     221                 :            :     // import data tables related to this worksheet
     222 [ +  - ][ +  - ]:         60 :     RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "table" ) );
                 [ +  - ]
     223         [ -  + ]:         60 :     for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
     224 [ #  # ][ #  # ]:          0 :         importOoxFragment( new TableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
                 [ #  # ]
     225                 :            : 
     226                 :            :     // import comments related to this worksheet
     227 [ +  - ][ +  - ]:         60 :     OUString aCommentsFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATION_TYPE( "comments" ) );
     228         [ +  + ]:         60 :     if( !aCommentsFragmentPath.isEmpty() )
     229 [ +  - ][ +  - ]:         60 :         importOoxFragment( new CommentsFragment( *this, aCommentsFragmentPath ) );
                 [ +  - ]
     230                 :         60 : }
     231                 :            : 
     232                 :        906 : ContextHandlerRef WorksheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
     233                 :            : {
     234   [ +  +  +  +  :        906 :     switch( getCurrentElement() )
          +  +  +  -  -  
             -  +  +  - ]
     235                 :            :     {
     236   [ +  -  -  -  :         60 :         case XML_ROOT_CONTEXT: switch( getSheetType() )
                -  -  - ]
     237                 :            :         {
     238         [ +  - ]:         60 :             case SHEETTYPE_WORKSHEET:   return (nElement == XLS_TOKEN( worksheet )) ? this : 0;
     239                 :          0 :             case SHEETTYPE_CHARTSHEET:  return 0;
     240         [ #  # ]:          0 :             case SHEETTYPE_MACROSHEET:  return (nElement == XM_TOKEN( macrosheet )) ? this : 0;
     241         [ #  # ]:          0 :             case SHEETTYPE_DIALOGSHEET: return (nElement == XLS_TOKEN( dialogsheet )) ? this : 0;
     242                 :          0 :             case SHEETTYPE_MODULESHEET: return 0;
     243                 :          0 :             case SHEETTYPE_EMPTYSHEET:  return 0;
     244                 :            :         }
     245                 :          0 :         break;
     246                 :            : 
     247                 :            :         case XLS_TOKEN( worksheet ):
     248                 :            :         case XM_TOKEN( macrosheet ):
     249                 :            :         case XLS_TOKEN( dialogsheet ):
     250   [ +  -  -  +  :        519 :             switch( nElement )
          -  -  +  +  +  
          +  -  -  +  +  
          +  +  -  +  +  
                      - ]
     251                 :            :             {
     252         [ +  - ]:         60 :                 case XLS_TOKEN( sheetData ):                return new SheetDataContext( *this );
     253         [ #  # ]:          0 :                 case XLS_TOKEN( conditionalFormatting ):    return new CondFormatContext( *this );
     254         [ #  # ]:          0 :                 case XLS_TOKEN( dataValidations ):          return new DataValidationsContext( *this );
     255         [ +  - ]:          3 :                 case XLS_TOKEN( autoFilter ):               return new AutoFilterContext( *this, getAutoFilters().createAutoFilter() );
     256         [ #  # ]:          0 :                 case XLS_TOKEN( scenarios ):                return new ScenariosContext( *this );
     257         [ #  # ]:          0 :                 case XLS_TOKEN( extLst ):                   return new ExtLstGlobalContext( *this );
     258                 :            : 
     259                 :            :                 case XLS_TOKEN( sheetViews ):
     260                 :            :                 case XLS_TOKEN( cols ):
     261                 :            :                 case XLS_TOKEN( mergeCells ):
     262                 :            :                 case XLS_TOKEN( hyperlinks ):
     263                 :            :                 case XLS_TOKEN( rowBreaks ):
     264                 :            :                 case XLS_TOKEN( colBreaks ):
     265                 :            :                 case XLS_TOKEN( oleObjects ):
     266                 :        117 :                 case XLS_TOKEN( controls ):         return this;
     267                 :            : 
     268                 :         51 :                 case XLS_TOKEN( sheetPr ):          getWorksheetSettings().importSheetPr( rAttribs );               return this;
     269                 :         60 :                 case XLS_TOKEN( dimension ):        importDimension( rAttribs );                                    break;
     270                 :         18 :                 case XLS_TOKEN( sheetFormatPr ):    importSheetFormatPr( rAttribs );                                break;
     271                 :          0 :                 case XLS_TOKEN( sheetProtection ):  getWorksheetSettings().importSheetProtection( rAttribs );       break;
     272                 :          0 :                 case XLS_TOKEN( phoneticPr ):       getWorksheetSettings().importPhoneticPr( rAttribs );            break;
     273                 :         42 :                 case XLS_TOKEN( printOptions ):     getPageSettings().importPrintOptions( rAttribs );               break;
     274                 :         60 :                 case XLS_TOKEN( pageMargins ):      getPageSettings().importPageMargins( rAttribs );                break;
     275                 :         45 :                 case XLS_TOKEN( pageSetup ):        getPageSettings().importPageSetup( getRelations(), rAttribs );  break;
     276                 :         51 :                 case XLS_TOKEN( headerFooter ):     getPageSettings().importHeaderFooter( rAttribs );               return this;
     277                 :          0 :                 case XLS_TOKEN( picture ):          getPageSettings().importPicture( getRelations(), rAttribs );    break;
     278                 :          6 :                 case XLS_TOKEN( drawing ):          importDrawing( rAttribs );                                      break;
     279                 :          6 :                 case XLS_TOKEN( legacyDrawing ):    importLegacyDrawing( rAttribs );                                break;
     280                 :            :             }
     281                 :        237 :         break;
     282                 :            : 
     283                 :            :         case XLS_TOKEN( sheetPr ):
     284   [ -  -  +  - ]:         42 :             switch( nElement )
     285                 :            :             {
     286                 :          0 :                 case XLS_TOKEN( tabColor ):         getWorksheetSettings().importTabColor( rAttribs );              break;
     287                 :          0 :                 case XLS_TOKEN( outlinePr ):        getWorksheetSettings().importOutlinePr( rAttribs );             break;
     288                 :         42 :                 case XLS_TOKEN( pageSetUpPr ):      importPageSetUpPr( rAttribs );                                  break;
     289                 :            :             }
     290                 :         42 :         break;
     291                 :            : 
     292                 :            :         case XLS_TOKEN( sheetViews ):
     293         [ +  - ]:         60 :             switch( nElement )
     294                 :            :             {
     295                 :         60 :                 case XLS_TOKEN( sheetView ):        getSheetViewSettings().importSheetView( rAttribs );             return this;
     296                 :            :             }
     297                 :          0 :         break;
     298                 :            :         case XLS_TOKEN( sheetView ):
     299      [ -  +  - ]:         48 :             switch( nElement )
     300                 :            :             {
     301                 :          0 :                 case XLS_TOKEN( pane ):             getSheetViewSettings().importPane( rAttribs );                  break;
     302                 :         48 :                 case XLS_TOKEN( selection ):        getSheetViewSettings().importSelection( rAttribs );             break;
     303                 :            :             }
     304                 :         48 :         break;
     305                 :            : 
     306                 :            :         case XLS_TOKEN( cols ):
     307         [ +  - ]:         69 :             if( nElement == XLS_TOKEN( col ) ) importCol( rAttribs );
     308                 :         69 :         break;
     309                 :            :         case XLS_TOKEN( mergeCells ):
     310         [ +  - ]:          3 :             if( nElement == XLS_TOKEN( mergeCell ) ) importMergeCell( rAttribs );
     311                 :          3 :         break;
     312                 :            :         case XLS_TOKEN( hyperlinks ):
     313         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( hyperlink ) ) importHyperlink( rAttribs );
     314                 :          0 :         break;
     315                 :            :         case XLS_TOKEN( rowBreaks ):
     316         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( brk ) ) importBrk( rAttribs, true );
     317                 :          0 :         break;
     318                 :            :         case XLS_TOKEN( colBreaks ):
     319         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( brk ) ) importBrk( rAttribs, false );
     320                 :          0 :         break;
     321                 :            : 
     322                 :            :         case XLS_TOKEN( headerFooter ):
     323         [ +  - ]:        102 :             switch( nElement )
     324                 :            :             {
     325                 :            :                 case XLS_TOKEN( firstHeader ):
     326                 :            :                 case XLS_TOKEN( firstFooter ):
     327                 :            :                 case XLS_TOKEN( oddHeader ):
     328                 :            :                 case XLS_TOKEN( oddFooter ):
     329                 :            :                 case XLS_TOKEN( evenHeader ):
     330                 :        102 :                 case XLS_TOKEN( evenFooter ):       return this;    // collect h/f contents in onCharacters()
     331                 :            :             }
     332                 :          0 :         break;
     333                 :            :         // Only process an oleObject or control if outside a mc:AlternateContent
     334                 :            :         // element OR if within a mc:Fallback. I suppose ideally we
     335                 :            :         // should process the stuff within 'mc:Choice'
     336                 :            :         case XLS_TOKEN( controls ):
     337                 :            :         case XLS_TOKEN( oleObjects ):
     338         [ +  - ]:          3 :             if ( getCurrentElement() == XLS_TOKEN( controls ) )
     339                 :            :             {
     340 [ +  - ][ +  - ]:          3 :                 if( aMceState.empty() || ( !aMceState.empty() && aMceState.back() == MCE_STARTED ) )
         [ -  + ][ -  + ]
     341                 :            :                 {
     342         [ #  # ]:          0 :                     if ( getCurrentElement() == XLS_TOKEN( oleObjects ) ) importOleObject( rAttribs );
     343                 :            :                     else
     344                 :          0 :                         importControl( rAttribs );
     345                 :            :                 }
     346 [ +  - ][ +  - ]:          3 :                 else if ( !aMceState.empty() && aMceState.back() == MCE_FOUND_CHOICE )
                 [ +  - ]
     347                 :            :                 {
     348                 :            :                     // reset the handling within 'Choice'
     349                 :            :                     // this will force attempted handling in Fallback
     350                 :          3 :                     aMceState.back() = MCE_STARTED;
     351                 :            :                 }
     352                 :            :             }
     353                 :          3 :         break;
     354                 :            :     }
     355                 :        906 :     return 0;
     356                 :            : }
     357                 :            : 
     358                 :        102 : void WorksheetFragment::onCharacters( const OUString& rChars )
     359                 :            : {
     360         [ +  - ]:        102 :     switch( getCurrentElement() )
     361                 :            :     {
     362                 :            :         case XLS_TOKEN( firstHeader ):
     363                 :            :         case XLS_TOKEN( firstFooter ):
     364                 :            :         case XLS_TOKEN( oddHeader ):
     365                 :            :         case XLS_TOKEN( oddFooter ):
     366                 :            :         case XLS_TOKEN( evenHeader ):
     367                 :            :         case XLS_TOKEN( evenFooter ):
     368                 :        102 :             getPageSettings().importHeaderFooterCharacters( rChars, getCurrentElement() );
     369                 :        102 :         break;
     370                 :            :     }
     371                 :        102 : }
     372                 :            : 
     373                 :          0 : ContextHandlerRef WorksheetFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
     374                 :            : {
     375   [ #  #  #  #  :          0 :     switch( getCurrentElement() )
          #  #  #  #  #  
                   #  # ]
     376                 :            :     {
     377                 :            :         case XML_ROOT_CONTEXT:
     378         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_WORKSHEET ) return this;
     379                 :          0 :         break;
     380                 :            : 
     381                 :            :         case BIFF12_ID_WORKSHEET:
     382   [ #  #  #  #  :          0 :             switch( nRecId )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
     383                 :            :             {
     384         [ #  # ]:          0 :                 case BIFF12_ID_SHEETDATA:       return new SheetDataContext( *this );
     385         [ #  # ]:          0 :                 case BIFF12_ID_CONDFORMATTING:  return new CondFormatContext( *this );
     386         [ #  # ]:          0 :                 case BIFF12_ID_DATAVALIDATIONS: return new DataValidationsContext( *this );
     387         [ #  # ]:          0 :                 case BIFF12_ID_AUTOFILTER:      return new AutoFilterContext( *this, getAutoFilters().createAutoFilter() );
     388         [ #  # ]:          0 :                 case BIFF12_ID_SCENARIOS:       return new ScenariosContext( *this );
     389                 :            : 
     390                 :            :                 case BIFF12_ID_SHEETVIEWS:
     391                 :            :                 case BIFF12_ID_COLS:
     392                 :            :                 case BIFF12_ID_MERGECELLS:
     393                 :            :                 case BIFF12_ID_ROWBREAKS:
     394                 :            :                 case BIFF12_ID_COLBREAKS:
     395                 :            :                 case BIFF12_ID_OLEOBJECTS:
     396                 :          0 :                 case BIFF12_ID_CONTROLS:        return this;
     397                 :            : 
     398                 :          0 :                 case BIFF12_ID_SHEETPR:         getWorksheetSettings().importSheetPr( rStrm );              break;
     399                 :          0 :                 case BIFF12_ID_DIMENSION:       importDimension( rStrm );                                   break;
     400                 :          0 :                 case BIFF12_ID_SHEETFORMATPR:   importSheetFormatPr( rStrm );                               break;
     401                 :          0 :                 case BIFF12_ID_HYPERLINK:       importHyperlink( rStrm );                                   break;
     402                 :          0 :                 case BIFF12_ID_PAGEMARGINS:     getPageSettings().importPageMargins( rStrm );               break;
     403                 :          0 :                 case BIFF12_ID_PAGESETUP:       getPageSettings().importPageSetup( getRelations(), rStrm ); break;
     404                 :          0 :                 case BIFF12_ID_PRINTOPTIONS:    getPageSettings().importPrintOptions( rStrm );              break;
     405                 :          0 :                 case BIFF12_ID_HEADERFOOTER:    getPageSettings().importHeaderFooter( rStrm );              break;
     406                 :          0 :                 case BIFF12_ID_PICTURE:         getPageSettings().importPicture( getRelations(), rStrm );   break;
     407                 :          0 :                 case BIFF12_ID_SHEETPROTECTION: getWorksheetSettings().importSheetProtection( rStrm );      break;
     408                 :          0 :                 case BIFF12_ID_PHONETICPR:      getWorksheetSettings().importPhoneticPr( rStrm );           break;
     409                 :          0 :                 case BIFF12_ID_DRAWING:         importDrawing( rStrm );                                     break;
     410                 :          0 :                 case BIFF12_ID_LEGACYDRAWING:   importLegacyDrawing( rStrm );                               break;
     411                 :            :             }
     412                 :          0 :         break;
     413                 :            : 
     414                 :            :         case BIFF12_ID_SHEETVIEWS:
     415         [ #  # ]:          0 :             switch( nRecId )
     416                 :            :             {
     417                 :          0 :                 case BIFF12_ID_SHEETVIEW:       getSheetViewSettings().importSheetView( rStrm );            return this;
     418                 :            :             }
     419                 :          0 :         break;
     420                 :            :         case BIFF12_ID_SHEETVIEW:
     421      [ #  #  # ]:          0 :             switch( nRecId )
     422                 :            :             {
     423                 :          0 :                 case BIFF12_ID_PANE:            getSheetViewSettings().importPane( rStrm );                 break;
     424                 :          0 :                 case BIFF12_ID_SELECTION:       getSheetViewSettings().importSelection( rStrm );            break;
     425                 :            :             }
     426                 :          0 :         break;
     427                 :            : 
     428                 :            :         case BIFF12_ID_COLS:
     429         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_COL ) importCol( rStrm );
     430                 :          0 :         break;
     431                 :            :         case BIFF12_ID_MERGECELLS:
     432         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_MERGECELL ) importMergeCell( rStrm );
     433                 :          0 :         break;
     434                 :            :         case BIFF12_ID_ROWBREAKS:
     435         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_BRK ) importBrk( rStrm, true );
     436                 :          0 :         break;
     437                 :            :         case BIFF12_ID_COLBREAKS:
     438         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_BRK ) importBrk( rStrm, false );
     439                 :          0 :         break;
     440                 :            :         case BIFF12_ID_OLEOBJECTS:
     441         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_OLEOBJECT ) importOleObject( rStrm );
     442                 :          0 :         break;
     443                 :            :         case BIFF12_ID_CONTROLS:
     444         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_CONTROL ) importControl( rStrm );
     445                 :          0 :         break;
     446                 :            :     }
     447                 :          0 :     return 0;
     448                 :            : }
     449                 :            : 
     450                 :          0 : const RecordInfo* WorksheetFragment::getRecordInfos() const
     451                 :            : {
     452                 :            :     static const RecordInfo spRecInfos[] =
     453                 :            :     {
     454                 :            :         { BIFF12_ID_AUTOFILTER,         BIFF12_ID_AUTOFILTER + 1        },
     455                 :            :         { BIFF12_ID_CFRULE,             BIFF12_ID_CFRULE + 1            },
     456                 :            :         { BIFF12_ID_COLBREAKS,          BIFF12_ID_COLBREAKS + 1         },
     457                 :            :         { BIFF12_ID_COLORSCALE,         BIFF12_ID_COLORSCALE + 1        },
     458                 :            :         { BIFF12_ID_COLS,               BIFF12_ID_COLS + 1              },
     459                 :            :         { BIFF12_ID_CONDFORMATTING,     BIFF12_ID_CONDFORMATTING + 1    },
     460                 :            :         { BIFF12_ID_CONTROLS,           BIFF12_ID_CONTROLS + 2          },
     461                 :            :         { BIFF12_ID_CUSTOMFILTERS,      BIFF12_ID_CUSTOMFILTERS + 1     },
     462                 :            :         { BIFF12_ID_CUSTOMSHEETVIEW,    BIFF12_ID_CUSTOMSHEETVIEW + 1   },
     463                 :            :         { BIFF12_ID_CUSTOMSHEETVIEWS,   BIFF12_ID_CUSTOMSHEETVIEWS + 3  },
     464                 :            :         { BIFF12_ID_DATABAR,            BIFF12_ID_DATABAR + 1           },
     465                 :            :         { BIFF12_ID_DATAVALIDATIONS,    BIFF12_ID_DATAVALIDATIONS + 1   },
     466                 :            :         { BIFF12_ID_DISCRETEFILTERS,    BIFF12_ID_DISCRETEFILTERS + 1   },
     467                 :            :         { BIFF12_ID_FILTERCOLUMN,       BIFF12_ID_FILTERCOLUMN + 1      },
     468                 :            :         { BIFF12_ID_HEADERFOOTER,       BIFF12_ID_HEADERFOOTER + 1      },
     469                 :            :         { BIFF12_ID_ICONSET,            BIFF12_ID_ICONSET + 1           },
     470                 :            :         { BIFF12_ID_MERGECELLS,         BIFF12_ID_MERGECELLS + 1        },
     471                 :            :         { BIFF12_ID_OLEOBJECTS,         BIFF12_ID_OLEOBJECTS + 2        },
     472                 :            :         { BIFF12_ID_ROW,                -1                              },
     473                 :            :         { BIFF12_ID_ROWBREAKS,          BIFF12_ID_ROWBREAKS + 1         },
     474                 :            :         { BIFF12_ID_SCENARIO,           BIFF12_ID_SCENARIO + 1          },
     475                 :            :         { BIFF12_ID_SCENARIOS,          BIFF12_ID_SCENARIOS + 1         },
     476                 :            :         { BIFF12_ID_SHEETDATA,          BIFF12_ID_SHEETDATA + 1         },
     477                 :            :         { BIFF12_ID_SHEETVIEW,          BIFF12_ID_SHEETVIEW + 1         },
     478                 :            :         { BIFF12_ID_SHEETVIEWS,         BIFF12_ID_SHEETVIEWS + 1        },
     479                 :            :         { BIFF12_ID_TABLEPARTS,         BIFF12_ID_TABLEPARTS + 2        },
     480                 :            :         { BIFF12_ID_WORKSHEET,          BIFF12_ID_WORKSHEET + 1         },
     481                 :            :         { -1,                           -1                              }
     482                 :            :     };
     483                 :          0 :     return spRecInfos;
     484                 :            : }
     485                 :            : 
     486                 :         60 : void WorksheetFragment::initializeImport()
     487                 :            : {
     488                 :            :     // initial processing in base class WorksheetHelper
     489         [ +  - ]:         60 :     initializeWorksheetImport();
     490                 :            : 
     491                 :            :     // import query table fragments related to this worksheet
     492 [ +  - ][ +  - ]:         60 :     RelationsRef xQueryRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "queryTable" ) );
                 [ +  - ]
     493         [ -  + ]:         60 :     for( Relations::const_iterator aIt = xQueryRels->begin(), aEnd = xQueryRels->end(); aIt != aEnd; ++aIt )
     494 [ #  # ][ #  # ]:          0 :         importOoxFragment( new QueryTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
                 [ #  # ]
     495                 :            : 
     496                 :            :     // import pivot table fragments related to this worksheet
     497 [ +  - ][ +  - ]:         60 :     RelationsRef xPivotRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATION_TYPE( "pivotTable" ) );
                 [ +  - ]
     498         [ -  + ]:         60 :     for( Relations::const_iterator aIt = xPivotRels->begin(), aEnd = xPivotRels->end(); aIt != aEnd; ++aIt )
     499 [ #  # ][ #  # ]:         60 :         importOoxFragment( new PivotTableFragment( *this, getFragmentPathFromRelation( aIt->second ) ) );
         [ #  # ][ +  - ]
                 [ +  - ]
     500                 :         60 : }
     501                 :            : 
     502                 :         60 : void WorksheetFragment::finalizeImport()
     503                 :            : {
     504                 :            :     // final processing in base class WorksheetHelper
     505                 :         60 :     finalizeWorksheetImport();
     506                 :         60 : }
     507                 :            : 
     508                 :            : // private --------------------------------------------------------------------
     509                 :            : 
     510                 :         42 : void WorksheetFragment::importPageSetUpPr( const AttributeList& rAttribs )
     511                 :            : {
     512                 :            :     // for whatever reason, this flag is still stored separated from the page settings
     513                 :         42 :     getPageSettings().setFitToPagesMode( rAttribs.getBool( XML_fitToPage, false ) );
     514                 :         42 : }
     515                 :            : 
     516                 :         60 : void WorksheetFragment::importDimension( const AttributeList& rAttribs )
     517                 :            : {
     518                 :         60 :     CellRangeAddress aRange;
     519 [ +  - ][ +  - ]:         60 :     getAddressConverter().convertToCellRangeUnchecked( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex() );
         [ +  - ][ +  - ]
     520                 :            :     /*  OOXML stores the used area, if existing, or "A1" if the sheet is empty.
     521                 :            :         In case of "A1", the dimension at the WorksheetHelper object will not
     522                 :            :         be set. If the cell A1 exists, the used area will be updated while
     523                 :            :         importing the cell. */
     524 [ +  + ][ +  + ]:         60 :     if( (aRange.EndColumn > 0) || (aRange.EndRow > 0) )
     525         [ +  - ]:         42 :         extendUsedArea( aRange );
     526                 :         60 : }
     527                 :            : 
     528                 :         18 : void WorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
     529                 :            : {
     530                 :            :     // default column settings
     531                 :         18 :     setBaseColumnWidth( rAttribs.getInteger( XML_baseColWidth, 8 ) );
     532                 :         18 :     setDefaultColumnWidth( rAttribs.getDouble( XML_defaultColWidth, 0.0 ) );
     533                 :            :     // default row settings
     534                 :            :     setDefaultRowSettings(
     535                 :            :         rAttribs.getDouble( XML_defaultRowHeight, 0.0 ),
     536                 :         18 :         rAttribs.getBool( XML_customHeight, false ),
     537                 :         18 :         rAttribs.getBool( XML_zeroHeight, false ),
     538                 :         18 :         rAttribs.getBool( XML_thickTop, false ),
     539                 :         36 :         rAttribs.getBool( XML_thickBottom, false ) );
     540                 :         18 : }
     541                 :            : 
     542                 :         69 : void WorksheetFragment::importCol( const AttributeList& rAttribs )
     543                 :            : {
     544         [ +  - ]:         69 :     ColumnModel aModel;
     545         [ +  - ]:         69 :     aModel.maRange.mnFirst = rAttribs.getInteger( XML_min, -1 );
     546         [ +  - ]:         69 :     aModel.maRange.mnLast  = rAttribs.getInteger( XML_max, -1 );
     547         [ +  - ]:         69 :     aModel.mfWidth         = rAttribs.getDouble( XML_width, 0.0 );
     548         [ +  - ]:         69 :     aModel.mnXfId          = rAttribs.getInteger( XML_style, -1 );
     549         [ +  - ]:         69 :     aModel.mnLevel         = rAttribs.getInteger( XML_outlineLevel, 0 );
     550         [ +  - ]:         69 :     aModel.mbShowPhonetic  = rAttribs.getBool( XML_phonetic, false );
     551         [ +  - ]:         69 :     aModel.mbHidden        = rAttribs.getBool( XML_hidden, false );
     552         [ +  - ]:         69 :     aModel.mbCollapsed     = rAttribs.getBool( XML_collapsed, false );
     553                 :            :     // set column properties in the current sheet
     554         [ +  - ]:         69 :     setColumnModel( aModel );
     555                 :         69 : }
     556                 :            : 
     557                 :          3 : void WorksheetFragment::importMergeCell( const AttributeList& rAttribs )
     558                 :            : {
     559                 :          3 :     CellRangeAddress aRange;
     560 [ +  - ][ +  - ]:          3 :     if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
         [ +  - ][ +  - ]
                 [ +  - ]
     561 [ +  - ][ +  - ]:          3 :         getSheetData().setMergedRange( aRange );
     562                 :          3 : }
     563                 :            : 
     564                 :          0 : void WorksheetFragment::importHyperlink( const AttributeList& rAttribs )
     565                 :            : {
     566         [ #  # ]:          0 :     HyperlinkModel aModel;
     567 [ #  # ][ #  # ]:          0 :     if( getAddressConverter().convertToCellRange( aModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     568                 :            :     {
     569 [ #  # ][ #  # ]:          0 :         aModel.maTarget   = getRelations().getExternalTargetFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
                 [ #  # ]
     570         [ #  # ]:          0 :         aModel.maLocation = rAttribs.getXString( XML_location, OUString() );
     571         [ #  # ]:          0 :         aModel.maDisplay  = rAttribs.getXString( XML_display, OUString() );
     572         [ #  # ]:          0 :         aModel.maTooltip  = rAttribs.getXString( XML_tooltip, OUString() );
     573         [ #  # ]:          0 :         setHyperlink( aModel );
     574                 :          0 :     }
     575                 :          0 : }
     576                 :            : 
     577                 :          0 : void WorksheetFragment::importBrk( const AttributeList& rAttribs, bool bRowBreak )
     578                 :            : {
     579         [ #  # ]:          0 :     PageBreakModel aModel;
     580         [ #  # ]:          0 :     aModel.mnColRow = rAttribs.getInteger( XML_id, 0 );
     581         [ #  # ]:          0 :     aModel.mnMin    = rAttribs.getInteger( XML_min, aModel.mnColRow );
     582         [ #  # ]:          0 :     aModel.mnMax    = rAttribs.getInteger( XML_max, aModel.mnColRow );
     583         [ #  # ]:          0 :     aModel.mbManual = rAttribs.getBool( XML_man, false );
     584         [ #  # ]:          0 :     setPageBreak( aModel, bRowBreak );
     585                 :          0 : }
     586                 :            : 
     587                 :          6 : void WorksheetFragment::importDrawing( const AttributeList& rAttribs )
     588                 :            : {
     589 [ +  - ][ +  - ]:          6 :     setDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
                 [ +  - ]
     590                 :          6 : }
     591                 :            : 
     592                 :          6 : void WorksheetFragment::importLegacyDrawing( const AttributeList& rAttribs )
     593                 :            : {
     594 [ +  - ][ +  - ]:          6 :     setVmlDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
                 [ +  - ]
     595                 :          6 : }
     596                 :            : 
     597                 :          0 : void WorksheetFragment::importOleObject( const AttributeList& rAttribs )
     598                 :            : {
     599         [ #  # ]:          0 :     ::oox::vml::OleObjectInfo aInfo;
     600 [ #  # ][ #  # ]:          0 :     aInfo.setShapeId( rAttribs.getInteger( XML_shapeId, 0 ) );
     601                 :            :     OSL_ENSURE( rAttribs.hasAttribute( XML_link ) != rAttribs.hasAttribute( R_TOKEN( id ) ),
     602                 :            :         "WorksheetFragment::importOleObject - OLE object must be either linked or embedded" );
     603         [ #  # ]:          0 :     aInfo.mbLinked = rAttribs.hasAttribute( XML_link );
     604         [ #  # ]:          0 :     if( aInfo.mbLinked )
     605 [ #  # ][ #  # ]:          0 :         aInfo.maTargetLink = getFormulaParser().importOleTargetLink( rAttribs.getString( XML_link, OUString() ) );
                 [ #  # ]
     606 [ #  # ][ #  # ]:          0 :     else if( rAttribs.hasAttribute( R_TOKEN( id ) ) )
     607 [ #  # ][ #  # ]:          0 :         importEmbeddedOleData( aInfo.maEmbeddedData, rAttribs.getString( R_TOKEN( id ), OUString() ) );
     608         [ #  # ]:          0 :     aInfo.maProgId = rAttribs.getString( XML_progId, OUString() );
     609         [ #  # ]:          0 :     aInfo.mbShowAsIcon = rAttribs.getToken( XML_dvAspect, XML_DVASPECT_CONTENT ) == XML_DVASPECT_ICON;
     610         [ #  # ]:          0 :     aInfo.mbAutoUpdate = rAttribs.getToken( XML_oleUpdate, XML_OLEUPDATE_ONCALL ) == XML_OLEUPDATE_ALWAYS;
     611         [ #  # ]:          0 :     aInfo.mbAutoLoad = rAttribs.getBool( XML_autoLoad, false );
     612 [ #  # ][ #  # ]:          0 :     getVmlDrawing().registerOleObject( aInfo );
                 [ #  # ]
     613                 :          0 : }
     614                 :            : 
     615                 :          0 : void WorksheetFragment::importControl( const AttributeList& rAttribs )
     616                 :            : {
     617         [ #  # ]:          0 :     ::oox::vml::ControlInfo aInfo;
     618 [ #  # ][ #  # ]:          0 :     aInfo.setShapeId( rAttribs.getInteger( XML_shapeId, 0 ) );
     619 [ #  # ][ #  # ]:          0 :     aInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
     620         [ #  # ]:          0 :     aInfo.maName = rAttribs.getString( XML_name, OUString() );
     621 [ #  # ][ #  # ]:          0 :     getVmlDrawing().registerControl( aInfo );
                 [ #  # ]
     622                 :          0 : }
     623                 :            : 
     624                 :          0 : void WorksheetFragment::importDimension( SequenceInputStream& rStrm )
     625                 :            : {
     626                 :          0 :     BinRange aBinRange;
     627         [ #  # ]:          0 :     aBinRange.read( rStrm );
     628                 :          0 :     CellRangeAddress aRange;
     629 [ #  # ][ #  # ]:          0 :     getAddressConverter().convertToCellRangeUnchecked( aRange, aBinRange, getSheetIndex() );
                 [ #  # ]
     630                 :            :     /*  BIFF12 stores the used area, if existing, or "A1" if the sheet is
     631                 :            :         empty. In case of "A1", the dimension at the WorksheetHelper object
     632                 :            :         will not be set. If the cell A1 exists, the used area will be updated
     633                 :            :         while importing the cell. */
     634 [ #  # ][ #  # ]:          0 :     if( (aRange.EndColumn > 0) || (aRange.EndRow > 0) )
     635         [ #  # ]:          0 :         extendUsedArea( aRange );
     636                 :          0 : }
     637                 :            : 
     638                 :          0 : void WorksheetFragment::importSheetFormatPr( SequenceInputStream& rStrm )
     639                 :            : {
     640                 :            :     sal_Int32 nDefaultWidth;
     641                 :            :     sal_uInt16 nBaseWidth, nDefaultHeight, nFlags;
     642 [ #  # ][ #  # ]:          0 :     rStrm >> nDefaultWidth >> nBaseWidth >> nDefaultHeight >> nFlags;
         [ #  # ][ #  # ]
     643                 :            : 
     644                 :            :     // base column with
     645         [ #  # ]:          0 :     setBaseColumnWidth( nBaseWidth );
     646                 :            :     // default width is stored as 1/256th of a character in BIFF12, convert to entire character
     647         [ #  # ]:          0 :     setDefaultColumnWidth( static_cast< double >( nDefaultWidth ) / 256.0 );
     648                 :            :     // row height is in twips in BIFF12, convert to points; equal flags in all BIFFs
     649                 :            :     setDefaultRowSettings(
     650                 :            :         nDefaultHeight / 20.0,
     651                 :          0 :         getFlag( nFlags, BIFF_DEFROW_CUSTOMHEIGHT ),
     652                 :          0 :         getFlag( nFlags, BIFF_DEFROW_HIDDEN ),
     653                 :          0 :         getFlag( nFlags, BIFF_DEFROW_THICKTOP ),
     654         [ #  # ]:          0 :         getFlag( nFlags, BIFF_DEFROW_THICKBOTTOM ) );
     655                 :          0 : }
     656                 :            : 
     657                 :          0 : void WorksheetFragment::importCol( SequenceInputStream& rStrm )
     658                 :            : {
     659         [ #  # ]:          0 :     ColumnModel aModel;
     660                 :            : 
     661                 :            :     sal_Int32 nWidth;
     662                 :            :     sal_uInt16 nFlags;
     663 [ #  # ][ #  # ]:          0 :     rStrm >> aModel.maRange.mnFirst >> aModel.maRange.mnLast >> nWidth >> aModel.mnXfId >> nFlags;
         [ #  # ][ #  # ]
                 [ #  # ]
     664                 :            : 
     665                 :            :     // column indexes are 0-based in BIFF12, but ColumnModel expects 1-based
     666                 :          0 :     ++aModel.maRange.mnFirst;
     667                 :          0 :     ++aModel.maRange.mnLast;
     668                 :            :     // width is stored as 1/256th of a character in BIFF12, convert to entire character
     669                 :          0 :     aModel.mfWidth        = static_cast< double >( nWidth ) / 256.0;
     670                 :            :     // equal flags in all BIFFs
     671                 :          0 :     aModel.mnLevel        = extractValue< sal_Int32 >( nFlags, 8, 3 );
     672                 :          0 :     aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
     673                 :          0 :     aModel.mbHidden       = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
     674                 :          0 :     aModel.mbCollapsed    = getFlag( nFlags, BIFF_COLINFO_COLLAPSED );
     675                 :            :     // set column properties in the current sheet
     676         [ #  # ]:          0 :     setColumnModel( aModel );
     677                 :          0 : }
     678                 :            : 
     679                 :          0 : void WorksheetFragment::importMergeCell( SequenceInputStream& rStrm )
     680                 :            : {
     681                 :          0 :     BinRange aBinRange;
     682         [ #  # ]:          0 :     rStrm >> aBinRange;
     683                 :          0 :     CellRangeAddress aRange;
     684 [ #  # ][ #  # ]:          0 :     if( getAddressConverter().convertToCellRange( aRange, aBinRange, getSheetIndex(), true, true ) )
         [ #  # ][ #  # ]
     685 [ #  # ][ #  # ]:          0 :         getSheetData().setMergedRange( aRange );
     686                 :          0 : }
     687                 :            : 
     688                 :          0 : void WorksheetFragment::importHyperlink( SequenceInputStream& rStrm )
     689                 :            : {
     690                 :          0 :     BinRange aBinRange;
     691         [ #  # ]:          0 :     rStrm >> aBinRange;
     692         [ #  # ]:          0 :     HyperlinkModel aModel;
     693 [ #  # ][ #  # ]:          0 :     if( getAddressConverter().convertToCellRange( aModel.maRange, aBinRange, getSheetIndex(), true, true ) )
         [ #  # ][ #  # ]
     694                 :            :     {
     695 [ #  # ][ #  # ]:          0 :         aModel.maTarget = getRelations().getExternalTargetFromRelId( BiffHelper::readString( rStrm ) );
                 [ #  # ]
     696 [ #  # ][ #  # ]:          0 :         rStrm >> aModel.maLocation >> aModel.maTooltip >> aModel.maDisplay;
                 [ #  # ]
     697         [ #  # ]:          0 :         setHyperlink( aModel );
     698                 :          0 :     }
     699                 :          0 : }
     700                 :            : 
     701                 :          0 : void WorksheetFragment::importBrk( SequenceInputStream& rStrm, bool bRowBreak )
     702                 :            : {
     703         [ #  # ]:          0 :     PageBreakModel aModel;
     704                 :            :     sal_Int32 nManual;
     705 [ #  # ][ #  # ]:          0 :     rStrm >> aModel.mnColRow >> aModel.mnMin >> aModel.mnMax >> nManual;
         [ #  # ][ #  # ]
     706                 :          0 :     aModel.mbManual = nManual != 0;
     707         [ #  # ]:          0 :     setPageBreak( aModel, bRowBreak );
     708                 :          0 : }
     709                 :            : 
     710                 :          0 : void WorksheetFragment::importDrawing( SequenceInputStream& rStrm )
     711                 :            : {
     712 [ #  # ][ #  # ]:          0 :     setDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
     713                 :          0 : }
     714                 :            : 
     715                 :          0 : void WorksheetFragment::importLegacyDrawing( SequenceInputStream& rStrm )
     716                 :            : {
     717 [ #  # ][ #  # ]:          0 :     setVmlDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
     718                 :          0 : }
     719                 :            : 
     720                 :          0 : void WorksheetFragment::importOleObject( SequenceInputStream& rStrm )
     721                 :            : {
     722         [ #  # ]:          0 :     ::oox::vml::OleObjectInfo aInfo;
     723                 :            :     sal_Int32 nAspect, nUpdateMode, nShapeId;
     724                 :            :     sal_uInt16 nFlags;
     725 [ #  # ][ #  # ]:          0 :     rStrm >> nAspect >> nUpdateMode >> nShapeId >> nFlags >> aInfo.maProgId;
         [ #  # ][ #  # ]
                 [ #  # ]
     726                 :          0 :     aInfo.mbLinked = getFlag( nFlags, BIFF12_OLEOBJECT_LINKED );
     727         [ #  # ]:          0 :     if( aInfo.mbLinked )
     728 [ #  # ][ #  # ]:          0 :         aInfo.maTargetLink = getFormulaParser().importOleTargetLink( rStrm );
     729                 :            :     else
     730 [ #  # ][ #  # ]:          0 :         importEmbeddedOleData( aInfo.maEmbeddedData, BiffHelper::readString( rStrm ) );
     731         [ #  # ]:          0 :     aInfo.setShapeId( nShapeId );
     732                 :          0 :     aInfo.mbShowAsIcon = nAspect == BIFF12_OLEOBJECT_ICON;
     733                 :          0 :     aInfo.mbAutoUpdate = nUpdateMode == BIFF12_OLEOBJECT_ALWAYS;
     734                 :          0 :     aInfo.mbAutoLoad = getFlag( nFlags, BIFF12_OLEOBJECT_AUTOLOAD );
     735 [ #  # ][ #  # ]:          0 :     getVmlDrawing().registerOleObject( aInfo );
                 [ #  # ]
     736                 :          0 : }
     737                 :            : 
     738                 :          0 : void WorksheetFragment::importControl( SequenceInputStream& rStrm )
     739                 :            : {
     740         [ #  # ]:          0 :     ::oox::vml::ControlInfo aInfo;
     741 [ #  # ][ #  # ]:          0 :     aInfo.setShapeId( rStrm.readInt32() );
     742 [ #  # ][ #  # ]:          0 :     aInfo.maFragmentPath = getFragmentPathFromRelId( BiffHelper::readString( rStrm ) );
     743         [ #  # ]:          0 :     rStrm >> aInfo.maName;
     744 [ #  # ][ #  # ]:          0 :     getVmlDrawing().registerControl( aInfo );
                 [ #  # ]
     745                 :          0 : }
     746                 :            : 
     747                 :          0 : void WorksheetFragment::importEmbeddedOleData( StreamDataSequence& orEmbeddedData, const OUString& rRelId )
     748                 :            : {
     749         [ #  # ]:          0 :     OUString aFragmentPath = getFragmentPathFromRelId( rRelId );
     750         [ #  # ]:          0 :     if( !aFragmentPath.isEmpty() )
     751 [ #  # ][ #  # ]:          0 :         getBaseFilter().importBinaryData( orEmbeddedData, aFragmentPath );
     752                 :          0 : }
     753                 :            : 
     754                 :            : } // namespace xls
     755 [ +  - ][ +  - ]:         24 : } // namespace oox
     756                 :            : 
     757                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10