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