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