diff options
author | Oliver Braun <obr@openoffice.org> | 2002-04-30 12:27:16 +0000 |
---|---|---|
committer | Oliver Braun <obr@openoffice.org> | 2002-04-30 12:27:16 +0000 |
commit | 9d5a44dbdc02aec4eee22086b1856281fd6ca038 (patch) | |
tree | 46fefc614fd91d6cfdf3d8057060b3d17c6bdb01 /vcl/source/window | |
parent | 605d75eb1925d00fe1e3117ce12d2e9d9494437c (diff) |
#99036# now implementing XDragGestureListener
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/dndevdis.cxx | 79 | ||||
-rw-r--r-- | vcl/source/window/dndevdis.hxx | 27 |
2 files changed, 98 insertions, 8 deletions
diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx index cb952377bc7c..9057ab7ffc47 100644 --- a/vcl/source/window/dndevdis.cxx +++ b/vcl/source/window/dndevdis.cxx @@ -2,9 +2,9 @@ * * $RCSfile: dndevdis.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: obr $ $Date: 2001-10-09 15:43:46 $ + * last change: $Author: obr $ $Date: 2002-04-30 13:27:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,6 +61,7 @@ #include <dndevdis.hxx> #include <dndlcon.hxx> +#include <window.h> #include <vos/mutex.hxx> #include <svapp.hxx> @@ -299,6 +300,32 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& //================================================================================================== +// DNDEventDispatcher::dragGestureRecognized +//================================================================================================== + +void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& dge ) + throw(RuntimeException) +{ MutexGuard aImplGuard( m_aMutex ); + + Point origin( dge.DragOriginX, dge.DragOriginY ); + sal_Int32 nListeners; + + // find the window that is toplevel for this coordinates + OClearableGuard aSolarGuard( Application::GetSolarMutex() ); + Window * pChildWindow = m_pTopWindow->ImplFindWindow( origin ); + + if( NULL == pChildWindow ) + pChildWindow = m_pTopWindow; + + while( pChildWindow->ImplGetClientWindow() ) + pChildWindow = pChildWindow->ImplGetClientWindow(); + + aSolarGuard.clear(); + + fireDragGestureEvent( pChildWindow, dge.DragSource, dge.Event, origin, dge.DragAction ); +} + +//================================================================================================== // DNDEventDispatcher::disposing //================================================================================================== @@ -487,3 +514,51 @@ sal_Int32 DNDEventDispatcher::fireDropEvent( Window *pWindow, return n; } + +//================================================================================================== +// DNDEventDispatcher::fireDragGestureRecognized +//================================================================================================== + +sal_Int32 DNDEventDispatcher::fireDragGestureEvent( Window *pWindow, + const Reference< XDragSource >& xSource, const Any event, + const Point& rOrigin, const sal_Int8 nDragAction +) + throw(::com::sun::star::uno::RuntimeException) +{ + sal_Int32 n = 0; + + if( pWindow && pWindow->IsInputEnabled() ) + { + OClearableGuard aGuard( Application::GetSolarMutex() ); + + // query DropTarget from window + Reference< XDragGestureRecognizer > xDragGestureRecognizer = pWindow->GetDragGestureRecognizer(); + + if( xDragGestureRecognizer.is() ) + { + // retrieve relative mouse position + Point relLoc = pWindow->ImplFrameToOutput( rOrigin ); + aGuard.clear(); + + n = static_cast < DNDListenerContainer * > ( xDragGestureRecognizer.get() )->fireDragGestureEvent( + nDragAction, relLoc.X(), relLoc.Y(), xSource, event ); + } + + // release UI lock + pWindow->DecrementLockCount(); + } + +#ifdef REMOTE_APPSERVER + + if( ! pWindow->ImplGetFrameData()->mbInternalDragGestureRecognizer ) + { + if( xSource.is() ) + { + xSource->startDrag( DragGestureEvent(), 0, 0, 0, Reference< XTransferable >(), Reference< XDragSourceListener > () ); + } + } + +#endif + + return n; +} diff --git a/vcl/source/window/dndevdis.hxx b/vcl/source/window/dndevdis.hxx index 61d81b4c9ca6..deafd653ed37 100644 --- a/vcl/source/window/dndevdis.hxx +++ b/vcl/source/window/dndevdis.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dndevdis.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: obr $ $Date: 2001-02-13 13:12:53 $ + * last change: $Author: obr $ $Date: 2002-04-30 13:27:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,17 +70,22 @@ #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> #endif -#ifndef _CPPUHELPER_IMPLBASE2_HXX_ -#include <cppuhelper/implbase2.hxx> +#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGESTURERECOGNIZER_HPP_ +#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> +#endif + +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> #endif #ifndef _SV_WINDOW_HXX #include <window.hxx> #endif -class DNDEventDispatcher: public ::cppu::WeakImplHelper2< +class DNDEventDispatcher: public ::cppu::WeakImplHelper3< ::com::sun::star::datatransfer::dnd::XDropTargetListener, - ::com::sun::star::datatransfer::dnd::XDropTargetDragContext > + ::com::sun::star::datatransfer::dnd::XDropTargetDragContext, + ::com::sun::star::datatransfer::dnd::XDragGestureListener > { Window * m_pTopWindow; Window * m_pCurrentWindow; @@ -108,6 +113,9 @@ class DNDEventDispatcher: public ::cppu::WeakImplHelper2< const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable ) throw(::com::sun::star::uno::RuntimeException); + sal_Int32 fireDragGestureEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& xSource, + const ::com::sun::star::uno::Any event, const Point& rOrigin, const sal_Int8 nDragAction )throw(::com::sun::star::uno::RuntimeException); + public: DNDEventDispatcher( Window * pTopWindow ); @@ -131,6 +139,13 @@ public: virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException); /* + * XDragGestureListener + */ + + virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw(::com::sun::star::uno::RuntimeException); + + + /* * XEventListener */ |