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 : class Window;
52 : class SfxRequest;
53 : class WorkWindow;
54 :
55 : // TODO: Remove
56 : #define PAGE_NO_END 65535
57 :
58 : /* Definition of SlideShow class */
59 :
60 : namespace sd
61 : {
62 :
63 : class SlideshowImpl;
64 : class ShowWindow;
65 : class Window;
66 : class View;
67 : class ViewShell;
68 : class ViewShellBase;
69 : struct PresentationSettingsEx;
70 : class FrameView;
71 :
72 : enum AnimationMode
73 : {
74 : ANIMATIONMODE_SHOW,
75 : ANIMATIONMODE_VIEW,
76 : ANIMATIONMODE_PREVIEW
77 : };
78 :
79 : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
80 :
81 0 : 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 : ::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 : ::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 :
159 : // settings
160 : bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
161 : bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
162 : ShowWindow* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
163 : int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
164 : sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
165 : sal_Int32 getFirstPageNumber();
166 : sal_Int32 getLastPageNumber();
167 : bool isEndless();
168 : bool isDrawingPossible();
169 :
170 : // events
171 : void resize( const Size &rSize );
172 : void activate(ViewShellBase& rBase);
173 : void deactivate(ViewShellBase& rBase);
174 : void paint( const Rectangle& rRect );
175 :
176 : bool keyInput(const KeyEvent& rKEvt);
177 :
178 : void receiveRequest(SfxRequest& rReq);
179 :
180 : bool dependsOn( ViewShellBase* pViewShellBase );
181 :
182 : static sal_Int32 GetDisplay();
183 :
184 : private:
185 : SlideShow( SdDrawDocument* pDoc );
186 :
187 : DECL_LINK( StartInPlacePresentationConfigurationHdl, void * );
188 : void StartInPlacePresentationConfigurationCallback();
189 :
190 : void StartInPlacePresentation();
191 : void StartFullscreenPresentation();
192 :
193 : void ThrowIfDisposed() throw (::com::sun::star::uno::RuntimeException);
194 :
195 : void CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow );
196 : WorkWindow *GetWorkWindow();
197 :
198 : // default: disabled copy/assignment
199 : SlideShow(const SlideShow&);
200 : SlideShow& operator=( const SlideShow& );
201 :
202 : SvxItemPropertySet maPropSet;
203 :
204 : rtl::Reference< SlideshowImpl > mxController;
205 : /** This flag is used together with mxController.is() to prevent
206 : multiple instances of the slide show for one document. The flag
207 : covers the time before mxController is set.
208 : */
209 : bool mbIsInStartup;
210 : SdDrawDocument* mpDoc;
211 :
212 : boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
213 :
214 : ViewShellBase* mpCurrentViewShellBase;
215 : ViewShellBase* mpFullScreenViewShellBase;
216 : FrameView* mpFullScreenFrameView;
217 : sal_Int32 mnInPlaceConfigEvent;
218 : };
219 :
220 : namespace slideshowhelp
221 : {
222 : void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc);
223 : }
224 :
225 : }
226 :
227 : #endif // INCLUDED_SD_SOURCE_UI_INC_SLIDESHOW_HXX
228 :
229 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|