LCOV - code coverage report
Current view: top level - libreoffice/oox/source/ppt - soundactioncontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 30 0.0 %
Date: 2012-12-27 Functions: 0 5 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 "oox/ppt/soundactioncontext.hxx"
      21             : 
      22             : #include "comphelper/anytostring.hxx"
      23             : #include "cppuhelper/exc_hlp.hxx"
      24             : 
      25             : #include "oox/helper/attributelist.hxx"
      26             : #include "oox/helper/propertymap.hxx"
      27             : #include "oox/drawingml/embeddedwavaudiofile.hxx"
      28             : 
      29             : using rtl::OUString;
      30             : using namespace ::oox::core;
      31             : using namespace ::com::sun::star::xml::sax;
      32             : using namespace ::com::sun::star::uno;
      33             : 
      34             : 
      35             : namespace oox { namespace ppt {
      36             : 
      37             : 
      38           0 :     SoundActionContext::SoundActionContext( FragmentHandler2& rParent, PropertyMap & aProperties ) throw()
      39             :     : FragmentHandler2( rParent )
      40             :     , maSlideProperties( aProperties )
      41             :     , mbHasStartSound( false )
      42             :     , mbLoopSound( false )
      43           0 :     , mbStopSound( false )
      44             :     {
      45           0 :     }
      46             : 
      47             : 
      48           0 :     SoundActionContext::~SoundActionContext() throw()
      49             :     {
      50           0 :     }
      51             : 
      52             : 
      53           0 :     void SoundActionContext::onEndElement()
      54             :     {
      55           0 :         if ( isCurrentElement( PPT_TOKEN( sndAc ) ) )
      56             :         {
      57           0 :             if( mbHasStartSound )
      58             :             {
      59           0 :                 OUString url;
      60             :                 // TODO this is very wrong
      61           0 :                 if ( !msSndName.isEmpty() )
      62             :                 {
      63             :                     // try the builtIn version
      64           0 :                     url = msSndName;
      65             :                 }
      66             : #if 0 // OOo does not support embedded data yet
      67             :                 else if ( msEmbedded.getLength() != 0 )
      68             :                 {
      69             :                     RelationsRef xRel = getHandler()->getRelations();
      70             :                     url =   xRel->getRelationById( msEmbedded )->msTarget;
      71             :                 }
      72             :                 else if ( msLink.getLength() != 0 )
      73             :                 {
      74             :                     url = msLink;
      75             :                 }
      76             : #endif
      77           0 :                 if ( !url.isEmpty() )
      78             :                 {
      79           0 :                     maSlideProperties[ PROP_Sound ] <<= url;
      80           0 :                     maSlideProperties[ PROP_SoundOn ] <<= sal_True;
      81           0 :                 }
      82             :             }
      83             : //          else if( mbStopSound )
      84             : //          {
      85             : //              maSlideProperties[ CREATE_OUSTRING( "" ) ] = Any( sal_True );
      86             : //          }
      87             :         }
      88           0 :     }
      89             : 
      90             : 
      91           0 :     ::oox::core::ContextHandlerRef SoundActionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      92             :     {
      93           0 :         switch( aElementToken )
      94             :         {
      95             :         case PPT_TOKEN( snd ):
      96           0 :             if( mbHasStartSound )
      97             :             {
      98           0 :                 drawingml::EmbeddedWAVAudioFile aAudio;
      99           0 :                 drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio);
     100             : 
     101           0 :                 msSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed );
     102             :             }
     103           0 :             return this;
     104             :         case PPT_TOKEN( endSnd ):
     105             :             // CT_Empty
     106           0 :             mbStopSound = true;
     107           0 :             return this;
     108             :         case PPT_TOKEN( stSnd ):
     109           0 :             mbHasStartSound = true;
     110           0 :             mbLoopSound = rAttribs.getBool( XML_loop, false );
     111           0 :             return this;
     112             :         default:
     113           0 :             break;
     114             :         }
     115             : 
     116           0 :         return this;
     117             :     }
     118             : 
     119             : 
     120             : 
     121             : } }
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10