1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SD_SLIDESHOWVIEWIMPL_HXX_
21 #define _SD_SLIDESHOWVIEWIMPL_HXX_
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>
56 #include <svx/svxids.hrc>
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"
75 struct WrappedMouseEvent
: public ::com::sun::star::lang::EventObject
86 ::com::sun::star::awt::MouseEvent maEvent
;
89 struct WrappedMouseMotionEvent
: public ::com::sun::star::lang::EventObject
98 ::com::sun::star::awt::MouseEvent maEvent
;
101 ///////////////////////////////////////////////////////////////////////
102 // SlideShowViewListeners
103 ///////////////////////////////////////////////////////////////////////
105 typedef std::vector
< ::com::sun::star::uno::WeakReference
< ::com::sun::star::util::XModifyListener
> > ViewListenerVector
;
106 class SlideShowViewListeners
109 SlideShowViewListeners( ::osl::Mutex
& rMutex
);
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
);
117 ViewListenerVector maListeners
;
118 ::osl::Mutex
& mrMutex
;
121 typedef ::std::auto_ptr
< SlideShowViewListeners
> SlideShowViewListenersPtr
;
123 ///////////////////////////////////////////////////////////////////////
124 // SlideShowViewPaintListeners
125 ///////////////////////////////////////////////////////////////////////
127 typedef ::comphelper::OListenerContainerBase
< ::com::sun::star::awt::XPaintListener
,
128 ::com::sun::star::awt::PaintEvent
> SlideShowViewPaintListeners_Base
;
130 class SlideShowViewPaintListeners
: public SlideShowViewPaintListeners_Base
133 SlideShowViewPaintListeners( ::osl::Mutex
& rMutex
);
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
);
138 typedef ::std::auto_ptr
< SlideShowViewPaintListeners
> SlideShowViewPaintListenersPtr
;
140 ///////////////////////////////////////////////////////////////////////
141 // SlideShowViewMouseListeners
142 ///////////////////////////////////////////////////////////////////////
144 typedef ::comphelper::OListenerContainerBase
< ::com::sun::star::awt::XMouseListener
, WrappedMouseEvent
> SlideShowViewMouseListeners_Base
;
146 class SlideShowViewMouseListeners
: public SlideShowViewMouseListeners_Base
149 SlideShowViewMouseListeners( ::osl::Mutex
& rMutex
);
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
);
156 typedef ::std::auto_ptr
< SlideShowViewMouseListeners
> SlideShowViewMouseListenersPtr
;
159 ///////////////////////////////////////////////////////////////////////
160 // SlideShowViewMouseMotionListeners
161 ///////////////////////////////////////////////////////////////////////
163 typedef ::comphelper::OListenerContainerBase
< ::com::sun::star::awt::XMouseMotionListener
,
164 WrappedMouseMotionEvent
> SlideShowViewMouseMotionListeners_Base
;
166 class SlideShowViewMouseMotionListeners
: public SlideShowViewMouseMotionListeners_Base
169 SlideShowViewMouseMotionListeners( ::osl::Mutex
& rMutex
);
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
);
175 typedef ::std::auto_ptr
< SlideShowViewMouseMotionListeners
> SlideShowViewMouseMotionListenersPtr
;
178 ///////////////////////////////////////////////////////////////////////
180 ///////////////////////////////////////////////////////////////////////
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
;
190 class SlideShowView
: public ::comphelper::OBaseMutex
,
191 public SlideShowView_Base
194 SlideShowView( ShowWindow
& rOutputWindow
,
195 SdDrawDocument
* pDoc
,
196 AnimationMode eAnimationMode
,
197 SlideshowImpl
* pSlideShow
,
200 void ignoreNextMouseReleased() { mbMousePressedEaten
= true; }
202 /// Dispose all internal references
203 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
);
205 /// Disposing our broadcaster
206 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& ) throw(::com::sun::star::uno::RuntimeException
);
208 virtual void SAL_CALL
paint( const ::com::sun::star::awt::PaintEvent
& e
) throw (::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
241 using cppu::WeakComponentImplHelperBase::disposing
;
249 void updateimpl( ::osl::ClearableMutexGuard
& rGuard
, SlideshowImpl
* pSlideShow
);
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
;
267 bool mbMousePressedEaten
;
275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */