summaryrefslogtreecommitdiff
path: root/dtrans
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2001-02-08 13:30:48 +0000
committerJoachim Lingner <jl@openoffice.org>2001-02-08 13:30:48 +0000
commit1cd01f7927034ab05418ccdb71b40713cd7211e3 (patch)
treec03a783f3bfd144805da29c9ca67e036083108ba /dtrans
parent0e8349c82a1539b10362ff9d78c7d3c1454f60bd (diff)
DTransHelper.cxx DTransHelper.hxx DataObjectWrapper.cxx DataObjectWrapper.hxx FmtTranslTbl.hxx ImplHelper.cxx ImplHelper.hxx TransferableWrapper.cxx TransferableWrapper.hxx TxtConvertHelper.cxx TxtConvertHelper.hxx dnd.xml dndentry.cxx globals.cxx globals.hxx makefile.mk source.cxx source.hxx sourcecontext.cxx sourcecontext.hxx target.cxx target.hxx targetdragcontext.cxx targetdragcontext.hxx targetdropcontext.cxx targetdropcontext.hxx
Diffstat (limited to 'dtrans')
-rw-r--r--dtrans/source/win32/dnd/dnd.xml2
-rw-r--r--dtrans/source/win32/dnd/dndentry.cxx76
-rw-r--r--dtrans/source/win32/dnd/globals.cxx4
-rw-r--r--dtrans/source/win32/dnd/globals.hxx27
-rw-r--r--dtrans/source/win32/dnd/makefile.mk10
-rw-r--r--dtrans/source/win32/dnd/source.cxx249
-rw-r--r--dtrans/source/win32/dnd/source.hxx62
-rw-r--r--dtrans/source/win32/dnd/sourcecontext.cxx89
-rw-r--r--dtrans/source/win32/dnd/sourcecontext.hxx26
-rw-r--r--dtrans/source/win32/dnd/target.cxx68
-rw-r--r--dtrans/source/win32/dnd/target.hxx35
-rw-r--r--dtrans/source/win32/dnd/targetdragcontext.cxx8
-rw-r--r--dtrans/source/win32/dnd/targetdragcontext.hxx8
-rw-r--r--dtrans/source/win32/dnd/targetdropcontext.cxx28
-rw-r--r--dtrans/source/win32/dnd/targetdropcontext.hxx16
15 files changed, 501 insertions, 207 deletions
diff --git a/dtrans/source/win32/dnd/dnd.xml b/dtrans/source/win32/dnd/dnd.xml
index 7bab1af4a290..88315256c86e 100644
--- a/dtrans/source/win32/dnd/dnd.xml
+++ b/dtrans/source/win32/dnd/dnd.xml
@@ -53,6 +53,8 @@
<Type> com.sun.star.uno.XWeak </Type>
<Type> com.sun.star.uno.XAggregation </Type>
<Type> com.sun.star.registry.XRegistryKey </Type>
+<Type> com.sun.star.awt.MouseButton </Type>
+<Type> com.sun.star.awt.MouseEvent </Type>
</COMPONENTDESCRIPTION>
diff --git a/dtrans/source/win32/dnd/dndentry.cxx b/dtrans/source/win32/dnd/dndentry.cxx
index dccc1f001ad3..f4cb30ffc666 100644
--- a/dtrans/source/win32/dnd/dndentry.cxx
+++ b/dtrans/source/win32/dnd/dndentry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dndentry.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:15 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -58,9 +58,6 @@
*
*
************************************************************************/
-//______________________________________________________________________________________________________________
-// includes of other projects
-//______________________________________________________________________________________________________________
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
@@ -75,44 +72,28 @@
#endif
#include "source.hxx"
-//-----------------------------------------------------------------
-// some defines
-//-----------------------------------------------------------------
-
-
-
-//-----------------------------------------------------------------------------------------------------------
-// namespace directives
-//-----------------------------------------------------------------------------------------------------------
+#include "target.hxx"
using namespace ::rtl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::registry ;
using namespace ::cppu ;
using namespace ::com::sun::star::lang;
-//using namespace ::com::sun::star::datatransfer::clipboard;
-//-----------------------------------------------------------------
-// create a static object to initialize the shell9x library
-//-----------------------------------------------------------------
-//-----------------------------------------------------------------------------------------------------------
-// functions to create a new Clipboad instance; is needed by factory helper implementation
-// @param rServiceManager - service manager, useful if the component needs other uno services
-// so we should give it to every UNO-Implementation component
-//-----------------------------------------------------------------------------------------------------------
-
Reference< XInterface > SAL_CALL createDragSource( const Reference< XMultiServiceFactory >& rServiceManager )
{
DragSource* pSource= new DragSource( rServiceManager );
return Reference<XInterface>( static_cast<XInitialization*>(pSource), UNO_QUERY);
}
+Reference< XInterface > SAL_CALL createDropTarget( const Reference< XMultiServiceFactory >& rServiceManager )
+{
+ DropTarget* pTarget= new DropTarget( rServiceManager );
+ return Reference<XInterface>( static_cast<XInitialization*>(pTarget), UNO_QUERY);
+}
-//-----------------------------------------------------------------------------------------------------------
-// the 3 important functions which will be exported
-//-----------------------------------------------------------------------------------------------------------
extern "C"
{
@@ -143,6 +124,10 @@ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey
try
{
Reference< XRegistryKey > pXNewKey( static_cast< XRegistryKey* >( pRegistryKey ) );
+ pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( DNDSOURCE_REGKEY_NAME ) ) );
+ bRetVal = sal_True;
+
+ pXNewKey= static_cast< XRegistryKey* >( pRegistryKey );
pXNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( DNDTARGET_REGKEY_NAME ) ) );
bRetVal = sal_True;
}
@@ -164,28 +149,37 @@ sal_Bool SAL_CALL component_writeInfo( void* pServiceManager, void* pRegistryKey
void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey )
{
void* pRet = 0;
+ Reference< XSingleServiceFactory > xFactory;
- if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) )
+ if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDSOURCE_IMPL_NAME ) ) )
{
Sequence< OUString > aSNS( 1 );
- aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( DNDTARGET_SERVICE_NAME ) );
+ aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( DNDSOURCE_SERVICE_NAME ) );
-// Reference< XSingleServiceFactory > xFactory ( createSingleFactory(
-// reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
-// OUString::createFromAscii( pImplName ),
-// createDragSource,
-// aSNS ) );
- Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory(
+ xFactory= createSingleFactory(
reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
OUString::createFromAscii( pImplName ),
createDragSource,
- aSNS));
+ aSNS);
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
+ }
+ else if( pSrvManager && ( 0 == rtl_str_compare( pImplName, DNDTARGET_IMPL_NAME ) ) )
+ {
+ Sequence< OUString > aSNS( 1 );
+ aSNS.getArray( )[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( DNDTARGET_SERVICE_NAME ) );
+
+ xFactory= createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ),
+ OUString::createFromAscii( pImplName ),
+ createDropTarget,
+ aSNS);
+
+ }
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
}
return pRet;
diff --git a/dtrans/source/win32/dnd/globals.cxx b/dtrans/source/win32/dnd/globals.cxx
index 12af71a6382d..be169bc52dc1 100644
--- a/dtrans/source/win32/dnd/globals.cxx
+++ b/dtrans/source/win32/dnd/globals.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: globals.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:16 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/dtrans/source/win32/dnd/globals.hxx b/dtrans/source/win32/dnd/globals.hxx
index daf7a1ab3573..04ae97f32b06 100644
--- a/dtrans/source/win32/dnd/globals.hxx
+++ b/dtrans/source/win32/dnd/globals.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: globals.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:16 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,9 +61,24 @@
#ifndef _GLOBALS_HXX_
#define _GLOBALS_HXX_
+#ifndef _OSL_MUTEX_H_
+#include <osl/mutex.hxx>
+#endif
+
#include <wtypes.h>
#include <sal/types.h>
+
+#define DNDSOURCE_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDragAndDropSource"
+#define DNDSOURCE_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDragAndDropSource_V1"
+#define DNDSOURCE_REGKEY_NAME "/com.sun.star.comp.datatransfer.dnd.OleDragAndDropSource_V1/UNO/SERVICES/com.sun.star.datatransfer.dnd.OleDragAndDropSource"
+
+#define DNDTARGET_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDragAndDropTarget"
+#define DNDTARGET_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDragAndDropTarget_V1"
+#define DNDTARGET_REGKEY_NAME "/com.sun.star.comp.datatransfer.dnd.OleDragAndDropTarget_V1/UNO/SERVICES/com.sun.star.datatransfer.dnd.OleDragAndDropTarget"
+
+
+
// This maps key states as occur as parameter, e.g. in IDropTarget::DragEnter,
// IDropSource::QueryContinueDrag, to actions as are declared in
// com::sun::star::datatransfer::dnd::DNDConstants ( ACTION_MOVE etc).
@@ -98,4 +113,12 @@ DWORD dndActionsToDropEffects( sal_Int8 actions);
// or Alt).
DWORD dndActionsToSingleDropEffect( sal_Int8 actions);
+
+
+struct MutexDummy
+{
+ osl::Mutex m_mutex;
+};
+
+
#endif \ No newline at end of file
diff --git a/dtrans/source/win32/dnd/makefile.mk b/dtrans/source/win32/dnd/makefile.mk
index b2e3cef7aadc..095b1530f9ff 100644
--- a/dtrans/source/win32/dnd/makefile.mk
+++ b/dtrans/source/win32/dnd/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1.1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: mh $ $Date: 2001-01-31 15:37:17 $
+# last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -84,7 +84,11 @@ stoponerror=tr
.INCLUDE : ..$/..$/cppumaker.mk
-CFLAGS+=/GR -DUNICODE -D_UNICODE
+#CFLAGS+=/GR -DUNICODE -D_UNICODE
+
+#DBG_CONSOLE_OUT: when IDropTarget or IDropSource are called we write to a console
+#DBG_CLIPBOARD_DATA: To provide DoDragDrop with an data object we call OleGetClipboard
+CFLAGS+= -DDBG_CONSOLE_OUT
SLOFILES= $(OBJ)$/dndentry.obj \
$(OBJ)$/target.obj \
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx
index 32c038bf972a..0c73f9ec9407 100644
--- a/dtrans/source/win32/dnd/source.cxx
+++ b/dtrans/source/win32/dnd/source.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: source.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:17 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,13 +65,23 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_XTRANSFERABLE_HPP_
#include <com/sun/star/datatransfer/XTransferable.hpp>
#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
+#include <com/sun/star/awt/MouseButton.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include <com/sun/star/awt/MouseEvent.hpp>
+#endif
+
#include "source.hxx"
-#include "target.hxx"
#include "globals.hxx"
#include "sourcecontext.hxx"
#include "TransferableWrapper.hxx"
#include <rtl/ustring.h>
+#include <comdef.h>
+#include <process.h>
+#include <winuser.h>
+#include <stdio.h>
using namespace rtl;
using namespace cppu;
@@ -80,10 +90,19 @@ using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::datatransfer::dnd::DNDConstants;
using namespace com::sun::star::uno;
+using namespace com::sun::star::awt::MouseButton;
+using namespace com::sun::star::awt;
+using namespace com::sun::star::lang;
+
+DWORD WINAPI DndOleSTAFunc(LPVOID pParams);
+
DragSource::DragSource( const Reference<XMultiServiceFactory>& sf):
m_serviceFactory( sf),
- WeakComponentImplHelper3<XInitialization,XDragSource,XDropTargetFactory>(m_mutex)
+ WeakComponentImplHelper2< XDragSource, XInitialization >(m_mutex),
+ m_pcurrentContext_impl(0),
+ m_hAppWindow(0),
+ m_MouseButton(0)
{
}
@@ -97,6 +116,9 @@ DragSource::~DragSource()
void SAL_CALL DragSource::initialize( const Sequence< Any >& aArguments )
throw(Exception, RuntimeException)
{
+ if( aArguments.getLength() >=2)
+ m_hAppWindow= *(HWND*)aArguments[1].getValue();
+ OSL_ASSERT( IsWindow( m_hAppWindow) );
}
// XDragSource
@@ -112,7 +134,8 @@ sal_Int32 SAL_CALL DragSource::getDefaultCursor( sal_Int8 dragAction )
return 0;
}
-void SAL_CALL DragSource::startDrag( const DragGestureEvent& trigger,
+// Notifies the XDragSourceListener by calling dragDropEnd
+void SAL_CALL DragSource::executeDrag( const DragGestureEvent& trigger,
sal_Int8 sourceActions,
sal_Int32 cursor,
sal_Int32 image,
@@ -120,32 +143,116 @@ void SAL_CALL DragSource::startDrag( const DragGestureEvent& trigger,
const Reference<XDragSourceListener >& listener )
throw( InvalidDNDOperationException, RuntimeException)
{
- m_sourceListener= listener;
+ // The actions supported by the drag source
m_sourceActions= sourceActions;
+ // We need the to know which mouse button triggered the operation.
+ // If it was the left one, then the drop occurs when that button
+ // has been released and if it was the right one then the drop
+ // occurs when the right button has been released. If the event is not
+ // set then we assume that the left button is pressed.
+ MouseEvent evtMouse;
+ trigger.Event >>= evtMouse;
+ m_MouseButton= evtMouse.Buttons;
+
+ // The SourceContext class administers the XDragSourceListener s and
+ // fires events to them. An instance only exists in the scope of this
+ // functions. However, the drag and drop operation causes callbacks
+ // to the IDropSource interface implemented in this class (but only
+ // while this function executes). The source context is also used
+ // in DragSource::QueryContinueDrag.
+ m_pcurrentContext_impl= new SourceContext(
+ static_cast<DragSource*>(this), listener );
+ m_currentContext= static_cast<XDragSourceContext*>( m_pcurrentContext_impl);
+
+ // Convert the XTransferable data object into an IDataObject object;
+#ifdef DBG_CLIPBOARD_DATA
+ IDataObject* pData;
+ OleGetClipboard( &pData);
+#else
+ IDataObject* pData= static_cast<IDataObject*>( new CXTDataObject( trans));
+#endif
+ pData->AddRef();
+
+ // Obtain the id of the thread that created the window
+ DWORD processId;
+ DWORD threadIdWindow= GetWindowThreadProcessId( m_hAppWindow, &processId);
- DWORD effect=0;
- HRESULT hr;
- hr= DoDragDrop(
- static_cast<IDataObject*>( new CXTDataObject( trans)),
- static_cast<IDropSource*>( this),
- dndActionsToDropEffects( sourceActions),
- &effect);
+ HRESULT hrDoDragDrop= DRAGDROP_S_CANCEL;
- DragSourceDropEvent e;
- if( hr == DRAGDROP_S_DROP)
+ // DoDragDrop needs an Ole STA appartment.
+ // Determine what kind of apartment this thread belongs to. If it is an OLE STA
+ // then we assume that this thread created the window. If not then the thread
+ // must be an MTA. All other cases are not handled.
+ HRESULT hrInit= OleInitialize( NULL);
+
+ DWORD dropEffect= 0;
+ if( hrInit == S_OK || hrInit == S_FALSE)
+ {
+ // OleInitialize has not been called before we called it. However if this
+ // is the thread of the window then we do DnD.
+ if( threadIdWindow == GetCurrentThreadId() )
{
- e.DropAction= dndOleDropEffectsToActions( effect);
- e.DropSuccess= sal_True;
+ hrDoDragDrop= DoDragDrop(
+ pData,
+ static_cast<IDropSource*>( this),
+ dndActionsToDropEffects( sourceActions),
+ &dropEffect);
}
else
- {
- e.DropAction= ACTION_NONE;
- e.DropSuccess= sal_False;
- }
- e.DragSourceContext= static_cast<XDragSourceContext*>( new SourceContext(
- static_cast<DragSource*>(this) ) );
- m_sourceListener->dragDropEnd( e);
+ OSL_ENSURE( false, "calling thread is nor the window thread and neither a MTA thread");
+ if( hrInit == S_OK)
+ OleUninitialize();
+ }
+ else if( hrInit == RPC_E_CHANGED_MODE)
+ {
+ // This function runs currently in an MTA, so we need to create an OLE STA
+ // thread in which we call DoDragDrop
+
+ // The structure contains all in an out parameter necessary for the
+ // DoDragDrop function and it is past as parameter to the thread function.
+ DndParams params;
+ params.data= pData;
+ params.source= static_cast<IDropSource*>( this);
+ // The effects ( DROPEFFECT ) that is supported by the source and which
+ // are passed as paramater to the DoDragDrop function
+ params.dwOkEffects= dndActionsToDropEffects( sourceActions);
+ // dwEffect is the effect which is choosen by the drop target ( IDropTarget).
+ // It is passed as argument to DoDragDrop
+ params.dwEffect= DROPEFFECT_NONE;
+ // The return value of DoDragDrop is copied to this member.
+ params.hr= S_OK;
+ // The thread id of the thread which created the window in which the drag & drop
+ // operation started.
+ params.threadIdCreator= threadIdWindow;
+ // We are currently running in an MTA. The window has been created in a different
+ // thread which must be an Ole STA.
+ DWORD idThread;
+ HANDLE holeThread= CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)DndOleSTAFunc,
+ &params, 0, &idThread);
+ // Is function shall only return when the drag and drop operation has finished.
+ // Therefore we wait for the termination of the thread we created above.
+ DWORD stat= WaitForSingleObject( holeThread, INFINITE);
+
+ hrDoDragDrop= params.hr;
+ dropEffect= params.dwEffect;
+ }
+ else
+ {
+ OSL_ASSERT( false);
+ }
+
+ OSL_ENSURE( hrDoDragDrop != E_INVALIDARG, "IDataObject impl does not contain valid data");
+
+
+ //Fire event
+ sal_Int8 action= hrDoDragDrop == DRAGDROP_S_DROP ? dndOleDropEffectsToActions( dropEffect) : ACTION_NONE;
+ m_pcurrentContext_impl->fire_dragDropEnd( hrDoDragDrop == DRAGDROP_S_DROP ? sal_True : sal_False,
+ ACTION_NONE);
+ // Destroy SourceContextslkfgj
+ m_currentContext= 0;
+ // Destroy the XTransferable wrapper
+ pData->Release();
}
#ifdef DEBUG
@@ -155,21 +262,10 @@ void SAL_CALL DragSource::release()
{
int a = m_refCount;
}
- WeakComponentImplHelper3<XInitialization,XDragSource,XDropTargetFactory>::release();
-
+ WeakComponentImplHelper2< XDragSource, XInitialization>::release();
}
#endif
-// XDropTargetFactory -------------------------------------------------------------------
-
-Reference<XDropTarget > SAL_CALL DragSource::createDropTarget( const Sequence< sal_Int8 >& windowId )
- throw( RuntimeException)
-{
- Sequence<sal_Int8>& seqWin= const_cast<Sequence<sal_Int8> & >( windowId);
- HWND h= *(HWND*) (const HWND*)seqWin.getConstArray();
- DropTarget* pTarget= new DropTarget(m_serviceFactory, h);
- return Reference<XDropTarget>(static_cast<XDropTarget*>( pTarget), UNO_QUERY);
-}
//IDropTarget ---------------------------------------------------------------------------
@@ -179,9 +275,9 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryInterface( REFIID riid, void **ppvOb
return E_POINTER;
*ppvObject= NULL;
- if( IsEqualGUID( riid, __uuidof( IUnknown)))
+ if( riid == __uuidof( IUnknown) )
*ppvObject= static_cast<IUnknown*>( this);
- else if ( IsEqualGUID( riid, __uuidof( IDropSource)))
+ else if ( riid == __uuidof( IDropSource) )
*ppvObject= static_cast<IDropSource*>( this);
if(*ppvObject)
@@ -219,24 +315,81 @@ HRESULT STDMETHODCALLTYPE DragSource::QueryContinueDrag(
}
else
{
- if (!(grfKeyState & MK_LBUTTON))
+ if( ( m_MouseButton == MouseButton::RIGHT && !(grfKeyState & MK_RBUTTON) ) ||
+ ( m_MouseButton == MouseButton::MIDDLE && !(grfKeyState & MK_MBUTTON) ) ||
+ ( m_MouseButton == MouseButton::LEFT && !(grfKeyState & MK_LBUTTON) ) ||
+ ( m_MouseButton == 0 && !(grfKeyState & MK_LBUTTON) ) )
{
-// DragSourceDropEvent e;
-// e.DropAction= dndOleKeysToAction(grfKeyState);
-// e.DropSuccess= sal_True;
-// e.DragSourceContext= static_cast<XDragSourceContext*>( new SourceContext(
-// static_cast<DragSource*>(this) ) );
-//
-// m_sourceListener->dragDropEnd( e);
-
retVal= DRAGDROP_S_DROP;
}
}
+
+ sal_Int8 dropAction= fEscapePressed ? ACTION_NONE :
+ ( m_sourceActions & dndOleKeysToAction( grfKeyState));
+ sal_Int8 userAction= fEscapePressed ? ACTION_NONE :
+ dndOleKeysToAction( grfKeyState);
+ m_pcurrentContext_impl->fire_dropActionChanged( dropAction, userAction);
+
+#if DBG_CONSOLE_OUT
+ printf("\nDragSource::QueryContinueDrag");
+#endif
return retVal;
}
HRESULT STDMETHODCALLTYPE DragSource::GiveFeedback(
/* [in] */ DWORD dwEffect)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDragSource::GiveFeedback");
+#endif
+
return DRAGDROP_S_USEDEFAULTCURSORS;
-} \ No newline at end of file
+}
+
+
+
+// This function is called as extra thread from DragSource::executeDrag.
+// The function carries out a drag and drop operation by calling
+// DoDragDrop
+DWORD WINAPI DndOleSTAFunc(LPVOID pParams)
+{
+ // The structure contains all arguments for DoDragDrop and other
+ DndParams *params= (DndParams*)pParams;
+ // Drag and drop only works in a thread in which OleInitialize is called.
+ params->hr= OleInitialize( NULL);
+ if( SUCCEEDED( params->hr) )
+ {
+ // We force the creation of a thread message queue. This is necessary
+ // for a later call to AttachThreadInput
+ MSG msgtemp;
+ PeekMessage( &msgtemp, NULL, WM_USER, WM_USER, PM_NOREMOVE);
+
+ DWORD threadId= GetCurrentThreadId();
+ // This thread is attached to the thread that created the window. Hence
+ // this thread also receives all mouse and keyboard messages which are
+ // needed by DoDragDrop
+ AttachThreadInput( threadId , params->threadIdCreator, TRUE );
+
+#ifdef DBG_CLIPBOARD_DATA
+ IDataObject* pData;
+ OleGetClipboard( &pData);
+ params->data= pData;
+#endif
+
+ params->hr= DoDragDrop(
+ params->data,
+ params->source,
+ params->dwOkEffects,
+ &params->dwEffect);
+
+ // Detach this thread from the window thread
+ AttachThreadInput( threadId, params->threadIdCreator, FALSE);
+
+ OleUninitialize();
+ }
+ return 0;
+}
+
+
+
+
diff --git a/dtrans/source/win32/dnd/source.hxx b/dtrans/source/win32/dnd/source.hxx
index 55ebf6e95fc8..0c6c4b5b6bac 100644
--- a/dtrans/source/win32/dnd/source.hxx
+++ b/dtrans/source/win32/dnd/source.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: source.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:17 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,32 +68,21 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETFACTORY_HPP_
#include <com/sun/star/datatransfer/dnd/XDropTargetFactory.hpp>
#endif
+#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGSOURCECONTEXT_HPP_
+#include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
#include <com/sun/star/lang/XInitialization.hpp>
#endif
#ifndef _OSL_MUTEX_H_
#include <osl/mutex.hxx>
#endif
-#ifndef _CPPUHELPER_COMPBASE3_HXX_
-#include <cppuhelper/compbase3.hxx>
+#ifndef _CPPUHELPER_COMPBASE2_HXX_
+#include <cppuhelper/compbase2.hxx>
#endif
-
-
-#include <wtypes.h>
+#include "globals.hxx"
#include <oleidl.h>
-// the service names
-#define DNDTARGET_SERVICE_NAME "com.sun.star.datatransfer.dnd.OleDragAndDrop"
-
-// the implementation names
-#define DNDTARGET_IMPL_NAME "com.sun.star.comp.datatransfer.dnd.OleDragAndDrop_V1"
-
-// the registry key names
-// a key under which this service will be registered, Format: -> "/ImplName/UNO/SERVICES/ServiceName"
-// < Implementation-Name ></UNO/SERVICES/>< Service-Name
-// TargetW32 >
-#define DNDTARGET_REGKEY_NAME "/com.sun.star.comp.datatransfer.dnd.OleDragAndDrop_V1/UNO/SERVICES/com.sun.star.datatransfer.dnd.OleDragAndDrop"
-
using namespace ::com::sun::star::lang;
@@ -103,28 +92,42 @@ using namespace osl;
using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::datatransfer::dnd;
-struct MutexDummy
+
+struct DndParams
{
- Mutex m_mutex;
+ IDataObject* data;
+ IDropSource* source;
+ DWORD dwOkEffects;
+ DWORD dwEffect;
+ HRESULT hr;
+ DWORD threadIdCreator;
};
+class SourceContext;
// RIGHT MOUSE BUTTON drag and drop not supportet currently.
// ALT modifier is considered to effect a user selection of effects
class DragSource:
public MutexDummy,
- public WeakComponentImplHelper3<XInitialization, XDragSource,
- XDropTargetFactory>,
+ public WeakComponentImplHelper2<XDragSource, XInitialization>,
public IDropSource
{
Reference<XMultiServiceFactory> m_serviceFactory;
- Reference<XDragSourceListener > m_sourceListener;
+ // only valid for one dnd operation
+ // The context notifies the XDragSourceListener s
+ Reference<XDragSourceContext> m_currentContext;
+ SourceContext* m_pcurrentContext_impl;
+ // From com::sun::star::datatransfer::dnd::DNDConstants
sal_Int8 m_sourceActions;
+ HWND m_hAppWindow;
+
+ // The mouse button that set off the drag and drop operation
+ short m_MouseButton;
- DragSourcet();
+ DragSource();
DragSource(const DragSource&);
DragSource &operator= ( const DragSource&);
@@ -144,7 +147,7 @@ public:
virtual sal_Bool SAL_CALL isDragImageSupported( ) throw(RuntimeException);
virtual sal_Int32 SAL_CALL getDefaultCursor( sal_Int8 dragAction )
throw( IllegalArgumentException, RuntimeException);
- virtual void SAL_CALL startDrag( const DragGestureEvent& trigger,
+ virtual void SAL_CALL executeDrag( const DragGestureEvent& trigger,
sal_Int8 sourceActions,
sal_Int32 cursor,
sal_Int32 image,
@@ -152,7 +155,9 @@ public:
const Reference<XDragSourceListener >& listener )
throw( InvalidDNDOperationException, RuntimeException);
- // XDropTargetFactory
+
+
+
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
@@ -161,8 +166,6 @@ public:
virtual ULONG STDMETHODCALLTYPE Release( );
- virtual Reference<XDropTarget > SAL_CALL createDropTarget( const Sequence< sal_Int8 >& windowId )
- throw( RuntimeException);
// IDropSource
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
@@ -174,4 +177,5 @@ public:
};
+
#endif \ No newline at end of file
diff --git a/dtrans/source/win32/dnd/sourcecontext.cxx b/dtrans/source/win32/dnd/sourcecontext.cxx
index 92831ab7d24d..b6833ee9e1ed 100644
--- a/dtrans/source/win32/dnd/sourcecontext.cxx
+++ b/dtrans/source/win32/dnd/sourcecontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sourcecontext.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:18 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,26 +60,39 @@
************************************************************************/
-
-
-
+#ifndef _COM_SUN_STAR_DATATRANSFER_DND_DNDCONSTANTS_HPP_
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#endif
#include "sourcecontext.hxx"
-SourceContext::SourceContext( DragSource* pSource): m_pDragSource( pSource)
+using namespace com::sun::star::datatransfer::dnd;
+using namespace com::sun::star::datatransfer::dnd::DNDConstants;
+
+SourceContext::SourceContext( DragSource* pSource,
+ const Reference<XDragSourceListener>& listener):
+ WeakComponentImplHelper1<XDragSourceContext>(m_mutex),
+ m_pDragSource( pSource),
+ m_dragSource( static_cast<XDragSource*>( m_pDragSource) )
{
+#ifdef DEBUG
+ if( listener.is())
+#endif
+ rBHelper.addListener( ::getCppuType( &listener ), listener );
}
SourceContext::~SourceContext()
{
}
-void SAL_CALL SourceContext::addDragSourceListener( const Reference<XDragSourceListener >& dsl )
+void SAL_CALL SourceContext::addDragSourceListener(
+ const Reference<XDragSourceListener >& dsl )
throw( RuntimeException)
{
}
-void SAL_CALL SourceContext::removeDragSourceListener( const Reference<XDragSourceListener >& dsl )
+void SAL_CALL SourceContext::removeDragSourceListener(
+ const Reference<XDragSourceListener >& dsl )
throw( RuntimeException)
{
}
@@ -106,3 +119,63 @@ void SAL_CALL SourceContext::transferablesFlavorsChanged( )
}
+// non -interface functions
+// Fires XDragSourceListener::dragDropEnd events.
+void SourceContext::fire_dragDropEnd( sal_Bool success, sal_Int8 effect)
+{
+
+ DragSourceDropEvent e;
+
+ if( success == sal_True)
+ {
+ e.DropAction= effect;
+ e.DropSuccess= sal_True;
+ }
+ else
+ {
+ e.DropAction= ACTION_NONE;
+ e.DropSuccess= sal_False;
+ }
+ e.DragSource= m_dragSource;
+ e.DragSourceContext= static_cast<XDragSourceContext*>( this);
+ e.Source= Reference<XInterface>( static_cast<XDragSourceContext*>( this), UNO_QUERY);
+
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer(
+ getCppuType( (Reference<XDragSourceListener>* )0 ) );
+
+ if( pContainer)
+ {
+ OInterfaceIteratorHelper iter( *pContainer);
+ while( iter.hasMoreElements())
+ {
+ Reference<XDragSourceListener> listener(
+ static_cast<XDragSourceListener*>( iter.next()));
+ listener->dragDropEnd( e);
+ }
+ }
+}
+
+
+void SourceContext::fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction)
+{
+ DragSourceDragEvent e;
+ e.DropAction= dropAction;
+ e.UserAction= userAction;
+ e.DragSource= m_dragSource;
+ e.DragSourceContext= static_cast<XDragSourceContext*>( this);
+ e.Source= Reference<XInterface>( static_cast<XDragSourceContext*>( this), UNO_QUERY);
+
+ OInterfaceContainerHelper* pContainer= rBHelper.getContainer(
+ getCppuType( (Reference<XDragSourceListener>* )0 ) );
+
+ if( pContainer)
+ {
+ OInterfaceIteratorHelper iter( *pContainer);
+ while( iter.hasMoreElements())
+ {
+ Reference<XDragSourceListener> listener(
+ static_cast<XDragSourceListener*>( iter.next()));
+ listener->dropActionChanged( e);
+ }
+ }
+} \ No newline at end of file
diff --git a/dtrans/source/win32/dnd/sourcecontext.hxx b/dtrans/source/win32/dnd/sourcecontext.hxx
index 1c3124265256..e8d282db61ed 100644
--- a/dtrans/source/win32/dnd/sourcecontext.hxx
+++ b/dtrans/source/win32/dnd/sourcecontext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: sourcecontext.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:18 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,10 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGSOURCECONTEXT_HPP_
#include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
#endif
+#ifndef _CPPUHELPER_COMPBASE1_HXX_
+#include <cppuhelper/compbase1.hxx>
+#endif
+
#include "source.hxx"
@@ -76,16 +80,24 @@ using namespace ::cppu;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-class SourceContext: public WeakImplHelper1<XDragSourceContext>
+
+// This class fires events to XDragSourceListener implementations.
+// Of that interface only dragDropEnd and dropActionChanged are called.
+// The functions dragEnter, dragExit and dragOver are not supported
+// currently
+class SourceContext: public MutexDummy,
+ public WeakComponentImplHelper1<XDragSourceContext>
{
DragSource* m_pDragSource;
+ Reference<XDragSource> m_dragSource;
SourceContext();
SourceContext( const SourceContext&);
SourceContext &operator= (const SourceContext& );
+
public:
- SourceContext( DragSource* pSource);
+ SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener);
~SourceContext();
virtual void SAL_CALL addDragSourceListener( const Reference<XDragSourceListener >& dsl )
@@ -101,6 +113,12 @@ public:
virtual void SAL_CALL transferablesFlavorsChanged( )
throw( RuntimeException);
+
+
+ // non - interface functions
+ void fire_dragDropEnd( sal_Bool success, sal_Int8 byte);
+ void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction);
+
};
diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx
index ba3b711f152f..05b00076f003 100644
--- a/dtrans/source/win32/dnd/target.cxx
+++ b/dtrans/source/win32/dnd/target.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: target.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:19 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -65,7 +65,7 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_XTRANSFERABLE_HPP_
#include <com/sun/star/datatransfer/XTransferable.hpp>
#endif
-
+#include <stdio.h>
#include "target.hxx"
#include "globals.hxx"
#include "targetdropcontext.hxx"
@@ -80,20 +80,24 @@ using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::datatransfer::dnd::DNDConstants;
-DropTarget::DropTarget( const Reference<XMultiServiceFactory>& sf, HWND hwin):
- m_hWnd( hwin),
+DropTarget::DropTarget( const Reference<XMultiServiceFactory>& sf):
+ m_hWnd( NULL),
m_serviceFactory( sf),
- WeakComponentImplHelper1<XDropTarget>(m_mutex),
+ WeakComponentImplHelper2<XInitialization,XDropTarget>(m_mutex),
m_bDropTargetRegistered(sal_False),
m_nDefaultActions(ACTION_COPY|ACTION_MOVE|ACTION_LINK),
m_nListenerDropAction( ACTION_NONE),
m_currentEventId(0)
{
- OSL_ASSERT( IsWindow(m_hWnd));
}
DropTarget::~DropTarget()
{
+ if( m_bDropTargetRegistered)
+ {
+ RevokeDragDrop(m_hWnd);
+ CoLockObjectExternal( static_cast<IDropTarget*>(this), FALSE, TRUE);
+ }
}
@@ -104,38 +108,24 @@ void SAL_CALL DropTarget::release()
{
int a = m_refCount;
}
- WeakComponentImplHelper1<XDropTarget>::release();
+ WeakComponentImplHelper2<XInitialization, XDropTarget>::release();
}
#endif
-void SAL_CALL DropTarget::disposing()
+
+void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException)
{
- if( m_bDropTargetRegistered)
+ if( aArguments.getLength() > 0)
{
- RevokeDragDrop(m_hWnd);
- CoLockObjectExternal( static_cast<IDropTarget*>(this), FALSE, TRUE);
+ m_hWnd= *(HWND*)aArguments[0].getValue();
+ OSL_ASSERT( IsWindow( m_hWnd) );
}
}
-// XInitialization
-//void SAL_CALL DropTarget::initialize( const Sequence< Any >& aArguments )
-// throw(Exception, RuntimeException)
-//{
-//
-//
-// m_hWnd= *(HWND*)aArguments[0].getValue();
-// OSL_ASSERT( IsWindow(m_hWnd));
-//
-// if( ! IsWindow( m_hWnd))
-// throw Exception( OUString::createFromAscii("Initialization of DropTarget ")
-// + OUString( RTL_CONSTASCII_USTRINGPARAM( DNDTARGET_SERVICE_NAME) )
-// + OUString::createFromAscii("service failed"),
-// Reference<XInterface>((XInitialization*)this, UNO_QUERY));
-//
-//}
-
-// XDropTarget
+
+// XDropTarget ----------------------------------------------------------------
void SAL_CALL DropTarget::addDropTargetListener( const Reference< XDropTargetListener >& dtl )
throw(RuntimeException)
{
@@ -232,6 +222,11 @@ STDMETHODIMP DropTarget::DragEnter( IDataObject __RPC_FAR *pDataObj,
POINTL pt,
DWORD *pdwEffect)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDropTarget::DragEnter state: %x effect %d", grfKeyState, *pdwEffect);
+#endif
+
+
// Dont consider the allowed source action at this point. Because if pdwEffect is COPY
// and grfKeyState is only MK_LBUTTON ( default is ACTION_MOVE ) than we give the listener the chance to change
// the action to COPY or something. Otherwise the source would display a NONE from the beginning.
@@ -271,6 +266,7 @@ STDMETHODIMP DropTarget::DragEnter( IDataObject __RPC_FAR *pDataObj,
{
*pdwEffect= DROPEFFECT_NONE;
}
+
return S_OK;
}
@@ -278,6 +274,10 @@ STDMETHODIMP DropTarget::DragOver( DWORD grfKeyState,
POINTL pt,
DWORD *pdwEffect)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDropTarget::DragOver");
+#endif
+
// A listener can change this value during fire_dragOver
m_nListenerDropAction= getFilteredActions( grfKeyState);
@@ -327,6 +327,10 @@ STDMETHODIMP DropTarget::DragOver( DWORD grfKeyState,
STDMETHODIMP DropTarget::DragLeave( void)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDropTarget::DragLeave");
+#endif
+
m_currentData=0;
if( m_nDefaultActions != ACTION_NONE)
{
@@ -343,6 +347,10 @@ STDMETHODIMP DropTarget::Drop( IDataObject *pDataObj,
POINTL pt,
DWORD __RPC_FAR *pdwEffect)
{
+#if DBG_CONSOLE_OUT
+ printf("\nDropTarget::Drop");
+#endif
+
m_bDropComplete= sal_False;
m_nListenerDropAction= getFilteredActions( grfKeyState);
diff --git a/dtrans/source/win32/dnd/target.hxx b/dtrans/source/win32/dnd/target.hxx
index af2e28c10876..4c3370ab38ce 100644
--- a/dtrans/source/win32/dnd/target.hxx
+++ b/dtrans/source/win32/dnd/target.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: target.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:19 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,8 +67,8 @@
#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGET_HPP_
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#endif
-#ifndef _CPPUHELPER_COMPBASE1_HXX_
-#include <cppuhelper/compbase1.hxx>
+#ifndef _CPPUHELPER_COMPBASE2_HXX_
+#include <cppuhelper/compbase2.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
@@ -77,10 +77,8 @@
#include <osl/mutex.hxx>
#endif
-#include <wtypes.h>
#include <oleidl.h>
-#include "source.hxx"
-// the service names
+#include "globals.hxx"
using namespace ::com::sun::star::lang;
@@ -91,29 +89,22 @@ using namespace ::com::sun::star::datatransfer;
using namespace ::com::sun::star::datatransfer::dnd;
-
-//struct MutexDummy
-//{
-// Mutex m_mutex;
-//};
-
-
// DropTarget is a singleton, that is one cannot count on its destructor
// do do the cleanup because the factory will hold a reference. The client
// has to call XComponent::dispose before the HWND becomes invalid.
class DropTarget: public MutexDummy,
- public WeakComponentImplHelper1< XDropTarget>,
+ public WeakComponentImplHelper2< XInitialization, XDropTarget>,
public IDropTarget
{
private:
+ // The native window for which acts as drop target.
HWND m_hWnd; // set by initialize
- IDataObject* m_pData;
Reference<XMultiServiceFactory> m_serviceFactory;
sal_Bool m_bDropTargetRegistered;
sal_Int8 m_nDefaultActions;
- // This value is set when a XDropTargetListener calls acceptDrop or rejectDrop on
- // the XDropTargetDropContext or acceptDrag or rejectDrag on XDropTargetDragContext.
+ // This value is set when a XDropTargetListener calls accept or reject on
+ // the XDropTargetDropContext or XDropTargetDragContext.
// The values are from the DNDConstants group.
sal_Int8 m_nListenerDropAction;
Reference<XTransferable> m_currentData;
@@ -134,18 +125,16 @@ private:
DropTarget &operator= (DropTarget&);
public:
- DropTarget(const Reference<XMultiServiceFactory>& sf, HWND);
+ DropTarget(const Reference<XMultiServiceFactory>& sf);
virtual ~DropTarget();
#ifdef DEBUG
virtual void SAL_CALL release();
#endif
- // overriding WeakComponentImplHelper, called from XComponent::dispose
- void SAL_CALL disposing();
// XInitialization
-// virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
-// throw(Exception, RuntimeException);
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
+ throw(Exception, RuntimeException);
// XDropTarget
virtual void SAL_CALL addDropTargetListener( const Reference< XDropTargetListener >& dtl )
diff --git a/dtrans/source/win32/dnd/targetdragcontext.cxx b/dtrans/source/win32/dnd/targetdragcontext.cxx
index bcc137e25e1c..da37560b11fb 100644
--- a/dtrans/source/win32/dnd/targetdragcontext.cxx
+++ b/dtrans/source/win32/dnd/targetdragcontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdragcontext.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:19 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,13 +74,13 @@ TargetDragContext::~TargetDragContext()
m_pDropTarget->release();
}
-void SAL_CALL TargetDragContext::acceptDrag( sal_Int8 dragOperation )
+void SAL_CALL TargetDragContext::accept( sal_Int8 dragOperation )
throw(InvalidDNDOperationException, RuntimeException)
{
m_pDropTarget->_acceptDrag( dragOperation, m_id);
}
-void SAL_CALL TargetDragContext::rejectDrag( )
+void SAL_CALL TargetDragContext::reject( )
throw(InvalidDNDOperationException, RuntimeException)
{
m_pDropTarget->_rejectDrag( m_id);
diff --git a/dtrans/source/win32/dnd/targetdragcontext.hxx b/dtrans/source/win32/dnd/targetdragcontext.hxx
index 4648689dd577..0f3dbcf8a46d 100644
--- a/dtrans/source/win32/dnd/targetdragcontext.hxx
+++ b/dtrans/source/win32/dnd/targetdragcontext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdragcontext.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:19 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,9 +94,9 @@ public:
TargetDragContext( DropTarget* pTarget, sal_uInt32 id);
~TargetDragContext();
- virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation )
+ virtual void SAL_CALL accept( sal_Int8 dragOperation )
throw(InvalidDNDOperationException, RuntimeException);
- virtual void SAL_CALL rejectDrag( )
+ virtual void SAL_CALL reject( )
throw(InvalidDNDOperationException, RuntimeException);
virtual Sequence< DataFlavor > SAL_CALL getCurrentDataFlavors( )
throw(RuntimeException);
diff --git a/dtrans/source/win32/dnd/targetdropcontext.cxx b/dtrans/source/win32/dnd/targetdropcontext.cxx
index 4cbdc5aa96cd..4f4017c2f87a 100644
--- a/dtrans/source/win32/dnd/targetdropcontext.cxx
+++ b/dtrans/source/win32/dnd/targetdropcontext.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdropcontext.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:19 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,11 @@
#include "targetdropcontext.hxx"
+using namespace ::com::sun::star::datatransfer::dnd;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
TargetDropContext::TargetDropContext( DropTarget* p, sal_uInt32 id): m_id( id)
{
m_pDropTarget= p;
@@ -72,18 +77,31 @@ TargetDropContext::~TargetDropContext()
m_pDropTarget->release();
}
-void SAL_CALL TargetDropContext::acceptDrop( sal_Int8 dropOperation )
+void SAL_CALL TargetDropContext::accept( sal_Int8 dropOperation )
throw(InvalidDNDOperationException, RuntimeException)
{
m_pDropTarget->_acceptDrop( dropOperation, m_id);
}
-
-void SAL_CALL TargetDropContext::rejectDrop( )
+//
+void SAL_CALL TargetDropContext::reject( )
throw(InvalidDNDOperationException, RuntimeException)
{
m_pDropTarget->_rejectDrop( m_id);
}
+Sequence< DataFlavor > SAL_CALL TargetDropContext::getCurrentDataFlavors( )
+ throw(RuntimeException)
+{
+ return m_pDropTarget->_getCurrentDataFlavors( m_id);
+}
+
+sal_Bool SAL_CALL TargetDropContext::isDataFlavorSupported( const DataFlavor& df )
+ throw(RuntimeException)
+{
+ return m_pDropTarget->_isDataFlavorSupported( df, m_id);
+}
+
+
void SAL_CALL TargetDropContext::dropComplete( sal_Bool success )
throw(InvalidDNDOperationException, RuntimeException)
{
diff --git a/dtrans/source/win32/dnd/targetdropcontext.hxx b/dtrans/source/win32/dnd/targetdropcontext.hxx
index a79994d990de..07ea552aa523 100644
--- a/dtrans/source/win32/dnd/targetdropcontext.hxx
+++ b/dtrans/source/win32/dnd/targetdropcontext.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: targetdropcontext.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: mh $ $Date: 2001-01-31 15:37:20 $
+ * last change: $Author: jl $ $Date: 2001-02-08 14:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,10 +90,18 @@ public:
TargetDropContext( DropTarget* pTarget, sal_uInt32 id);
~TargetDropContext();
- virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation )
+ // XDropTargetDragContext
+ virtual void SAL_CALL accept( sal_Int8 dropOperation )
throw(InvalidDNDOperationException, RuntimeException);
- virtual void SAL_CALL rejectDrop( )
+ virtual void SAL_CALL reject( )
throw(InvalidDNDOperationException, RuntimeException);
+ virtual Sequence< DataFlavor > SAL_CALL getCurrentDataFlavors( )
+ throw(RuntimeException);
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& df )
+ throw(RuntimeException);
+
+
+ // XDropTargetDropContext (inherits XDropTargetDragContext)
virtual void SAL_CALL dropComplete( sal_Bool success )
throw(InvalidDNDOperationException, RuntimeException);
};