Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
22 :
23 : #include <com/sun/star/presentation/XPresentation2.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 :
26 : #include <rtl/ref.hxx>
27 :
28 : #include <tools/link.hxx>
29 :
30 : #include <cppuhelper/compbase2.hxx>
31 : #include <cppuhelper/basemutex.hxx>
32 :
33 : #include <editeng/unoipset.hxx>
34 :
35 : #include <boost/shared_ptr.hpp>
36 :
37 : namespace com { namespace sun { namespace star {
38 :
39 : namespace drawing {
40 : class XDrawPage;
41 : }
42 : namespace animations {
43 : class XAnimationNode;
44 : }
45 : } } }
46 :
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;
58 :
59 : // TODO: Remove
60 : #define PAGE_NO_END 65535
61 :
62 : /* Definition of SlideShow class */
63 :
64 : namespace sd
65 : {
66 :
67 : class SlideshowImpl;
68 : class Window;
69 : class View;
70 : class ViewShell;
71 : class ViewShellBase;
72 : struct PresentationSettingsEx;
73 : class FrameView;
74 :
75 : enum AnimationMode
76 : {
77 : ANIMATIONMODE_SHOW,
78 : ANIMATIONMODE_PREVIEW
79 : };
80 :
81 : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
82 :
83 304 : class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
84 : {
85 : public:
86 : /// used by the model to create a slideshow for it
87 : static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
88 :
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 );
93 :
94 : static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
95 :
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 );
100 :
101 : static void Stop( ViewShellBase& rBase );
102 :
103 : /// returns true if there is a running presentation for the given ViewShellBase
104 : static bool IsRunning( ViewShellBase& rBase );
105 :
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 );
109 :
110 : // helper api
111 :
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 );
116 :
117 : // uno api
118 :
119 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
120 :
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;
125 :
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;
134 :
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;
141 :
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;
148 :
149 : // legacy api
150 :
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()
155 :
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);
161 :
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();
172 :
173 : // events
174 : void resize( const Size &rSize );
175 : void activate(ViewShellBase& rBase);
176 : void deactivate(ViewShellBase& rBase);
177 : void paint( const Rectangle& rRect );
178 :
179 : bool keyInput(const KeyEvent& rKEvt);
180 :
181 : void receiveRequest(SfxRequest& rReq);
182 :
183 : bool dependsOn( ViewShellBase* pViewShellBase );
184 :
185 : static sal_Int32 GetDisplay();
186 :
187 : bool IsExitAfterPresenting() const;
188 : void SetExitAfterPresenting(bool bExit);
189 :
190 : private:
191 : SlideShow( SdDrawDocument* pDoc );
192 :
193 : DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
194 : void StartInPlacePresentationConfigurationCallback();
195 :
196 : void StartInPlacePresentation();
197 : void StartFullscreenPresentation();
198 :
199 : void ThrowIfDisposed() const throw (css::uno::RuntimeException);
200 :
201 : void CreateController( ViewShell* pViewSh, ::sd::View* pView, vcl::Window* pParentWindow );
202 : WorkWindow *GetWorkWindow();
203 :
204 : SlideShow(const SlideShow&) SAL_DELETED_FUNCTION;
205 : SlideShow& operator=( const SlideShow& ) SAL_DELETED_FUNCTION;
206 :
207 : SvxItemPropertySet maPropSet;
208 :
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.
213 : */
214 : bool mbIsInStartup;
215 : SdDrawDocument* mpDoc;
216 :
217 : boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
218 :
219 : ViewShellBase* mpCurrentViewShellBase;
220 : ViewShellBase* mpFullScreenViewShellBase;
221 : FrameView* mpFullScreenFrameView;
222 : ImplSVEvent * mnInPlaceConfigEvent;
223 : };
224 :
225 : namespace slideshowhelp
226 : {
227 : void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc);
228 : }
229 :
230 : }
231 :
232 : #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
233 :
234 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|