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 Size;
50 : class Rectangle;
51 : namespace vcl { class Window; }
52 : class SfxRequest;
53 : class WorkWindow;
54 : struct ImplSVEvent;
55 :
56 : // TODO: Remove
57 : #define PAGE_NO_END 65535
58 :
59 : /* Definition of SlideShow class */
60 :
61 : namespace sd
62 : {
63 :
64 : class SlideshowImpl;
65 : class ShowWindow;
66 : class Window;
67 : class View;
68 : class ViewShell;
69 : class ViewShellBase;
70 : struct PresentationSettingsEx;
71 : class FrameView;
72 :
73 : enum AnimationMode
74 : {
75 : ANIMATIONMODE_SHOW,
76 : ANIMATIONMODE_PREVIEW
77 : };
78 :
79 : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
80 :
81 484 : class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
82 : {
83 : public:
84 : /// used by the model to create a slideshow for it
85 : static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
86 :
87 : // static helper api
88 : static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument* pDocument );
89 : static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument& rDocument );
90 : static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase& rBase );
91 :
92 : static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
93 :
94 : static bool StartPreview( ViewShellBase& rBase,
95 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
96 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
97 : ::vcl::Window* pParent = 0 );
98 :
99 : static void Stop( ViewShellBase& rBase );
100 :
101 : /// returns true if there is a running presentation for the given ViewShellBase
102 : static bool IsRunning( ViewShellBase& rBase );
103 :
104 : /// returns true if there is a running presentation inside the given ViewShell
105 : /// returns false even if there is a running presentation but in another ViewShell
106 : static bool IsRunning( ViewShell& rViewShell );
107 :
108 : // helper api
109 :
110 : bool startPreview(
111 : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
112 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
113 : ::vcl::Window* pParent = 0 );
114 :
115 : // uno api
116 :
117 : virtual void SAL_CALL disposing (void) SAL_OVERRIDE;
118 :
119 : // XServiceInfo
120 : virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 :
124 : // XPropertySet
125 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : 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;
127 : 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;
128 : 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;
129 : 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;
130 : 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;
131 : 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;
132 :
133 : // XPresentation
134 : virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 : virtual void SAL_CALL end()
136 : throw (::com::sun::star::uno::RuntimeException,
137 : std::exception) SAL_OVERRIDE;
138 : virtual void SAL_CALL rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 :
140 : // XPresentation2
141 : virtual void SAL_CALL startWithArguments(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments)
142 : throw (::com::sun::star::uno::RuntimeException,
143 : std::exception) SAL_OVERRIDE;
144 : virtual sal_Bool SAL_CALL isRunning( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SAL_CALL getController( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 :
147 : // legacy api
148 :
149 : // actions
150 : void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage()
151 : void jumpToPageIndex( sal_Int32 nIndex );
152 : void jumpToBookmark( const OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark()
153 :
154 : /** sets or clears the pause state of the running slideshow.
155 : !!!! This should only be called by the SdShowWindow !!!!*/
156 : bool pause( bool bPause );
157 :
158 : // settings
159 : bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
160 : bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
161 : ShowWindow* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
162 : int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
163 : sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
164 : sal_Int32 getFirstPageNumber();
165 : sal_Int32 getLastPageNumber();
166 : bool isEndless();
167 : bool isDrawingPossible();
168 :
169 : // events
170 : void resize( const Size &rSize );
171 : void activate(ViewShellBase& rBase);
172 : void deactivate(ViewShellBase& rBase);
173 : void paint( const Rectangle& rRect );
174 :
175 : bool keyInput(const KeyEvent& rKEvt);
176 :
177 : void receiveRequest(SfxRequest& rReq);
178 :
179 : bool dependsOn( ViewShellBase* pViewShellBase );
180 :
181 : static sal_Int32 GetDisplay();
182 :
183 : bool IsExitAfterPresenting() const;
184 : void SetExitAfterPresenting(bool bExit);
185 :
186 : private:
187 : SlideShow( SdDrawDocument* pDoc );
188 :
189 : DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
190 : void StartInPlacePresentationConfigurationCallback();
191 :
192 : void StartInPlacePresentation();
193 : void StartFullscreenPresentation();
194 :
195 : void ThrowIfDisposed() const throw (css::uno::RuntimeException);
196 :
197 : void CreateController( ViewShell* pViewSh, ::sd::View* pView, ::vcl::Window* pParentWindow );
198 : WorkWindow *GetWorkWindow();
199 :
200 : // default: disabled copy/assignment
201 : SlideShow(const SlideShow&);
202 : SlideShow& operator=( const SlideShow& );
203 :
204 : SvxItemPropertySet maPropSet;
205 :
206 : rtl::Reference< SlideshowImpl > mxController;
207 : /** This flag is used together with mxController.is() to prevent
208 : multiple instances of the slide show for one document. The flag
209 : covers the time before mxController is set.
210 : */
211 : bool mbIsInStartup;
212 : SdDrawDocument* mpDoc;
213 :
214 : boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
215 :
216 : ViewShellBase* mpCurrentViewShellBase;
217 : ViewShellBase* mpFullScreenViewShellBase;
218 : FrameView* mpFullScreenFrameView;
219 : ImplSVEvent * mnInPlaceConfigEvent;
220 : };
221 :
222 : namespace slideshowhelp
223 : {
224 : void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc);
225 : }
226 :
227 : }
228 :
229 : #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
230 :
231 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|