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