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

Generated by: LCOV version 1.10