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 #ifndef INCLUDED_SLIDESHOW_TRANSITIONFACTORY_HXX
25 #define INCLUDED_SLIDESHOW_TRANSITIONFACTORY_HXX
26 
27 #include <com/sun/star/animations/XTransitionFilter.hpp>
28 #include <com/sun/star/presentation/XTransitionFactory.hpp>
29 
30 #include "animatableshape.hxx"
31 #include "rgbcolor.hxx"
32 #include "slide.hxx"
33 #include "screenupdater.hxx"
34 #include "animationactivity.hxx"
35 #include "activitiesfactory.hxx"
36 #include "numberanimation.hxx"
37 #include "transitioninfo.hxx"
38 #include "soundplayer.hxx"
39 
40 #include <boost/utility.hpp>
41 
42 namespace slideshow
43 {
44     namespace internal
45     {
46         /* Definition of Transitionfactory class */
47         class TransitionFactory : private boost::noncopyable
48         {
49         public:
50             /** Create a transition effect for shapes.
51 
52             	This method creates an AnimationActivity, which, when
53             	run, performs the requested transition effect on the
54             	given shape.
55 
56                 @param rParms
57                 Collection of activity parameters, see ActivitiesFactory
58 
59                 @param rShape
60                 Shape to animate
61 
62                 @param rShapeManager
63                 ShapeManager, to manage shape animation
64 
65                 @param xTransition
66                 The transition effect
67 
68                 @return the created activity, or NULL for no
69                 transition effect
70              */
71             static AnimationActivitySharedPtr createShapeTransition(
72                 const ActivitiesFactory::CommonParameters& 				rParms,
73                 const AnimatableShapeSharedPtr& 						rShape,
74                 const ShapeManagerSharedPtr& 							rShapeManager,
75                 const ::basegfx::B2DVector&                             rSlideSize,
76                 ::com::sun::star::uno::Reference<
77                 	::com::sun::star::animations::XTransitionFilter > const&  xTransition );
78 
79 
80             /** Create a transition effect for slides.
81 
82             	This method creates a NumberAnimation, which,
83             	when run, performs the requested transition effect
84             	with the slide bitmaps.
85 
86                 @param rEnteringBitmap
87                 Bitmap of the slide which 'enters' the screen.
88 
89                 @param rLeavingBitmap
90                 Bitmap of the slide which 'leaves' the screen.
91 
92                 @param nTransitionType
93                 Type of the transition (see XTransitionFilter)
94 
95                 @param nTransitionSubType
96                 Subtype of the transition (see XTransitionFilter)
97 
98                 @param bTransitionDirection
99                 Direction of the transition (see XTransitionFilter)
100 
101                 @param rTransitionFadeColor
102                 Optional fade color for the transition
103 
104                 @return the created animation, or NULL for no
105                 transition effect
106              */
107             static NumberAnimationSharedPtr createSlideTransition(
108                 const SlideSharedPtr&                          rLeavingSlide,
109                 const SlideSharedPtr&                          rEnteringSlide,
110                 const UnoViewContainer&                        rViewContainer,
111                 ScreenUpdater&                                 rScreenUpdater,
112                 EventMultiplexer&                              rEventMultiplexer,
113                 const com::sun::star::uno::Reference<
114                       com::sun::star::presentation::XTransitionFactory>&
115                                                                xOptionalFactory,
116                 sal_Int16                                      nTransitionType,
117                 sal_Int16                                      nTransitionSubType,
118                 bool                                           bTransitionDirection,
119                 const RGBColor&                                rTransitionFadeColor,
120                 const SoundPlayerSharedPtr&                    rSoundPlayer );
121 
122         private:
123             static const TransitionInfo* getTransitionInfo(
124                 sal_Int16 nTransitionType, sal_Int16 nTransitionSubType );
125             static const TransitionInfo* getRandomTransitionInfo();
126 
127             static AnimationActivitySharedPtr createShapeTransition(
128                 const ActivitiesFactory::CommonParameters& 				rParms,
129                 const AnimatableShapeSharedPtr& 						rShape,
130                 const ShapeManagerSharedPtr& 							rShapeManager,
131                 const ::basegfx::B2DVector&                             rSlideSize,
132                 ::com::sun::star::uno::Reference<
133                 	::com::sun::star::animations::XTransitionFilter > const& xTransition,
134                 sal_Int16               								nTransitionType,
135                 sal_Int16               								nTransitionSubType );
136 
137             // static factory
138             TransitionFactory();
139             ~TransitionFactory();
140         };
141     }
142 }
143 
144 #endif /* INCLUDED_SLIDESHOW_TRANSITIONFACTORY_HXX */
145