LCOV - code coverage report
Current view: top level - include/oox/core - fastparser.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.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_FASTPARSER_HXX
      21             : #define INCLUDED_OOX_CORE_FASTPARSER_HXX
      22             : 
      23             : #include <com/sun/star/uno/XComponentContext.hpp>
      24             : #include <com/sun/star/xml/sax/XFastParser.hpp>
      25             : 
      26             : namespace oox {
      27             :     struct NamespaceMap;
      28             :     class StorageBase;
      29             : }
      30             : 
      31             : namespace sax_fastparser {
      32             :     class FastSaxParser;
      33             : }
      34             : 
      35             : namespace oox {
      36             : namespace core {
      37             : 
      38             : 
      39             : 
      40             : /** Wrapper for a fast SAX parser that works on automatically generated OOXML
      41             :     token and namespace identifiers.
      42             :  */
      43             : class FastParser
      44             : {
      45             : public:
      46             :     explicit            FastParser(
      47             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
      48             :                             throw( ::com::sun::star::uno::RuntimeException );
      49             : 
      50             :     virtual             ~FastParser();
      51             : 
      52             :     /** Registers an OOXML namespace at the parser. */
      53             :     void                registerNamespace( sal_Int32 nNamespaceId )
      54             :                             throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
      55             : 
      56             :     /** Sets the passed document handler that will receive the SAX parser events. */
      57             :     void                setDocumentHandler(
      58             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler )
      59             :                             throw( ::com::sun::star::uno::RuntimeException );
      60             : 
      61             :     /** Parses the passed SAX input source.
      62             :         @param bCloseStream  True = closes the stream in the input source after parsing. */
      63             :     void                parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false )
      64             :                             throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
      65             : 
      66             :     /** Parses the passed input stream.
      67             :         @param bCloseStream  True = closes the passed stream after parsing. */
      68             :     void                parseStream(
      69             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
      70             :                             const OUString& rStreamName, bool bCloseStream = false )
      71             :                             throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
      72             : 
      73             :     /** Parses a stream from the passed storage with the specified name.
      74             :         @param bCloseStream  True = closes the stream after parsing. */
      75             :     void                parseStream( StorageBase& rStorage, const OUString& rStreamName, bool bCloseStream = false )
      76             :                             throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
      77             : 
      78             :     OUString getNamespaceURL( const OUString& rPrefix )
      79             :                         throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
      80             : 
      81             :     bool hasNamespaceURL( const OUString& rPrefix ) const;
      82             : 
      83             :     sal_Int32 getNamespaceId( const OUString& aUrl );
      84             : 
      85             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
      86           0 :                getTokenHandler() const { return mxTokenHandler; }
      87             : 
      88             : private:
      89             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser >
      90             :                         mxParser;
      91             :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
      92             :                         mxTokenHandler;
      93             :     const NamespaceMap& mrNamespaceMap;
      94             : 
      95             :     sax_fastparser::FastSaxParser* mpParser;
      96             : };
      97             : 
      98             : 
      99             : 
     100             : } // namespace core
     101             : } // namespace oox
     102             : 
     103             : #endif
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10