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