LCOV - code coverage report
Current view: top level - sd/source/ui/slideshow - slideshowviewimpl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 333 0.3 %
Date: 2014-11-03 Functions: 2 43 4.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <slideshowviewimpl.hxx>
      21             : #include <slideshowimpl.hxx>
      22             : #include <osl/mutex.hxx>
      23             : 
      24             : #include <com/sun/star/awt/Pointer.hpp>
      25             : #include <com/sun/star/beans/XPropertySet.hpp>
      26             : 
      27             : #include <basegfx/polygon/b2dpolygon.hxx>
      28             : #include <basegfx/polygon/b2dpolygontools.hxx>
      29             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      30             : 
      31             : #include <cppcanvas/vclfactory.hxx>
      32             : #include <cppcanvas/basegfxfactory.hxx>
      33             : 
      34             : using ::com::sun::star::uno::UNO_QUERY;
      35             : using ::com::sun::star::uno::XInterface;
      36             : using ::com::sun::star::uno::Reference;
      37             : using ::com::sun::star::uno::WeakReference;
      38             : using ::com::sun::star::uno::RuntimeException;
      39             : using ::com::sun::star::lang::XComponent;
      40             : using ::com::sun::star::uno::Exception;
      41             : using ::com::sun::star::presentation::XSlideShow;
      42             : using ::com::sun::star::presentation::XSlideShowView;
      43             : using ::com::sun::star::presentation::XShapeEventListener;
      44             : using ::com::sun::star::presentation::XSlideShowListener;
      45             : 
      46             : using namespace ::com::sun::star;
      47             : 
      48             : namespace sd
      49             : {
      50             : 
      51             : // SlideShowViewListeners
      52           0 : SlideShowViewListeners::SlideShowViewListeners( ::osl::Mutex& rMutex )
      53           0 : :   mrMutex( rMutex )
      54             : {
      55           0 : }
      56             : 
      57           0 : void SlideShowViewListeners::addListener( const Reference< util::XModifyListener >& _rxListener )
      58             : {
      59           0 :     ::osl::MutexGuard aGuard( mrMutex );
      60             : 
      61           0 :     WeakReference< util::XModifyListener > xWeak( _rxListener );
      62           0 :     if( std::find( maListeners.begin(), maListeners.end(), xWeak ) == maListeners.end() )
      63           0 :         maListeners.push_back( xWeak );
      64           0 : }
      65             : 
      66           0 : void SlideShowViewListeners::removeListener( const Reference< util::XModifyListener >& _rxListener )
      67             : {
      68           0 :     ::osl::MutexGuard aGuard( mrMutex );
      69             : 
      70           0 :     WeakReference< util::XModifyListener > xWeak( _rxListener );
      71           0 :     ViewListenerVector::iterator aIter( std::find( maListeners.begin(), maListeners.end(), xWeak ) );
      72           0 :     if( aIter != maListeners.end() )
      73           0 :         maListeners.erase( aIter );
      74           0 : }
      75             : 
      76           0 : bool SlideShowViewListeners::notify( const lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception )
      77             : {
      78           0 :     ::osl::MutexGuard aGuard( mrMutex );
      79             : 
      80           0 :     ViewListenerVector::iterator aIter( maListeners.begin() );
      81           0 :     while( aIter != maListeners.end() )
      82             :     {
      83           0 :         Reference< util::XModifyListener > xListener( (*aIter) );
      84           0 :         if( xListener.is() )
      85             :         {
      86           0 :             xListener->modified( _rEvent );
      87           0 :             ++aIter;
      88             :         }
      89             :         else
      90             :         {
      91           0 :             aIter = maListeners.erase( aIter );
      92             :         }
      93           0 :     }
      94           0 :     return true;
      95             : }
      96             : 
      97           0 : void SlideShowViewListeners::disposing( const lang::EventObject& _rEventSource )
      98             : {
      99           0 :     ::osl::MutexGuard aGuard( mrMutex );
     100             : 
     101           0 :     ViewListenerVector::iterator aIter( maListeners.begin() );
     102           0 :     while( aIter != maListeners.end() )
     103             :     {
     104           0 :         Reference< util::XModifyListener > xListener( (*aIter++) );
     105           0 :         if( xListener.is() )
     106           0 :             xListener->disposing( _rEventSource );
     107           0 :     }
     108             : 
     109           0 :     maListeners.clear();
     110           0 : }
     111             : 
     112             : // SlideShowViewPaintListeners
     113           0 : SlideShowViewPaintListeners::SlideShowViewPaintListeners( ::osl::Mutex& rMutex )
     114           0 : :   SlideShowViewPaintListeners_Base( rMutex )
     115             : {
     116           0 : }
     117             : 
     118           0 : bool SlideShowViewPaintListeners::implTypedNotify( const Reference< awt::XPaintListener >& rListener,
     119             :                                               const awt::PaintEvent&                  rEvent ) throw( uno::Exception )
     120             : {
     121           0 :     rListener->windowPaint( rEvent );
     122           0 :     return true; // continue calling listeners
     123             : }
     124             : 
     125             : // SlideShowViewMouseListeners
     126           0 : SlideShowViewMouseListeners::SlideShowViewMouseListeners( ::osl::Mutex& rMutex ) :
     127           0 :     SlideShowViewMouseListeners_Base( rMutex )
     128             : {
     129           0 : }
     130             : 
     131           0 : bool SlideShowViewMouseListeners::implTypedNotify( const Reference< awt::XMouseListener >&  rListener,
     132             :                                               const WrappedMouseEvent&                  rEvent ) throw( uno::Exception )
     133             : {
     134           0 :     switch( rEvent.meType )
     135             :     {
     136             :         case WrappedMouseEvent::PRESSED:
     137           0 :             rListener->mousePressed( rEvent.maEvent );
     138           0 :             break;
     139             : 
     140             :         case WrappedMouseEvent::RELEASED:
     141           0 :             rListener->mouseReleased( rEvent.maEvent );
     142           0 :             break;
     143             : 
     144             :         case WrappedMouseEvent::ENTERED:
     145           0 :             rListener->mouseEntered( rEvent.maEvent );
     146           0 :             break;
     147             : 
     148             :         case WrappedMouseEvent::EXITED:
     149           0 :             rListener->mouseExited( rEvent.maEvent );
     150           0 :             break;
     151             :     }
     152             : 
     153           0 :     return true; // continue calling listeners
     154             : }
     155             : 
     156             : // SlideShowViewMouseMotionListeners
     157           0 : SlideShowViewMouseMotionListeners::SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex ) :
     158           0 :     SlideShowViewMouseMotionListeners_Base( rMutex )
     159             : {
     160           0 : }
     161             : 
     162           0 : bool SlideShowViewMouseMotionListeners::implTypedNotify( const Reference< awt::XMouseMotionListener >&  rListener,
     163             :                                                     const WrappedMouseMotionEvent&                  rEvent ) throw( uno::Exception )
     164             : {
     165           0 :     switch( rEvent.meType )
     166             :     {
     167             :         case WrappedMouseMotionEvent::DRAGGED:
     168           0 :             rListener->mouseDragged( rEvent.maEvent );
     169           0 :             break;
     170             : 
     171             :         case WrappedMouseMotionEvent::MOVED:
     172           0 :             rListener->mouseMoved( rEvent.maEvent );
     173           0 :             break;
     174             :     }
     175             : 
     176           0 :     return true; // continue calling listeners
     177             : }
     178             : 
     179             : // SlideShowView
     180           0 : SlideShowView::SlideShowView( ShowWindow&     rOutputWindow,
     181             :                               SdDrawDocument* pDoc,
     182             :                               AnimationMode   eAnimationMode,
     183             :                               SlideshowImpl*  pSlideShow,
     184             :                               bool            bFullScreen )
     185             : :   SlideShowView_Base( m_aMutex ),
     186           0 :     mpCanvas( ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas( rOutputWindow ) ),
     187             :     mxWindow( VCLUnoHelper::GetInterface( &rOutputWindow ), uno::UNO_QUERY_THROW ),
     188             :     mxWindowPeer( mxWindow, uno::UNO_QUERY_THROW ),
     189             :     mxPointer(),
     190             :     mpSlideShow( pSlideShow ),
     191             :     mrOutputWindow( rOutputWindow ),
     192           0 :     mpViewListeners( new SlideShowViewListeners( m_aMutex ) ),
     193           0 :     mpPaintListeners( new SlideShowViewPaintListeners( m_aMutex ) ),
     194           0 :     mpMouseListeners( new SlideShowViewMouseListeners( m_aMutex ) ),
     195           0 :     mpMouseMotionListeners( new SlideShowViewMouseMotionListeners( m_aMutex ) ),
     196             :     mpDoc( pDoc ),
     197             :     mbIsMouseMotionListener( false ),
     198             :     meAnimationMode( eAnimationMode ),
     199             :     mbFirstPaint( true ),
     200             :     mbFullScreen( bFullScreen ),
     201           0 :     mbMousePressedEaten( false )
     202             : {
     203           0 :     init();
     204             : 
     205           0 :     mTranslationOffset.Width = 0;
     206           0 :     mTranslationOffset.Height = 0;
     207           0 : }
     208             : 
     209             : // Dispose all internal references
     210           0 : void SAL_CALL SlideShowView::dispose() throw (RuntimeException, std::exception)
     211             : {
     212           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     213             : 
     214           0 :     mpSlideShow = 0;
     215             : 
     216             :     // deregister listeners
     217           0 :     if( mxWindow.is() )
     218             :     {
     219           0 :         mxWindow->removeWindowListener( this );
     220           0 :         mxWindow->removeMouseListener( this );
     221             : 
     222           0 :         if( mbIsMouseMotionListener )
     223           0 :             mxWindow->removeMouseMotionListener( this );
     224             :     }
     225             : 
     226           0 :     mpCanvas.reset();
     227           0 :     mxWindow.clear();
     228             : 
     229             :     // clear all listener containers
     230           0 :     disposing( lang::EventObject() );
     231             : 
     232             :     // call base
     233           0 :     WeakComponentImplHelperBase::dispose();
     234           0 : }
     235             : 
     236             : // Disposing our broadcaster
     237           0 : void SAL_CALL SlideShowView::disposing( const lang::EventObject& ) throw(RuntimeException, std::exception)
     238             : {
     239           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     240             : 
     241             :     // notify all listeners that _we_ are going down (send a disposing()),
     242             :     // then delete listener containers:
     243           0 :     lang::EventObject const evt( static_cast<OWeakObject *>(this) );
     244           0 :     if (mpViewListeners.get() != 0) {
     245           0 :         mpViewListeners->disposing( evt );
     246           0 :         mpViewListeners.reset();
     247             :     }
     248           0 :     if (mpPaintListeners.get() != 0) {
     249           0 :         mpPaintListeners->disposing( evt );
     250           0 :         mpPaintListeners.reset();
     251             :     }
     252           0 :     if (mpMouseListeners.get() != 0) {
     253           0 :         mpMouseListeners->disposing( evt );
     254           0 :         mpMouseListeners.reset();
     255             :     }
     256           0 :     if (mpMouseMotionListeners.get() != 0) {
     257           0 :         mpMouseMotionListeners->disposing( evt );
     258           0 :         mpMouseMotionListeners.reset();
     259           0 :     }
     260           0 : }
     261             : 
     262           0 : void SAL_CALL SlideShowView::paint( const awt::PaintEvent& e ) throw (RuntimeException)
     263             : {
     264           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     265             : 
     266           0 :     if( mbFirstPaint )
     267             :     {
     268           0 :         mbFirstPaint = false;
     269           0 :         SlideshowImpl* pSlideShow = mpSlideShow;
     270           0 :         aGuard.clear();
     271           0 :         if( pSlideShow )
     272           0 :             pSlideShow->onFirstPaint();
     273             :     }
     274             :     else
     275             :     {
     276             :         // Change event source, to enable listeners to match event
     277             :         // with view
     278           0 :         awt::PaintEvent aEvent( e );
     279           0 :         aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     280           0 :         mpPaintListeners->notify( aEvent );
     281           0 :         updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     282           0 :     }
     283           0 : }
     284             : 
     285             : // XSlideShowView methods
     286           0 : Reference< rendering::XSpriteCanvas > SAL_CALL SlideShowView::getCanvas(  ) throw (RuntimeException, std::exception)
     287             : {
     288           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     289             : 
     290           0 :     return mpCanvas.get() ? mpCanvas->getUNOSpriteCanvas() : Reference< rendering::XSpriteCanvas >();
     291             : }
     292             : 
     293           0 : void SAL_CALL SlideShowView::clear() throw (::com::sun::star::uno::RuntimeException, std::exception)
     294             : {
     295             :     // paint background in black
     296           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     297           0 :     SolarMutexGuard aSolarGuard;
     298             : 
     299             :     // fill the bounds rectangle in black
     300             : 
     301           0 :     const Size aWindowSize( mrOutputWindow.GetSizePixel() );
     302             : 
     303             :     ::basegfx::B2DPolygon aPoly( ::basegfx::tools::createPolygonFromRect(
     304             :                                      ::basegfx::B2DRectangle(0.0,0.0,
     305           0 :                                                              aWindowSize.Width(),
     306           0 :                                                              aWindowSize.Height() ) ) );
     307             :     ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
     308           0 :         ::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( mpCanvas, aPoly ) );
     309             : 
     310           0 :     if( pPolyPoly.get() )
     311             :     {
     312           0 :         pPolyPoly->setRGBAFillColor( 0x000000FFU );
     313           0 :         pPolyPoly->draw();
     314           0 :     }
     315           0 : }
     316             : 
     317           0 : geometry::IntegerSize2D SAL_CALL SlideShowView::getTranslationOffset( ) throw (RuntimeException, std::exception)
     318             : {
     319           0 :         return mTranslationOffset;
     320             : }
     321             : 
     322           0 : geometry::AffineMatrix2D SAL_CALL SlideShowView::getTransformation(  ) throw (RuntimeException, std::exception)
     323             : {
     324           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     325           0 :     SolarMutexGuard aSolarGuard;
     326             : 
     327           0 :     const Size& rTmpSize( mrOutputWindow.GetSizePixel() );
     328             : 
     329           0 :     if (rTmpSize.Width()<=0 || rTmpSize.Height()<=0)
     330             :     {
     331           0 :         return geometry::AffineMatrix2D (1,0,0,0,1,0);
     332             :     }
     333             : 
     334           0 :     const Size aWindowSize( mrOutputWindow.GetSizePixel() );
     335           0 :     Size aOutputSize( aWindowSize );
     336             : 
     337           0 :     if( meAnimationMode != ANIMATIONMODE_SHOW )
     338             :     {
     339           0 :         aOutputSize.Width() = (long)( aOutputSize.Width() / 1.03 );
     340           0 :         aOutputSize.Height() = (long)( aOutputSize.Height() / 1.03 );
     341             :     }
     342             : 
     343           0 :     SdPage* pP = mpDoc->GetSdPage( 0, PK_STANDARD );
     344           0 :     Size aPageSize( pP->GetSize() );
     345             : 
     346           0 :     const double page_ratio = (double)aPageSize.Width() / (double)aPageSize.Height();
     347           0 :     const double output_ratio = (double)aOutputSize.Width() / (double)aOutputSize.Height();
     348             : 
     349           0 :     if( page_ratio > output_ratio )
     350             :     {
     351           0 :         aOutputSize.Height() = ( aOutputSize.Width() * aPageSize.Height() ) / aPageSize.Width();
     352             :     }
     353           0 :     else if( page_ratio < output_ratio )
     354             :     {
     355           0 :         aOutputSize.Width() = ( aOutputSize.Height() * aPageSize.Width() ) / aPageSize.Height();
     356             :     }
     357             : 
     358           0 :     Point aOutputOffset( ( aWindowSize.Width() - aOutputSize.Width() ) >> 1,
     359           0 :                             ( aWindowSize.Height() - aOutputSize.Height() ) >> 1 );
     360             : 
     361             :     // Reduce available width by one, as the slides might actually
     362             :     // render one pixel wider and higher as aPageSize below specifies
     363             :     // (when shapes of page size have visible border lines)
     364           0 :     aOutputSize.Width() --;
     365           0 :     aOutputSize.Height() --;
     366             : 
     367             :     // Record mTranslationOffset
     368           0 :     mTranslationOffset.Height = aOutputOffset.Y();
     369           0 :     mTranslationOffset.Width = aOutputOffset.X();
     370             : 
     371           0 :     maPresentationArea = Rectangle( aOutputOffset, aOutputSize );
     372           0 :     mrOutputWindow.SetPresentationArea( maPresentationArea );
     373             : 
     374             :     // scale presentation into available window rect (minus 10%); center in the window
     375             :     const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
     376           0 :         aOutputSize.Width(), aOutputSize.Height(), aOutputOffset.X(), aOutputOffset.Y()));
     377             : 
     378           0 :     geometry::AffineMatrix2D aRes;
     379             : 
     380           0 :     return ::basegfx::unotools::affineMatrixFromHomMatrix( aRes, aMatrix );
     381             : }
     382             : 
     383           0 : void SAL_CALL SlideShowView::addTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException, std::exception)
     384             : {
     385           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     386             : 
     387           0 :     if( mpViewListeners.get() )
     388           0 :         mpViewListeners->addListener( xListener );
     389           0 : }
     390             : 
     391           0 : void SAL_CALL SlideShowView::removeTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException, std::exception)
     392             : {
     393           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     394             : 
     395           0 :     if( mpViewListeners.get() )
     396           0 :         mpViewListeners->removeListener( xListener );
     397           0 : }
     398             : 
     399           0 : void SAL_CALL SlideShowView::addPaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException, std::exception)
     400             : {
     401           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     402             : 
     403           0 :     if( mpPaintListeners.get() )
     404           0 :         mpPaintListeners->addTypedListener( xListener );
     405           0 : }
     406             : 
     407           0 : void SAL_CALL SlideShowView::removePaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException, std::exception)
     408             : {
     409           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     410             : 
     411           0 :     if( mpPaintListeners.get() )
     412           0 :         mpPaintListeners->removeTypedListener( xListener );
     413           0 : }
     414             : 
     415           0 : void SAL_CALL SlideShowView::addMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException, std::exception)
     416             : {
     417           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     418             : 
     419           0 :     if( mpMouseListeners.get() )
     420           0 :         mpMouseListeners->addTypedListener( xListener );
     421           0 : }
     422             : 
     423           0 : void SAL_CALL SlideShowView::removeMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException, std::exception)
     424             : {
     425           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     426             : 
     427           0 :     if( mpMouseListeners.get() )
     428           0 :         mpMouseListeners->removeTypedListener( xListener );
     429           0 : }
     430             : 
     431           0 : void SAL_CALL SlideShowView::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException, std::exception)
     432             : {
     433           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     434             : 
     435           0 :     if( !mbIsMouseMotionListener && mxWindow.is() )
     436             :     {
     437             :         // delay motion event registration, until we really
     438             :         // need it
     439           0 :         mbIsMouseMotionListener = true;
     440           0 :         mxWindow->addMouseMotionListener( this );
     441             :     }
     442             : 
     443           0 :     if( mpMouseMotionListeners.get() )
     444           0 :         mpMouseMotionListeners->addTypedListener( xListener );
     445           0 : }
     446             : 
     447           0 : void SAL_CALL SlideShowView::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException, std::exception)
     448             : {
     449           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     450             : 
     451           0 :     if( mpMouseMotionListeners.get() )
     452           0 :         mpMouseMotionListeners->removeTypedListener( xListener );
     453             : 
     454             :     // TODO(P1): Might be nice to deregister for mouse motion
     455             :     // events, when the last listener is gone.
     456           0 : }
     457             : 
     458           0 : void SAL_CALL SlideShowView::setMouseCursor( sal_Int16 nPointerShape ) throw (RuntimeException, std::exception)
     459             : {
     460           0 :     ::osl::MutexGuard aGuard( m_aMutex );
     461             : 
     462             :     // forward to window
     463           0 :     if( mxPointer.is() )
     464           0 :         mxPointer->setType( nPointerShape );
     465             : 
     466           0 :     if( mxWindowPeer.is() )
     467           0 :         mxWindowPeer->setPointer( mxPointer );
     468           0 : }
     469             : 
     470           0 : awt::Rectangle SAL_CALL SlideShowView::getCanvasArea(  ) throw (RuntimeException, std::exception)
     471             : {
     472           0 :     awt::Rectangle aRectangle;
     473             : 
     474           0 :     if( mxWindow.is() )
     475           0 :         return mxWindow->getPosSize();
     476             : 
     477           0 :     aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
     478             : 
     479           0 :     return aRectangle;
     480             : }
     481             : 
     482           0 : void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow )
     483             : {
     484           0 :     if( pSlideShow )
     485             :     {
     486           0 :         ::rtl::Reference< SlideshowImpl > aSLGuard( pSlideShow );
     487             : 
     488           0 :         if( mbFirstPaint )
     489             :         {
     490           0 :             mbFirstPaint = false;
     491           0 :             SlideshowImpl* pTmpSlideShow = mpSlideShow;
     492           0 :             rGuard.clear();
     493           0 :             if( pTmpSlideShow )
     494           0 :                 pTmpSlideShow->onFirstPaint();
     495             :         } else
     496           0 :             rGuard.clear();
     497             : 
     498           0 :         pSlideShow->startUpdateTimer();
     499             :     }
     500           0 : }
     501             : 
     502             : // XWindowListener methods
     503           0 : void SAL_CALL SlideShowView::windowResized( const awt::WindowEvent& e ) throw (RuntimeException, std::exception)
     504             : {
     505           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     506             : 
     507           0 :     if( mpViewListeners.get() )
     508             :     {
     509             :         // Change event source, to enable listeners to match event
     510             :         // with view
     511           0 :         awt::WindowEvent aEvent( e );
     512           0 :         aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     513             : 
     514           0 :         mpViewListeners->notify( aEvent );
     515           0 :         updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     516           0 :     }
     517           0 : }
     518             : 
     519           0 : void SAL_CALL SlideShowView::windowMoved( const awt::WindowEvent& ) throw (RuntimeException, std::exception)
     520             : {
     521             :     // ignored
     522           0 : }
     523             : 
     524           0 : void SAL_CALL SlideShowView::windowShown( const lang::EventObject& ) throw (RuntimeException, std::exception)
     525             : {
     526             :     // ignored
     527           0 : }
     528             : 
     529           0 : void SAL_CALL SlideShowView::windowHidden( const lang::EventObject& ) throw (RuntimeException, std::exception)
     530             : {
     531             :     // ignored
     532           0 : }
     533             : 
     534             : // XMouseListener implementation
     535           0 : void SAL_CALL SlideShowView::mousePressed( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     536             : {
     537           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     538           0 :     if( mpSlideShow && mpSlideShow->isInputFreezed() )
     539             :     {
     540           0 :         mbMousePressedEaten = true;
     541             :     }
     542             :     else
     543             :     {
     544           0 :         mbMousePressedEaten = false;
     545             : 
     546             :         // Change event source, to enable listeners to match event
     547             :         // with view
     548           0 :         WrappedMouseEvent aEvent;
     549           0 :         aEvent.meType = WrappedMouseEvent::PRESSED;
     550           0 :         aEvent.maEvent = e;
     551           0 :         aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     552             : 
     553           0 :         if( mpMouseListeners.get() )
     554           0 :             mpMouseListeners->notify( aEvent );
     555           0 :         updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     556           0 :     }
     557           0 : }
     558             : 
     559           0 : void SAL_CALL SlideShowView::mouseReleased( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     560             : {
     561           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     562           0 :     if( mbMousePressedEaten )
     563             :     {
     564             :         // if mouse button down was ignored, also ignore mouse button up
     565           0 :         mbMousePressedEaten = false;
     566             :     }
     567           0 :     else if( mpSlideShow && !mpSlideShow->isInputFreezed() )
     568             :     {
     569             :         // Change event source, to enable listeners to match event
     570             :         // with view
     571           0 :         WrappedMouseEvent aEvent;
     572           0 :         aEvent.meType = WrappedMouseEvent::RELEASED;
     573           0 :         aEvent.maEvent = e;
     574           0 :         aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     575             : 
     576           0 :         if( mpMouseListeners.get() )
     577           0 :             mpMouseListeners->notify( aEvent );
     578           0 :         updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     579           0 :     }
     580           0 : }
     581             : 
     582           0 : void SAL_CALL SlideShowView::mouseEntered( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     583             : {
     584           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     585             : 
     586             :     // Change event source, to enable listeners to match event
     587             :     // with view
     588           0 :     WrappedMouseEvent aEvent;
     589           0 :     aEvent.meType = WrappedMouseEvent::ENTERED;
     590           0 :     aEvent.maEvent = e;
     591           0 :     aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     592             : 
     593           0 :     if( mpMouseListeners.get() )
     594           0 :         mpMouseListeners->notify( aEvent );
     595           0 :     updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     596           0 : }
     597             : 
     598           0 : void SAL_CALL SlideShowView::mouseExited( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     599             : {
     600           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     601             : 
     602             :     // Change event source, to enable listeners to match event
     603             :     // with view
     604           0 :     WrappedMouseEvent aEvent;
     605           0 :     aEvent.meType = WrappedMouseEvent::EXITED;
     606           0 :     aEvent.maEvent = e;
     607           0 :     aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     608             : 
     609           0 :     if( mpMouseListeners.get() )
     610           0 :         mpMouseListeners->notify( aEvent );
     611           0 :     updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     612           0 : }
     613             : 
     614             : // XMouseMotionListener implementation
     615           0 : void SAL_CALL SlideShowView::mouseDragged( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     616             : {
     617           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     618             : 
     619             :     // Change event source, to enable listeners to match event
     620             :     // with view
     621           0 :     WrappedMouseMotionEvent aEvent;
     622           0 :     aEvent.meType = WrappedMouseMotionEvent::DRAGGED;
     623           0 :     aEvent.maEvent = e;
     624           0 :     aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     625             : 
     626           0 :     if( mpMouseMotionListeners.get() )
     627           0 :         mpMouseMotionListeners->notify( aEvent );
     628           0 :     updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     629           0 : }
     630             : 
     631           0 : void SAL_CALL SlideShowView::mouseMoved( const awt::MouseEvent& e ) throw (uno::RuntimeException, std::exception)
     632             : {
     633           0 :     ::osl::ClearableMutexGuard aGuard( m_aMutex );
     634             : 
     635             :     // Change event source, to enable listeners to match event
     636             :     // with view
     637           0 :     WrappedMouseMotionEvent aEvent;
     638           0 :     aEvent.meType = WrappedMouseMotionEvent::MOVED;
     639           0 :     aEvent.maEvent = e;
     640           0 :     aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
     641             : 
     642           0 :     if( mpMouseMotionListeners.get() )
     643           0 :         mpMouseMotionListeners->notify( aEvent );
     644           0 :     updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
     645           0 : }
     646             : 
     647           0 : void SlideShowView::init()
     648             : {
     649           0 :     mxWindow->addWindowListener( this );
     650           0 :     mxWindow->addMouseListener( this );
     651             : 
     652           0 :     mxPointer = awt::Pointer::create( ::comphelper::getProcessComponentContext() );
     653             : 
     654           0 :     getTransformation();
     655             : 
     656             :     // #i48939# only switch on kind of hacky scroll optimization, when
     657             :     // running fullscreen. this minimizes the probability that other
     658             :     // windows partially cover the show.
     659           0 :     if( mbFullScreen )
     660             :     {
     661             :         try
     662             :         {
     663           0 :             Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
     664           0 :                                                            uno::UNO_QUERY_THROW );
     665           0 :             xCanvasProps->setPropertyValue("UnsafeScrolling",
     666           0 :                 uno::makeAny( true ) );
     667             :         }
     668           0 :         catch( uno::Exception& )
     669             :         {
     670             :         }
     671             :     }
     672           0 : }
     673             : 
     674         114 : } // namespace ::sd
     675             : 
     676             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10