merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / slideshow / slideshowviewimpl.hxx
blobf04bac24af3ae90076b46e09ec0f973723464407
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: slideshowviewimpl.hxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_SLIDESHOWVIEWIMPL_HXX_
32 #define _SD_SLIDESHOWVIEWIMPL_HXX_
34 #include <cppuhelper/implbase1.hxx>
35 #include <cppuhelper/compbase4.hxx>
36 #include <comphelper/broadcasthelper.hxx>
37 #include <comphelper/listenernotification.hxx>
38 #include <toolkit/helper/vclunohelper.hxx>
39 #include <comphelper/processfactory.hxx>
40 #include <com/sun/star/awt/WindowEvent.hpp>
41 #include <com/sun/star/awt/XWindowListener.hpp>
42 #include <com/sun/star/awt/XWindow.hpp>
43 #include <com/sun/star/awt/XWindowPeer.hpp>
44 #include <com/sun/star/util/XModifyListener.hpp>
45 #include <com/sun/star/awt/XPaintListener.hpp>
46 #include <com/sun/star/awt/XPointer.hpp>
47 #include <com/sun/star/presentation/XSlideShow.hpp>
48 #include <com/sun/star/presentation/XSlideShowView.hpp>
49 #include <com/sun/star/presentation/XSlideShowListener.hpp>
50 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
51 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
52 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
53 #include <comphelper/implementationreference.hxx>
54 #include <basegfx/matrix/b2dhommatrix.hxx>
55 #include <basegfx/tools/canvastools.hxx>
56 #include <cppcanvas/spritecanvas.hxx>
57 #include <vcl/help.hxx>
58 #include <tools/urlobj.hxx>
59 #include <svtools/pathoptions.hxx>
60 #include <svtools/saveopt.hxx>
61 #include <sfx2/bindings.hxx>
62 #include <sfx2/dispatch.hxx>
63 #include <sfx2/viewfrm.hxx>
64 #include <basic/sbstar.hxx>
65 #include <svx/svdpagv.hxx>
66 #include <svx/fmshell.hxx>
68 #ifndef _SVX_SVXIDS_HRC
69 #include <svx/svxids.hrc>
70 #endif
71 #include "sdmod.hxx"
72 #include "cusshow.hxx"
73 #include "ViewShellBase.hxx"
74 #include "PresentationViewShell.hxx"
75 #include "ViewShell.hxx"
76 #include "drawview.hxx"
77 #include "slideshow.hxx"
78 #include "drawdoc.hxx"
79 #include "showwindow.hxx"
80 #include "optsitem.hxx"
81 #include "FrameView.hxx"
82 #include "DrawDocShell.hxx"
84 #ifndef _SD_APP_HRC_
85 #include "app.hrc"
86 #endif
88 namespace sd
91 struct WrappedMouseEvent : public ::com::sun::star::lang::EventObject
93 enum EventType
95 PRESSED,
96 RELEASED,
97 ENTERED,
98 EXITED
101 EventType meType;
102 ::com::sun::star::awt::MouseEvent maEvent;
105 struct WrappedMouseMotionEvent : public ::com::sun::star::lang::EventObject
107 enum EventType
109 DRAGGED,
110 MOVED
113 EventType meType;
114 ::com::sun::star::awt::MouseEvent maEvent;
117 ///////////////////////////////////////////////////////////////////////
118 // SlideShowViewListeners
119 ///////////////////////////////////////////////////////////////////////
121 typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > > ViewListenerVector;
122 class SlideShowViewListeners
124 public:
125 SlideShowViewListeners( ::osl::Mutex& rMutex );
127 void addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
128 void removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
129 bool notify( const ::com::sun::star::lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception );
130 void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
132 protected:
133 ViewListenerVector maListeners;
134 ::osl::Mutex& mrMutex;
137 typedef ::std::auto_ptr< SlideShowViewListeners > SlideShowViewListenersPtr;
139 ///////////////////////////////////////////////////////////////////////
140 // SlideShowViewPaintListeners
141 ///////////////////////////////////////////////////////////////////////
143 typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XPaintListener,
144 ::com::sun::star::awt::PaintEvent > SlideShowViewPaintListeners_Base;
146 class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
148 public:
149 SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
151 protected:
152 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 );
154 typedef ::std::auto_ptr< SlideShowViewPaintListeners > SlideShowViewPaintListenersPtr;
156 ///////////////////////////////////////////////////////////////////////
157 // SlideShowViewMouseListeners
158 ///////////////////////////////////////////////////////////////////////
160 typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
162 class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
164 public:
165 SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
167 protected:
168 virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rListener,
169 const WrappedMouseEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
172 typedef ::std::auto_ptr< SlideShowViewMouseListeners > SlideShowViewMouseListenersPtr;
175 ///////////////////////////////////////////////////////////////////////
176 // SlideShowViewMouseMotionListeners
177 ///////////////////////////////////////////////////////////////////////
179 typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseMotionListener,
180 WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
182 class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
184 public:
185 SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
187 protected:
188 virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rListener,
189 const WrappedMouseMotionEvent& rEvent ) throw( ::com::sun::star::uno::Exception );
191 typedef ::std::auto_ptr< SlideShowViewMouseMotionListeners > SlideShowViewMouseMotionListenersPtr;
194 ///////////////////////////////////////////////////////////////////////
195 // SlideShowView
196 ///////////////////////////////////////////////////////////////////////
198 class ShowWindow;
199 class SlideshowImpl;
201 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::presentation::XSlideShowView,
202 ::com::sun::star::awt::XWindowListener,
203 ::com::sun::star::awt::XMouseListener,
204 ::com::sun::star::awt::XMouseMotionListener > SlideShowView_Base;
206 class SlideShowView : public ::comphelper::OBaseMutex,
207 public SlideShowView_Base
209 public:
210 SlideShowView( ShowWindow& rOutputWindow,
211 SdDrawDocument* pDoc,
212 AnimationMode eAnimationMode,
213 SlideshowImpl* pSlideShow,
214 bool bFullScreen );
216 void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
218 /// Dispose all internal references
219 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
221 /// Disposing our broadcaster
222 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException);
224 virtual void SAL_CALL paint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
226 // XSlideShowView methods
227 virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) throw (::com::sun::star::uno::RuntimeException);
228 virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException);
229 virtual ::com::sun::star::geometry::AffineMatrix2D SAL_CALL getTransformation( ) throw (::com::sun::star::uno::RuntimeException);
230 virtual void SAL_CALL addTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
231 virtual void SAL_CALL removeTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
232 virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
233 virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
234 virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
235 virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
236 virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
237 virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
238 virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException);
239 virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) throw (::com::sun::star::uno::RuntimeException);
241 // XWindowListener methods
242 virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
243 virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
244 virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
245 virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
247 // XMouseListener implementation
248 virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
249 virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
250 virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
251 virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
253 // XMouseMotionListener implementation
254 virtual void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
255 virtual void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
257 using cppu::WeakComponentImplHelperBase::disposing;
259 protected:
260 ~SlideShowView() {}
262 private:
263 void init();
265 void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
267 ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
268 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > mxWindow;
269 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
270 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer > mxPointer;
271 SlideshowImpl* mpSlideShow;
272 ShowWindow& mrOutputWindow;
273 SlideShowViewListenersPtr mpViewListeners;
274 SlideShowViewPaintListenersPtr mpPaintListeners;
275 SlideShowViewMouseListenersPtr mpMouseListeners;
276 SlideShowViewMouseMotionListenersPtr mpMouseMotionListeners;
277 SdDrawDocument* mpDoc;
278 bool mbIsMouseMotionListener;
279 Rectangle maPresentationArea;
280 AnimationMode meAnimationMode;
281 bool mbFirstPaint;
282 bool mbFullScreen;
283 bool mbMousePressedEaten;
287 } // namespace ::sd
289 #endif