LCOV - code coverage report
Current view: top level - include/oox/core - fragmenthandler.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 3 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.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 INCLUDED_OOX_CORE_FRAGMENTHANDLER_HXX
      21             : #define INCLUDED_OOX_CORE_FRAGMENTHANDLER_HXX
      22             : 
      23             : #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
      24             : #include <cppuhelper/implbase1.hxx>
      25             : #include <oox/core/contexthandler.hxx>
      26             : #include <oox/core/relations.hxx>
      27             : #include <oox/dllapi.h>
      28             : 
      29             : namespace com { namespace sun { namespace star {
      30             :     namespace io { class XInputStream; }
      31             : } } }
      32             : 
      33             : namespace oox {
      34             : namespace core {
      35             : 
      36             : 
      37             : 
      38             : /** Base data of a fragment.
      39             : 
      40             :     This data is stored in a separate struct to make it accessible in every
      41             :     child context handler of the fragment.
      42             :  */
      43       12059 : struct FragmentBaseData
      44             : {
      45             :     XmlFilterBase&      mrFilter;
      46             :     const OUString maFragmentPath;
      47             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >
      48             :                         mxLocator;
      49             :     RelationsRef        mxRelations;
      50             : 
      51             :     explicit            FragmentBaseData(
      52             :                             XmlFilterBase& rFilter,
      53             :                             const OUString& rFragmentPath,
      54             :                             RelationsRef xRelations );
      55             : };
      56             : 
      57             : 
      58             : 
      59             : /** Describes record identifiers used to create contexts in a binary stream.
      60             : 
      61             :     If a record is used to start a new context, usually the record identifier
      62             :     increased by 1 is used to mark the end of this context, e.g. the Excel
      63             :     record SHEETDATA == 0x0091 starts the <sheetData> context, and the record
      64             :     SHEETDATA_END == 0x0092 ends this context. But some records are used to
      65             :     start a new context, though there is no identifier to end this context,
      66             :     e.g. the ROW or EXTROW records. These record identifiers can be marked by
      67             :     setting the mnEndRecId member of this struct to -1.
      68             :  */
      69             : struct RecordInfo
      70             : {
      71             :     sal_Int32           mnStartRecId;       ///< Record identifier for context start.
      72             :     sal_Int32           mnEndRecId;         ///< Record identifier for context end, -1 = no record.
      73             : };
      74             : 
      75             : 
      76             : 
      77             : typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
      78             : 
      79         584 : class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
      80             : {
      81             : public:
      82             :     explicit            FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
      83             :     virtual             ~FragmentHandler();
      84             : 
      85             :     /** Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context. */
      86             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
      87        2717 :                         getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
      88             : 
      89             :     // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
      90             : 
      91             :     virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             :     virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             : 
      95             :     // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
      96             : 
      97             :     virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     105             :     virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     106             : 
     107             :     // XML stream handling ----------------------------------------------------
     108             : 
     109             :     /** Opens the fragment stream referred by the own fragment path. Derived
     110             :         classes may provide specilized stream implementations. */
     111             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
     112             :                         openFragmentStream() const;
     113             : 
     114             :     // binary records ---------------------------------------------------------
     115             : 
     116             :     virtual const RecordInfo* getRecordInfos() const;
     117             : 
     118             : protected:
     119             :     explicit            FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
     120             : };
     121             : 
     122             : typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
     123             : 
     124             : 
     125             : 
     126             : } // namespace core
     127             : } // namespace oox
     128             : 
     129             : #endif
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11