LCOV - code coverage report
Current view: top level - sc/source/filter/inc - excelhandlers.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 12 66.7 %
Date: 2015-06-13 12:38:46 Functions: 16 27 59.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SC_SOURCE_FILTER_INC_EXCELHANDLERS_HXX
      21             : #define INCLUDED_SC_SOURCE_FILTER_INC_EXCELHANDLERS_HXX
      22             : 
      23             : #include <oox/core/fragmenthandler2.hxx>
      24             : #include "worksheethelper.hxx"
      25             : 
      26             : namespace oox {
      27             : namespace xls {
      28             : 
      29             : /** Context handler derived from the WorkbookHelper helper class.
      30             : 
      31             :     Used to import contexts in global workbook fragments.
      32             :  */
      33        3415 : class WorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
      34             : {
      35             : public:
      36             :     template< typename ParentType >
      37        3415 :     inline explicit     WorkbookContextBase( ParentType& rParent ) :
      38        3415 :                             ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) {}
      39             : };
      40             : 
      41             : /** Context handler derived from the WorksheetHelper helper class.
      42             : 
      43             :     Used to import contexts in sheet fragments.
      44             :  */
      45         474 : class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelper
      46             : {
      47             : public:
      48             :     template< typename ParentType >
      49         474 :     inline explicit     WorksheetContextBase( ParentType& rParent ) :
      50         474 :                             ::oox::core::ContextHandler2( rParent ), WorksheetHelper( rParent ) {}
      51             : };
      52             : 
      53             : /** Fragment handler derived from the WorkbookHelper helper class.
      54             : 
      55             :     Used to import global workbook fragments.
      56             :  */
      57         407 : class WorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
      58             : {
      59             : public:
      60             :     explicit            WorkbookFragmentBase(
      61             :                             const WorkbookHelper& rHelper,
      62             :                             const OUString& rFragmentPath );
      63             : };
      64             : 
      65             : /** Fragment handler derived from the WorksheetHelper helper class.
      66             : 
      67             :     Used to import sheet fragments.
      68             :  */
      69         370 : class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelper
      70             : {
      71             : public:
      72             :     explicit            WorksheetFragmentBase(
      73             :                             const WorksheetHelper& rHelper,
      74             :                             const OUString& rFragmentPath );
      75             : };
      76             : 
      77             : /** Base class for all BIFF context handlers.
      78             : 
      79             :     Derived handlers have to implement the importRecord() function that has to
      80             :     import the record the passed BIFF input stream currently points to.
      81             :  */
      82           0 : class BiffContextHandler
      83             : {
      84             : public:
      85             :     virtual             ~BiffContextHandler();
      86             : 
      87             :     /** Derived classes have to implement importing the current record. */
      88             :     virtual void        importRecord( BiffInputStream& rStrm ) = 0;
      89             : };
      90             : 
      91             : /** Context handler derived from the WorksheetHelper helper class.
      92             : 
      93             :     Used to import contexts in sheet fragments.
      94             :  */
      95           0 : class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelper
      96             : {
      97             : protected:
      98             :     explicit            BiffWorksheetContextBase( const WorksheetHelper& rHelper );
      99             : };
     100             : 
     101             : /** An enumeration for all types of fragments in a BIFF workbook stream. */
     102             : enum BiffFragmentType
     103             : {
     104             :     BIFF_FRAGMENT_GLOBALS,      /// Workbook globals fragment.
     105             :     BIFF_FRAGMENT_WORKSHEET,    /// Worksheet fragment.
     106             :     BIFF_FRAGMENT_CHARTSHEET,   /// Chart sheet fragment.
     107             :     BIFF_FRAGMENT_MACROSHEET,   /// Macro sheet fragment.
     108             :     BIFF_FRAGMENT_MODULESHEET,  /// BIFF5 VB module fragment.
     109             :     BIFF_FRAGMENT_EMPTYSHEET,   /// Sheet fragment of unsupported type.
     110             :     BIFF_FRAGMENT_WORKSPACE,    /// BIFF4 workspace/workbook globals.
     111             :     BIFF_FRAGMENT_UNKNOWN       /// Unknown fragment/error.
     112             : };
     113             : 
     114             : class BiffFragmentHandler
     115             : {
     116             : public:
     117             :     /** Opens the stream with the passed full name. */
     118             :     explicit            BiffFragmentHandler(
     119             :                             const ::oox::core::FilterBase& rFilter,
     120             :                             const OUString& rStrmName );
     121             : 
     122             :     virtual             ~BiffFragmentHandler();
     123             : 
     124             :     /** Imports the fragment, returns true, if EOF record has been reached. */
     125             :     virtual bool        importFragment() = 0;
     126             : 
     127             : protected:
     128             :     /** Returns the BIFF input stream of this fragment. */
     129           0 :     inline BiffInputStream& getInputStream() { return *mxBiffStrm; }
     130             : 
     131             :     /** Skips the current fragment up to its trailing EOF record.
     132             : 
     133             :         Skips all records until next EOF record. When this function returns,
     134             :         stream points to the EOF record, and the next call of startNextRecord()
     135             :         at the stream will start the record following the EOF record.
     136             : 
     137             :         Embedded fragments enclosed in BOF/EOF records (e.g. embedded chart
     138             :         objects) are skipped correctly.
     139             : 
     140             :         @return  True = stream points to the EOF record of the current fragment.
     141             :      */
     142             :     bool                skipFragment();
     143             : 
     144             : private:
     145             :     typedef ::boost::shared_ptr< BinaryXInputStream >   XInputStreamRef;
     146             :     typedef ::boost::shared_ptr< BiffInputStream >      BiffInputStreamRef;
     147             : 
     148             :     XInputStreamRef     mxXInStrm;
     149             :     BiffInputStreamRef  mxBiffStrm;
     150             : };
     151             : 
     152             : /** Fragment handler derived from the WorkbookHelper helper class.
     153             : 
     154             :     Used to import global workbook fragments.
     155             :  */
     156           0 : class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelper
     157             : {
     158             : protected:
     159             :     explicit            BiffWorkbookFragmentBase(
     160             :                             const WorkbookHelper& rHelper,
     161             :                             const OUString& rStrmName,
     162             :                             bool bCloneDecoder = false );
     163             : };
     164             : 
     165             : } // namespace xls
     166             : } // namespace oox
     167             : 
     168             : #endif
     169             : 
     170             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11