LCOV - code coverage report
Current view: top level - xmloff/source/transform - DeepTContext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 38 68 55.9 %
Date: 2014-11-03 Functions: 7 14 50.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 "DeepTContext.hxx"
      21             : #include "FlatTContext.hxx"
      22             : #include "EventOOoTContext.hxx"
      23             : #include "TransformerActions.hxx"
      24             : #include "ElemTransformerAction.hxx"
      25             : #include "PersMixedContentTContext.hxx"
      26             : #include "TransformerBase.hxx"
      27             : 
      28             : using namespace ::com::sun::star::uno;
      29             : using namespace ::com::sun::star::xml::sax;
      30             : 
      31           0 : TYPEINIT1( XMLPersElemContentTContext, XMLPersAttrListTContext );
      32             : 
      33           6 : void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext )
      34             : {
      35             :     OSL_ENSURE( pContext && pContext->IsPersistent(),
      36             :                 "non-persistent context" );
      37           6 :     XMLTransformerContextVector::value_type aVal( pContext );
      38           6 :     m_aChildContexts.push_back( aVal );
      39           6 : }
      40             : 
      41        1242 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      42             :         XMLTransformerBase& rImp,
      43             :         const OUString& rQName ) :
      44        1242 :     XMLPersAttrListTContext( rImp, rQName )
      45             : {
      46        1242 : }
      47             : 
      48          54 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      49             :         XMLTransformerBase& rImp,
      50             :         const OUString& rQName,
      51             :        sal_uInt16 nActionMap ) :
      52          54 :     XMLPersAttrListTContext( rImp, rQName, nActionMap )
      53             : {
      54          54 : }
      55             : 
      56         114 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      57             :         XMLTransformerBase& rImp,
      58             :         const OUString& rQName,
      59             :         sal_uInt16 nPrefix,
      60             :         ::xmloff::token::XMLTokenEnum eToken ) :
      61         114 :     XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken )
      62             : {
      63         114 : }
      64             : 
      65           0 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      66             :         XMLTransformerBase& rImp,
      67             :         const OUString& rQName,
      68             :         sal_uInt16 nPrefix,
      69             :         ::xmloff::token::XMLTokenEnum eToken,
      70             :        sal_uInt16 nActionMap ) :
      71           0 :     XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken, nActionMap )
      72             : {
      73           0 : }
      74             : 
      75        1410 : XMLPersElemContentTContext::~XMLPersElemContentTContext()
      76             : {
      77        1410 : }
      78             : 
      79         132 : XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
      80             :         sal_uInt16 nPrefix,
      81             :         const OUString& rLocalName,
      82             :         const OUString& rQName,
      83             :         const Reference< XAttributeList >& )
      84             : {
      85         132 :     XMLTransformerContext *pContext = 0;
      86             : 
      87         132 :     XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
      88             :     XMLTransformerActions::const_iterator aIter =
      89         132 :         GetTransformer().GetElemActions().find( aKey );
      90             : 
      91         132 :     if( !(aIter == GetTransformer().GetElemActions().end()) )
      92             :     {
      93         100 :         switch( (*aIter).second.m_nActionType )
      94             :         {
      95             :         case XML_ETACTION_COPY:
      96           0 :             pContext = new XMLPersMixedContentTContext( GetTransformer(),
      97           0 :                                                        rQName );
      98           0 :             break;
      99             :         case XML_ETACTION_COPY_TEXT:
     100           0 :             pContext = new XMLPersMixedContentTContext( GetTransformer(),
     101           0 :                                                        rQName );
     102           0 :             break;
     103             :         case XML_ETACTION_RENAME_ELEM:
     104           0 :             pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
     105           0 :                     (*aIter).second.GetQNamePrefixFromParam1(),
     106           0 :                     (*aIter).second.GetQNameTokenFromParam1() );
     107           0 :             break;
     108             :         case XML_ETACTION_RENAME_ELEM_PROC_ATTRS:
     109           0 :             pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
     110           0 :                     (*aIter).second.GetQNamePrefixFromParam1(),
     111           0 :                     (*aIter).second.GetQNameTokenFromParam1(),
     112           0 :                        static_cast< sal_uInt16 >( (*aIter).second.m_nParam2 ) );
     113           0 :             break;
     114             :         case XML_ETACTION_RENAME_ELEM_ADD_PROC_ATTR:
     115             :             {
     116             :                 XMLPersMixedContentTContext *pMC =
     117           0 :                     new XMLPersMixedContentTContext( GetTransformer(), rQName,
     118           0 :                         (*aIter).second.GetQNamePrefixFromParam1(),
     119           0 :                         (*aIter).second.GetQNameTokenFromParam1(),
     120             :                         static_cast< sal_uInt16 >(
     121           0 :                             (*aIter).second.m_nParam3  >> 16 ) );
     122             :                 pMC->AddAttribute(
     123           0 :                     (*aIter).second.GetQNamePrefixFromParam2(),
     124           0 :                     (*aIter).second.GetQNameTokenFromParam2(),
     125             :                        static_cast< ::xmloff::token::XMLTokenEnum >(
     126           0 :                         (*aIter).second.m_nParam3 & 0xffff ) );
     127           0 :                 pContext = pMC;
     128             :             }
     129           0 :             break;
     130             :         case XML_ETACTION_PROC_ATTRS:
     131          54 :             pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
     132          54 :                        static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
     133          54 :             break;
     134             :         default:
     135          46 :             pContext = GetTransformer().CreateUserDefinedContext(
     136          46 :                             (*aIter).second, rQName, true );
     137             :             OSL_ENSURE( pContext && pContext->IsPersistent(),
     138             :                         "unknown or not persistent action" );
     139          46 :             if( pContext && !pContext->IsPersistent() )
     140             :             {
     141           0 :                 delete pContext;
     142           0 :                 pContext = 0;
     143             :             }
     144          46 :             break;
     145             :         }
     146             :     }
     147             : 
     148             :     // default is copying
     149         132 :     if( !pContext )
     150          32 :         pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName );
     151         132 :     XMLTransformerContextVector::value_type aVal( pContext );
     152         132 :     m_aChildContexts.push_back( aVal );
     153             : 
     154         132 :     return pContext;
     155             : }
     156             : 
     157         750 : void XMLPersElemContentTContext::ExportContent()
     158             : {
     159         750 :     XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
     160             : 
     161         888 :     for( ; aIter != m_aChildContexts.end(); ++aIter )
     162             :     {
     163         138 :         (*aIter)->Export();
     164             :     }
     165         750 : }
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10