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