LCOV - code coverage report
Current view: top level - xmloff/source/transform - RenameElemTContext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 25 96.0 %
Date: 2015-06-13 12:38:46 Functions: 6 11 54.5 %
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 "RenameElemTContext.hxx"
      21             : #include "MutableAttrList.hxx"
      22             : #include "TransformerBase.hxx"
      23             : #include <xmloff/nmspmap.hxx>
      24             : 
      25             : 
      26             : using namespace ::com::sun::star::uno;
      27             : using namespace ::com::sun::star::xml::sax;
      28             : 
      29           0 : TYPEINIT1( XMLRenameElemTransformerContext, XMLTransformerContext );
      30             : 
      31          55 : XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
      32             :         XMLTransformerBase& rImp,
      33             :         const OUString& rQName,
      34             :         sal_uInt16 nPrefix,
      35             :         ::xmloff::token::XMLTokenEnum eToken ) :
      36             :     XMLTransformerContext( rImp, rQName ),
      37          55 :     m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
      38         110 :                             ::xmloff::token::GetXMLToken( eToken ) ) )
      39             : {
      40          55 : }
      41             : 
      42           2 : XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
      43             :         XMLTransformerBase& rImp,
      44             :         const OUString& rQName,
      45             :         sal_uInt16 nPrefix,
      46             :         ::xmloff::token::XMLTokenEnum eToken,
      47             :         sal_uInt16 nAPrefix,
      48             :         ::xmloff::token::XMLTokenEnum eAToken,
      49             :         ::xmloff::token::XMLTokenEnum eVToken ) :
      50             :     XMLTransformerContext( rImp, rQName ),
      51           2 :     m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
      52           2 :                             ::xmloff::token::GetXMLToken( eToken ) ) ),
      53           2 :     m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
      54           2 :                                     ::xmloff::token::GetXMLToken( eAToken ) ) ),
      55          10 :     m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
      56             : {
      57           2 : }
      58             : 
      59         114 : XMLRenameElemTransformerContext::~XMLRenameElemTransformerContext()
      60             : {
      61         114 : }
      62             : 
      63          57 : void XMLRenameElemTransformerContext::StartElement(
      64             :         const Reference< XAttributeList >& rAttrList )
      65             : {
      66          57 :     Reference< XAttributeList > xAttrList( rAttrList );
      67          57 :     if( !m_aAttrQName.isEmpty() )
      68             :     {
      69             :         XMLMutableAttributeList *pMutableAttrList =
      70           2 :             new XMLMutableAttributeList( xAttrList );
      71           2 :         xAttrList = pMutableAttrList;
      72           2 :         pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
      73             :     }
      74          57 :     GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
      75          57 : }
      76             : 
      77          57 : void XMLRenameElemTransformerContext::EndElement()
      78             : {
      79          57 :     GetTransformer().GetDocHandler()->endElement( m_aElemQName );
      80          57 : }
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11