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 #include "precompiled_sd.hxx" 29 30 #include "slideshow.hxx" 31 #include "ViewShellBase.hxx" 32 #include <rtl/ref.hxx> 33 #include <tools/link.hxx> 34 #include <boost/enable_shared_from_this.hpp> 35 36 namespace sd { 37 38 /** This class is used when a display is removed or added to restart the 39 slide show. This is necessary at least with DirectX because 40 deactivating a display invalidates DirectX resources. Accessing those 41 leads to a crash. 42 43 During a restart a possibly installed presenter extension is given the 44 oportunity to show or hide depending on the number of available displays. 45 */ 46 class SlideShowRestarter 47 : public boost::enable_shared_from_this<SlideShowRestarter> 48 { 49 public: 50 /** Create a new SlideShowRestarter object. 51 @param rpSlideShow 52 The slide show is used to determine the current slide, which is 53 restored after the restart, and of course to stop and start the 54 slide show. 55 @param pViewShellBase 56 Used to get access to a slot dispatcher. 57 */ 58 SlideShowRestarter ( 59 const ::rtl::Reference<SlideShow>& rpSlideShow, 60 ViewShellBase* pViewShellBase); 61 virtual ~SlideShowRestarter (void); 62 63 /** Restarting the slide show is an asynchronous multi step process 64 which is started by calling this method. 65 */ 66 void Restart (void); 67 68 private: 69 sal_Int32 mnEventId; 70 ::rtl::Reference<SlideShow> mpSlideShow; 71 ViewShellBase* mpViewShellBase; 72 ::boost::shared_ptr<SlideShowRestarter> mpSelf; 73 sal_Int32 mnDisplayCount; 74 SfxDispatcher* mpDispatcher; 75 sal_Int32 mnCurrentSlideNumber; 76 77 /** The display count is used to determine whether the number of 78 displays has changed and thus whether restarting the slide show is 79 really necessary. 80 */ 81 sal_Int32 GetDisplayCount (void); 82 83 DECL_LINK(EndPresentation, void*); 84 85 /** Restart the presentation on the slide last shown before the restart 86 was initiated. 87 */ 88 void StartPresentation (void); 89 }; 90 91 } // end of namespace sd 92