bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / slideshow / SlideShowRestarter.hxx
blob56a23b80030ff37f3095d77e843593053b601868
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_SOURCE_UI_SLIDESHOW_SLIDESHOWRESTARTER_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESHOW_SLIDESHOWRESTARTER_HXX
23 #include "slideshow.hxx"
24 #include "ViewShellBase.hxx"
25 #include <rtl/ref.hxx>
26 #include <tools/link.hxx>
27 #include <boost/enable_shared_from_this.hpp>
29 namespace sd {
31 /** This class is used when a display is removed or added to restart the
32 slide show. This is necessary at least with DirectX because
33 deactivating a display invalidates DirectX resources. Accessing those
34 leads to a crash.
36 During a restart a possibly installed presenter extension is given the
37 opportunity to show or hide depending on the number of available displays.
39 class SlideShowRestarter
40 : public boost::enable_shared_from_this<SlideShowRestarter>
42 public:
43 /** Create a new SlideShowRestarter object.
44 @param rpSlideShow
45 The slide show is used to determine the current slide, which is
46 restored after the restart, and of course to stop and start the
47 slide show.
48 @param pViewShellBase
49 Used to get access to a slot dispatcher.
51 SlideShowRestarter (
52 const ::rtl::Reference<SlideShow>& rpSlideShow,
53 ViewShellBase* pViewShellBase);
54 virtual ~SlideShowRestarter();
56 /** Restarting the slide show is an asynchronous multi step process
57 which is started by calling this method.
58 @param bForce
59 Used to force a re-start, even if the display count is unchanged.
61 void Restart (bool bForce);
63 private:
64 ImplSVEvent * mnEventId;
65 ::rtl::Reference<SlideShow> mpSlideShow;
66 ViewShellBase* mpViewShellBase;
67 ::boost::shared_ptr<SlideShowRestarter> mpSelf;
68 sal_Int32 mnDisplayCount;
69 SfxDispatcher* mpDispatcher;
70 sal_Int32 mnCurrentSlideNumber;
72 /** The display count is used to determine whether the number of
73 displays has changed and thus whether restarting the slide show is
74 really necessary.
76 sal_Int32 GetDisplayCount();
78 DECL_LINK(EndPresentation, void*);
80 /** Restart the presentation on the slide last shown before the restart
81 was initiated.
83 void StartPresentation();
86 } // end of namespace sd
88 #endif // INCLUDED_SD_SOURCE_UI_SLIDESHOW_SLIDESHOWRESTARTER_HXX
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */