LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFastDocumentHandler.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 38 0.0 %
Date: 2014-04-14 Functions: 0 15 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             : #include <iostream>
      21             : #include <boost/shared_ptr.hpp>
      22             : #ifdef DEBUG_ELEMENT
      23             : #include "ooxmlLoggers.hxx"
      24             : #endif
      25             : #include "OOXMLFastDocumentHandler.hxx"
      26             : #include "OOXMLFastContextHandler.hxx"
      27             : #include "ooxml/OOXMLFastTokens.hxx"
      28             : #include "OOXMLFactory.hxx"
      29             : 
      30             : namespace writerfilter {
      31             : namespace ooxml
      32             : {
      33             : using namespace ::com::sun::star;
      34             : using namespace ::std;
      35             : 
      36             : 
      37           0 : OOXMLFastDocumentHandler::OOXMLFastDocumentHandler(
      38             :     uno::Reference< uno::XComponentContext > const & context,
      39             :     Stream* pStream,
      40             :     OOXMLDocumentImpl* pDocument,
      41             :     sal_Int32 nXNoteId )
      42             :     : m_xContext(context)
      43             :     , mpStream( pStream )
      44             : #ifdef DEBUG_ELEMENT
      45             :     , mpTmpStream()
      46             : #endif
      47             :     , mpDocument( pDocument )
      48             :     , mnXNoteId( nXNoteId )
      49           0 :     , mpContextHandler()
      50             : {
      51           0 : }
      52             : 
      53             : // ::com::sun::star::xml::sax::XFastContextHandler:
      54           0 : void SAL_CALL OOXMLFastDocumentHandler::startFastElement
      55             : (::sal_Int32
      56             : #ifdef DEBUG_CONTEXT_STACK
      57             : Element
      58             : #endif
      59             : , const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
      60             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
      61             : {
      62             : #ifdef DEBUG_CONTEXT_STACK
      63             :     clog << this << ":start element:"
      64             :          << fastTokenToId(Element)
      65             :          << endl;
      66             : #endif
      67           0 : }
      68             : 
      69           0 : void SAL_CALL OOXMLFastDocumentHandler::startUnknownElement
      70             : (const OUString &
      71             : #ifdef DEBUG_CONTEXT_STACK
      72             : Namespace
      73             : #endif
      74             : , const OUString &
      75             : #ifdef DEBUG_CONTEXT_STACK
      76             : Name
      77             : #endif
      78             : ,
      79             :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
      80             : throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
      81             : {
      82             : #ifdef DEBUG_CONTEXT_STACK
      83             :     clog << this << ":start unknown element:"
      84             :          << OUStringToOString(Namespace, RTL_TEXTENCODING_ASCII_US).getStr()
      85             :          << ":"
      86             :          << OUStringToOString(Name, RTL_TEXTENCODING_ASCII_US).getStr()
      87             :          << endl;
      88             : #endif
      89           0 : }
      90             : 
      91           0 : void SAL_CALL OOXMLFastDocumentHandler::endFastElement(::sal_Int32
      92             : #ifdef DEBUG_CONTEXT_STACK
      93             : Element
      94             : #endif
      95             : )
      96             : throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
      97             : {
      98             : #ifdef DEBUG_CONTEXT_STACK
      99             :     clog << this << ":end element:"
     100             :          << fastTokenToId(Element)
     101             :          << endl;
     102             : #endif
     103           0 : }
     104             : 
     105           0 : void SAL_CALL OOXMLFastDocumentHandler::endUnknownElement
     106             : (const OUString &
     107             : #ifdef DEBUG_CONTEXT_STACK
     108             : Namespace
     109             : #endif
     110             : , const OUString &
     111             : #ifdef DEBUG_CONTEXT_STACK
     112             : Name
     113             : #endif
     114             : )
     115             : throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     116             : {
     117             : #ifdef DEBUG_CONTEXT_STACK
     118             :     clog << this << ":end unknown element:"
     119             :          << OUStringToOString(Namespace, RTL_TEXTENCODING_ASCII_US).getStr()
     120             :          << ":"
     121             :          << OUStringToOString(Name, RTL_TEXTENCODING_ASCII_US).getStr()
     122             :          << endl;
     123             : #endif
     124           0 : }
     125             : 
     126             : OOXMLFastContextHandler::Pointer_t
     127           0 : OOXMLFastDocumentHandler::getContextHandler() const
     128             : {
     129           0 :     if (mpContextHandler == OOXMLFastContextHandler::Pointer_t())
     130             :     {
     131             :         mpContextHandler.reset
     132           0 :         (new OOXMLFastContextHandler(m_xContext));
     133           0 :         mpContextHandler->setStream(mpStream);
     134           0 :         mpContextHandler->setDocument(mpDocument);
     135           0 :         mpContextHandler->setXNoteId(mnXNoteId);
     136           0 :         mpContextHandler->setForwardEvents(true);
     137             :     }
     138             : 
     139           0 :     return mpContextHandler;
     140             : }
     141             : 
     142             : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     143           0 :  OOXMLFastDocumentHandler::createFastChildContext
     144             : (::sal_Int32 Element,
     145             :  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     146             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     147             : {
     148             : #ifdef DEBUG_CONTEXT_STACK
     149             :     clog << this << ":createFastChildContext:"
     150             :          << fastTokenToId(Element)
     151             :          << endl;
     152             : #endif
     153             : 
     154           0 :     if ( mpStream == 0 && mpDocument == 0 )
     155             :     {
     156             :         // document handler has been created as unknown child - see <OOXMLFastDocumentHandler::createUnknownChildContext(..)>
     157             :         // --> do not provide a child context
     158           0 :         return NULL;
     159             :     }
     160             : 
     161           0 :     return OOXMLFactory::getInstance()->createFastChildContextFromStart(getContextHandler().get(), Element);
     162             : }
     163             : 
     164             : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     165           0 : OOXMLFastDocumentHandler::createUnknownChildContext
     166             : (const OUString &
     167             : #ifdef DEBUG_CONTEXT_STACK
     168             : Namespace
     169             : #endif
     170             : ,
     171             :  const OUString &
     172             : #ifdef DEBUG_CONTEXT_STACK
     173             : Name
     174             : #endif
     175             : , const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
     176             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     177             : {
     178             : #ifdef DEBUG_CONTEXT_STACK
     179             :     clog << this << ":createUnknownChildContext:"
     180             :          << OUStringToOString(Namespace, RTL_TEXTENCODING_ASCII_US).getStr()
     181             :          << ":"
     182             :          << OUStringToOString(Name, RTL_TEXTENCODING_ASCII_US).getStr()
     183             :          << endl;
     184             : #endif
     185             : 
     186             :     return uno::Reference< xml::sax::XFastContextHandler >
     187           0 :         ( new OOXMLFastDocumentHandler( m_xContext, 0, 0, 0 ) );
     188             : }
     189             : 
     190           0 : void SAL_CALL OOXMLFastDocumentHandler::characters(const OUString & /*aChars*/)
     191             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     192             : {
     193           0 : }
     194             : 
     195             : // ::com::sun::star::xml::sax::XFastDocumentHandler:
     196           0 : void SAL_CALL OOXMLFastDocumentHandler::startDocument()
     197             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     198             : {
     199           0 : }
     200             : 
     201           0 : void SAL_CALL OOXMLFastDocumentHandler::endDocument()
     202             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     203             : {
     204           0 : }
     205             : 
     206           0 : void SAL_CALL OOXMLFastDocumentHandler::setDocumentLocator
     207             : (const uno::Reference< xml::sax::XLocator > & /*xLocator*/)
     208             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     209             : {
     210           0 : }
     211             : 
     212           0 : void OOXMLFastDocumentHandler::setIsSubstream( bool bSubstream )
     213             : {
     214           0 :     if ( mpStream != 0 && mpDocument != 0 )
     215             :     {
     216           0 :         getContextHandler( )->getParserState( )->setInSectionGroup( bSubstream );
     217             :     }
     218           0 : }
     219             : 
     220           0 : }}
     221             : 
     222             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10