LCOV - code coverage report
Current view: top level - sc/source/filter/oox - chartsheetfragment.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 60 1.7 %
Date: 2012-08-25 Functions: 2 11 18.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 53 3.8 %

           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 "chartsheetfragment.hxx"
      30                 :            : 
      31                 :            : #include "oox/helper/attributelist.hxx"
      32                 :            : #include "biffinputstream.hxx"
      33                 :            : #include "pagesettings.hxx"
      34                 :            : #include "viewsettings.hxx"
      35                 :            : #include "workbooksettings.hxx"
      36                 :            : #include "worksheetsettings.hxx"
      37                 :            : 
      38                 :            : namespace oox {
      39                 :            : namespace xls {
      40                 :            : 
      41                 :            : // ============================================================================
      42                 :            : 
      43                 :            : using namespace ::oox::core;
      44                 :            : 
      45                 :            : using ::rtl::OUString;
      46                 :            : 
      47                 :            : // ============================================================================
      48                 :            : 
      49                 :          0 : ChartsheetFragment::ChartsheetFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
      50                 :          0 :     WorksheetFragmentBase( rHelper, rFragmentPath )
      51                 :            : {
      52                 :          0 : }
      53                 :            : 
      54                 :          0 : ContextHandlerRef ChartsheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      55                 :            : {
      56   [ #  #  #  #  :          0 :     switch( getCurrentElement() )
                      # ]
      57                 :            :     {
      58                 :            :         case XML_ROOT_CONTEXT:
      59         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( chartsheet ) ) return this;
      60                 :          0 :         break;
      61                 :            : 
      62                 :            :         case XLS_TOKEN( chartsheet ):
      63   [ #  #  #  #  :          0 :             switch( nElement )
             #  #  #  #  
                      # ]
      64                 :            :             {
      65                 :          0 :                 case XLS_TOKEN( sheetViews ):       return this;
      66                 :            : 
      67                 :          0 :                 case XLS_TOKEN( sheetPr ):          getWorksheetSettings().importChartSheetPr( rAttribs );              break;
      68                 :          0 :                 case XLS_TOKEN( sheetProtection ):  getWorksheetSettings().importChartProtection( rAttribs );           break;
      69                 :          0 :                 case XLS_TOKEN( pageMargins ):      getPageSettings().importPageMargins( rAttribs );                    break;
      70                 :          0 :                 case XLS_TOKEN( pageSetup ):        getPageSettings().importChartPageSetup( getRelations(), rAttribs ); break;
      71                 :          0 :                 case XLS_TOKEN( headerFooter ):     getPageSettings().importHeaderFooter( rAttribs );                   return this;
      72                 :          0 :                 case XLS_TOKEN( picture ):          getPageSettings().importPicture( getRelations(), rAttribs );        break;
      73                 :          0 :                 case XLS_TOKEN( drawing ):          importDrawing( rAttribs );                                          break;
      74                 :            :             }
      75                 :          0 :         break;
      76                 :            : 
      77                 :            :         case XLS_TOKEN( sheetViews ):
      78         [ #  # ]:          0 :             if( nElement == XLS_TOKEN( sheetView ) ) getSheetViewSettings().importChartSheetView( rAttribs );
      79                 :          0 :         break;
      80                 :            : 
      81                 :            :         case XLS_TOKEN( headerFooter ):
      82         [ #  # ]:          0 :             switch( nElement )
      83                 :            :             {
      84                 :            :                 case XLS_TOKEN( firstHeader ):
      85                 :            :                 case XLS_TOKEN( firstFooter ):
      86                 :            :                 case XLS_TOKEN( oddHeader ):
      87                 :            :                 case XLS_TOKEN( oddFooter ):
      88                 :            :                 case XLS_TOKEN( evenHeader ):
      89                 :          0 :                 case XLS_TOKEN( evenFooter ):       return this;    // collect contents in onCharacters()
      90                 :            :             }
      91                 :          0 :         break;
      92                 :            :     }
      93                 :          0 :     return 0;
      94                 :            : }
      95                 :            : 
      96                 :          0 : void ChartsheetFragment::onCharacters( const OUString& rChars )
      97                 :            : {
      98         [ #  # ]:          0 :     switch( getCurrentElement() )
      99                 :            :     {
     100                 :            :         case XLS_TOKEN( firstHeader ):
     101                 :            :         case XLS_TOKEN( firstFooter ):
     102                 :            :         case XLS_TOKEN( oddHeader ):
     103                 :            :         case XLS_TOKEN( oddFooter ):
     104                 :            :         case XLS_TOKEN( evenHeader ):
     105                 :            :         case XLS_TOKEN( evenFooter ):
     106                 :          0 :             getPageSettings().importHeaderFooterCharacters( rChars, getCurrentElement() );
     107                 :          0 :         break;
     108                 :            :     }
     109                 :          0 : }
     110                 :            : 
     111                 :          0 : ContextHandlerRef ChartsheetFragment::onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm )
     112                 :            : {
     113   [ #  #  #  # ]:          0 :     switch( getCurrentElement() )
     114                 :            :     {
     115                 :            :         case XML_ROOT_CONTEXT:
     116         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_WORKSHEET ) return this;
     117                 :          0 :         break;
     118                 :            : 
     119                 :            :         case BIFF12_ID_WORKSHEET:
     120   [ #  #  #  #  :          0 :             switch( nRecId )
             #  #  #  #  
                      # ]
     121                 :            :             {
     122                 :          0 :                 case BIFF12_ID_CHARTSHEETVIEWS:  return this;
     123                 :            : 
     124                 :          0 :                 case BIFF12_ID_CHARTSHEETPR:    getWorksheetSettings().importChartSheetPr( rStrm );                 break;
     125                 :          0 :                 case BIFF12_ID_CHARTPROTECTION: getWorksheetSettings().importChartProtection( rStrm );              break;
     126                 :          0 :                 case BIFF12_ID_PAGEMARGINS:     getPageSettings().importPageMargins( rStrm );                       break;
     127                 :          0 :                 case BIFF12_ID_CHARTPAGESETUP:  getPageSettings().importChartPageSetup( getRelations(), rStrm );    break;
     128                 :          0 :                 case BIFF12_ID_HEADERFOOTER:    getPageSettings().importHeaderFooter( rStrm );                      break;
     129                 :          0 :                 case BIFF12_ID_PICTURE:         getPageSettings().importPicture( getRelations(), rStrm );           break;
     130                 :          0 :                 case BIFF12_ID_DRAWING:         importDrawing( rStrm );                                             break;
     131                 :            :             }
     132                 :          0 :         break;
     133                 :            : 
     134                 :            :         case BIFF12_ID_CHARTSHEETVIEWS:
     135         [ #  # ]:          0 :             if( nRecId == BIFF12_ID_CHARTSHEETVIEW ) getSheetViewSettings().importChartSheetView( rStrm );
     136                 :          0 :         break;
     137                 :            :     }
     138                 :          0 :     return 0;
     139                 :            : }
     140                 :            : 
     141                 :          0 : const RecordInfo* ChartsheetFragment::getRecordInfos() const
     142                 :            : {
     143                 :            :     static const RecordInfo spRecInfos[] =
     144                 :            :     {
     145                 :            :         { BIFF12_ID_CHARTSHEETVIEW,     BIFF12_ID_CHARTSHEETVIEW + 1    },
     146                 :            :         { BIFF12_ID_CHARTSHEETVIEWS,    BIFF12_ID_CHARTSHEETVIEWS + 1   },
     147                 :            :         { BIFF12_ID_CUSTOMCHARTVIEW,    BIFF12_ID_CUSTOMCHARTVIEW + 1   },
     148                 :            :         { BIFF12_ID_CUSTOMCHARTVIEWS,   BIFF12_ID_CUSTOMCHARTVIEWS + 1  },
     149                 :            :         { BIFF12_ID_HEADERFOOTER,       BIFF12_ID_HEADERFOOTER + 1      },
     150                 :            :         { BIFF12_ID_WORKSHEET,          BIFF12_ID_WORKSHEET + 1         },
     151                 :            :         { -1,                           -1                              }
     152                 :            :     };
     153                 :          0 :     return spRecInfos;
     154                 :            : }
     155                 :            : 
     156                 :          0 : void ChartsheetFragment::initializeImport()
     157                 :            : {
     158                 :            :     // initial processing in base class WorksheetHelper
     159                 :          0 :     initializeWorksheetImport();
     160                 :          0 : }
     161                 :            : 
     162                 :          0 : void ChartsheetFragment::finalizeImport()
     163                 :            : {
     164                 :            :     // final processing in base class WorksheetHelper
     165                 :          0 :     finalizeWorksheetImport();
     166                 :          0 : }
     167                 :            : 
     168                 :            : // private --------------------------------------------------------------------
     169                 :            : 
     170                 :          0 : void ChartsheetFragment::importDrawing( const AttributeList& rAttribs )
     171                 :            : {
     172 [ #  # ][ #  # ]:          0 :     setDrawingPath( getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ) );
                 [ #  # ]
     173                 :          0 : }
     174                 :            : 
     175                 :          0 : void ChartsheetFragment::importDrawing( SequenceInputStream& rStrm )
     176                 :            : {
     177 [ #  # ][ #  # ]:          0 :     setDrawingPath( getFragmentPathFromRelId( BiffHelper::readString( rStrm ) ) );
     178                 :          0 : }
     179                 :            : 
     180                 :            : } // namespace xls
     181 [ +  - ][ +  - ]:         24 : } // namespace oox
     182                 :            : 
     183                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10