xref: /trunk/main/sd/source/ui/slideshow/slideshowviewimpl.hxx (revision 9d97e9635cf537de28a9272394b68cfd2c8f8314)
1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22cdf0e10cSrcweir #ifndef _SD_SLIDESHOWVIEWIMPL_HXX_
23cdf0e10cSrcweir #define _SD_SLIDESHOWVIEWIMPL_HXX_
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
26cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx>
27cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
28cdf0e10cSrcweir #include <comphelper/listenernotification.hxx>
29cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
30cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
31cdf0e10cSrcweir #include <com/sun/star/awt/WindowEvent.hpp>
32cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp>
33cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp>
35cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp>
37cdf0e10cSrcweir #include <com/sun/star/awt/XPointer.hpp>
38cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShow.hpp>
39cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowView.hpp>
40cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowListener.hpp>
41cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
42cdf0e10cSrcweir #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
43cdf0e10cSrcweir #include <com/sun/star/rendering/XSpriteCanvas.hpp>
44cdf0e10cSrcweir #include <comphelper/implementationreference.hxx>
45cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
46cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
47cdf0e10cSrcweir #include <cppcanvas/spritecanvas.hxx>
48cdf0e10cSrcweir #include <vcl/help.hxx>
49cdf0e10cSrcweir #include <tools/urlobj.hxx>
50cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
51cdf0e10cSrcweir #include <unotools/saveopt.hxx>
52cdf0e10cSrcweir #include <sfx2/bindings.hxx>
53cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
54cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
55cdf0e10cSrcweir #include <basic/sbstar.hxx>
56cdf0e10cSrcweir #include <svx/svdpagv.hxx>
57cdf0e10cSrcweir #include <svx/fmshell.hxx>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
60cdf0e10cSrcweir #include <svx/svxids.hrc>
61cdf0e10cSrcweir #endif
62cdf0e10cSrcweir #include "sdmod.hxx"
63cdf0e10cSrcweir #include "cusshow.hxx"
64cdf0e10cSrcweir #include "ViewShellBase.hxx"
65cdf0e10cSrcweir #include "PresentationViewShell.hxx"
66cdf0e10cSrcweir #include "ViewShell.hxx"
67cdf0e10cSrcweir #include "drawview.hxx"
68cdf0e10cSrcweir #include "slideshow.hxx"
69cdf0e10cSrcweir #include "drawdoc.hxx"
70cdf0e10cSrcweir #include "showwindow.hxx"
71cdf0e10cSrcweir #include "optsitem.hxx"
72cdf0e10cSrcweir #include "FrameView.hxx"
73cdf0e10cSrcweir #include "DrawDocShell.hxx"
74cdf0e10cSrcweir 
75cdf0e10cSrcweir #ifndef _SD_APP_HRC_
76cdf0e10cSrcweir #include "app.hrc"
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir 
79cdf0e10cSrcweir namespace sd
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 
82cdf0e10cSrcweir struct WrappedMouseEvent : public ::com::sun::star::lang::EventObject
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     enum EventType
85cdf0e10cSrcweir     {
86cdf0e10cSrcweir         PRESSED,
87cdf0e10cSrcweir         RELEASED,
88cdf0e10cSrcweir         ENTERED,
89cdf0e10cSrcweir         EXITED
90cdf0e10cSrcweir     };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     EventType       meType;
93cdf0e10cSrcweir     ::com::sun::star::awt::MouseEvent   maEvent;
94cdf0e10cSrcweir };
95cdf0e10cSrcweir 
96cdf0e10cSrcweir struct WrappedMouseMotionEvent : public ::com::sun::star::lang::EventObject
97cdf0e10cSrcweir {
98cdf0e10cSrcweir     enum EventType
99cdf0e10cSrcweir     {
100cdf0e10cSrcweir         DRAGGED,
101cdf0e10cSrcweir         MOVED
102cdf0e10cSrcweir     };
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     EventType       meType;
105cdf0e10cSrcweir     ::com::sun::star::awt::MouseEvent   maEvent;
106cdf0e10cSrcweir };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir // SlideShowViewListeners
109cdf0e10cSrcweir 
110cdf0e10cSrcweir typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > > ViewListenerVector;
111cdf0e10cSrcweir class SlideShowViewListeners
112cdf0e10cSrcweir {
113cdf0e10cSrcweir public:
114cdf0e10cSrcweir     SlideShowViewListeners( ::osl::Mutex& rMutex );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     void    addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
117cdf0e10cSrcweir     void    removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& _rxListener );
118cdf0e10cSrcweir     bool    notify( const ::com::sun::star::lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception );
119cdf0e10cSrcweir     void    disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir protected:
122cdf0e10cSrcweir     ViewListenerVector maListeners;
123cdf0e10cSrcweir     ::osl::Mutex& mrMutex;
124cdf0e10cSrcweir };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir typedef ::std::auto_ptr< SlideShowViewListeners >   SlideShowViewListenersPtr;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir // SlideShowViewPaintListeners
129cdf0e10cSrcweir 
130cdf0e10cSrcweir typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XPaintListener,
131cdf0e10cSrcweir                                                 ::com::sun::star::awt::PaintEvent >         SlideShowViewPaintListeners_Base;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
134cdf0e10cSrcweir {
135cdf0e10cSrcweir public:
136cdf0e10cSrcweir     SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir protected:
139cdf0e10cSrcweir     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 );
140cdf0e10cSrcweir };
141cdf0e10cSrcweir typedef ::std::auto_ptr< SlideShowViewPaintListeners >  SlideShowViewPaintListenersPtr;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir // SlideShowViewMouseListeners
144cdf0e10cSrcweir 
145cdf0e10cSrcweir typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
148cdf0e10cSrcweir {
149cdf0e10cSrcweir public:
150cdf0e10cSrcweir     SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
151cdf0e10cSrcweir 
152cdf0e10cSrcweir protected:
153cdf0e10cSrcweir     virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >&  rListener,
154cdf0e10cSrcweir                                   const WrappedMouseEvent&                      rEvent ) throw( ::com::sun::star::uno::Exception );
155cdf0e10cSrcweir };
156cdf0e10cSrcweir 
157cdf0e10cSrcweir typedef ::std::auto_ptr< SlideShowViewMouseListeners >  SlideShowViewMouseListenersPtr;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 
160cdf0e10cSrcweir // SlideShowViewMouseMotionListeners
161cdf0e10cSrcweir 
162cdf0e10cSrcweir typedef ::comphelper::OListenerContainerBase< ::com::sun::star::awt::XMouseMotionListener,
163cdf0e10cSrcweir                                                 WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
166cdf0e10cSrcweir {
167cdf0e10cSrcweir public:
168cdf0e10cSrcweir     SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir protected:
171cdf0e10cSrcweir     virtual bool implTypedNotify( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >&    rListener,
172cdf0e10cSrcweir                                   const WrappedMouseMotionEvent&                    rEvent ) throw( ::com::sun::star::uno::Exception );
173cdf0e10cSrcweir };
174cdf0e10cSrcweir typedef ::std::auto_ptr< SlideShowViewMouseMotionListeners >    SlideShowViewMouseMotionListenersPtr;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 
177cdf0e10cSrcweir // SlideShowView
178cdf0e10cSrcweir 
179cdf0e10cSrcweir class ShowWindow;
180cdf0e10cSrcweir class SlideshowImpl;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::presentation::XSlideShowView,
183cdf0e10cSrcweir                                             ::com::sun::star::awt::XWindowListener,
184cdf0e10cSrcweir                                             ::com::sun::star::awt::XMouseListener,
185cdf0e10cSrcweir                                             ::com::sun::star::awt::XMouseMotionListener > SlideShowView_Base;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir class SlideShowView : public ::comphelper::OBaseMutex,
188cdf0e10cSrcweir                     public SlideShowView_Base
189cdf0e10cSrcweir {
190cdf0e10cSrcweir public:
191cdf0e10cSrcweir     SlideShowView( ShowWindow&     rOutputWindow,
192cdf0e10cSrcweir                    SdDrawDocument* pDoc,
193cdf0e10cSrcweir                    AnimationMode   eAnimationMode,
194cdf0e10cSrcweir                    SlideshowImpl*  pSlideShow,
195cdf0e10cSrcweir                    bool            bFullScreen );
196cdf0e10cSrcweir 
ignoreNextMouseReleased()197cdf0e10cSrcweir     void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
198cdf0e10cSrcweir 
199*9d97e963Smseidel     // Dispose all internal references
200cdf0e10cSrcweir     virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
201cdf0e10cSrcweir 
202*9d97e963Smseidel     // Disposing our broadcaster
203cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException);
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     virtual void SAL_CALL paint( const ::com::sun::star::awt::PaintEvent& e ) throw (::com::sun::star::uno::RuntimeException);
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     // XSlideShowView methods
208cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > SAL_CALL getCanvas(  ) throw (::com::sun::star::uno::RuntimeException);
209cdf0e10cSrcweir     virtual void SAL_CALL clear(  ) throw (::com::sun::star::uno::RuntimeException);
210cdf0e10cSrcweir     virtual ::com::sun::star::geometry::AffineMatrix2D SAL_CALL getTransformation(  ) throw (::com::sun::star::uno::RuntimeException);
211cdf0e10cSrcweir     virtual void SAL_CALL addTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
212cdf0e10cSrcweir     virtual void SAL_CALL removeTransformationChangedListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
213cdf0e10cSrcweir     virtual void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
214cdf0e10cSrcweir     virtual void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
215cdf0e10cSrcweir     virtual void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
216cdf0e10cSrcweir     virtual void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
217cdf0e10cSrcweir     virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
218cdf0e10cSrcweir     virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
219cdf0e10cSrcweir     virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException);
220cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea(  ) throw (::com::sun::star::uno::RuntimeException);
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     // XWindowListener methods
223cdf0e10cSrcweir     virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
224cdf0e10cSrcweir     virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
225cdf0e10cSrcweir     virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
226cdf0e10cSrcweir     virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     // XMouseListener implementation
229cdf0e10cSrcweir     virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
230cdf0e10cSrcweir     virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
231cdf0e10cSrcweir     virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
232cdf0e10cSrcweir     virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     // XMouseMotionListener implementation
235cdf0e10cSrcweir     virtual void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
236cdf0e10cSrcweir     virtual void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
237cdf0e10cSrcweir 
238cdf0e10cSrcweir     using cppu::WeakComponentImplHelperBase::disposing;
239cdf0e10cSrcweir 
240cdf0e10cSrcweir protected:
~SlideShowView()241cdf0e10cSrcweir     ~SlideShowView() {}
242cdf0e10cSrcweir 
243cdf0e10cSrcweir private:
244cdf0e10cSrcweir     void init();
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     ::cppcanvas::SpriteCanvasSharedPtr                                              mpCanvas;
249cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >              mxWindow;
250cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >          mxWindowPeer;
251cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >             mxPointer;
252cdf0e10cSrcweir     SlideshowImpl*                          mpSlideShow;
253cdf0e10cSrcweir     ShowWindow&                             mrOutputWindow;
254cdf0e10cSrcweir     SlideShowViewListenersPtr               mpViewListeners;
255cdf0e10cSrcweir     SlideShowViewPaintListenersPtr          mpPaintListeners;
256cdf0e10cSrcweir     SlideShowViewMouseListenersPtr          mpMouseListeners;
257cdf0e10cSrcweir     SlideShowViewMouseMotionListenersPtr    mpMouseMotionListeners;
258cdf0e10cSrcweir     SdDrawDocument*                         mpDoc;
259cdf0e10cSrcweir     bool                                    mbIsMouseMotionListener;
260cdf0e10cSrcweir     Rectangle                               maPresentationArea;
261cdf0e10cSrcweir     AnimationMode                           meAnimationMode;
262cdf0e10cSrcweir     bool                                    mbFirstPaint;
263cdf0e10cSrcweir     bool                                    mbFullScreen;
264cdf0e10cSrcweir     bool                                    mbMousePressedEaten;
265cdf0e10cSrcweir };
266cdf0e10cSrcweir 
267cdf0e10cSrcweir } // namespace ::sd
268cdf0e10cSrcweir 
269cdf0e10cSrcweir #endif
270*9d97e963Smseidel 
271*9d97e963Smseidel /* vim: set noet sw=4 ts=4: */
272