merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / slideshow / SlideShowRestarter.hxx
blobc18c431b6e688df0b497aeadd372ffd3d5af6a0c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlideShowRestarter.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "precompiled_sd.hxx"
33 #include "slideshow.hxx"
34 #include "ViewShellBase.hxx"
35 #include <rtl/ref.hxx>
36 #include <tools/link.hxx>
37 #include <boost/enable_shared_from_this.hpp>
39 namespace sd {
41 /** This class is used when a display is removed or added to restart the
42 slide show. This is necessary at least with DirectX because
43 deactivating a display invalidates DirectX resources. Accessing those
44 leads to a crash.
46 During a restart a possibly installed presenter extension is given the
47 oportunity to show or hide depending on the number of available displays.
49 class SlideShowRestarter
50 : public boost::enable_shared_from_this<SlideShowRestarter>
52 public:
53 /** Create a new SlideShowRestarter object.
54 @param rpSlideShow
55 The slide show is used to determine the current slide, which is
56 restored after the restart, and of course to stop and start the
57 slide show.
58 @param pViewShellBase
59 Used to get access to a slot dispatcher.
61 SlideShowRestarter (
62 const ::rtl::Reference<SlideShow>& rpSlideShow,
63 ViewShellBase* pViewShellBase);
64 virtual ~SlideShowRestarter (void);
66 /** Restarting the slide show is an asynchronous multi step process
67 which is started by calling this method.
69 void Restart (void);
71 private:
72 sal_Int32 mnEventId;
73 ::rtl::Reference<SlideShow> mpSlideShow;
74 ViewShellBase* mpViewShellBase;
75 ::boost::shared_ptr<SlideShowRestarter> mpSelf;
76 sal_Int32 mnDisplayCount;
77 SfxDispatcher* mpDispatcher;
78 sal_Int32 mnCurrentSlideNumber;
80 /** The display count is used to determine whether the number of
81 displays has changed and thus whether restarting the slide show is
82 really necessary.
84 sal_Int32 GetDisplayCount (void);
86 DECL_LINK(EndPresentation, void*);
88 /** Restart the presentation on the slide last shown before the restart
89 was initiated.
91 void StartPresentation (void);
94 } // end of namespace sd