bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / slideshow.hxx
blobb8c1178a7ac29e21ec568d0584275c6f91fdacf9
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_INC_SLIDESHOW_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
23 #include <com/sun/star/presentation/XPresentation2.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <rtl/ref.hxx>
28 #include <tools/link.hxx>
30 #include <cppuhelper/compbase2.hxx>
31 #include <cppuhelper/basemutex.hxx>
33 #include <editeng/unoipset.hxx>
35 #include <boost/shared_ptr.hpp>
37 namespace com { namespace sun { namespace star {
39 namespace drawing {
40 class XDrawPage;
42 namespace animations {
43 class XAnimationNode;
45 } } }
47 class SdDrawDocument;
48 class KeyEvent;
49 class OutputDevice;
50 class Size;
51 class Rectangle;
52 namespace vcl { class Window; }
53 class SfxRequest;
54 class WorkWindow;
55 class CommandSwipeData;
56 class CommandLongPressData;
57 struct ImplSVEvent;
59 // TODO: Remove
60 #define PAGE_NO_END 65535
62 /* Definition of SlideShow class */
64 namespace sd
67 class SlideshowImpl;
68 class Window;
69 class View;
70 class ViewShell;
71 class ViewShellBase;
72 struct PresentationSettingsEx;
73 class FrameView;
75 enum AnimationMode
77 ANIMATIONMODE_SHOW,
78 ANIMATIONMODE_PREVIEW
81 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
83 class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
85 public:
86 /// used by the model to create a slideshow for it
87 static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
89 // static helper api
90 static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument* pDocument );
91 static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument& rDocument );
92 static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase& rBase );
94 static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
96 static bool StartPreview( ViewShellBase& rBase,
97 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
98 const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
99 vcl::Window* pParent = 0 );
101 static void Stop( ViewShellBase& rBase );
103 /// returns true if there is a running presentation for the given ViewShellBase
104 static bool IsRunning( ViewShellBase& rBase );
106 /// returns true if there is a running presentation inside the given ViewShell
107 /// returns false even if there is a running presentation but in another ViewShell
108 static bool IsRunning( ViewShell& rViewShell );
110 // helper api
112 bool startPreview(
113 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
114 const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
115 vcl::Window* pParent = 0 );
117 // uno api
119 virtual void SAL_CALL disposing() SAL_OVERRIDE;
121 // XServiceInfo
122 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 // XPropertySet
127 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL setPropertyValue( const 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, std::exception) SAL_OVERRIDE;
129 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 virtual void SAL_CALL addPropertyChangeListener( const 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, std::exception) SAL_OVERRIDE;
131 virtual void SAL_CALL removePropertyChangeListener( const 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, std::exception) SAL_OVERRIDE;
132 virtual void SAL_CALL addVetoableChangeListener( const 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, std::exception) SAL_OVERRIDE;
133 virtual void SAL_CALL removeVetoableChangeListener( const 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, std::exception) SAL_OVERRIDE;
135 // XPresentation
136 virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 virtual void SAL_CALL end()
138 throw (::com::sun::star::uno::RuntimeException,
139 std::exception) SAL_OVERRIDE;
140 virtual void SAL_CALL rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 // XPresentation2
143 virtual void SAL_CALL startWithArguments(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments)
144 throw (::com::sun::star::uno::RuntimeException,
145 std::exception) SAL_OVERRIDE;
146 virtual sal_Bool SAL_CALL isRunning( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SAL_CALL getController( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 // legacy api
151 // actions
152 void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage()
153 void jumpToPageIndex( sal_Int32 nIndex );
154 void jumpToBookmark( const OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark()
156 /** sets or clears the pause state of the running slideshow.
157 !!!! This should only be called by the SdShowWindow !!!!*/
158 bool pause( bool bPause );
159 bool swipe(const CommandSwipeData &rSwipeData);
160 bool longpress(const CommandLongPressData& rLongPressData);
162 // settings
163 bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
164 bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
165 OutputDevice* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
166 int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
167 sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
168 sal_Int32 getFirstPageNumber();
169 sal_Int32 getLastPageNumber();
170 bool isEndless();
171 bool isDrawingPossible();
173 // events
174 void resize( const Size &rSize );
175 void activate(ViewShellBase& rBase);
176 void deactivate(ViewShellBase& rBase);
177 void paint( const Rectangle& rRect );
179 bool keyInput(const KeyEvent& rKEvt);
181 void receiveRequest(SfxRequest& rReq);
183 bool dependsOn( ViewShellBase* pViewShellBase );
185 static sal_Int32 GetDisplay();
187 bool IsExitAfterPresenting() const;
188 void SetExitAfterPresenting(bool bExit);
190 private:
191 SlideShow( SdDrawDocument* pDoc );
193 DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
194 void StartInPlacePresentationConfigurationCallback();
196 void StartInPlacePresentation();
197 void StartFullscreenPresentation();
199 void ThrowIfDisposed() const throw (css::uno::RuntimeException);
201 void CreateController( ViewShell* pViewSh, ::sd::View* pView, vcl::Window* pParentWindow );
202 WorkWindow *GetWorkWindow();
204 SlideShow(const SlideShow&) SAL_DELETED_FUNCTION;
205 SlideShow& operator=( const SlideShow& ) SAL_DELETED_FUNCTION;
207 SvxItemPropertySet maPropSet;
209 rtl::Reference< SlideshowImpl > mxController;
210 /** This flag is used together with mxController.is() to prevent
211 multiple instances of the slide show for one document. The flag
212 covers the time before mxController is set.
214 bool mbIsInStartup;
215 SdDrawDocument* mpDoc;
217 boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
219 ViewShellBase* mpCurrentViewShellBase;
220 ViewShellBase* mpFullScreenViewShellBase;
221 FrameView* mpFullScreenFrameView;
222 ImplSVEvent * mnInPlaceConfigEvent;
225 namespace slideshowhelp
227 void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc);
232 #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
234 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */