LCOV - code coverage report
Current view: top level - xmloff/source/transform - TransformerContext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 30 70.0 %
Date: 2015-06-13 12:38:46 Functions: 8 17 47.1 %
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 <com/sun/star/xml/sax/SAXParseException.hpp>
      21             : #include <com/sun/star/xml/sax/SAXException.hpp>
      22             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      23             : #include <com/sun/star/xml/sax/XAttributeList.hpp>
      24             : #include <osl/diagnose.h>
      25             : #include <xmloff/nmspmap.hxx>
      26             : 
      27             : #include "TransformerBase.hxx"
      28             : 
      29             : #include "TransformerContext.hxx"
      30             : 
      31             : 
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::xml::sax;
      34             : 
      35           0 : TYPEINIT0( XMLTransformerContext );
      36             : 
      37          26 : bool XMLTransformerContext::HasQName( sal_uInt16 nPrefix,
      38             :                        ::xmloff::token::XMLTokenEnum eToken ) const
      39             : {
      40          26 :     OUString aLocalName;
      41          26 :     return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName,
      42          78 :                                               &aLocalName ) == nPrefix &&
      43          52 :            ::xmloff::token::IsXMLToken( aLocalName, eToken );
      44             : }
      45             : 
      46           0 : bool XMLTransformerContext::HasNamespace( sal_uInt16 nPrefix ) const
      47             : {
      48           0 :     return GetTransformer().GetNamespaceMap().GetKeyByAttrName( m_aQName ) == nPrefix;
      49             : }
      50             : 
      51        9992 : XMLTransformerContext::XMLTransformerContext( XMLTransformerBase& rImp,
      52             :                                                 const OUString& rQName ) :
      53             :     m_rTransformer( rImp ),
      54             :     m_aQName( rQName ),
      55        9992 :     m_pRewindMap( 0 )
      56             : {
      57        9992 : }
      58             : 
      59       15070 : XMLTransformerContext::~XMLTransformerContext()
      60             : {
      61       15070 : }
      62             : 
      63        8613 : XMLTransformerContext *XMLTransformerContext::CreateChildContext( sal_uInt16 nPrefix,
      64             :                                             const OUString& rLocalName,
      65             :                                             const OUString& rQName,
      66             :                                             const Reference< XAttributeList >& )
      67             : {
      68        8613 :     return m_rTransformer.CreateContext( nPrefix, rLocalName, rQName );
      69             : }
      70             : 
      71        5388 : void XMLTransformerContext::StartElement( const Reference< XAttributeList >& rAttrList )
      72             : {
      73        5388 :     m_rTransformer.GetDocHandler()->startElement( m_aQName, rAttrList );
      74        5388 : }
      75             : 
      76        5385 : void XMLTransformerContext::EndElement()
      77             : {
      78        5385 :     m_rTransformer.GetDocHandler()->endElement( m_aQName );
      79        5385 : }
      80             : 
      81       22552 : void XMLTransformerContext::Characters( const OUString& rChars )
      82             : {
      83       22552 :     m_rTransformer.GetDocHandler()->characters( rChars );
      84       22552 : }
      85             : 
      86           0 : bool XMLTransformerContext::IsPersistent() const
      87             : {
      88           0 :     return false;
      89             : }
      90             : 
      91           0 : void XMLTransformerContext::Export()
      92             : {
      93             :     OSL_ENSURE( false, "context is not persistent" );
      94           0 : }
      95             : 
      96           0 : void XMLTransformerContext::ExportContent()
      97             : {
      98             :     OSL_ENSURE( false, "context is not persistent" );
      99           0 : }
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11