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