summaryrefslogtreecommitdiff
path: root/dtrans/test
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2001-03-30 14:37:32 +0000
committerJoachim Lingner <jl@openoffice.org>2001-03-30 14:37:32 +0000
commit226f5a8f120d235879d204bfbee3d45d927660f0 (patch)
tree87964c8fe1350b5f3610d3fb2373933dcbfeaa7a /dtrans/test
parent1a9bce9e32a502f74e6ed115d914bc516387a108 (diff)
*** empty log message ***
Diffstat (limited to 'dtrans/test')
-rw-r--r--dtrans/test/win32/dnd/atlwindow.cxx76
-rw-r--r--dtrans/test/win32/dnd/atlwindow.hxx9
-rw-r--r--dtrans/test/win32/dnd/dndTest.cxx7
-rw-r--r--dtrans/test/win32/dnd/makefile.mk13
4 files changed, 67 insertions, 38 deletions
diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx
index 415332775b23..5d5812f7b25c 100644
--- a/dtrans/test/win32/dnd/atlwindow.cxx
+++ b/dtrans/test/win32/dnd/atlwindow.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: atlwindow.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jl $ $Date: 2001-02-26 15:29:45 $
+ * last change: $Author: jl $ $Date: 2001-03-30 15:37:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,7 +71,7 @@
#include "atlwindow.hxx"
#include "targetlistener.hxx"
#include "sourcelistener.hxx"
-#include "transferable.hxx"
+//#include "transferable.hxx"
#include <map>
#include <winbase.h>
@@ -202,31 +202,53 @@ LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled
ZeroMemory( pBuffer, length + 1);
::SendMessageA( m_hwndEdit, WM_GETTEXT, length, (LPARAM) pBuffer);
-
- // call XDragSource::executeDrag from an MTA
- if( m_isMTA )
- {
- DWORD mtaThreadId;
- ThreadData data;
- data.source= m_xDragSource;
- data.transferable= static_cast<XTransferable*>( new CTransferable( A2W(pBuffer)));
- data.evtThreadReady= CreateEvent( NULL, FALSE, FALSE, NULL);
-
- HANDLE hThread= CreateThread( NULL, 0, MTAFunc, &data, 0, &mtaThreadId);
- // We must wait until the thread copied the ThreadData structure
- WaitForSingleObject( data.evtThreadReady, INFINITE);
- CloseHandle( data.evtThreadReady);
- }
- else
+ IDataObject* pData= NULL;
+ HRESULT hr= CreateDataCache( NULL, CLSID_NULL, __uuidof(IDataObject),(void**) &pData);
+ if( pData)
{
- Reference<XTransferable> data( static_cast<XTransferable*>( new CTransferable( A2W(pBuffer))) );
-
- m_xDragSource->startDrag( DragGestureEvent(),
- ACTION_LINK|ACTION_MOVE|ACTION_COPY,
- 0,
- 0,
- data,
- Reference<XDragSourceListener>( static_cast<XDragSourceListener*>(new DragSourceListener() ) ) );
+ FORMATETC format={ CF_TEXT, NULL, DVASPECT_CONTENT, -1, };
+
+ HGLOBAL mem= GlobalAlloc(GHND, length + 1 );
+ void* pMem= GlobalLock( mem);
+ memcpy( pMem, pBuffer, length+1);
+ GlobalUnlock( mem);
+
+ STGMEDIUM medium;
+ medium.tymed= TYMED_HGLOBAL;
+ medium.hGlobal= mem;
+ medium.pUnkForRelease= NULL;
+
+ pData->SetData( &format, &medium, TRUE); // releases HGLOBAL eventually
+
+ Reference<XTransferable> xTrans= m_aDataConverter.createTransferableFromDataObj(
+ MultiServiceFactory, pData);
+
+ // call XDragSource::executeDrag from an MTA
+ if( m_isMTA )
+ {
+ DWORD mtaThreadId;
+ ThreadData data;
+ data.source= m_xDragSource;
+ data.transferable= xTrans;
+
+ data.evtThreadReady= CreateEvent( NULL, FALSE, FALSE, NULL);
+
+ HANDLE hThread= CreateThread( NULL, 0, MTAFunc, &data, 0, &mtaThreadId);
+ // We must wait until the thread copied the ThreadData structure
+ WaitForSingleObject( data.evtThreadReady, INFINITE);
+ CloseHandle( data.evtThreadReady);
+
+
+ }
+ else
+ {
+ m_xDragSource->startDrag( DragGestureEvent(),
+ ACTION_LINK|ACTION_MOVE|ACTION_COPY,
+ 0,
+ 0,
+ xTrans,
+ Reference<XDragSourceListener>( static_cast<XDragSourceListener*>(new DragSourceListener() ) ) );
+ }
}
delete[] pBuffer;
diff --git a/dtrans/test/win32/dnd/atlwindow.hxx b/dtrans/test/win32/dnd/atlwindow.hxx
index e09fc7bd0bb5..bfebf18e5add 100644
--- a/dtrans/test/win32/dnd/atlwindow.hxx
+++ b/dtrans/test/win32/dnd/atlwindow.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: atlwindow.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jl $ $Date: 2001-02-08 15:09:23 $
+ * last change: $Author: jl $ $Date: 2001-03-30 15:37:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,9 @@ extern CComModule _Module;
#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
#include <com/sun/star/uno/Reference.h>
+#include "../../source/inc/DtObjFactory.hxx"
+
+
using namespace com::sun::star::uno;
using namespace com::sun::star::datatransfer::dnd;
using namespace com::sun::star::datatransfer;
@@ -89,6 +92,8 @@ class AWindow: public CWindowImpl<AWindow, CWindow,
HWND m_hwndEdit;
+ CDTransObjFactory m_aDataConverter;
+
public:
AWindow(LPCTSTR strName)
{
diff --git a/dtrans/test/win32/dnd/dndTest.cxx b/dtrans/test/win32/dnd/dndTest.cxx
index ec1134611085..6dda3002f64b 100644
--- a/dtrans/test/win32/dnd/dndTest.cxx
+++ b/dtrans/test/win32/dnd/dndTest.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dndTest.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jl $ $Date: 2001-02-26 15:29:45 $
+ * last change: $Author: jl $ $Date: 2001-03-30 15:37:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,7 +74,8 @@ CComModule _Module;
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <rtl/process.h>
-#include "transferable.hxx"
+#include <cppuhelper/servicefactory.hxx>
+//#include "transferable.hxx"
#include "sourcelistener.hxx"
diff --git a/dtrans/test/win32/dnd/makefile.mk b/dtrans/test/win32/dnd/makefile.mk
index da96d01fe450..f1b2c18670fb 100644
--- a/dtrans/test/win32/dnd/makefile.mk
+++ b/dtrans/test/win32/dnd/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: jl $ $Date: 2001-02-20 12:55:53 $
+# last change: $Author: jl $ $Date: 2001-03-30 15:37:32 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -113,8 +113,6 @@ APP1TARGET= $(TARGET)
APP1OBJS= $(OBJ)$/dndTest.obj \
$(OBJ)$/atlwindow.obj \
$(OBJ)$/targetlistener.obj \
- $(SLO)$/implhelper.obj \
- $(OBJ)$/transferable.obj \
$(OBJ)$/sourcelistener.obj
LIBCIMT=msvcrtd.lib
@@ -128,13 +126,16 @@ APP1STDLIBS= \
ole32.lib \
comsupp.lib \
oleaut32.lib \
- gdi32.lib \
- $(LB)$/dtutils.lib
+ gdi32.lib \
+ uuid.lib
APP1LIBS= \
$(SOLARLIBDIR)$/imtaolecb.lib\
$(SOLARLIBDIR)$/user9x.lib\
$(SOLARLIBDIR)$/tools32.lib\
+ $(SLB)$/dtobjfact.lib \
+ $(SLB)$/dtutils.lib
+