LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - excelhandlers.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 8 12 66.7 %
Date: 2012-12-27 Functions: 12 25 48.0 %
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 OOX_XLS_EXCELHANDLERS_HXX
      21             : #define OOX_XLS_EXCELHANDLERS_HXX
      22             : 
      23             : #include "oox/core/fragmenthandler2.hxx"
      24             : #include "worksheethelper.hxx"
      25             : 
      26             : namespace oox {
      27             : namespace xls {
      28             : 
      29             : // ============================================================================
      30             : // ============================================================================
      31             : 
      32             : /** Context handler derived from the WorkbookHelper helper class.
      33             : 
      34             :     Used to import contexts in global workbook fragments.
      35             :  */
      36         451 : class WorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
      37             : {
      38             : public:
      39             :     template< typename ParentType >
      40         451 :     inline explicit     WorkbookContextBase( ParentType& rParent ) :
      41         451 :                             ::oox::core::ContextHandler2( rParent ), WorkbookHelper( rParent ) {}
      42             : };
      43             : 
      44             : // ============================================================================
      45             : 
      46             : /** Context handler derived from the WorksheetHelper helper class.
      47             : 
      48             :     Used to import contexts in sheet fragments.
      49             :  */
      50          56 : class WorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelper
      51             : {
      52             : public:
      53             :     template< typename ParentType >
      54          56 :     inline explicit     WorksheetContextBase( ParentType& rParent ) :
      55          56 :                             ::oox::core::ContextHandler2( rParent ), WorksheetHelper( rParent ) {}
      56             : };
      57             : 
      58             : // ============================================================================
      59             : 
      60             : /** Fragment handler derived from the WorkbookHelper helper class.
      61             : 
      62             :     Used to import global workbook fragments.
      63             :  */
      64          31 : class WorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
      65             : {
      66             : public:
      67             :     explicit            WorkbookFragmentBase(
      68             :                             const WorkbookHelper& rHelper,
      69             :                             const ::rtl::OUString& rFragmentPath );
      70             : };
      71             : 
      72             : // ============================================================================
      73             : 
      74             : /** Fragment handler derived from the WorksheetHelper helper class.
      75             : 
      76             :     Used to import sheet fragments.
      77             :  */
      78          28 : class WorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelper
      79             : {
      80             : public:
      81             :     explicit            WorksheetFragmentBase(
      82             :                             const WorksheetHelper& rHelper,
      83             :                             const ::rtl::OUString& rFragmentPath );
      84             : };
      85             : 
      86             : // ============================================================================
      87             : // ============================================================================
      88             : 
      89             : /** Base class for all BIFF context handlers.
      90             : 
      91             :     Derived handlers have to implement the importRecord() function that has to
      92             :     import the record the passed BIFF input stream currently points to.
      93             :  */
      94           0 : class BiffContextHandler
      95             : {
      96             : public:
      97             :     virtual             ~BiffContextHandler();
      98             : 
      99             :     /** Derived classes have to implement importing the current record. */
     100             :     virtual void        importRecord( BiffInputStream& rStrm ) = 0;
     101             : };
     102             : 
     103             : // ----------------------------------------------------------------------------
     104             : 
     105             : /** Context handler derived from the WorksheetHelper helper class.
     106             : 
     107             :     Used to import contexts in sheet fragments.
     108             :  */
     109           0 : class BiffWorksheetContextBase : public BiffContextHandler, public WorksheetHelper
     110             : {
     111             : protected:
     112             :     explicit            BiffWorksheetContextBase( const WorksheetHelper& rHelper );
     113             : };
     114             : 
     115             : // ============================================================================
     116             : 
     117             : /** An enumeration for all types of fragments in a BIFF workbook stream. */
     118             : enum BiffFragmentType
     119             : {
     120             :     BIFF_FRAGMENT_GLOBALS,      /// Workbook globals fragment.
     121             :     BIFF_FRAGMENT_WORKSHEET,    /// Worksheet fragment.
     122             :     BIFF_FRAGMENT_CHARTSHEET,   /// Chart sheet fragment.
     123             :     BIFF_FRAGMENT_MACROSHEET,   /// Macro sheet fragment.
     124             :     BIFF_FRAGMENT_MODULESHEET,  /// BIFF5 VB module fragment.
     125             :     BIFF_FRAGMENT_EMPTYSHEET,   /// Sheet fragment of unsupported type.
     126             :     BIFF_FRAGMENT_WORKSPACE,    /// BIFF4 workspace/workbook globals.
     127             :     BIFF_FRAGMENT_UNKNOWN       /// Unknown fragment/error.
     128             : };
     129             : 
     130             : // ----------------------------------------------------------------------------
     131             : 
     132             : class BiffFragmentHandler
     133             : {
     134             : public:
     135             :     /** Opens the stream with the passed full name. */
     136             :     explicit            BiffFragmentHandler(
     137             :                             const ::oox::core::FilterBase& rFilter,
     138             :                             const ::rtl::OUString& rStrmName );
     139             : 
     140             :     virtual             ~BiffFragmentHandler();
     141             : 
     142             :     /** Imports the fragment, returns true, if EOF record has been reached. */
     143             :     virtual bool        importFragment() = 0;
     144             : 
     145             : protected:
     146             :     /** Returns the BIFF input stream of this fragment. */
     147           0 :     inline BiffInputStream& getInputStream() { return *mxBiffStrm; }
     148             : 
     149             :     /** Skips the current fragment up to its trailing EOF record.
     150             : 
     151             :         Skips all records until next EOF record. When this function returns,
     152             :         stream points to the EOF record, and the next call of startNextRecord()
     153             :         at the stream will start the record following the EOF record.
     154             : 
     155             :         Embedded fragments enclosed in BOF/EOF records (e.g. embedded chart
     156             :         objects) are skipped correctly.
     157             : 
     158             :         @return  True = stream points to the EOF record of the current fragment.
     159             :      */
     160             :     bool                skipFragment();
     161             : 
     162             : private:
     163             :     typedef ::boost::shared_ptr< BinaryXInputStream >   XInputStreamRef;
     164             :     typedef ::boost::shared_ptr< BiffInputStream >      BiffInputStreamRef;
     165             : 
     166             :     XInputStreamRef     mxXInStrm;
     167             :     BiffInputStreamRef  mxBiffStrm;
     168             : };
     169             : 
     170             : // ----------------------------------------------------------------------------
     171             : 
     172             : /** Fragment handler derived from the WorkbookHelper helper class.
     173             : 
     174             :     Used to import global workbook fragments.
     175             :  */
     176           0 : class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelper
     177             : {
     178             : protected:
     179             :     explicit            BiffWorkbookFragmentBase(
     180             :                             const WorkbookHelper& rHelper,
     181             :                             const ::rtl::OUString& rStrmName,
     182             :                             bool bCloneDecoder = false );
     183             : };
     184             : 
     185             : // ----------------------------------------------------------------------------
     186             : 
     187             : } // namespace xls
     188             : } // namespace oox
     189             : 
     190             : #endif
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10