LCOV - code coverage report
Current view: top level - xmloff/source/transform - RenameElemTContext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 25 56.0 %
Date: 2014-11-03 Functions: 5 11 45.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          56 : XMLRenameElemTransformerContext::XMLRenameElemTransformerContext(
      32             :         XMLTransformerBase& rImp,
      33             :         const OUString& rQName,
      34             :         sal_uInt16 nPrefix,
      35             :         ::xmloff::token::XMLTokenEnum eToken ) :
      36             :     XMLTransformerContext( rImp, rQName ),
      37          56 :     m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
      38         112 :                             ::xmloff::token::GetXMLToken( eToken ) ) )
      39             : {
      40          56 : }
      41             : 
      42           0 : 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           0 :     m_aElemQName( rImp.GetNamespaceMap().GetQNameByKey( nPrefix,
      52           0 :                             ::xmloff::token::GetXMLToken( eToken ) ) ),
      53           0 :     m_aAttrQName( rImp.GetNamespaceMap().GetQNameByKey( nAPrefix,
      54           0 :                                     ::xmloff::token::GetXMLToken( eAToken ) ) ),
      55           0 :     m_aAttrValue( ::xmloff::token::GetXMLToken( eVToken ) )
      56             : {
      57           0 : }
      58             : 
      59         112 : XMLRenameElemTransformerContext::~XMLRenameElemTransformerContext()
      60             : {
      61         112 : }
      62             : 
      63          56 : void XMLRenameElemTransformerContext::StartElement(
      64             :         const Reference< XAttributeList >& rAttrList )
      65             : {
      66          56 :     Reference< XAttributeList > xAttrList( rAttrList );
      67          56 :     if( !m_aAttrQName.isEmpty() )
      68             :     {
      69             :         XMLMutableAttributeList *pMutableAttrList =
      70           0 :             new XMLMutableAttributeList( xAttrList );
      71           0 :         xAttrList = pMutableAttrList;
      72           0 :         pMutableAttrList->AddAttribute( m_aAttrQName, m_aAttrValue );
      73             :     }
      74          56 :     GetTransformer().GetDocHandler()->startElement( m_aElemQName, xAttrList );
      75          56 : }
      76             : 
      77          56 : void XMLRenameElemTransformerContext::EndElement()
      78             : {
      79          56 :     GetTransformer().GetDocHandler()->endElement( m_aElemQName );
      80          56 : }
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10