LCOV - code coverage report
Current view: top level - xmloff/source/transform - DeepTContext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 38 68 55.9 %
Date: 2012-08-25 Functions: 7 14 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 34 119 28.6 %

           Branch data     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                 :        106 : void XMLPersElemContentTContext::AddContent( XMLTransformerContext *pContext )
      35                 :            : {
      36                 :            :     OSL_ENSURE( pContext && pContext->IsPersistent(),
      37                 :            :                 "non-persistent context" );
      38         [ +  - ]:        106 :     XMLTransformerContextVector::value_type aVal( pContext );
      39 [ +  - ][ +  - ]:        106 :     m_aChildContexts.push_back( aVal );
      40                 :        106 : }
      41                 :            : 
      42                 :       2223 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      43                 :            :         XMLTransformerBase& rImp,
      44                 :            :         const OUString& rQName ) :
      45         [ +  - ]:       2223 :     XMLPersAttrListTContext( rImp, rQName )
      46                 :            : {
      47                 :       2223 : }
      48                 :            : 
      49                 :         44 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      50                 :            :         XMLTransformerBase& rImp,
      51                 :            :         const OUString& rQName,
      52                 :            :        sal_uInt16 nActionMap ) :
      53         [ +  - ]:         44 :     XMLPersAttrListTContext( rImp, rQName, nActionMap )
      54                 :            : {
      55                 :         44 : }
      56                 :            : 
      57                 :        506 : XMLPersElemContentTContext::XMLPersElemContentTContext(
      58                 :            :         XMLTransformerBase& rImp,
      59                 :            :         const OUString& rQName,
      60                 :            :         sal_uInt16 nPrefix,
      61                 :            :         ::xmloff::token::XMLTokenEnum eToken ) :
      62         [ +  - ]:        506 :     XMLPersAttrListTContext( rImp, rQName, nPrefix, eToken )
      63                 :            : {
      64                 :        506 : }
      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                 :       2773 : XMLPersElemContentTContext::~XMLPersElemContentTContext()
      77                 :            : {
      78         [ -  + ]:       2773 : }
      79                 :            : 
      80                 :        392 : XMLTransformerContext *XMLPersElemContentTContext::CreateChildContext(
      81                 :            :         sal_uInt16 nPrefix,
      82                 :            :         const OUString& rLocalName,
      83                 :            :         const OUString& rQName,
      84                 :            :         const Reference< XAttributeList >& )
      85                 :            : {
      86                 :        392 :     XMLTransformerContext *pContext = 0;
      87                 :            : 
      88                 :        392 :     XMLTransformerActions::key_type aKey( nPrefix, rLocalName );
      89                 :            :     XMLTransformerActions::const_iterator aIter =
      90         [ +  - ]:        392 :         GetTransformer().GetElemActions().find( aKey );
      91                 :            : 
      92 [ +  + ][ +  - ]:        392 :     if( !(aIter == GetTransformer().GetElemActions().end()) )
      93                 :            :     {
      94 [ +  - ][ -  -  :        286 :         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                 :         44 :             pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName,
     133 [ +  - ][ +  - ]:         44 :                        static_cast< sal_uInt16 >( (*aIter).second.m_nParam1 ) );
                 [ +  - ]
     134                 :         44 :             break;
     135                 :            :         default:
     136                 :        242 :             pContext = GetTransformer().CreateUserDefinedContext(
     137 [ +  - ][ +  - ]:        242 :                             (*aIter).second, rQName, sal_True );
     138                 :            :             OSL_ENSURE( pContext && pContext->IsPersistent(),
     139                 :            :                         "unknown or not persistent action" );
     140 [ +  - ][ +  - ]:        242 :             if( pContext && !pContext->IsPersistent() )
         [ -  + ][ -  + ]
     141                 :            :             {
     142 [ #  # ][ #  # ]:          0 :                 delete pContext;
     143                 :          0 :                 pContext = 0;
     144                 :            :             }
     145                 :        286 :             break;
     146                 :            :         }
     147                 :            :     }
     148                 :            : 
     149                 :            :     // default is copying
     150         [ +  + ]:        392 :     if( !pContext )
     151 [ +  - ][ +  - ]:        106 :         pContext = new XMLPersMixedContentTContext( GetTransformer(), rQName );
     152         [ +  - ]:        392 :     XMLTransformerContextVector::value_type aVal( pContext );
     153         [ +  - ]:        392 :     m_aChildContexts.push_back( aVal );
     154                 :            : 
     155         [ +  - ]:        392 :     return pContext;
     156                 :            : }
     157                 :            : 
     158                 :       1748 : void XMLPersElemContentTContext::ExportContent()
     159                 :            : {
     160                 :       1748 :     XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin();
     161                 :            : 
     162 [ +  - ][ +  + ]:       2246 :     for( ; aIter != m_aChildContexts.end(); ++aIter )
     163                 :            :     {
     164         [ +  - ]:        498 :         (*aIter)->Export();
     165                 :            :     }
     166                 :       1748 : }
     167                 :            : 
     168                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10