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 #include <com/sun/star/animations/AnimationTransformType.hpp>
35 
36 #include "animationtransformnode.hxx"
37 #include "animationfactory.hxx"
38 #include "activitiesfactory.hxx"
39 
40 using namespace com::sun::star;
41 
42 namespace slideshow {
43 namespace internal {
44 
45 void AnimationTransformNode::dispose()
46 {
47     mxTransformNode.clear();
48     AnimationBaseNode::dispose();
49 }
50 
51 AnimationActivitySharedPtr AnimationTransformNode::createActivity() const
52 {
53     ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
54 
55     const sal_Int16 nTransformType( mxTransformNode->getTransformType() );
56 
57     const AttributableShapeSharedPtr& rShape( getShape() );
58 
59     switch( nTransformType )
60     {
61     default:
62         ENSURE_OR_THROW(
63             false, "AnimationTransformNode::createTransformActivity(): "
64             "Unknown transform type" );
65 
66     case animations::AnimationTransformType::TRANSLATE:
67         // FALLTHROUGH intended
68     case animations::AnimationTransformType::SCALE:
69         return ActivitiesFactory::createAnimateActivity(
70             aParms,
71             AnimationFactory::createPairPropertyAnimation(
72                 rShape,
73                 getContext().mpSubsettableShapeManager,
74                 getSlideSize(),
75                 nTransformType ),
76             getXAnimateNode() );
77 
78     case animations::AnimationTransformType::ROTATE:
79         return ActivitiesFactory::createAnimateActivity(
80             aParms,
81             AnimationFactory::createNumberPropertyAnimation(
82                 ::rtl::OUString(
83                     RTL_CONSTASCII_USTRINGPARAM("Rotate") ),
84                 rShape,
85                 getContext().mpSubsettableShapeManager,
86                 getSlideSize() ),
87             getXAnimateNode() );
88 
89     case animations::AnimationTransformType::SKEWX:
90         return ActivitiesFactory::createAnimateActivity(
91             aParms,
92             AnimationFactory::createNumberPropertyAnimation(
93                 ::rtl::OUString(
94                     RTL_CONSTASCII_USTRINGPARAM("SkewX") ),
95                 rShape,
96                 getContext().mpSubsettableShapeManager,
97                 getSlideSize() ),
98             getXAnimateNode() );
99 
100     case animations::AnimationTransformType::SKEWY:
101         return ActivitiesFactory::createAnimateActivity(
102             aParms,
103             AnimationFactory::createNumberPropertyAnimation(
104                 ::rtl::OUString(
105                     RTL_CONSTASCII_USTRINGPARAM("SkewY") ),
106                 rShape,
107                 getContext().mpSubsettableShapeManager,
108                 getSlideSize() ),
109             getXAnimateNode() );
110     }
111 }
112 
113 } // namespace internal
114 } // namespace slideshow
115