LCOV - code coverage report
Current view: top level - oox/source/ppt - commonbehaviorcontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 52 0.0 %
Date: 2014-04-14 Functions: 0 8 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 "comphelper/anytostring.hxx"
      21             : #include "cppuhelper/exc_hlp.hxx"
      22             : #include <rtl/ustrbuf.hxx>
      23             : 
      24             : #include <com/sun/star/animations/XTimeContainer.hpp>
      25             : #include <com/sun/star/animations/XAnimationNode.hpp>
      26             : #include <com/sun/star/animations/XAnimate.hpp>
      27             : 
      28             : #include "oox/core/fragmenthandler.hxx"
      29             : 
      30             : #include "commonbehaviorcontext.hxx"
      31             : #include "commontimenodecontext.hxx"
      32             : #include "timetargetelementcontext.hxx"
      33             : #include "pptfilterhelpers.hxx"
      34             : 
      35             : #include <string.h>
      36             : 
      37             : using namespace ::oox::core;
      38             : using namespace ::com::sun::star::uno;
      39             : using namespace ::com::sun::star::xml::sax;
      40             : using namespace ::com::sun::star::animations;
      41             : 
      42             : namespace oox { namespace ppt {
      43             : 
      44           0 :     CommonBehaviorContext::CommonBehaviorContext( FragmentHandler2& rParent,
      45             :             const Reference< XFastAttributeList >& xAttribs,
      46             :             const TimeNodePtr & pNode )
      47             :         : TimeNodeContext( rParent, PPT_TOKEN( cBhvr ), xAttribs, pNode )
      48             :             , mbInAttrList( false )
      49           0 :             , mbIsInAttrName( false )
      50             :     {
      51           0 :     }
      52             : 
      53             : 
      54           0 :     CommonBehaviorContext::~CommonBehaviorContext( ) throw( )
      55             :     {
      56           0 :     }
      57             : 
      58             : 
      59             : 
      60           0 :     void CommonBehaviorContext::onEndElement()
      61             :     {
      62           0 :         switch( getCurrentElement() )
      63             :         {
      64             :         case PPT_TOKEN( cBhvr ):
      65             :         {
      66           0 :             if( !maAttributes.empty() )
      67             :             {
      68           0 :                 OUStringBuffer sAttributes;
      69           0 :                 std::list< Attribute >::const_iterator iter;
      70           0 :                 for(iter = maAttributes.begin(); iter != maAttributes.end(); ++iter)
      71             :                 {
      72           0 :                     if( !sAttributes.isEmpty() )
      73             :                     {
      74           0 :                         sAttributes.appendAscii( ";" );
      75             :                     }
      76           0 :                     sAttributes.append( iter->name );
      77             :                 }
      78           0 :                 OUString sTmp( sAttributes.makeStringAndClear() );
      79           0 :                 mpNode->getNodeProperties()[ NP_ATTRIBUTENAME ] = makeAny( sTmp );
      80             :             }
      81           0 :             break;
      82             :         }
      83             :         case PPT_TOKEN( attrNameLst ):
      84           0 :             mbInAttrList = false;
      85           0 :             break;
      86             :         case PPT_TOKEN( attrName ):
      87           0 :             if( mbIsInAttrName )
      88             :             {
      89           0 :                 const ImplAttributeNameConversion *attrConv = gImplConversionList;
      90           0 :                 while( attrConv->mpMSName != NULL )
      91             :                 {
      92           0 :                     if(msCurrentAttribute.equalsAscii( attrConv->mpMSName ) )
      93             :                     {
      94           0 :                         Attribute attr;
      95           0 :                         attr.name = OUString::intern( attrConv->mpAPIName,
      96           0 :                                                              strlen(attrConv->mpAPIName),
      97           0 :                                                              RTL_TEXTENCODING_ASCII_US );
      98           0 :                         attr.type = attrConv->meAttribute;
      99           0 :                         maAttributes.push_back( attr );
     100             :                         SAL_INFO("oox.ppt", "OOX: attrName is " << OUSTRING_TO_CSTR( msCurrentAttribute ) << " -> " << attrConv->mpAPIName );
     101           0 :                         break;
     102             :                     }
     103           0 :                     attrConv++;
     104             :                 }
     105           0 :                 mbIsInAttrName = false;
     106             :             }
     107           0 :             break;
     108             :         default:
     109           0 :             break;
     110             :         }
     111           0 :     }
     112             : 
     113             : 
     114           0 :     void CommonBehaviorContext::onCharacters( const OUString& aChars )
     115             :     {
     116           0 :         if( mbIsInAttrName )
     117             :         {
     118           0 :             msCurrentAttribute += aChars;
     119             :         }
     120           0 :     }
     121             : 
     122             : 
     123           0 :     ::oox::core::ContextHandlerRef CommonBehaviorContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
     124             :     {
     125           0 :         switch ( aElementToken )
     126             :         {
     127             :         case PPT_TOKEN( cTn ):
     128           0 :             return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode );
     129             :         case PPT_TOKEN( tgtEl ):
     130           0 :             return new TimeTargetElementContext( *this, mpNode->getTarget() );
     131             :         case PPT_TOKEN( attrNameLst ):
     132           0 :             mbInAttrList = true;
     133           0 :             return this;
     134             :         case PPT_TOKEN( attrName ):
     135             :         {
     136           0 :             if( mbInAttrList )
     137             :             {
     138           0 :                 mbIsInAttrName = true;
     139           0 :                 msCurrentAttribute = OUString();
     140             :             }
     141             :             else
     142             :             {
     143             :                 SAL_INFO("oox.ppt", "OOX: Attribute Name outside an Attribute List" );
     144             :             }
     145           0 :             return this;
     146             :         }
     147             :         default:
     148           0 :             break;
     149             :         }
     150             : 
     151           0 :         return this;
     152             :     }
     153             : 
     154           0 : } }
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10