LCOV - code coverage report
Current view: top level - xmloff/source/transform - DeepTContext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 68 0.0 %
Date: 2014-04-14 Functions: 0 14 0.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           0 : void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext )
      34             : {
      35             :     OSL_ENSURE( pContext && pContext->IsPersistent(),
      36             :                 "non-persistent context" );
      37           0 :     XMLTransformerContextVector::value_type aVal( pContext );
      38           0 :     m_aChildContexts.push_back( aVal );
      39           0 : }
      40             : 
      41           0 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      42             :         XMLTransformerBase& rImp,
      43             :         const OUString& rQName ) :
      44           0 :     XMLPersAttrListTContext( rImp, rQName )
      45             : {
      46           0 : }
      47             : 
      48           0 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      49             :         XMLTransformerBase& rImp,
      50             :         const OUString& rQName,
      51             :        sal_uInt16 nActionMap ) :
      52           0 :     XMLPersAttrListTContext( rImp, rQName, nActionMap )
      53             : {
      54           0 : }
      55             : 
      56           0 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      57             :         XMLTransformerBase& rImp,
      58             :         const OUString& rQName,
      59             :         sal_uInt16 nPrefix,
      60             :         ::xmloff::token::XMLTokenEnum eToken ) :
      61           0 :     XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken )
      62             : {
      63           0 : }
      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           0 : XMLPersElemContentTContext::~XMLPersElemContentTContext()
      76             : {
      77           0 : }
      78             : 
      79           0 : XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
      80             :         sal_uInt16 nPrefix,
      81             :         const OUString& rLocalName,
      82             :         const OUString& rQName,
      83             :         const Reference< XAttributeList >& )
      84             : {
      85           0 :     XMLTransformerContext *pContext = 0;
      86             : 
      87           0 :     XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
      88             :     XMLTransformerActions::const_iterator aIter =
      89           0 :         GetTransformer().GetElemActions().find( aKey );
      90             : 
      91           0 :     if( !(aIter == GetTransformer().GetElemActions().end()) )
      92             :     {
      93           0 :         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           0 :             pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
     132           0 :                        static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
     133           0 :             break;
     134             :         default:
     135           0 :             pContext = GetTransformer().CreateUserDefinedContext(
     136           0 :                             (*aIter).second, rQName, sal_True );
     137             :             OSL_ENSURE( pContext && pContext->IsPersistent(),
     138             :                         "unknown or not persistent action" );
     139           0 :             if( pContext && !pContext->IsPersistent() )
     140             :             {
     141           0 :                 delete pContext;
     142           0 :                 pContext = 0;
     143             :             }
     144           0 :             break;
     145             :         }
     146             :     }
     147             : 
     148             :     // default is copying
     149           0 :     if( !pContext )
     150           0 :         pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName );
     151           0 :     XMLTransformerContextVector::value_type aVal( pContext );
     152           0 :     m_aChildContexts.push_back( aVal );
     153             : 
     154           0 :     return pContext;
     155             : }
     156             : 
     157           0 : void XMLPersElemContentTContext::ExportContent()
     158             : {
     159           0 :     XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
     160             : 
     161           0 :     for( ; aIter != m_aChildContexts.end(); ++aIter )
     162             :     {
     163           0 :         (*aIter)->Export();
     164             :     }
     165           0 : }
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10