LCOV - code coverage report
Current view: top level - libreoffice/oox/source/ppt - timetargetelementcontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 51 2.0 %
Date: 2012-12-27 Functions: 2 10 20.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 "timetargetelementcontext.hxx"
      21             : 
      22             : #include "comphelper/anytostring.hxx"
      23             : #include "cppuhelper/exc_hlp.hxx"
      24             : #include <osl/diagnose.h>
      25             : 
      26             : #include <com/sun/star/uno/Any.hxx>
      27             : 
      28             : #include "oox/helper/attributelist.hxx"
      29             : #include "oox/drawingml/embeddedwavaudiofile.hxx"
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::xml::sax;
      33             : using namespace ::oox::core;
      34             : 
      35             : using ::rtl::OUString;
      36             : 
      37             : namespace oox { namespace ppt {
      38             : 
      39             : 
      40             : 
      41             :     // CT_TLShapeTargetElement
      42           0 :     class ShapeTargetElementContext
      43             :         : public FragmentHandler2
      44             :     {
      45             :     public:
      46           0 :         ShapeTargetElementContext( FragmentHandler2& rParent, ShapeTargetElement & aValue )
      47             :             : FragmentHandler2( rParent )
      48             :                 , bTargetSet(false)
      49           0 :                 , maShapeTarget(aValue)
      50             :             {
      51           0 :             }
      52           0 :         virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      53             :             {
      54           0 :                 switch( aElementToken )
      55             :                 {
      56             :                 case PPT_TOKEN( bg ):
      57           0 :                     bTargetSet = true;
      58           0 :                     maShapeTarget.mnType = XML_bg;
      59           0 :                     return this;
      60             :                 case PPT_TOKEN( txEl ):
      61           0 :                     bTargetSet = true;
      62           0 :                     maShapeTarget.mnType = XML_txEl;
      63           0 :                     return this;
      64             :                 case PPT_TOKEN( subSp ):
      65           0 :                     bTargetSet = true;
      66           0 :                     maShapeTarget.mnType = XML_subSp;
      67           0 :                     maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, OUString() );
      68           0 :                     return this;
      69             :                 case PPT_TOKEN( graphicEl ):
      70             :                 case PPT_TOKEN( oleChartEl ):
      71           0 :                     bTargetSet = true;
      72             :                     // TODO
      73           0 :                     return this;
      74             :                 case PPT_TOKEN( charRg ):
      75             :                 case PPT_TOKEN( pRg ):
      76           0 :                     if( bTargetSet && maShapeTarget.mnType == XML_txEl )
      77             :                     {
      78           0 :                         maShapeTarget.mnRangeType = getBaseToken( aElementToken );
      79           0 :                         maShapeTarget.maRange = drawingml::GetIndexRange( rAttribs.getFastAttributeList() );
      80             :                     }
      81           0 :                     return this;
      82             :                 default:
      83           0 :                     break;
      84             :                 }
      85           0 :                 return this;
      86             :             }
      87             : 
      88             :     private:
      89             :         bool bTargetSet;
      90             :         ShapeTargetElement & maShapeTarget;
      91             :     };
      92             : 
      93             : 
      94             : 
      95           0 :     TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2& rParent, const AnimTargetElementPtr & pValue )
      96             :         : FragmentHandler2( rParent ),
      97           0 :             mpTarget( pValue )
      98             :     {
      99             :         OSL_ENSURE( mpTarget, "no valid target passed" );
     100           0 :     }
     101             : 
     102             : 
     103           0 :     TimeTargetElementContext::~TimeTargetElementContext( ) throw( )
     104             :     {
     105           0 :     }
     106             : 
     107           0 :     ::oox::core::ContextHandlerRef TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
     108             :     {
     109           0 :         switch( aElementToken )
     110             :         {
     111             :         case PPT_TOKEN( inkTgt ):
     112             :         {
     113           0 :             mpTarget->mnType = XML_inkTgt;
     114           0 :             OUString aId = rAttribs.getString( XML_spid, OUString() );
     115           0 :             if( !aId.isEmpty() )
     116             :             {
     117           0 :                 mpTarget->msValue = aId;
     118             :             }
     119           0 :             return this;
     120             :         }
     121             :         case PPT_TOKEN( sldTgt ):
     122           0 :             mpTarget->mnType = XML_sldTgt;
     123           0 :             return this;
     124             :         case PPT_TOKEN( sndTgt ):
     125             :         {
     126           0 :             mpTarget->mnType = XML_sndTgt;
     127           0 :             drawingml::EmbeddedWAVAudioFile aAudio;
     128           0 :             drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio);
     129             : 
     130           0 :             OUString sSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed );
     131           0 :             mpTarget->msValue = sSndName;
     132           0 :             break;
     133             :         }
     134             :         case PPT_TOKEN( spTgt ):
     135             :         {
     136           0 :             mpTarget->mnType = XML_spTgt;
     137           0 :             OUString aId = rAttribs.getString( XML_spid, OUString() );
     138           0 :             mpTarget->msValue = aId;
     139           0 :             return new ShapeTargetElementContext( *this, mpTarget->maShapeTarget );
     140             :         }
     141             :         default:
     142             :             OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getBaseToken( aElementToken ) );
     143           0 :             break;
     144             :         }
     145             : 
     146           0 :         return this;
     147             :     }
     148             : 
     149             : 
     150          51 : } }
     151             : 
     152             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10