LCOV - code coverage report
Current view: top level - slideshow/source/engine/animationnodes - animationsetnode.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 39 2.6 %
Date: 2015-06-13 12:38:46 Functions: 2 4 50.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             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <canvas/verbosetrace.hxx>
      23             : 
      24             : #include "animationfactory.hxx"
      25             : #include "setactivity.hxx"
      26             : #include "animationsetnode.hxx"
      27             : #include "nodetools.hxx"
      28             : #include "tools.hxx"
      29             : #include "delayevent.hxx"
      30             : 
      31             : #include <boost/bind.hpp>
      32             : 
      33             : using namespace com::sun::star;
      34             : 
      35             : namespace slideshow {
      36             : namespace internal {
      37             : 
      38           0 : void AnimationSetNode::implScheduleDeactivationEvent()
      39             : {
      40           0 :     scheduleDeactivationEvent();
      41           0 : }
      42             : 
      43           0 : AnimationActivitySharedPtr AnimationSetNode::createActivity() const
      44             : {
      45           0 :     ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
      46           0 :     uno::Reference<animations::XAnimate> const xAnimateNode = getXAnimateNode();
      47           0 :     OUString const attrName( xAnimateNode->getAttributeName() );
      48           0 :     AttributableShapeSharedPtr const pShape( getShape() );
      49             : 
      50             :     // make deactivation a two-step procedure. Normally, we
      51             :     // could solely rely on
      52             :     // BaseNode::scheduleDeactivationEvent() to deactivate()
      53             :     // us. Unfortunately, that method on the one hand ignores
      54             :     // indefinite timing, on the other hand generates
      55             :     // zero-timeout delays, which might get fired _before_ our
      56             :     // set activity has taken place. Therefore, we enforce
      57             :     // sequentiality by letting only the set activity schedule
      58             :     // the deactivation event (and AnimationBaseNode
      59             :     // takes care for the fact when mpActivity should be zero).
      60             : 
      61             :     // AnimationBaseNode::fillCommonParameters() has set up
      62             :     // immediate deactivation as default when activity ends, but
      63           0 :     if (! isIndefiniteTiming( xAnimateNode->getDuration() )) {
      64             :         boost::shared_ptr<AnimationSetNode> const pSelf(
      65           0 :             boost::dynamic_pointer_cast<AnimationSetNode>(getSelf()) );
      66           0 :         ENSURE_OR_THROW(
      67             :             pSelf, "cannot cast getSelf() to my type!" );
      68           0 :         aParms.mpEndEvent = makeEvent(
      69             :             boost::bind( &AnimationSetNode::implScheduleDeactivationEvent,
      70             :                          pSelf ),
      71           0 :             "AnimationSetNode::implScheduleDeactivationEvent");
      72             :     }
      73             : 
      74           0 :     switch (AnimationFactory::classifyAttributeName( attrName )) {
      75             :     default:
      76             :     case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
      77           0 :         ENSURE_OR_THROW(
      78             :             false, "AnimationSetNode::createSetActivity(): "
      79             :             "Unexpected attribute class" );
      80             :         break;
      81             : 
      82             :     case AnimationFactory::CLASS_NUMBER_PROPERTY:
      83             :     {
      84             :         NumberAnimation::ValueType aValue;
      85             : 
      86           0 :         ENSURE_OR_THROW(
      87             :             extractValue( aValue,
      88             :                           xAnimateNode->getTo(),
      89             :                           pShape,
      90             :                           getSlideSize() ),
      91             :             "AnimationSetNode::createSetActivity(): "
      92             :             "Could not import numeric to value" );
      93             : 
      94             :         return makeSetActivity(
      95             :             aParms,
      96             :             AnimationFactory::createNumberPropertyAnimation(
      97             :                 attrName,
      98             :                 pShape,
      99           0 :                 getContext().mpSubsettableShapeManager,
     100           0 :                 getSlideSize(),
     101             :                 AnimationFactory::FLAG_NO_SPRITE ),
     102           0 :             aValue );
     103             :     }
     104             : 
     105             :     case AnimationFactory::CLASS_ENUM_PROPERTY:
     106             :     {
     107             :         EnumAnimation::ValueType aValue;
     108             : 
     109           0 :         ENSURE_OR_THROW(
     110             :             extractValue( aValue,
     111             :                           xAnimateNode->getTo(),
     112             :                           pShape,
     113             :                           getSlideSize() ),
     114             :             "AnimationSetNode::createSetActivity(): "
     115             :             "Could not import enum to value" );
     116             : 
     117             :         return makeSetActivity(
     118             :             aParms,
     119             :             AnimationFactory::createEnumPropertyAnimation(
     120             :                 attrName,
     121             :                 pShape,
     122           0 :                 getContext().mpSubsettableShapeManager,
     123           0 :                 getSlideSize(),
     124             :                 AnimationFactory::FLAG_NO_SPRITE ),
     125           0 :             aValue );
     126             :     }
     127             : 
     128             :     case AnimationFactory::CLASS_COLOR_PROPERTY:
     129             :     {
     130           0 :         ColorAnimation::ValueType aValue;
     131             : 
     132           0 :         ENSURE_OR_THROW(
     133             :             extractValue( aValue,
     134             :                           xAnimateNode->getTo(),
     135             :                           pShape,
     136             :                           getSlideSize() ),
     137             :             "AnimationSetNode::createSetActivity(): "
     138             :             "Could not import color to value" );
     139             : 
     140             :         return makeSetActivity(
     141             :             aParms,
     142             :             AnimationFactory::createColorPropertyAnimation(
     143             :                 attrName,
     144             :                 pShape,
     145           0 :                 getContext().mpSubsettableShapeManager,
     146           0 :                 getSlideSize(),
     147             :                 AnimationFactory::FLAG_NO_SPRITE ),
     148           0 :             aValue );
     149             :     }
     150             : 
     151             :     case AnimationFactory::CLASS_STRING_PROPERTY:
     152             :     {
     153           0 :         StringAnimation::ValueType aValue;
     154             : 
     155           0 :         ENSURE_OR_THROW(
     156             :             extractValue( aValue,
     157             :                           xAnimateNode->getTo(),
     158             :                           pShape,
     159             :                           getSlideSize() ),
     160             :             "AnimationSetNode::createSetActivity(): "
     161             :             "Could not import string to value" );
     162             : 
     163             :         return makeSetActivity(
     164             :             aParms,
     165             :             AnimationFactory::createStringPropertyAnimation(
     166             :                 attrName,
     167             :                 pShape,
     168           0 :                 getContext().mpSubsettableShapeManager,
     169           0 :                 getSlideSize(),
     170             :                 AnimationFactory::FLAG_NO_SPRITE ),
     171           0 :             aValue );
     172             :     }
     173             : 
     174             :     case AnimationFactory::CLASS_BOOL_PROPERTY:
     175             :     {
     176             :         BoolAnimation::ValueType aValue;
     177             : 
     178           0 :         ENSURE_OR_THROW(
     179             :             extractValue( aValue,
     180             :                           xAnimateNode->getTo(),
     181             :                           pShape,
     182             :                           getSlideSize() ),
     183             :             "AnimationSetNode::createSetActivity(): "
     184             :             "Could not import bool to value" );
     185             : 
     186             :         return makeSetActivity(
     187             :             aParms,
     188             :             AnimationFactory::createBoolPropertyAnimation(
     189             :                 attrName,
     190             :                 pShape,
     191           0 :                 getContext().mpSubsettableShapeManager,
     192           0 :                 getSlideSize(),
     193             :                 AnimationFactory::FLAG_NO_SPRITE ),
     194           0 :             aValue );
     195             :     }
     196             :     }
     197             : 
     198           0 :     return AnimationActivitySharedPtr();
     199             : }
     200             : 
     201             : } // namespace internal
     202           3 : } // namespace slideshow
     203             : 
     204             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11