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