1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_slideshow.hxx"
30 
31 // must be first
32 #include <canvas/debug.hxx>
33 #include <canvas/verbosetrace.hxx>
34 
35 #include "propertyanimationnode.hxx"
36 #include "animationfactory.hxx"
37 
38 using namespace com::sun::star;
39 
40 namespace slideshow {
41 namespace internal {
42 
43 AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
44 {
45     // Create AnimationActivity from common XAnimate parameters:
46     ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
47     uno::Reference<animations::XAnimate> const& xAnimateNode =getXAnimateNode();
48     rtl::OUString const attrName( xAnimateNode->getAttributeName() );
49     AttributableShapeSharedPtr const pShape( getShape() );
50 
51     switch (AnimationFactory::classifyAttributeName( attrName )) {
52     default:
53     case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
54         ENSURE_OR_THROW(
55             false,
56             "Unexpected attribute class (unknown or empty attribute name)" );
57         break;
58 
59     case AnimationFactory::CLASS_NUMBER_PROPERTY:
60         return ActivitiesFactory::createAnimateActivity(
61             aParms,
62             AnimationFactory::createNumberPropertyAnimation(
63                 attrName,
64                 pShape,
65                 getContext().mpSubsettableShapeManager,
66                 getSlideSize() ),
67             xAnimateNode );
68 
69     case AnimationFactory::CLASS_ENUM_PROPERTY:
70         return ActivitiesFactory::createAnimateActivity(
71             aParms,
72             AnimationFactory::createEnumPropertyAnimation(
73                 attrName,
74                 pShape,
75                 getContext().mpSubsettableShapeManager,
76                 getSlideSize() ),
77             xAnimateNode );
78 
79     case AnimationFactory::CLASS_COLOR_PROPERTY:
80         return ActivitiesFactory::createAnimateActivity(
81             aParms,
82             AnimationFactory::createColorPropertyAnimation(
83                 attrName,
84                 pShape,
85                 getContext().mpSubsettableShapeManager,
86                 getSlideSize() ),
87             xAnimateNode );
88 
89     case AnimationFactory::CLASS_STRING_PROPERTY:
90         return ActivitiesFactory::createAnimateActivity(
91             aParms,
92             AnimationFactory::createStringPropertyAnimation(
93                 attrName,
94                 pShape,
95                 getContext().mpSubsettableShapeManager,
96                 getSlideSize() ),
97             xAnimateNode );
98 
99     case AnimationFactory::CLASS_BOOL_PROPERTY:
100         return ActivitiesFactory::createAnimateActivity(
101             aParms,
102             AnimationFactory::createBoolPropertyAnimation(
103                 attrName,
104                 pShape,
105                 getContext().mpSubsettableShapeManager,
106                 getSlideSize() ),
107             xAnimateNode );
108     }
109 
110     return AnimationActivitySharedPtr();
111 }
112 
113 } // namespace internal
114 } // namespace slideshow
115 
116