Branch data 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_SLIDESHOWVIEWIMPL_HXX_
21 : : #define _SD_SLIDESHOWVIEWIMPL_HXX_
22 : :
23 : : #include <cppuhelper/implbase1.hxx>
24 : : #include <cppuhelper/compbase4.hxx>
25 : : #include <comphelper/broadcasthelper.hxx>
26 : : #include <comphelper/listenernotification.hxx>
27 : : #include <toolkit/helper/vclunohelper.hxx>
28 : : #include <comphelper/processfactory.hxx>
29 : : #include <com/sun/star/awt/WindowEvent.hpp>
30 : : #include <com/sun/star/awt/XWindowListener.hpp>
31 : : #include <com/sun/star/awt/XWindow.hpp>
32 : : #include <com/sun/star/awt/XWindowPeer.hpp>
33 : : #include <com/sun/star/util/XModifyListener.hpp>
34 : : #include <com/sun/star/awt/XPaintListener.hpp>
35 : : #include <com/sun/star/awt/XPointer.hpp>
36 : : #include <com/sun/star/presentation/XSlideShow.hpp>
37 : : #include <com/sun/star/presentation/XSlideShowView.hpp>
38 : : #include <com/sun/star/presentation/XSlideShowListener.hpp>
39 : : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
40 : : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
41 : : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
42 : : #include <comphelper/implementationreference.hxx>
43 : : #include <basegfx/matrix/b2dhommatrix.hxx>
44 : : #include <basegfx/tools/canvastools.hxx>
45 : : #include <cppcanvas/spritecanvas.hxx>
46 : : #include <vcl/help.hxx>
47 : : #include <unotools/pathoptions.hxx>
48 : : #include <unotools/saveopt.hxx>
49 : : #include <sfx2/bindings.hxx>
50 : : #include <sfx2/dispatch.hxx>
51 : : #include <sfx2/viewfrm.hxx>
52 : : #include <basic/sbstar.hxx>
53 : : #include <svx/svdpagv.hxx>
54 : : #include <svx/fmshell.hxx>
55 : :
56 : : #include <svx/svxids.hrc>
57 : : #include "sdmod.hxx"
58 : : #include "cusshow.hxx"
59 : : #include "ViewShellBase.hxx"
60 : : #include "PresentationViewShell.hxx"
61 : : #include "ViewShell.hxx"
62 : : #include "drawview.hxx"
63 : : #include "slideshow.hxx"
64 : : #include "drawdoc.hxx"
65 : : #include "showwindow.hxx"
66 : : #include "optsitem.hxx"
67 : : #include "FrameView.hxx"
68 : : #include "DrawDocShell.hxx"
69 : :
70 : : #include "app.hrc"
71 : :
72 : : namespace sd
73 : : {
74 : :
75 [ # # ][ # # ]: 0 : struct WrappedMouseEvent : public ::com::sun::star::lang::EventObject
76 : : {
77 : : enum EventType
78 : : {
79 : : PRESSED,
80 : : RELEASED,
81 : : ENTERED,
82 : : EXITED
83 : : };
84 : :
85 : : EventType meType;
86 : : ::com::sun::star::awt::MouseEvent maEvent;
87 : : };
88 : :
89 [ # # ][ # # ]: 0 : struct WrappedMouseMotionEvent : public ::com::sun::star::lang::EventObject
90 : : {
91 : : enum EventType
92 : : {
93 : : DRAGGED,
94 : : MOVED
95 : : };
96 : :
97 : : EventType meType;
98 : : ::com::sun::star::awt::MouseEvent maEvent;
99 : : };
100 : :
101 : : ///////////////////////////////////////////////////////////////////////
102 : : // SlideShowViewListeners
103 : : ///////////////////////////////////////////////////////////////////////
104 : :
105 : : typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > > ViewListenerVector;
106 : 0 : class SlideShowViewListeners
107 : : {
108 : : public:
109 : : SlideShowViewListeners( ::osl::Mutex& rMutex );
110 : :
111 : : void addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
112 : : void removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
113 : : bool notify( const ::com::sun::star::lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception );
114 : : void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
115 : :
116 : : protected:
117 : : ViewListenerVector maListeners;
118 : : ::osl::Mutex& mrMutex;
119 : : };
120 : :
121 : : typedef ::std::auto_ptr< SlideShowViewListeners > SlideShowViewListenersPtr;
122 : :
123 : : ///////////////////////////////////////////////////////////////////////
124 : : // SlideShowViewPaintListeners
125 : : ///////////////////////////////////////////////////////////////////////
126 : :
127 : : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XPaintListener,
128 : : ::com::sun::star::awt::PaintEvent > SlideShowViewPaintListeners_Base;
129 : :
130 [ # # ]: 0 : class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
131 : : {
132 : : public:
133 : : SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
134 : :
135 : : protected:
136 : : virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rListener, const ::com::sun::star::awt::PaintEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
137 : : };
138 : : typedef ::std::auto_ptr< SlideShowViewPaintListeners > SlideShowViewPaintListenersPtr;
139 : :
140 : : ///////////////////////////////////////////////////////////////////////
141 : : // SlideShowViewMouseListeners
142 : : ///////////////////////////////////////////////////////////////////////
143 : :
144 : : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
145 : :
146 [ # # ]: 0 : class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
147 : : {
148 : : public:
149 : : SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
150 : :
151 : : protected:
152 : : virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rListener,
153 : : const WrappedMouseEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
154 : : };
155 : :
156 : : typedef ::std::auto_ptr< SlideShowViewMouseListeners > SlideShowViewMouseListenersPtr;
157 : :
158 : :
159 : : ///////////////////////////////////////////////////////////////////////
160 : : // SlideShowViewMouseMotionListeners
161 : : ///////////////////////////////////////////////////////////////////////
162 : :
163 : : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseMotionListener,
164 : : WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
165 : :
166 [ # # ]: 0 : class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
167 : : {
168 : : public:
169 : : SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
170 : :
171 : : protected:
172 : : virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rListener,
173 : : const WrappedMouseMotionEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
174 : : };
175 : : typedef ::std::auto_ptr< SlideShowViewMouseMotionListeners > SlideShowViewMouseMotionListenersPtr;
176 : :
177 : :
178 : : ///////////////////////////////////////////////////////////////////////
179 : : // SlideShowView
180 : : ///////////////////////////////////////////////////////////////////////
181 : :
182 : : class ShowWindow;
183 : : class SlideshowImpl;
184 : :
185 : : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::presentation::XSlideShowView,
186 : : ::com::sun::star::awt::XWindowListener,
187 : : ::com::sun::star::awt::XMouseListener,
188 : : ::com::sun::star::awt::XMouseMotionListener > SlideShowView_Base;
189 : :
190 : : class SlideShowView : public ::comphelper::OBaseMutex,
191 : : public SlideShowView_Base
192 : : {
193 : : public:
194 : : SlideShowView( ShowWindow& rOutputWindow,
195 : : SdDrawDocument* pDoc,
196 : : AnimationMode eAnimationMode,
197 : : SlideshowImpl* pSlideShow,
198 : : bool bFullScreen );
199 : :
200 : 0 : void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
201 : :
202 : : /// Dispose all internal references
203 : : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
204 : :
205 : : /// Disposing our broadcaster
206 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException);
207 : :
208 : : virtual void SAL_CALL paint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
209 : :
210 : : // XSlideShowView methods
211 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException);
212 : : virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException);
213 : : virtual ::com::sun::star::geometry::AffineMatrix2D SAL_CALL getTransformation( ) throw (::com::sun::star::uno::RuntimeException);
214 : : virtual void SAL_CALL addTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
215 : : virtual void SAL_CALL removeTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
216 : : virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
217 : : virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
218 : : virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
219 : : virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
220 : : virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
221 : : virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
222 : : virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException);
223 : : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) throw (::com::sun::star::uno::RuntimeException);
224 : :
225 : : // XWindowListener methods
226 : : virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
227 : : virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
228 : : virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
229 : : virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
230 : :
231 : : // XMouseListener implementation
232 : : virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
233 : : virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
234 : : virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
235 : : virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
236 : :
237 : : // XMouseMotionListener implementation
238 : : virtual void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
239 : : virtual void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
240 : :
241 : : using cppu::WeakComponentImplHelperBase::disposing;
242 : :
243 : : protected:
244 [ # # ][ # # ]: 0 : ~SlideShowView() {}
[ # # ][ # # ]
[ # # ][ # # ]
245 : :
246 : : private:
247 : : void init();
248 : :
249 : : void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
250 : :
251 : : ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
252 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > mxWindow;
253 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
254 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > mxPointer;
255 : : SlideshowImpl* mpSlideShow;
256 : : ShowWindow& mrOutputWindow;
257 : : SlideShowViewListenersPtr mpViewListeners;
258 : : SlideShowViewPaintListenersPtr mpPaintListeners;
259 : : SlideShowViewMouseListenersPtr mpMouseListeners;
260 : : SlideShowViewMouseMotionListenersPtr mpMouseMotionListeners;
261 : : SdDrawDocument* mpDoc;
262 : : bool mbIsMouseMotionListener;
263 : : Rectangle maPresentationArea;
264 : : AnimationMode meAnimationMode;
265 : : bool mbFirstPaint;
266 : : bool mbFullScreen;
267 : : bool mbMousePressedEaten;
268 : : };
269 : :
270 : :
271 : : } // namespace ::sd
272 : :
273 : : #endif
274 : :
275 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|