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