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