LCOV - code coverage report
Current view: top level - writerfilter/source/ooxml - OOXMLFastDocumentHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 32 44 72.7 %
Date: 2012-08-25 Functions: 12 18 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 28 46.4 %

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

Generated by: LCOV version 1.10