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