1*70f497fbSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*70f497fbSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*70f497fbSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*70f497fbSAndrew Rist  * distributed with this work for additional information
6*70f497fbSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*70f497fbSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*70f497fbSAndrew Rist  * "License"); you may not use this file except in compliance
9*70f497fbSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*70f497fbSAndrew Rist  *
11*70f497fbSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*70f497fbSAndrew Rist  *
13*70f497fbSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*70f497fbSAndrew Rist  * software distributed under the License is distributed on an
15*70f497fbSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*70f497fbSAndrew Rist  * KIND, either express or implied.  See the License for the
17*70f497fbSAndrew Rist  * specific language governing permissions and limitations
18*70f497fbSAndrew Rist  * under the License.
19*70f497fbSAndrew Rist  *
20*70f497fbSAndrew Rist  *************************************************************/
21*70f497fbSAndrew Rist 
22*70f497fbSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_slideshow.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // must be first
28cdf0e10cSrcweir #include <canvas/debug.hxx>
29cdf0e10cSrcweir #include <canvas/verbosetrace.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "propertyanimationnode.hxx"
32cdf0e10cSrcweir #include "animationfactory.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir using namespace com::sun::star;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace slideshow {
37cdf0e10cSrcweir namespace internal {
38cdf0e10cSrcweir 
createActivity() const39cdf0e10cSrcweir AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
40cdf0e10cSrcweir {
41cdf0e10cSrcweir     // Create AnimationActivity from common XAnimate parameters:
42cdf0e10cSrcweir     ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
43cdf0e10cSrcweir     uno::Reference<animations::XAnimate> const& xAnimateNode =getXAnimateNode();
44cdf0e10cSrcweir     rtl::OUString const attrName( xAnimateNode->getAttributeName() );
45cdf0e10cSrcweir     AttributableShapeSharedPtr const pShape( getShape() );
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     switch (AnimationFactory::classifyAttributeName( attrName )) {
48cdf0e10cSrcweir     default:
49cdf0e10cSrcweir     case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
50cdf0e10cSrcweir         ENSURE_OR_THROW(
51cdf0e10cSrcweir             false,
52cdf0e10cSrcweir             "Unexpected attribute class (unknown or empty attribute name)" );
53cdf0e10cSrcweir         break;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     case AnimationFactory::CLASS_NUMBER_PROPERTY:
56cdf0e10cSrcweir         return ActivitiesFactory::createAnimateActivity(
57cdf0e10cSrcweir             aParms,
58cdf0e10cSrcweir             AnimationFactory::createNumberPropertyAnimation(
59cdf0e10cSrcweir                 attrName,
60cdf0e10cSrcweir                 pShape,
61cdf0e10cSrcweir                 getContext().mpSubsettableShapeManager,
62cdf0e10cSrcweir                 getSlideSize() ),
63cdf0e10cSrcweir             xAnimateNode );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     case AnimationFactory::CLASS_ENUM_PROPERTY:
66cdf0e10cSrcweir         return ActivitiesFactory::createAnimateActivity(
67cdf0e10cSrcweir             aParms,
68cdf0e10cSrcweir             AnimationFactory::createEnumPropertyAnimation(
69cdf0e10cSrcweir                 attrName,
70cdf0e10cSrcweir                 pShape,
71cdf0e10cSrcweir                 getContext().mpSubsettableShapeManager,
72cdf0e10cSrcweir                 getSlideSize() ),
73cdf0e10cSrcweir             xAnimateNode );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     case AnimationFactory::CLASS_COLOR_PROPERTY:
76cdf0e10cSrcweir         return ActivitiesFactory::createAnimateActivity(
77cdf0e10cSrcweir             aParms,
78cdf0e10cSrcweir             AnimationFactory::createColorPropertyAnimation(
79cdf0e10cSrcweir                 attrName,
80cdf0e10cSrcweir                 pShape,
81cdf0e10cSrcweir                 getContext().mpSubsettableShapeManager,
82cdf0e10cSrcweir                 getSlideSize() ),
83cdf0e10cSrcweir             xAnimateNode );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     case AnimationFactory::CLASS_STRING_PROPERTY:
86cdf0e10cSrcweir         return ActivitiesFactory::createAnimateActivity(
87cdf0e10cSrcweir             aParms,
88cdf0e10cSrcweir             AnimationFactory::createStringPropertyAnimation(
89cdf0e10cSrcweir                 attrName,
90cdf0e10cSrcweir                 pShape,
91cdf0e10cSrcweir                 getContext().mpSubsettableShapeManager,
92cdf0e10cSrcweir                 getSlideSize() ),
93cdf0e10cSrcweir             xAnimateNode );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     case AnimationFactory::CLASS_BOOL_PROPERTY:
96cdf0e10cSrcweir         return ActivitiesFactory::createAnimateActivity(
97cdf0e10cSrcweir             aParms,
98cdf0e10cSrcweir             AnimationFactory::createBoolPropertyAnimation(
99cdf0e10cSrcweir                 attrName,
100cdf0e10cSrcweir                 pShape,
101cdf0e10cSrcweir                 getContext().mpSubsettableShapeManager,
102cdf0e10cSrcweir                 getSlideSize() ),
103cdf0e10cSrcweir             xAnimateNode );
104cdf0e10cSrcweir     }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     return AnimationActivitySharedPtr();
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir } // namespace internal
110cdf0e10cSrcweir } // namespace slideshow
111cdf0e10cSrcweir 
112