2004-11-26 13:20:49 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
2008-04-10 15:56:16 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-11-26 13:20:49 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 13:03:07 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sd.hxx"
|
2004-11-26 13:20:49 -06:00
|
|
|
#include <slideshowviewimpl.hxx>
|
2004-12-09 09:11:45 -06:00
|
|
|
#include <slideshowimpl.hxx>
|
2005-03-18 09:50:40 -06:00
|
|
|
#include <vos/mutex.hxx>
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-11-02 06:18:15 -06:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
|
2004-11-26 13:20:49 -06:00
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
|
|
|
#include <basegfx/polygon/b2dpolygontools.hxx>
|
2009-09-22 11:14:05 -05:00
|
|
|
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
|
|
|
|
2004-11-26 13:20:49 -06:00
|
|
|
#include <cppcanvas/vclfactory.hxx>
|
|
|
|
#include <cppcanvas/basegfxfactory.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
using ::com::sun::star::uno::UNO_QUERY;
|
|
|
|
using ::com::sun::star::uno::XInterface;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
2005-11-17 09:11:37 -06:00
|
|
|
using ::com::sun::star::uno::WeakReference;
|
2004-11-26 13:20:49 -06:00
|
|
|
using ::com::sun::star::uno::RuntimeException;
|
|
|
|
using ::com::sun::star::lang::XComponent;
|
|
|
|
using ::com::sun::star::uno::Exception;
|
|
|
|
using ::com::sun::star::presentation::XSlideShow;
|
|
|
|
using ::com::sun::star::presentation::XSlideShowView;
|
|
|
|
using ::com::sun::star::presentation::XShapeEventListener;
|
|
|
|
using ::com::sun::star::presentation::XSlideShowListener;
|
|
|
|
using ::comphelper::ImplementationReference;
|
|
|
|
|
2005-12-14 10:19:46 -06:00
|
|
|
using ::rtl::OUString;
|
2004-11-26 13:20:49 -06:00
|
|
|
using namespace ::com::sun::star;
|
2005-03-10 05:12:05 -06:00
|
|
|
using namespace ::com::sun::star;
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
namespace sd
|
|
|
|
{
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// SlideShowViewListeners
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SlideShowViewListeners::SlideShowViewListeners( ::osl::Mutex& rMutex )
|
2005-11-17 09:11:37 -06:00
|
|
|
: mrMutex( rMutex )
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-11-17 09:11:37 -06:00
|
|
|
void SlideShowViewListeners::addListener( const Reference< util::XModifyListener >& _rxListener )
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
2005-11-17 09:11:37 -06:00
|
|
|
::osl::MutexGuard aGuard( mrMutex );
|
|
|
|
|
|
|
|
WeakReference< util::XModifyListener > xWeak( _rxListener );
|
|
|
|
if( std::find( maListeners.begin(), maListeners.end(), xWeak ) == maListeners.end() )
|
|
|
|
maListeners.push_back( xWeak );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SlideShowViewListeners::removeListener( const Reference< util::XModifyListener >& _rxListener )
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( mrMutex );
|
|
|
|
|
|
|
|
WeakReference< util::XModifyListener > xWeak( _rxListener );
|
|
|
|
ViewListenerVector::iterator aIter( std::find( maListeners.begin(), maListeners.end(), xWeak ) );
|
|
|
|
if( aIter != maListeners.end() )
|
|
|
|
maListeners.erase( aIter );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SlideShowViewListeners::notify( const lang::EventObject& _rEvent ) throw( com::sun::star::uno::Exception )
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( mrMutex );
|
|
|
|
|
|
|
|
ViewListenerVector::iterator aIter( maListeners.begin() );
|
|
|
|
while( aIter != maListeners.end() )
|
|
|
|
{
|
|
|
|
Reference< util::XModifyListener > xListener( (*aIter) );
|
|
|
|
if( xListener.is() )
|
|
|
|
{
|
|
|
|
xListener->modified( _rEvent );
|
|
|
|
aIter++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aIter = maListeners.erase( aIter );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SlideShowViewListeners::disposing( const lang::EventObject& _rEventSource )
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( mrMutex );
|
|
|
|
|
|
|
|
ViewListenerVector::iterator aIter( maListeners.begin() );
|
|
|
|
while( aIter != maListeners.end() )
|
|
|
|
{
|
|
|
|
Reference< util::XModifyListener > xListener( (*aIter++) );
|
|
|
|
if( xListener.is() )
|
|
|
|
xListener->disposing( _rEventSource );
|
|
|
|
}
|
|
|
|
|
|
|
|
maListeners.clear();
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// SlideShowViewPaintListeners
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SlideShowViewPaintListeners::SlideShowViewPaintListeners( ::osl::Mutex& rMutex )
|
|
|
|
: SlideShowViewPaintListeners_Base( rMutex )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-19 06:33:15 -05:00
|
|
|
bool SlideShowViewPaintListeners::implTypedNotify( const Reference< awt::XPaintListener >& rListener,
|
2004-11-26 13:20:49 -06:00
|
|
|
const awt::PaintEvent& rEvent ) throw( uno::Exception )
|
|
|
|
{
|
|
|
|
rListener->windowPaint( rEvent );
|
|
|
|
return true; // continue calling listeners
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// SlideShowViewMouseListeners
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SlideShowViewMouseListeners::SlideShowViewMouseListeners( ::osl::Mutex& rMutex ) :
|
|
|
|
SlideShowViewMouseListeners_Base( rMutex )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-19 06:33:15 -05:00
|
|
|
bool SlideShowViewMouseListeners::implTypedNotify( const Reference< awt::XMouseListener >& rListener,
|
2004-11-26 13:20:49 -06:00
|
|
|
const WrappedMouseEvent& rEvent ) throw( uno::Exception )
|
|
|
|
{
|
|
|
|
switch( rEvent.meType )
|
|
|
|
{
|
|
|
|
case WrappedMouseEvent::PRESSED:
|
|
|
|
rListener->mousePressed( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WrappedMouseEvent::RELEASED:
|
|
|
|
rListener->mouseReleased( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WrappedMouseEvent::ENTERED:
|
|
|
|
rListener->mouseEntered( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WrappedMouseEvent::EXITED:
|
|
|
|
rListener->mouseExited( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true; // continue calling listeners
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// SlideShowViewMouseMotionListeners
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
SlideShowViewMouseMotionListeners::SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex ) :
|
|
|
|
SlideShowViewMouseMotionListeners_Base( rMutex )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-06-19 06:33:15 -05:00
|
|
|
bool SlideShowViewMouseMotionListeners::implTypedNotify( const Reference< awt::XMouseMotionListener >& rListener,
|
2004-11-26 13:20:49 -06:00
|
|
|
const WrappedMouseMotionEvent& rEvent ) throw( uno::Exception )
|
|
|
|
{
|
|
|
|
switch( rEvent.meType )
|
|
|
|
{
|
|
|
|
case WrappedMouseMotionEvent::DRAGGED:
|
|
|
|
rListener->mouseDragged( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WrappedMouseMotionEvent::MOVED:
|
|
|
|
rListener->mouseMoved( rEvent.maEvent );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true; // continue calling listeners
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
// SlideShowView
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-11-02 06:18:15 -06:00
|
|
|
SlideShowView::SlideShowView( ShowWindow& rOutputWindow,
|
|
|
|
SdDrawDocument* pDoc,
|
|
|
|
AnimationMode eAnimationMode,
|
|
|
|
SlideshowImpl* pSlideShow,
|
|
|
|
bool bFullScreen )
|
2004-11-26 13:20:49 -06:00
|
|
|
: SlideShowView_Base( m_aMutex ),
|
|
|
|
mpCanvas( ::cppcanvas::VCLFactory::getInstance().createSpriteCanvas( rOutputWindow ) ),
|
|
|
|
mxWindow( VCLUnoHelper::GetInterface( &rOutputWindow ), uno::UNO_QUERY_THROW ),
|
|
|
|
mxWindowPeer( mxWindow, uno::UNO_QUERY_THROW ),
|
|
|
|
mxPointer(),
|
2006-12-12 11:10:26 -06:00
|
|
|
mpSlideShow( pSlideShow ),
|
2004-11-26 13:20:49 -06:00
|
|
|
mrOutputWindow( rOutputWindow ),
|
|
|
|
mpViewListeners( new SlideShowViewListeners( m_aMutex ) ),
|
|
|
|
mpPaintListeners( new SlideShowViewPaintListeners( m_aMutex ) ),
|
|
|
|
mpMouseListeners( new SlideShowViewMouseListeners( m_aMutex ) ),
|
|
|
|
mpMouseMotionListeners( new SlideShowViewMouseMotionListeners( m_aMutex ) ),
|
2006-12-12 11:10:26 -06:00
|
|
|
mpDoc( pDoc ),
|
2004-11-26 13:20:49 -06:00
|
|
|
mbIsMouseMotionListener( false ),
|
2004-12-09 09:11:45 -06:00
|
|
|
meAnimationMode( eAnimationMode ),
|
2005-11-02 06:18:15 -06:00
|
|
|
mbFirstPaint( true ),
|
2007-01-29 07:51:34 -06:00
|
|
|
mbFullScreen( bFullScreen ),
|
|
|
|
mbMousePressedEaten( false )
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Dispose all internal references
|
|
|
|
void SAL_CALL SlideShowView::dispose() throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-03-18 09:50:40 -06:00
|
|
|
mpSlideShow = 0;
|
|
|
|
|
2004-11-26 13:20:49 -06:00
|
|
|
// deregister listeners
|
|
|
|
if( mxWindow.is() )
|
|
|
|
{
|
|
|
|
mxWindow->removeWindowListener( this );
|
|
|
|
mxWindow->removeMouseListener( this );
|
|
|
|
|
|
|
|
if( mbIsMouseMotionListener )
|
|
|
|
mxWindow->removeMouseMotionListener( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
mpCanvas.reset();
|
|
|
|
mxWindow.clear();
|
|
|
|
|
|
|
|
// clear all listener containers
|
|
|
|
disposing( lang::EventObject() );
|
|
|
|
|
|
|
|
// call base
|
|
|
|
WeakComponentImplHelperBase::dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Disposing our broadcaster
|
|
|
|
void SAL_CALL SlideShowView::disposing( const lang::EventObject& ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
// notify all listeners that _we_ are going down (send a disposing()),
|
|
|
|
// then delete listener containers:
|
|
|
|
lang::EventObject const evt( static_cast<OWeakObject *>(this) );
|
|
|
|
if (mpViewListeners.get() != 0) {
|
|
|
|
mpViewListeners->disposing( evt );
|
|
|
|
mpViewListeners.reset();
|
|
|
|
}
|
|
|
|
if (mpPaintListeners.get() != 0) {
|
|
|
|
mpPaintListeners->disposing( evt );
|
|
|
|
mpPaintListeners.reset();
|
|
|
|
}
|
|
|
|
if (mpMouseListeners.get() != 0) {
|
|
|
|
mpMouseListeners->disposing( evt );
|
|
|
|
mpMouseListeners.reset();
|
|
|
|
}
|
|
|
|
if (mpMouseMotionListeners.get() != 0) {
|
|
|
|
mpMouseMotionListeners->disposing( evt );
|
|
|
|
mpMouseMotionListeners.reset();
|
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::paint( const awt::PaintEvent& e ) throw (RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2004-12-09 09:11:45 -06:00
|
|
|
if( mbFirstPaint )
|
|
|
|
{
|
|
|
|
mbFirstPaint = false;
|
2005-03-18 09:50:40 -06:00
|
|
|
SlideshowImpl* pSlideShow = mpSlideShow;
|
|
|
|
aGuard.clear();
|
|
|
|
if( pSlideShow )
|
|
|
|
pSlideShow->onFirstPaint();
|
2004-12-09 09:11:45 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
awt::PaintEvent aEvent( e );
|
|
|
|
aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
|
|
|
mpPaintListeners->notify( aEvent );
|
2007-07-17 08:30:36 -05:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2004-12-09 09:11:45 -06:00
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// XSlideShowView methods
|
|
|
|
Reference< rendering::XSpriteCanvas > SAL_CALL SlideShowView::getCanvas( ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
return mpCanvas.get() ? mpCanvas->getUNOSpriteCanvas() : Reference< rendering::XSpriteCanvas >();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::clear() throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
|
|
|
// paint background in black
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2005-03-18 09:50:40 -06:00
|
|
|
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// fill the bounds rectangle in black
|
|
|
|
// ----------------------------------
|
|
|
|
|
|
|
|
const Size aWindowSize( mrOutputWindow.GetSizePixel() );
|
|
|
|
|
|
|
|
::basegfx::B2DPolygon aPoly( ::basegfx::tools::createPolygonFromRect(
|
|
|
|
::basegfx::B2DRectangle(0.0,0.0,
|
|
|
|
aWindowSize.Width(),
|
|
|
|
aWindowSize.Height() ) ) );
|
|
|
|
::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
|
|
|
|
::cppcanvas::BaseGfxFactory::getInstance().createPolyPolygon( mpCanvas, aPoly ) );
|
|
|
|
|
|
|
|
if( pPolyPoly.get() )
|
|
|
|
{
|
|
|
|
pPolyPoly->setRGBAFillColor( 0x000000FFU );
|
|
|
|
pPolyPoly->draw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
geometry::AffineMatrix2D SAL_CALL SlideShowView::getTransformation( ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
2005-03-18 09:50:40 -06:00
|
|
|
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-04-18 03:21:25 -05:00
|
|
|
const Size& rTmpSize( mrOutputWindow.GetSizePixel() );
|
|
|
|
|
2008-04-03 08:15:05 -05:00
|
|
|
if (rTmpSize.Width()<=0 || rTmpSize.Height()<=0)
|
|
|
|
{
|
|
|
|
return geometry::AffineMatrix2D (1,0,0,0,1,0);
|
|
|
|
}
|
|
|
|
|
2005-04-18 03:21:25 -05:00
|
|
|
// Reduce available width by one, as the slides might actually
|
|
|
|
// render one pixel wider and higher as aPageSize below specifies
|
|
|
|
// (when shapes of page size have visible border lines)
|
|
|
|
const Size aWindowSize( rTmpSize.Width()-1,
|
|
|
|
rTmpSize.Height()-1 );
|
|
|
|
Size aOutputSize( aWindowSize );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
if( meAnimationMode != ANIMATIONMODE_SHOW )
|
|
|
|
{
|
|
|
|
aOutputSize.Width() = (long)( aOutputSize.Width() / 1.03 );
|
|
|
|
aOutputSize.Height() = (long)( aOutputSize.Height() / 1.03 );
|
|
|
|
}
|
|
|
|
|
|
|
|
SdPage* pP = mpDoc->GetSdPage( 0, PK_STANDARD );
|
|
|
|
Size aPageSize( pP->GetSize() );
|
|
|
|
|
|
|
|
const double page_ratio = (double)aPageSize.Width() / (double)aPageSize.Height();
|
|
|
|
const double output_ratio = (double)aOutputSize.Width() / (double)aOutputSize.Height();
|
|
|
|
|
|
|
|
if( page_ratio > output_ratio )
|
|
|
|
{
|
|
|
|
aOutputSize.Height() = ( aOutputSize.Width() * aPageSize.Height() ) / aPageSize.Width();
|
|
|
|
}
|
|
|
|
else if( page_ratio < output_ratio )
|
|
|
|
{
|
|
|
|
aOutputSize.Width() = ( aOutputSize.Height() * aPageSize.Width() ) / aPageSize.Height();
|
|
|
|
}
|
|
|
|
|
2005-04-18 03:21:25 -05:00
|
|
|
Point aOutputOffset( ( aWindowSize.Width() - aOutputSize.Width() ) >> 1,
|
|
|
|
( aWindowSize.Height() - aOutputSize.Height() ) >> 1 );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
maPresentationArea = Rectangle( aOutputOffset, aOutputSize );
|
|
|
|
mrOutputWindow.SetPresentationArea( maPresentationArea );
|
|
|
|
|
2009-09-22 11:14:05 -05:00
|
|
|
// scale presentation into available window rect (minus 10%); center in the window
|
|
|
|
const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix(
|
|
|
|
aOutputSize.Width(), aOutputSize.Height(), aOutputOffset.X(), aOutputOffset.Y()));
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
geometry::AffineMatrix2D aRes;
|
|
|
|
|
|
|
|
return ::basegfx::unotools::affineMatrixFromHomMatrix( aRes, aMatrix );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::addTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpViewListeners.get() )
|
|
|
|
mpViewListeners->addListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::removeTransformationChangedListener( const Reference< util::XModifyListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpViewListeners.get() )
|
|
|
|
mpViewListeners->removeListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::addPaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpPaintListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpPaintListeners->addTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::removePaintListener( const Reference< awt::XPaintListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpPaintListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpPaintListeners->removeTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::addMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpMouseListeners->addTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::removeMouseListener( const Reference< awt::XMouseListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpMouseListeners->removeTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( !mbIsMouseMotionListener && mxWindow.is() )
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
// delay motion event registration, until we really
|
|
|
|
// need it
|
|
|
|
mbIsMouseMotionListener = true;
|
|
|
|
mxWindow->addMouseMotionListener( this );
|
|
|
|
}
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseMotionListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpMouseMotionListeners->addTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseMotionListeners.get() )
|
2006-06-19 06:33:15 -05:00
|
|
|
mpMouseMotionListeners->removeTypedListener( xListener );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// TODO(P1): Might be nice to deregister for mouse motion
|
|
|
|
// events, when the last listener is gone.
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::setMouseCursor( sal_Int16 nPointerShape ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard( m_aMutex );
|
|
|
|
|
|
|
|
// forward to window
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mxPointer.is() )
|
|
|
|
mxPointer->setType( nPointerShape );
|
|
|
|
|
|
|
|
if( mxWindowPeer.is() )
|
|
|
|
mxWindowPeer->setPointer( mxPointer );
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
2009-02-19 07:21:10 -06:00
|
|
|
awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
awt::Rectangle aRectangle;
|
|
|
|
|
|
|
|
if( mxWindow.is() )
|
|
|
|
return mxWindow->getPosSize();
|
|
|
|
|
|
|
|
aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
|
|
|
|
|
|
|
|
return aRectangle;
|
|
|
|
}
|
|
|
|
|
2008-04-03 08:15:05 -05:00
|
|
|
void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow )
|
|
|
|
{
|
|
|
|
if( pSlideShow )
|
|
|
|
{
|
|
|
|
::rtl::Reference< SlideshowImpl > aSLGuard( pSlideShow );
|
|
|
|
rGuard.clear();
|
|
|
|
pSlideShow->startUpdateTimer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-26 13:20:49 -06:00
|
|
|
// XWindowListener methods
|
|
|
|
void SAL_CALL SlideShowView::windowResized( const awt::WindowEvent& e ) throw (RuntimeException)
|
|
|
|
{
|
2006-12-13 07:51:05 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpViewListeners.get() )
|
|
|
|
{
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
awt::WindowEvent aEvent( e );
|
|
|
|
aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
mpViewListeners->notify( aEvent );
|
2006-12-13 07:51:05 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2005-10-11 02:18:31 -05:00
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
2006-12-12 11:10:26 -06:00
|
|
|
void SAL_CALL SlideShowView::windowMoved( const awt::WindowEvent& ) throw (RuntimeException)
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
// ignored
|
|
|
|
}
|
|
|
|
|
2006-12-12 11:10:26 -06:00
|
|
|
void SAL_CALL SlideShowView::windowShown( const lang::EventObject& ) throw (RuntimeException)
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
// ignored
|
|
|
|
}
|
|
|
|
|
2006-12-12 11:10:26 -06:00
|
|
|
void SAL_CALL SlideShowView::windowHidden( const lang::EventObject& ) throw (RuntimeException)
|
2004-11-26 13:20:49 -06:00
|
|
|
{
|
|
|
|
// ignored
|
|
|
|
}
|
|
|
|
|
|
|
|
// XMouseListener implementation
|
|
|
|
void SAL_CALL SlideShowView::mousePressed( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2007-01-29 07:51:34 -06:00
|
|
|
if( mpSlideShow && mpSlideShow->isInputFreezed() )
|
2005-01-28 08:41:43 -06:00
|
|
|
{
|
2007-01-29 07:51:34 -06:00
|
|
|
mbMousePressedEaten = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mbMousePressedEaten = false;
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-01-28 08:41:43 -06:00
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseEvent::PRESSED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
|
|
|
mpMouseListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2005-01-28 08:41:43 -06:00
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::mouseReleased( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2007-01-29 07:51:34 -06:00
|
|
|
if( mbMousePressedEaten )
|
|
|
|
{
|
|
|
|
// if mouse button down was ignored, also ignore mouse button up
|
|
|
|
mbMousePressedEaten = false;
|
|
|
|
}
|
|
|
|
else if( mpSlideShow && !mpSlideShow->isInputFreezed() )
|
2005-01-28 08:41:43 -06:00
|
|
|
{
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseEvent::RELEASED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
|
|
|
mpMouseListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2005-01-28 08:41:43 -06:00
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::mouseEntered( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseEvent::ENTERED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
|
|
|
mpMouseListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::mouseExited( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseEvent::EXITED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseListeners.get() )
|
|
|
|
mpMouseListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// XMouseMotionListener implementation
|
|
|
|
void SAL_CALL SlideShowView::mouseDragged( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseMotionEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseMotionEvent::DRAGGED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseMotionListeners.get() )
|
|
|
|
mpMouseMotionListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SlideShowView::mouseMoved( const awt::MouseEvent& e ) throw (uno::RuntimeException)
|
|
|
|
{
|
2005-03-18 09:50:40 -06:00
|
|
|
::osl::ClearableMutexGuard aGuard( m_aMutex );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
// Change event source, to enable listeners to match event
|
|
|
|
// with view
|
|
|
|
WrappedMouseMotionEvent aEvent;
|
|
|
|
aEvent.meType = WrappedMouseMotionEvent::MOVED;
|
|
|
|
aEvent.maEvent = e;
|
|
|
|
aEvent.maEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( mpMouseMotionListeners.get() )
|
|
|
|
mpMouseMotionListeners->notify( aEvent );
|
2005-03-18 09:50:40 -06:00
|
|
|
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void SlideShowView::init()
|
|
|
|
{
|
|
|
|
mxWindow->addWindowListener( this );
|
|
|
|
mxWindow->addMouseListener( this );
|
|
|
|
|
|
|
|
Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(),
|
|
|
|
uno::UNO_QUERY_THROW );
|
|
|
|
|
2005-10-11 02:18:31 -05:00
|
|
|
if( xFactory.is() )
|
|
|
|
mxPointer.set( xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Pointer")) ),
|
|
|
|
uno::UNO_QUERY );
|
2004-11-26 13:20:49 -06:00
|
|
|
|
|
|
|
getTransformation();
|
2005-11-02 06:18:15 -06:00
|
|
|
|
|
|
|
// #i48939# only switch on kind of hacky scroll optimisation, when
|
|
|
|
// running fullscreen. this minimizes the probability that other
|
|
|
|
// windows partially cover the show.
|
|
|
|
if( mbFullScreen )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xCanvasProps( getCanvas(),
|
|
|
|
uno::UNO_QUERY_THROW );
|
|
|
|
xCanvasProps->setPropertyValue(
|
|
|
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UnsafeScrolling")),
|
|
|
|
uno::makeAny( true ) );
|
|
|
|
}
|
|
|
|
catch( uno::Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2004-11-26 13:20:49 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ::sd
|