Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SD_SLIDESHOW_HXX
30 : : #define _SD_SLIDESHOW_HXX
31 : :
32 : : #include <com/sun/star/presentation/XPresentation2.hpp>
33 : : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : :
35 : : #include <rtl/ref.hxx>
36 : :
37 : : #include <tools/link.hxx>
38 : :
39 : : #include <cppuhelper/compbase2.hxx>
40 : : #include <cppuhelper/basemutex.hxx>
41 : :
42 : : #include <editeng/unoipset.hxx>
43 : :
44 : : #include <memory>
45 : : #include <boost/shared_ptr.hpp>
46 : :
47 : : namespace com { namespace sun { namespace star {
48 : :
49 : : namespace drawing {
50 : : class XDrawPage;
51 : : }
52 : : namespace animations {
53 : : class XAnimationNode;
54 : : }
55 : : } } }
56 : :
57 : : class SdDrawDocument;
58 : : class KeyEvent;
59 : : class Size;
60 : : class Rectangle;
61 : : class Window;
62 : : class SfxRequest;
63 : : class WorkWindow;
64 : :
65 : : // TODO: Remove
66 : : #define PAGE_NO_END 65535
67 : :
68 : : /* Definition of SlideShow class */
69 : :
70 : : namespace sd
71 : : {
72 : :
73 : : class SlideshowImpl;
74 : : class ShowWindow;
75 : : class Window;
76 : : class View;
77 : : class ViewShell;
78 : : class ViewShellBase;
79 : : struct PresentationSettingsEx;
80 : : class FrameView;
81 : :
82 : : enum AnimationMode
83 : : {
84 : : ANIMATIONMODE_SHOW,
85 : : ANIMATIONMODE_VIEW,
86 : : ANIMATIONMODE_PREVIEW
87 : : };
88 : :
89 : : typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::presentation::XPresentation2, ::com::sun::star::lang::XServiceInfo > SlideshowBase;
90 : :
91 [ + - ][ + - ]: 266 : class SlideShow : private ::cppu::BaseMutex, public SlideshowBase
[ + - ][ - + ]
92 : : {
93 : : public:
94 : : /// used by the model to create a slideshow for it
95 : : static rtl::Reference< SlideShow > Create( SdDrawDocument* pDoc );
96 : :
97 : : // static helper api
98 : : static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument* pDocument );
99 : : static rtl::Reference< SlideShow > GetSlideShow( SdDrawDocument& rDocument );
100 : : static rtl::Reference< SlideShow > GetSlideShow( ViewShellBase& rBase );
101 : :
102 : : static ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > GetSlideShowController(ViewShellBase& rBase );
103 : :
104 : : static bool StartPreview( ViewShellBase& rBase,
105 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
106 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
107 : : ::Window* pParent = 0 );
108 : :
109 : : static void Stop( ViewShellBase& rBase );
110 : :
111 : : /// returns true if there is a running presentation for the given ViewShellBase
112 : : static bool IsRunning( ViewShellBase& rBase );
113 : :
114 : : /// returns true if there is a running presentation inside the given ViewShell
115 : : /// returns false even if there is a running presentation but in another ViewShell
116 : : static bool IsRunning( ViewShell& rViewShell );
117 : :
118 : : // helper api
119 : :
120 : : bool startPreview(
121 : : const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage,
122 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode,
123 : : ::Window* pParent = 0 );
124 : :
125 : : // uno api
126 : :
127 : : virtual void SAL_CALL disposing (void);
128 : :
129 : : // XServiceInfo
130 : : virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
131 : : virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
132 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
133 : :
134 : : // XPropertySet
135 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
136 : : virtual void SAL_CALL setPropertyValue( const ::rtl::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);
137 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
138 : : virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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);
139 : : virtual void SAL_CALL removePropertyChangeListener( const ::rtl::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);
140 : : virtual void SAL_CALL addVetoableChangeListener( const ::rtl::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);
141 : : virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::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);
142 : :
143 : : // XPresentation
144 : : virtual void SAL_CALL start( ) throw (::com::sun::star::uno::RuntimeException);
145 : : virtual void SAL_CALL end( ) throw (::com::sun::star::uno::RuntimeException);
146 : : virtual void SAL_CALL rehearseTimings( ) throw (::com::sun::star::uno::RuntimeException);
147 : :
148 : : // XPresentation2
149 : : virtual void SAL_CALL startWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::uno::RuntimeException);
150 : : virtual ::sal_Bool SAL_CALL isRunning( ) throw (::com::sun::star::uno::RuntimeException);
151 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SAL_CALL getController( ) throw (::com::sun::star::uno::RuntimeException);
152 : :
153 : : // legacy api
154 : :
155 : : // actions
156 : : void jumpToPageNumber( sal_Int32 nPage ); // a.k.a. FuSlideShow::JumpToPage()
157 : : void jumpToPageIndex( sal_Int32 nIndex );
158 : : void jumpToBookmark( const ::rtl::OUString& sBookmark ); // a.k.a. FuSlideShow::JumpToBookmark()
159 : :
160 : : /** sets or clears the pause state of the running slideshow.
161 : : !!!! This should only be called by the SdShowWindow !!!!*/
162 : : bool pause( bool bPause );
163 : :
164 : :
165 : : // settings
166 : : bool isFullScreen(); // a.k.a. FuSlideShow::IsFullScreen()
167 : : bool isAlwaysOnTop(); // a.k.a. FuSlideShow::IsAlwaysOnTop();
168 : : ShowWindow* getShowWindow(); // a.k.a. FuSlideShow::GetShowWindow()
169 : : int getAnimationMode(); // a.k.a. FuSlideShow::GetAnimationMode()
170 : : sal_Int32 getCurrentPageNumber(); // a.k.a. FuSlideShow::GetCurrentPage()
171 : : sal_Int32 getFirstPageNumber();
172 : : sal_Int32 getLastPageNumber();
173 : : bool isEndless();
174 : : bool isDrawingPossible();
175 : :
176 : : // events
177 : : void resize( const Size &rSize );
178 : : void activate(ViewShellBase& rBase);
179 : : void deactivate(ViewShellBase& rBase);
180 : : void paint( const Rectangle& rRect );
181 : :
182 : : bool keyInput(const KeyEvent& rKEvt);
183 : :
184 : : void receiveRequest(SfxRequest& rReq);
185 : :
186 : : bool dependsOn( ViewShellBase* pViewShellBase );
187 : :
188 : : static sal_Int32 GetDisplay();
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() throw (::com::sun::star::uno::RuntimeException);
200 : :
201 : : void CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow );
202 : : WorkWindow *GetWorkWindow();
203 : :
204 : : // default: disabled copy/assignment
205 : : SlideShow(const SlideShow&);
206 : : SlideShow& operator=( const SlideShow& );
207 : :
208 : : SvxItemPropertySet maPropSet;
209 : :
210 : : rtl::Reference< SlideshowImpl > mxController;
211 : : /** This flag is used together with mxController.is() to prevent
212 : : multiple instances of the slide show for one document. The flag
213 : : covers the time before mxController is set.
214 : : */
215 : : bool mbIsInStartup;
216 : : SdDrawDocument* mpDoc;
217 : :
218 : : boost::shared_ptr< PresentationSettingsEx > mxCurrentSettings;
219 : :
220 : : ViewShellBase* mpCurrentViewShellBase;
221 : : ViewShellBase* mpFullScreenViewShellBase;
222 : : FrameView* mpFullScreenFrameView;
223 : : sal_Int32 mnInPlaceConfigEvent;
224 : : };
225 : :
226 : : }
227 : :
228 : : #endif /* _SD_SLIDESHOW_HXX */
229 : :
230 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|