diff options
author | Kai Ahrens <ka@openoffice.org> | 2001-09-28 10:02:11 +0000 |
---|---|---|
committer | Kai Ahrens <ka@openoffice.org> | 2001-09-28 10:02:11 +0000 |
commit | 4829a4fb39cdbeab24c5cf298a574e982fa6aac3 (patch) | |
tree | cbed995a4747251489d2cc5470a361aa28a2866c /svtools/source/misc/transfer2.cxx | |
parent | new version for SRC641 (diff) | |
download | core-4829a4fb39cdbeab24c5cf298a574e982fa6aac3.tar.gz core-4829a4fb39cdbeab24c5cf298a574e982fa6aac3.zip |
#92523#: send drag event with release flag set
Diffstat (limited to 'svtools/source/misc/transfer2.cxx')
-rw-r--r-- | svtools/source/misc/transfer2.cxx | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index 5a7731c7515e..4c18188258bd 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: transfer2.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: ka $ $Date: 2001-08-14 14:45:02 $ + * last change: $Author: ka $ $Date: 2001-09-28 11:02:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -176,7 +176,8 @@ void DragSourceHelper::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) // ---------------------------------------- DropTargetHelper::DropTargetListener::DropTargetListener( DropTargetHelper& rDropTargetHelper ) : - mrParent( rDropTargetHelper ) + mrParent( rDropTargetHelper ), + mpLastDragOverEvent( NULL ) { } @@ -184,6 +185,7 @@ DropTargetHelper::DropTargetListener::DropTargetListener( DropTargetHelper& rDro DropTargetHelper::DropTargetListener::~DropTargetListener() { + delete mpLastDragOverEvent; } // ----------------------------------------------------------------------------- @@ -230,6 +232,12 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv rDTDE.Context->acceptDrop( nRet ); rDTDE.Context->dropComplete( DNDConstants::ACTION_NONE != nRet ); + + if( mpLastDragOverEvent ) + { + delete mpLastDragOverEvent; + mpLastDragOverEvent = NULL; + } } catch( const ::com::sun::star::uno::Exception& ) { @@ -255,13 +263,24 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragEnter( const DropTargetD // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEvent& dte ) throw( RuntimeException ) +void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDragEvent& rDTDE ) throw( RuntimeException ) { const ::vos::OGuard aGuard( Application::GetSolarMutex() ); try { - mrParent.ImplEndDrag(); + if( mpLastDragOverEvent ) + delete mpLastDragOverEvent; + + mpLastDragOverEvent = new AcceptDropEvent( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE ); + mpLastDragOverEvent->mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 ); + + const sal_Int8 nRet = mrParent.AcceptDrop( *mpLastDragOverEvent ); + + if( DNDConstants::ACTION_NONE == nRet ) + rDTDE.Context->rejectDrag(); + else + rDTDE.Context->acceptDrag( nRet ); } catch( const ::com::sun::star::uno::Exception& ) { @@ -270,27 +289,28 @@ void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEv // ----------------------------------------------------------------------------- -void SAL_CALL DropTargetHelper::DropTargetListener::dragOver( const DropTargetDragEvent& rDTDE ) throw( RuntimeException ) +void SAL_CALL DropTargetHelper::DropTargetListener::dragExit( const DropTargetEvent& dte ) throw( RuntimeException ) { const ::vos::OGuard aGuard( Application::GetSolarMutex() ); try { - AcceptDropEvent aEvt( rDTDE.DropAction & ~DNDConstants::ACTION_DEFAULT, Point( rDTDE.LocationX, rDTDE.LocationY ), rDTDE ); - aEvt.mbDefault = ( ( rDTDE.DropAction & DNDConstants::ACTION_DEFAULT ) != 0 ); - - const sal_Int8 nRet = mrParent.AcceptDrop( aEvt ); + if( mpLastDragOverEvent ) + { + mpLastDragOverEvent->mbLeaving = sal_True; + mrParent.AcceptDrop( *mpLastDragOverEvent ); + delete mpLastDragOverEvent; + mpLastDragOverEvent = NULL; + } - if( DNDConstants::ACTION_NONE == nRet ) - rDTDE.Context->rejectDrag(); - else - rDTDE.Context->acceptDrag( nRet ); + mrParent.ImplEndDrag(); } catch( const ::com::sun::star::uno::Exception& ) { } } + // ----------------------------------------------------------------------------- void SAL_CALL DropTargetHelper::DropTargetListener::dropActionChanged( const DropTargetDragEvent& dtde ) throw( RuntimeException ) |