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