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