2001-02-05 08:45:05 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: dndevdis.cxx,v $
|
|
|
|
*
|
2001-06-15 08:25:10 +00:00
|
|
|
* $Revision: 1.6 $
|
2001-02-05 08:45:05 +00:00
|
|
|
*
|
2001-06-15 08:25:10 +00:00
|
|
|
* last change: $Author: pb $ $Date: 2001-06-15 09:25:10 $
|
2001-02-05 08:45:05 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <dndevdis.hxx>
|
|
|
|
#include <dndlcon.hxx>
|
|
|
|
|
|
|
|
#include <vos/mutex.hxx>
|
|
|
|
#include <svapp.hxx>
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
using namespace ::osl;
|
2001-02-05 08:45:05 +00:00
|
|
|
using namespace ::vos;
|
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::datatransfer;
|
|
|
|
using namespace ::com::sun::star::datatransfer::dnd;
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::DNDEventDispatcher
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
DNDEventDispatcher::DNDEventDispatcher( Window * pTopWindow ):
|
|
|
|
m_pTopWindow( pTopWindow ),
|
|
|
|
m_pCurrentWindow( NULL )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::~DNDEventDispatcher
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
DNDEventDispatcher::~DNDEventDispatcher()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::drop
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde )
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2001-02-12 11:26:06 +00:00
|
|
|
MutexGuard aImplGuard( m_aMutex );
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
Point location( dtde.LocationX, dtde.LocationY );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// find the window that is toplevel for this coordinates
|
2001-02-12 11:26:06 +00:00
|
|
|
OClearableGuard aSolarGuard( Application::GetSolarMutex() );
|
2001-02-05 08:45:05 +00:00
|
|
|
Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
|
2001-06-15 08:25:10 +00:00
|
|
|
|
|
|
|
if( NULL == pChildWindow )
|
|
|
|
pChildWindow = m_pTopWindow;
|
|
|
|
|
|
|
|
while( pChildWindow->ImplGetClientWindow() )
|
|
|
|
pChildWindow = pChildWindow->ImplGetClientWindow();
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
aSolarGuard.clear();
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// handle the case that drop is in an other vcl window than the last dragOver
|
|
|
|
if( pChildWindow != m_pCurrentWindow )
|
|
|
|
{
|
|
|
|
// fire dragExit on listeners of previous window
|
2001-02-12 11:26:06 +00:00
|
|
|
fireDragExitEvent( m_pCurrentWindow );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
fireDragEnterEvent( pChildWindow, static_cast < XDropTargetDragContext * > (this),
|
|
|
|
dtde.DropAction, location, dtde.SourceActions, m_aDataFlavorList );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 nListeners = 0;
|
|
|
|
|
|
|
|
// send drop event to the child window
|
2001-02-12 11:26:06 +00:00
|
|
|
nListeners = fireDropEvent( pChildWindow, dtde.Context, dtde.DropAction,
|
|
|
|
location, dtde.SourceActions, dtde.Transferable );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// reject drop if no listeners found
|
2001-02-09 14:59:18 +00:00
|
|
|
if( nListeners == 0 ) {
|
|
|
|
OSL_TRACE( "rejecting drop due to missing listeners." );
|
|
|
|
dtde.Context->rejectDrop();
|
|
|
|
}
|
2001-02-12 11:26:06 +00:00
|
|
|
|
|
|
|
// this is a drop -> no further drag overs
|
|
|
|
m_pCurrentWindow = NULL;
|
|
|
|
m_aDataFlavorList.realloc( 0 );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::dragEnter
|
|
|
|
//==================================================================================================
|
|
|
|
|
2001-02-09 14:59:18 +00:00
|
|
|
void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtdee )
|
2001-02-05 08:45:05 +00:00
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2001-02-12 11:26:06 +00:00
|
|
|
MutexGuard aImplGuard( m_aMutex );
|
2001-02-20 10:17:45 +00:00
|
|
|
Point location( dtdee.LocationX, dtdee.LocationY );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// find the window that is toplevel for this coordinates
|
2001-02-12 11:26:06 +00:00
|
|
|
OClearableGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
|
2001-06-15 08:25:10 +00:00
|
|
|
|
|
|
|
if( NULL == pChildWindow )
|
|
|
|
pChildWindow = m_pTopWindow;
|
|
|
|
|
|
|
|
while( pChildWindow->ImplGetClientWindow() )
|
|
|
|
pChildWindow = pChildWindow->ImplGetClientWindow();
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
aSolarGuard.clear();
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// assume pointer write operation to be atomic
|
|
|
|
m_pCurrentWindow = pChildWindow;
|
2001-02-12 11:26:06 +00:00
|
|
|
m_aDataFlavorList = dtdee.SupportedDataFlavors;
|
2001-02-05 08:45:05 +00:00
|
|
|
|
2001-02-09 14:59:18 +00:00
|
|
|
// fire dragEnter on listeners of current window
|
2001-02-12 11:26:06 +00:00
|
|
|
sal_Int32 nListeners = fireDragEnterEvent( pChildWindow, dtdee.Context, dtdee.DropAction, location,
|
|
|
|
dtdee.SourceActions, dtdee.SupportedDataFlavors );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// reject drag if no listener found
|
2001-02-09 14:59:18 +00:00
|
|
|
if( nListeners == 0 ) {
|
|
|
|
OSL_TRACE( "rejecting drag enter due to missing listeners." );
|
|
|
|
dtdee.Context->rejectDrag();
|
|
|
|
}
|
2001-02-12 11:26:06 +00:00
|
|
|
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::dragExit
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::dragExit( const DropTargetEvent& dte )
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2001-02-12 11:26:06 +00:00
|
|
|
MutexGuard aImplGuard( m_aMutex );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
fireDragExitEvent( m_pCurrentWindow );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
// reset member values
|
2001-02-05 08:45:05 +00:00
|
|
|
m_pCurrentWindow = NULL;
|
2001-02-12 11:26:06 +00:00
|
|
|
m_aDataFlavorList.realloc( 0 );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::dragOver
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde )
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2001-02-12 11:26:06 +00:00
|
|
|
MutexGuard aImplGuard( m_aMutex );
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
Point location( dtde.LocationX, dtde.LocationY );
|
2001-02-05 08:45:05 +00:00
|
|
|
sal_Int32 nListeners;
|
|
|
|
|
|
|
|
// find the window that is toplevel for this coordinates
|
2001-02-12 11:26:06 +00:00
|
|
|
OClearableGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
|
2001-06-15 08:25:10 +00:00
|
|
|
|
|
|
|
if( NULL == pChildWindow )
|
|
|
|
pChildWindow = m_pTopWindow;
|
|
|
|
|
|
|
|
while( pChildWindow->ImplGetClientWindow() )
|
|
|
|
pChildWindow = pChildWindow->ImplGetClientWindow();
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
aSolarGuard.clear();
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
if( pChildWindow != m_pCurrentWindow )
|
|
|
|
{
|
|
|
|
// fire dragExit on listeners of previous window
|
2001-02-12 11:26:06 +00:00
|
|
|
fireDragExitEvent( m_pCurrentWindow );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// remember new window
|
|
|
|
m_pCurrentWindow = pChildWindow;
|
|
|
|
|
|
|
|
// fire dragEnter on listeners of current window
|
2001-02-12 11:26:06 +00:00
|
|
|
nListeners = fireDragEnterEvent( pChildWindow, dtde.Context, dtde.DropAction, location,
|
|
|
|
dtde.SourceActions, m_aDataFlavorList );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-02-09 14:59:18 +00:00
|
|
|
// fire dragOver on listeners of current window
|
2001-02-12 11:26:06 +00:00
|
|
|
nListeners = fireDragOverEvent( pChildWindow, dtde.Context, dtde.DropAction, location,
|
|
|
|
dtde.SourceActions );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// reject drag if no listener found
|
|
|
|
if( nListeners == 0 )
|
2001-02-09 14:59:18 +00:00
|
|
|
{
|
|
|
|
OSL_TRACE( "rejecting drag over due to missing listeners." );
|
|
|
|
dtde.Context->rejectDrag();
|
|
|
|
}
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::dropActionChanged
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& dtde )
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
2001-02-12 11:26:06 +00:00
|
|
|
MutexGuard aImplGuard( m_aMutex );
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
Point location( dtde.LocationX, dtde.LocationY );
|
2001-02-05 08:45:05 +00:00
|
|
|
sal_Int32 nListeners;
|
|
|
|
|
|
|
|
// find the window that is toplevel for this coordinates
|
2001-02-12 11:26:06 +00:00
|
|
|
OClearableGuard aSolarGuard( Application::GetSolarMutex() );
|
|
|
|
Window * pChildWindow = m_pTopWindow->ImplFindWindow( location );
|
2001-06-15 08:25:10 +00:00
|
|
|
|
|
|
|
if( NULL == pChildWindow )
|
|
|
|
pChildWindow = m_pTopWindow;
|
|
|
|
|
|
|
|
while( pChildWindow->ImplGetClientWindow() )
|
|
|
|
pChildWindow = pChildWindow->ImplGetClientWindow();
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
aSolarGuard.clear();
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
if( pChildWindow != m_pCurrentWindow )
|
|
|
|
{
|
|
|
|
// fire dragExit on listeners of previous window
|
2001-02-12 11:26:06 +00:00
|
|
|
fireDragExitEvent( m_pCurrentWindow );
|
2001-02-05 08:45:05 +00:00
|
|
|
|
|
|
|
// remember new window
|
|
|
|
m_pCurrentWindow = pChildWindow;
|
|
|
|
|
|
|
|
// fire dragEnter on listeners of current window
|
2001-02-12 11:26:06 +00:00
|
|
|
nListeners = fireDragEnterEvent( pChildWindow, dtde.Context, dtde.DropAction, location,
|
|
|
|
dtde.SourceActions, m_aDataFlavorList );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// fire dropActionChanged on listeners of current window
|
2001-02-12 11:26:06 +00:00
|
|
|
nListeners = fireDropActionChangedEvent( pChildWindow, dtde.Context, dtde.DropAction, location,
|
|
|
|
dtde.SourceActions );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// reject drag if no listener found
|
|
|
|
if( nListeners == 0 )
|
2001-02-09 14:59:18 +00:00
|
|
|
{
|
|
|
|
OSL_TRACE( "rejecting dropActionChanged due to missing listeners." );
|
|
|
|
dtde.Context->rejectDrag();
|
|
|
|
}
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::disposing
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::disposing( const EventObject& eo )
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
2001-02-12 11:26:06 +00:00
|
|
|
// DNDEventDispatcher::acceptDrag
|
|
|
|
//==================================================================================================
|
|
|
|
|
2001-02-13 12:12:53 +00:00
|
|
|
void SAL_CALL DNDEventDispatcher::acceptDrag( sal_Int8 dropAction ) throw(RuntimeException)
|
2001-02-12 11:26:06 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::rejectDrag
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
void SAL_CALL DNDEventDispatcher::rejectDrag() throw(RuntimeException)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::fireDragEnterEvent
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
sal_Int32 DNDEventDispatcher::fireDragEnterEvent( Window *pWindow,
|
|
|
|
const Reference< XDropTargetDragContext >& xContext, const sal_Int8 nDropAction,
|
|
|
|
const Point& rLocation, const sal_Int8 nSourceActions, const Sequence< DataFlavor >& aFlavorList
|
|
|
|
)
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
|
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
OClearableGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
// query DropTarget from window
|
|
|
|
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
|
|
|
|
|
|
|
|
if( xDropTarget.is() )
|
|
|
|
{
|
|
|
|
// retrieve relative mouse position
|
|
|
|
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
|
|
|
|
aGuard.clear();
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragEnterEvent(
|
|
|
|
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions, aFlavorList );
|
2001-02-12 11:26:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::fireDragOverEvent
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
sal_Int32 DNDEventDispatcher::fireDragOverEvent( Window *pWindow,
|
|
|
|
const Reference< XDropTargetDragContext >& xContext, const sal_Int8 nDropAction,
|
|
|
|
const Point& rLocation, const sal_Int8 nSourceActions
|
|
|
|
)
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
|
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
OClearableGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
// query DropTarget from window
|
|
|
|
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
|
|
|
|
|
|
|
|
if( xDropTarget.is() )
|
|
|
|
{
|
|
|
|
// retrieve relative mouse position
|
|
|
|
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
|
|
|
|
aGuard.clear();
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragOverEvent(
|
|
|
|
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions );
|
2001-02-12 11:26:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::fireDragExitEvent
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
sal_Int32 DNDEventDispatcher::fireDragExitEvent( Window *pWindow ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
|
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
OClearableGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
// query DropTarget from window
|
|
|
|
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
|
|
|
|
|
|
|
|
aGuard.clear();
|
|
|
|
|
|
|
|
if( xDropTarget.is() )
|
|
|
|
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDragExitEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::fireDropActionChangedEvent
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( Window *pWindow,
|
|
|
|
const Reference< XDropTargetDragContext >& xContext, const sal_Int8 nDropAction,
|
|
|
|
const Point& rLocation, const sal_Int8 nSourceActions
|
|
|
|
)
|
|
|
|
throw(RuntimeException)
|
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
|
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
OClearableGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
// query DropTarget from window
|
|
|
|
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
|
|
|
|
|
|
|
|
if( xDropTarget.is() )
|
|
|
|
{
|
|
|
|
// retrieve relative mouse position
|
|
|
|
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
|
|
|
|
aGuard.clear();
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDropActionChangedEvent(
|
|
|
|
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions );
|
2001-02-12 11:26:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
// DNDEventDispatcher::fireDropEvent
|
2001-02-05 08:45:05 +00:00
|
|
|
//==================================================================================================
|
|
|
|
|
2001-02-12 11:26:06 +00:00
|
|
|
sal_Int32 DNDEventDispatcher::fireDropEvent( Window *pWindow,
|
|
|
|
const Reference< XDropTargetDropContext >& xContext, const sal_Int8 nDropAction, const Point& rLocation,
|
|
|
|
const sal_Int8 nSourceActions, const Reference< XTransferable >& xTransferable
|
|
|
|
)
|
|
|
|
throw(RuntimeException)
|
2001-02-05 08:45:05 +00:00
|
|
|
{
|
|
|
|
sal_Int32 n = 0;
|
|
|
|
|
|
|
|
if( pWindow )
|
|
|
|
{
|
|
|
|
OClearableGuard aGuard( Application::GetSolarMutex() );
|
|
|
|
|
|
|
|
// query DropTarget from window
|
|
|
|
Reference< XDropTarget > xDropTarget = pWindow->GetDropTarget();
|
|
|
|
|
|
|
|
if( xDropTarget.is() )
|
|
|
|
{
|
|
|
|
// retrieve relative mouse position
|
2001-02-12 11:26:06 +00:00
|
|
|
Point relLoc = pWindow->ImplFrameToOutput( rLocation );
|
2001-02-05 08:45:05 +00:00
|
|
|
aGuard.clear();
|
|
|
|
|
2001-02-20 10:17:45 +00:00
|
|
|
n = static_cast < DNDListenerContainer * > ( xDropTarget.get() )->fireDropEvent(
|
|
|
|
xContext, nDropAction, relLoc.X(), relLoc.Y(), nSourceActions, xTransferable );
|
2001-02-05 08:45:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|