update dev300-m58
[ooovba.git] / sd / source / ui / inc / slideshow.hxx
blobec045b6920f5c4b6f4c8f4bcd579e9796c7417b6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: slideshow.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_SLIDESHOW_HXX
32 #define _SD_SLIDESHOW_HXX
34 #include <com/sun/star/presentation/XPresentation2.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <rtl/ref.hxx>
39 #include <tools/link.hxx>
41 #include <cppuhelper/compbase2.hxx>
42 #include <cppuhelper/basemutex.hxx>
44 #include <svx/unoipset.hxx>
46 #include <memory>
47 #include <boost/shared_ptr.hpp>
49 namespace com { namespace sun { namespace star {
51 namespace drawing {
52 class XDrawPage;
54 namespace animations {
55 class XAnimationNode;
57 } } }
59 class SdDrawDocument;
60 class KeyEvent;
61 class HelpEvent;
62 class MouseEvent;
63 class Size;
64 class CommandEvent;
65 class Rectangle;
66 class Window;
67 class SfxRequest;
69 // TODO: Remove
70 #define PAGE_NO_END 65535
71 #define PAGE_NO_SOFTEND (PAGE_NO_END - 1)
72 #define PAGE_NO_PAUSE (PAGE_NO_SOFTEND - 1)
73 #define PAGE_NO_FIRSTDEF PAGE_NO_PAUSE // immer mit anpassen
75 /* Definition of SlideShow class */
77 namespace sd
80 class SlideshowImpl;
81 class ShowWindow;
82 class Window;
83 class View;
84 class ViewShell;
85 struct PresentationSettings;
86 class EffectSequenceHelper;
87 class ViewShellBase;
88 struct PresentationSettingsEx;
89 class FrameView;
91 enum AnimationMode
93 ANIMATIONMODE_SHOW,
94 ANIMATIONMODE_VIEW,
95 ANIMATIONMODE_PREVIEW
98 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
100 class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
102 public:
103 /// used by the model to create a slideshow for it
104 static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
106 // static helper api
107 static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument* pDocument );
108 static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase& rBase );
110 static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
112 static bool StartPreview( ViewShellBase& rBase,
113 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
114 const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
115 ::Window* pParent = 0 );
117 static void Stop( ViewShellBase& rBase );
119 /// returns true if there is a running presentation for the given ViewShellBase
120 static bool IsRunning( ViewShellBase& rBase );
122 /// returns true if there is a running presentation inside the given ViewShell
123 /// returns false even if there is a running presentation but in another ViewShell
124 static bool IsRunning( ViewShell& rViewShell );
126 // helper api
128 bool startPreview(
129 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
130 const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
131 ::Window* pParent = 0 );
133 // uno api
135 virtual void SAL_CALL disposing (void);
137 // XServiceInfo
138 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
139 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
140 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
142 // XPropertySet
143 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
144 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
145 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
146 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
147 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
148 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
149 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
151 // XPresentation
152 virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException);
153 virtual void SAL_CALL end( ) throw (::com::sun::star::uno::RuntimeException);
154 virtual void SAL_CALL rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException);
156 // XPresentation2
157 virtual void SAL_CALL startWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException);
158 virtual ::sal_Bool SAL_CALL isRunning( ) throw (::com::sun::star::uno::RuntimeException);
159 virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SAL_CALL getController( ) throw (::com::sun::star::uno::RuntimeException);
161 // legacy api
163 // actions
164 void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage()
165 void jumpToPageIndex( sal_Int32 nIndex );
166 void jumpToBookmark( const ::rtl::OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark()
168 /** sets or clears the pause state of the running slideshow.
169 !!!! This should only be called by the SdShowWindow !!!!*/
170 bool pause( bool bPause );
173 // settings
174 bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
175 bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
176 ShowWindow* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
177 int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
178 sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
179 sal_Int32 getCurrentPageIndex();
180 sal_Int32 getFirstPageNumber();
181 sal_Int32 getLastPageNumber();
182 bool isEndless();
183 bool isDrawingPossible();
185 // events
186 void resize( const Size &rSize );
187 void activate(ViewShellBase& rBase);
188 void deactivate(ViewShellBase& rBase);
189 void paint( const Rectangle& rRect );
191 bool keyInput(const KeyEvent& rKEvt);
193 void receiveRequest(SfxRequest& rReq);
195 bool dependsOn( ViewShellBase* pViewShellBase );
197 static sal_Int32 GetDisplay();
199 private:
200 SlideShow( SdDrawDocument* pDoc );
202 DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
203 void StartInPlacePresentationConfigurationCallback();
205 void StartInPlacePresentation();
206 void StartFullscreenPresentation();
208 void ThrowIfDisposed() throw (::com::sun::star::uno::RuntimeException);
210 void CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow );
212 // default: disabled copy/assignment
213 SlideShow(const SlideShow&);
214 SlideShow& operator=( const SlideShow& );
216 SvxItemPropertySet maPropSet;
218 rtl::Reference< SlideshowImpl > mxController;
219 /** This flag is used together with mxController.is() to prevent
220 multiple instances of the slide show for one document. The flag
221 covers the time before mxController is set.
223 bool mbIsInStartup;
224 SdDrawDocument* mpDoc;
226 boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
228 ViewShellBase* mpCurrentViewShellBase;
229 ViewShellBase* mpFullScreenViewShellBase;
230 FrameView* mpFullScreenFrameView;
231 sal_Int32 mnInPlaceConfigEvent;
236 #endif /* _SD_SLIDESHOW_HXX */