LCOV - code coverage report
Current view: top level - slideshow/source/engine/animationnodes - animationcommandnode.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 40 2.5 %
Date: 2014-11-03 Functions: 2 6 33.3 %
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             : 
      21             : // must be first
      22             : #include <canvas/debug.hxx>
      23             : #include <canvas/verbosetrace.hxx>
      24             : #include <com/sun/star/presentation/EffectCommands.hpp>
      25             : #include <com/sun/star/animations/XAnimate.hpp>
      26             : #include <com/sun/star/beans/PropertyValue.hpp>
      27             : 
      28             : #include "animationcommandnode.hxx"
      29             : #include "delayevent.hxx"
      30             : #include "tools.hxx"
      31             : #include "nodetools.hxx"
      32             : 
      33             : #include <boost/bind.hpp>
      34             : 
      35             : using namespace com::sun::star;
      36             : 
      37             : namespace slideshow {
      38             : namespace internal {
      39             : 
      40             : namespace EffectCommands = com::sun::star::presentation::EffectCommands;
      41             : 
      42           0 : AnimationCommandNode::AnimationCommandNode( uno::Reference<animations::XAnimationNode> const& xNode,
      43             :                                              ::boost::shared_ptr<BaseContainerNode> const& pParent,
      44             :                                              NodeContext const& rContext ) :
      45             :     BaseNode( xNode, pParent, rContext ),
      46             :     mpShape(),
      47           0 :     mxCommandNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW )
      48             : {
      49           0 :     uno::Reference< drawing::XShape > xShape( mxCommandNode->getTarget(),
      50           0 :                                               uno::UNO_QUERY );
      51           0 :     ShapeSharedPtr pShape( getContext().mpSubsettableShapeManager->lookupShape( xShape ) );
      52           0 :     mpShape = ::boost::dynamic_pointer_cast< IExternalMediaShapeBase >( pShape );
      53           0 : }
      54             : 
      55           0 : void AnimationCommandNode::dispose()
      56             : {
      57           0 :     mxCommandNode.clear();
      58           0 :     mpShape.reset();
      59           0 :     BaseNode::dispose();
      60           0 : }
      61             : 
      62           0 : void AnimationCommandNode::activate_st()
      63             : {
      64           0 :     switch( mxCommandNode->getCommand() ) {
      65             :         // the command is user defined
      66           0 :     case EffectCommands::CUSTOM: break;
      67             :         // the command is an ole verb.
      68           0 :     case EffectCommands::VERB: break;
      69             :         // the command starts playing on a media object
      70             :     case EffectCommands::PLAY:
      71             :     {
      72           0 :         double fMediaTime=0.0;
      73           0 :         beans::PropertyValue aMediaTime;
      74           0 :         if( (mxCommandNode->getParameter() >>= aMediaTime) && aMediaTime.Name == "MediaTime" )
      75             :         {
      76           0 :             aMediaTime.Value >>= fMediaTime;
      77             :         }
      78           0 :         if( mpShape )
      79             :         {
      80           0 :             mpShape->setMediaTime(fMediaTime/1000.0);
      81           0 :             mpShape->play();
      82             :         }
      83           0 :         break;
      84             :     }
      85             :         // the command toggles the pause status on a media object
      86             :     case EffectCommands::TOGGLEPAUSE:
      87             :     {
      88           0 :         if( mpShape )
      89             :         {
      90           0 :             if( mpShape->isPlaying() )
      91           0 :                 mpShape->pause();
      92             :             else
      93           0 :                 mpShape->play();
      94             :         }
      95           0 :         break;
      96             :     }
      97             :         // the command stops the animation on a media object
      98             :     case EffectCommands::STOP:
      99             :     {
     100           0 :         if( mpShape )
     101           0 :             mpShape->stop();
     102           0 :         break;
     103             :     }
     104             :         // the command stops all currently running sound effects
     105             :     case EffectCommands::STOPAUDIO:
     106           0 :         getContext().mrEventMultiplexer.notifyCommandStopAudio( getSelf() );
     107           0 :         break;
     108             :     }
     109             : 
     110             :     // deactivate ASAP:
     111             :     scheduleDeactivationEvent(
     112           0 :         makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
     113           0 :                    "AnimationCommandNode::deactivate" ) );
     114           0 : }
     115             : 
     116           0 : bool AnimationCommandNode::hasPendingAnimation() const
     117             : {
     118           0 :     return mxCommandNode->getCommand() == EffectCommands::STOPAUDIO || mpShape;
     119             : }
     120             : 
     121             : } // namespace internal
     122           6 : } // namespace slideshow
     123             : 
     124             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10