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_SLIDESHOW_SLIDESHOWVIEWIMPL_HXX
21 : #define INCLUDED_SD_SOURCE_UI_SLIDESHOW_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 : typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > > ViewListenerVector;
104 0 : class SlideShowViewListeners
105 : {
106 : public:
107 : SlideShowViewListeners( ::osl::Mutex& rMutex );
108 :
109 : void addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
110 : void removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
111 : bool notify( const ::com::sun::star::lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception );
112 : void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
113 :
114 : protected:
115 : ViewListenerVector maListeners;
116 : ::osl::Mutex& mrMutex;
117 : };
118 :
119 : typedef ::std::auto_ptr< SlideShowViewListeners > SlideShowViewListenersPtr;
120 :
121 :
122 : // SlideShowViewPaintListeners
123 : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XPaintListener,
124 : ::com::sun::star::awt::PaintEvent > SlideShowViewPaintListeners_Base;
125 :
126 0 : class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
127 : {
128 : public:
129 : SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
130 :
131 : protected:
132 : 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 ) SAL_OVERRIDE;
133 : };
134 : typedef ::std::auto_ptr< SlideShowViewPaintListeners > SlideShowViewPaintListenersPtr;
135 :
136 :
137 : // SlideShowViewMouseListeners
138 : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
139 :
140 0 : class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
141 : {
142 : public:
143 : SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
144 :
145 : protected:
146 : virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rListener,
147 : const WrappedMouseEvent& rEvent ) throw( ::com::sun::star::uno::Exception ) SAL_OVERRIDE;
148 : };
149 :
150 : typedef ::std::auto_ptr< SlideShowViewMouseListeners > SlideShowViewMouseListenersPtr;
151 :
152 :
153 :
154 : // SlideShowViewMouseMotionListeners
155 : typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseMotionListener,
156 : WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
157 :
158 0 : class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
159 : {
160 : public:
161 : SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
162 :
163 : protected:
164 : virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rListener,
165 : const WrappedMouseMotionEvent& rEvent ) throw( ::com::sun::star::uno::Exception ) SAL_OVERRIDE;
166 : };
167 : typedef ::std::auto_ptr< SlideShowViewMouseMotionListeners > SlideShowViewMouseMotionListenersPtr;
168 :
169 :
170 :
171 : // SlideShowView
172 : class ShowWindow;
173 : class SlideshowImpl;
174 :
175 : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::presentation::XSlideShowView,
176 : ::com::sun::star::awt::XWindowListener,
177 : ::com::sun::star::awt::XMouseListener,
178 : ::com::sun::star::awt::XMouseMotionListener > SlideShowView_Base;
179 :
180 : class SlideShowView : public ::comphelper::OBaseMutex,
181 : public SlideShowView_Base
182 : {
183 : public:
184 : SlideShowView( ShowWindow& rOutputWindow,
185 : SdDrawDocument* pDoc,
186 : AnimationMode eAnimationMode,
187 : SlideshowImpl* pSlideShow,
188 : bool bFullScreen );
189 :
190 0 : void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
191 :
192 : /// Dispose all internal references
193 : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 :
195 : /// Disposing our broadcaster
196 : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
197 :
198 : virtual void SAL_CALL paint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
199 :
200 : // XSlideShowView methods
201 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
202 : virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 : virtual ::com::sun::star::geometry::AffineMatrix2D SAL_CALL getTransformation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
204 : virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getTranslationOffset( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
205 : virtual void SAL_CALL addTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
206 : virtual void SAL_CALL removeTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
207 : virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
208 : virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
209 : virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 : virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
211 : virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
212 : virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
213 : virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
214 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 :
216 : // XWindowListener methods
217 : virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
218 : virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
219 : virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
220 : virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
221 :
222 : // XMouseListener implementation
223 : virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
224 : virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
225 : virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
226 : virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
227 :
228 : // XMouseMotionListener implementation
229 : virtual void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
230 : virtual void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
231 :
232 : using cppu::WeakComponentImplHelperBase::disposing;
233 :
234 : protected:
235 0 : virtual ~SlideShowView() {}
236 :
237 : private:
238 : void init();
239 :
240 : void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
241 :
242 : ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
243 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > mxWindow;
244 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
245 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > mxPointer;
246 : SlideshowImpl* mpSlideShow;
247 : ShowWindow& mrOutputWindow;
248 : SlideShowViewListenersPtr mpViewListeners;
249 : SlideShowViewPaintListenersPtr mpPaintListeners;
250 : SlideShowViewMouseListenersPtr mpMouseListeners;
251 : SlideShowViewMouseMotionListenersPtr mpMouseMotionListeners;
252 : SdDrawDocument* mpDoc;
253 : bool mbIsMouseMotionListener;
254 : Rectangle maPresentationArea;
255 : AnimationMode meAnimationMode;
256 : bool mbFirstPaint;
257 : bool mbFullScreen;
258 : bool mbMousePressedEaten;
259 : ::com::sun::star::geometry::IntegerSize2D mTranslationOffset;
260 : };
261 :
262 :
263 : } // namespace ::sd
264 :
265 : #endif
266 :
267 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|