summaryrefslogtreecommitdiff
path: root/dtrans/test/win32
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2001-02-08 14:10:41 +0000
committerJoachim Lingner <jl@openoffice.org>2001-02-08 14:10:41 +0000
commit7e2fa34c09ce9240263c879d5e7c6d70b68eff31 (patch)
tree7a9ce474bb6f2b097875b2576689ff14ec837f19 /dtrans/test/win32
parent9a1f5d7901ca1726ec5b9d37acc8e729c17d34b4 (diff)
*** empty log message ***
Diffstat (limited to 'dtrans/test/win32')
-rw-r--r--dtrans/test/win32/dnd/atlwindow.cxx271
-rw-r--r--dtrans/test/win32/dnd/atlwindow.hxx129
-rw-r--r--dtrans/test/win32/dnd/dndTest.cxx169
-rw-r--r--dtrans/test/win32/dnd/makefile.mk151
-rw-r--r--dtrans/test/win32/dnd/targetlistener.cxx139
-rw-r--r--dtrans/test/win32/dnd/targetlistener.hxx101
-rw-r--r--dtrans/test/win32/dnd/transferable.cxx157
-rw-r--r--dtrans/test/win32/dnd/transferable.hxx181
8 files changed, 1298 insertions, 0 deletions
diff --git a/dtrans/test/win32/dnd/atlwindow.cxx b/dtrans/test/win32/dnd/atlwindow.cxx
new file mode 100644
index 000000000000..6d502165680c
--- /dev/null
+++ b/dtrans/test/win32/dnd/atlwindow.cxx
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * $RCSfile: atlwindow.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:09:05 $
+ *
+ * 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 <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTargetFactory.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <rtl/string.h>
+
+#include "atlwindow.hxx"
+#include "targetlistener.hxx"
+#include "transferable.hxx"
+#include <map>
+
+#include <winbase.h>
+using namespace com::sun::star::lang;
+using namespace com::sun::star::datatransfer::dnd;
+using namespace com::sun::star::datatransfer::dnd::DNDConstants;
+using namespace cppu;
+using namespace rtl;
+using namespace std;
+
+LRESULT APIENTRY EditSubclassProc( HWND hwnd, UINT uMsg,WPARAM wParam, LPARAM lParam) ;
+
+
+extern Reference< XMultiServiceFactory > MultiServiceFactory;
+DWORD WINAPI MTAFunc(LPVOID pParams);
+
+char* szSTAWin= "XDragSource::executeDrag is called from the same "
+ "OLE STA thread that created the window.";
+char* szMTAWin= "XDragSource::executeDrag is called from a MTA thread "
+ "that did not create the window.";
+
+WNDPROC wpOrigEditProc;
+
+map<HWND, HWND> mapEditToMainWnd;
+
+LRESULT AWindow::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ Reference<XComponent> xcompSource( m_xDragSource, UNO_QUERY);
+
+ PostQuitMessage(0);
+
+
+ m_xDropTarget=0;
+ m_xDragSource=0;
+
+
+ // Remove the subclass from the edit control.
+ ::SetWindowLong(m_hwndEdit, GWL_WNDPROC,
+ (LONG) wpOrigEditProc);
+
+ return 0;
+}
+
+
+LRESULT AWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ // Prepare the EDIT control
+
+ m_hwndEdit = CreateWindowA(
+ "EDIT", // predefined class
+ NULL, // no window title
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL |
+ ES_LEFT | ES_MULTILINE | ES_AUTOVSCROLL,
+ 0, 0, 0, 0, // set size in WM_SIZE message
+ m_hWnd, // parent window
+ (HMENU) NULL, // edit control ID
+ (HINSTANCE) GetWindowLong( GWL_HINSTANCE),
+ NULL);
+
+ // the map is used in the window procedure for the edit window to associate the
+ // it to the right main window ( AWindow)
+ mapEditToMainWnd[m_hwndEdit]= m_hWnd;
+ // Superclass the edit window, because we want to process mouse messages
+ wpOrigEditProc = (WNDPROC) ::SetWindowLongA(m_hwndEdit,
+ GWL_WNDPROC, (LONG) EditSubclassProc);
+
+
+ // Add text to the window.
+ if( m_isMTA)
+ ::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szMTAWin);
+ else
+ ::SendMessageA(m_hwndEdit, WM_SETTEXT, 0, (LPARAM) szSTAWin);
+// (LPARAM) lpszTrouble);
+
+
+ // create the DragSource
+ Reference< XInterface> xint= MultiServiceFactory->createInstance(OUString(L"com.sun.star.datatransfer.dnd.OleDragAndDropSource"));
+ m_xDragSource= Reference<XDragSource>( xint, UNO_QUERY);
+ Reference<XInitialization> xInit( xint, UNO_QUERY);
+
+ Any ar[2];
+ ar[1]<<= (sal_uInt32)m_hWnd;
+ xInit->initialize( Sequence<Any>( ar, 2) );
+
+ //create the DropTarget
+ Reference< XInterface> xintTarget= MultiServiceFactory->createInstance(OUString(L"com.sun.star.datatransfer.dnd.OleDragAndDropTarget"));
+ m_xDropTarget= Reference<XDropTarget>( xintTarget, UNO_QUERY);
+ Reference<XInitialization> xInitTarget( xintTarget, UNO_QUERY);
+
+ Any any;
+ any <<= (sal_uInt32)m_hWnd;
+ xInitTarget->initialize( Sequence<Any>( &any, 1) );
+
+
+ m_xDropTarget->addDropTargetListener( static_cast<XDropTargetListener*>
+ ( new DropTargetListener( m_hwndEdit)) );
+// // make this window tho a drop target
+ m_xDropTarget->setActive(sal_True);
+
+ return 0;
+}
+
+// When the mouse is dragged for a second than a drag is initiated
+LRESULT AWindow::OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ if( uMsg== WM_LBUTTONDOWN)
+ {
+ SetTimer( 1, 1000);
+ }
+
+ else if( uMsg == WM_LBUTTONUP)
+ {
+ KillTimer( 1);
+ }
+
+ return 0;
+}
+
+LRESULT AWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ HRESULT hr;
+ USES_CONVERSION;
+ KillTimer( 1);
+ if(m_xDragSource.is())
+ {
+
+ int length= (int)::SendMessageA( m_hwndEdit, WM_GETTEXTLENGTH, 0, 0);
+ char * pBuffer= new char[length + 1];
+ ZeroMemory( pBuffer, length + 1);
+ ::SendMessageA( m_hwndEdit, WM_GETTEXT, length, (LPARAM) pBuffer);
+
+
+ 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
+ {
+ Reference<XTransferable> data( static_cast<XTransferable*>( new CTransferable( A2W(pBuffer))) );
+
+ m_xDragSource->executeDrag( DragGestureEvent(),
+ ACTION_LINK|ACTION_MOVE|ACTION_COPY,
+ 0,
+ 0,
+ data,
+ Reference<XDragSourceListener>());
+ }
+
+ delete[] pBuffer;
+ }
+
+ return 0;
+}
+
+LRESULT AWindow::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ // Make the edit control the size of the window's
+ // client area.
+ ::MoveWindow(m_hwndEdit,
+ 0, 0, // starting x- and y-coordinates
+ LOWORD(lParam), // width of client area
+ HIWORD(lParam), // height of client area
+ TRUE); // repaint window
+
+ return 0;
+}
+LRESULT AWindow::OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+ ::SetFocus(m_hwndEdit);
+ return 0;
+}
+
+
+
+// Subclass procedure for EDIT window
+LRESULT APIENTRY EditSubclassProc( HWND hwnd, UINT uMsg,WPARAM wParam, LPARAM lParam)
+{
+
+ if( uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
+ {
+ HWND hAWindow= mapEditToMainWnd[hwnd];
+ ::SendMessage( hAWindow, uMsg, wParam, lParam);
+
+ }
+ return CallWindowProc( wpOrigEditProc, hwnd, uMsg,
+ wParam, lParam);
+}
+ \ No newline at end of file
diff --git a/dtrans/test/win32/dnd/atlwindow.hxx b/dtrans/test/win32/dnd/atlwindow.hxx
new file mode 100644
index 000000000000..e09fc7bd0bb5
--- /dev/null
+++ b/dtrans/test/win32/dnd/atlwindow.hxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: atlwindow.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:09:23 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _WINDOW_HXX_
+#define _WINDOW_HXX_
+#include <atlbase.h>
+extern CComModule _Module;
+#include<atlcom.h>
+#include<atlctl.h>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/uno/Reference.h>
+using namespace com::sun::star::uno;
+using namespace com::sun::star::datatransfer::dnd;
+using namespace com::sun::star::datatransfer;
+
+struct ThreadData
+{
+ Reference<XDragSource> source;
+ Reference<XTransferable> transferable;
+ HANDLE evtThreadReady;
+};
+
+class AWindow: public CWindowImpl<AWindow, CWindow,
+ CWinTraits<WS_CAPTION |WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0> >
+{
+ TCHAR m_strName[80];
+ Reference<XDropTarget> m_xDropTarget;
+ Reference<XDragSource> m_xDragSource;
+ BOOL m_isMTA;
+
+ HWND m_hwndEdit;
+
+public:
+ AWindow(LPCTSTR strName)
+ {
+ RECT rcPos= {0,0,200,200};
+ Create(0, rcPos, strName);
+ }
+ AWindow(LPCTSTR strName, RECT pos, BOOL mta=FALSE): m_isMTA( mta)
+ {
+ Create(0, pos, strName);
+ }
+
+ ~AWindow()
+ {
+ if(m_hWnd)
+ DestroyWindow();
+ }
+
+
+ BEGIN_MSG_MAP(AWindow)
+ MESSAGE_HANDLER( WM_CLOSE, OnClose)
+ MESSAGE_HANDLER( WM_CREATE, OnCreate)
+ MESSAGE_RANGE_HANDLER( WM_MOUSEFIRST, WM_MOUSELAST, OnMouseAction)
+ MESSAGE_HANDLER( WM_TIMER, OnTimer)
+ MESSAGE_HANDLER( WM_SIZE, OnSize)
+ MESSAGE_HANDLER( WM_SETFOCUS, OnFocus)
+
+ END_MSG_MAP()
+
+ LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnMouseAction(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+ LRESULT OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+};
+
+#endif \ No newline at end of file
diff --git a/dtrans/test/win32/dnd/dndTest.cxx b/dtrans/test/win32/dnd/dndTest.cxx
new file mode 100644
index 000000000000..4c373d65dd42
--- /dev/null
+++ b/dtrans/test/win32/dnd/dndTest.cxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * $RCSfile: dndTest.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:09:35 $
+ *
+ * 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 <windows.h>
+#include <comdef.h>
+#include <tchar.h>
+#include <atlbase.h>
+CComModule _Module;
+#include<atlcom.h>
+#include<atlimpl.cpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
+#include <com/sun/star/datatransfer/dnd/XDropTargetFactory.hpp>
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <rtl/process.h>
+#include "transferable.hxx"
+
+
+#include "atlwindow.hxx"
+BEGIN_OBJECT_MAP(ObjectMap)
+END_OBJECT_MAP()
+
+using namespace com::sun::star::lang;
+using namespace com::sun::star::datatransfer;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::datatransfer::dnd;
+using namespace com::sun::star::datatransfer::dnd::DNDConstants;
+using namespace rtl;
+
+HRESULT doTest();
+
+Reference< XMultiServiceFactory > MultiServiceFactory;
+//int APIENTRY WinMain(HINSTANCE hInstance,
+// HINSTANCE hPrevInstance,
+// LPSTR lpCmdLine,
+// int nCmdShow)
+//int _tmain( int argc, TCHAR *argv[ ], TCHAR *envp[ ] )
+int main( int argc, char *argv[ ], char *envp[ ] )
+{
+ HRESULT hr;
+ if( FAILED( hr=OleInitialize(NULL )))
+ {
+ _tprintf(_T("CoInitialize failed \n"));
+ return -1;
+ }
+
+
+ _Module.Init( ObjectMap, GetModuleHandle( NULL));
+
+ if( FAILED(hr=doTest()))
+ {
+ _com_error err( hr);
+ const TCHAR * errMsg= err.ErrorMessage();
+// MessageBox( NULL, errMsg, "Test failed", MB_ICONERROR);
+ }
+
+
+ _Module.Term();
+ OleUninitialize();
+ return 0;
+}
+
+
+
+HRESULT doTest()
+{
+
+ MultiServiceFactory= createRegistryServiceFactory( OUString(L"applicat.rdb"));
+
+ HRESULT hr= S_OK;
+ RECT pos1={0,0,300,200};
+ AWindow win(_T("Drag and Drop, OLE STA"), pos1);
+
+ RECT pos2={ 0, 205, 300, 405};
+ AWindow win2( _T("Drag and Drop, MTA"), pos2, true);
+
+ MSG msg;
+ while( GetMessage(&msg, (HWND)NULL, 0, 0) )
+ {
+ TranslateMessage( &msg);
+ DispatchMessage( &msg);
+ }
+
+ return S_OK;
+}
+
+extern Reference<XMultiServiceFactory> MultiServiceFactory;
+DWORD WINAPI MTAFunc(LPVOID pParams)
+{
+ HRESULT hr= S_OK;
+ hr= CoInitializeEx( NULL, COINIT_MULTITHREADED);
+ ATLASSERT( FAILED(hr) );
+
+ ThreadData data= *( ThreadData*)pParams;
+ SetEvent(data.evtThreadReady);
+
+ data.source->executeDrag( DragGestureEvent(),
+ ACTION_LINK|ACTION_MOVE|ACTION_COPY,
+ 0,
+ 0,
+ data.transferable,
+ Reference<XDragSourceListener>());
+
+
+ CoUninitialize();
+ return 0;
+}
diff --git a/dtrans/test/win32/dnd/makefile.mk b/dtrans/test/win32/dnd/makefile.mk
new file mode 100644
index 000000000000..bed5e64ed1fc
--- /dev/null
+++ b/dtrans/test/win32/dnd/makefile.mk
@@ -0,0 +1,151 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: jl $ $Date: 2001-02-08 15:09:52 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/
+
+PRJNAME=dtrans
+TARGET=dndTest
+TARGETTYPE=CUI
+LIBTARGET=NO
+
+#USE_DEFFILE= TRUE
+NO_BSYMBOLIC= TRUE
+ENABLE_EXCEPTIONS=TRUE
+BOOTSTRAP_SERVICE=FALSE
+
+# --- Settings ---
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files ---
+
+# CFLAGS+=/GR -DUNICODE -D_UNICODE
+CFLAGS+= -D_WIN32_DCOM
+UNOUCRDEP= $(SOLARBINDIR)$/applicat.rdb
+UNOUCRRDB= $(SOLARBINDIR)$/applicat.rdb
+
+.IF "$(BOOTSTRAP_SERVICE)" == "TRUE"
+UNOUCROUT= $(OUT)$/inc$/comprehensive
+INCPRE+= $(OUT)$/inc$/comprehensive
+CPPUMAKERFLAGS += -C
+.ELSE
+UNOUCROUT= $(OUT)$/inc
+INCPRE+= $(OUT)$/inc -I$(SOLARINCDIR)$/external$/atl
+.ENDIF
+
+UNOTYPES= com.sun.star.lang.XInitialization \
+ com.sun.star.lang.XComponent \
+ com.sun.star.datatransfer.dnd.XDropTarget \
+ com.sun.star.datatransfer.dnd.XDropTargetListener \
+ com.sun.star.datatransfer.dnd.XDropTargetFactory \
+ com.sun.star.datatransfer.dnd.DNDConstants \
+ com.sun.star.datatransfer.dnd.XDragSource
+
+
+
+.IF "$(depend)" != ""
+
+.ENDIF # depend
+
+APP1NOSAL=TRUE
+
+APP1TARGET= $(TARGET)
+APP1OBJS= $(OBJ)$/dndTest.obj \
+ $(OBJ)$/atlwindow.obj \
+ $(OBJ)$/targetlistener.obj \
+ $(OBJ)$/implhelper.obj \
+ $(OBJ)$/transferable.obj
+
+LIBCIMT=msvcrtd.lib
+
+
+APP1STDLIBS= \
+ $(SALLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ user32.lib \
+ ole32.lib \
+ comsupp.lib \
+ oleaut32.lib \
+ gdi32.lib \
+ $(LB)$/dtutils.lib
+
+APP1LIBS= \
+ $(SOLARLIBDIR)$/imtaolecb.lib\
+ $(SOLARLIBDIR)$/user9x.lib\
+ $(SOLARLIBDIR)$/tools32.lib\
+
+
+
+.IF "$(GUI)"=="WNT"
+APP1STDLIBS += $(LIBCIMT)
+APP2STDLIBS += $(LIBCIMT)
+.ENDIF
+
+APP1DEF= $(MISC)\$(APP1TARGET).def
+
+# --- Targets ---
+
+.INCLUDE : target.mk
+
diff --git a/dtrans/test/win32/dnd/targetlistener.cxx b/dtrans/test/win32/dnd/targetlistener.cxx
new file mode 100644
index 000000000000..a66e4e0cde5f
--- /dev/null
+++ b/dtrans/test/win32/dnd/targetlistener.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * $RCSfile: targetlistener.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:10:08 $
+ *
+ * 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 "targetlistener.hxx"
+#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
+#include <com/sun/star/datatransfer/DataFlavor.hpp>
+
+//using namespace com::sun::star::datatransfer::dnd;
+using namespace com::sun::star::datatransfer::dnd::DNDConstants;
+using namespace com::sun::star::datatransfer;
+using namespace rtl;
+
+DropTargetListener::DropTargetListener(HWND hEdit):m_hEdit( hEdit)
+{
+}
+DropTargetListener::~DropTargetListener()
+{
+}
+
+void SAL_CALL DropTargetListener::disposing( const EventObject& Source )
+ throw(RuntimeException)
+{
+
+}
+
+
+
+void SAL_CALL DropTargetListener::drop( const DropTargetDropEvent& e )
+ throw(RuntimeException)
+{
+// e.Context->dropComplete( sal_True);
+// e.Context->accept( ACTION_COPY);
+ e.Context->reject();
+
+ // if the Transferable contains text, then we send it to the edit window
+// Sequence<DataFlavor> flavors= e.Transferable->getTransferDataFlavors();
+// DataFlavor aFlavor;
+// for( int i=0; i < flavors.getLength(); i++)
+// aFlavor= flavors[4];
+
+ DataFlavor flavor( OUString(OUString::createFromAscii("text/plain;charset=windows-1252")),
+ OUString(L"Text plain"), getCppuType( ( Sequence<sal_Int8>*)0 ) );
+
+ Any anyData= e.Transferable->getTransferData( flavor);
+ Sequence<sal_Int8> seq= *( Sequence<sal_Int8>*)anyData.getValue();
+ SendMessage( m_hEdit, WM_SETTEXT, 0, (LPARAM) seq.getConstArray() );
+}
+
+void SAL_CALL DropTargetListener::dragEnter( const DropTargetDragEvent& dtde )
+ throw(RuntimeException)
+{
+ //If one drags something that is not moveable
+ if( !(dtde.SourceActions & dtde.DropAction) )
+ dtde.Context->accept( ACTION_COPY);
+
+// dtde.Context->rejectDrag( );
+
+ Sequence<DataFlavor> seq= dtde.Context->getCurrentDataFlavors();
+ for( int i=0; i < seq.getLength(); i++)
+ {
+ DataFlavor& f= seq[i];
+ }
+}
+
+void SAL_CALL DropTargetListener::dragExit( const DropTargetEvent& dte )
+ throw(RuntimeException)
+{
+}
+
+void SAL_CALL DropTargetListener::dragOver( const DropTargetDragEvent& dtde )
+ throw(RuntimeException)
+{
+ if( !(dtde.SourceActions & dtde.DropAction) )
+ dtde.Context->accept( ACTION_COPY);
+}
+
+void SAL_CALL DropTargetListener::dropActionChanged( const DropTargetDragEvent& dtde )
+ throw(RuntimeException)
+{
+}
diff --git a/dtrans/test/win32/dnd/targetlistener.hxx b/dtrans/test/win32/dnd/targetlistener.hxx
new file mode 100644
index 000000000000..bacadda47683
--- /dev/null
+++ b/dtrans/test/win32/dnd/targetlistener.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * $RCSfile: targetlistener.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:10:21 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TARGETLISTENER_HXX_
+#define _TARGETLISTENER_HXX_
+
+#include <windows.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp>
+#include <com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp>
+
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::datatransfer::dnd;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+class DropTargetListener: public WeakImplHelper1<XDropTargetListener>
+{
+ // this is a window where droped data are shown as text (only text)
+ HWND m_hEdit;
+public:
+ DropTargetListener( HWND hEdit);
+ ~DropTargetListener();
+
+ virtual void SAL_CALL disposing( const EventObject& Source )
+ throw(RuntimeException);
+
+
+ virtual void SAL_CALL drop( const DropTargetDropEvent& dtde )
+ throw(RuntimeException);
+ virtual void SAL_CALL dragEnter( const DropTargetDragEvent& dtde )
+ throw(RuntimeException);
+ virtual void SAL_CALL dragExit( const DropTargetEvent& dte )
+ throw(RuntimeException);
+ virtual void SAL_CALL dragOver( const DropTargetDragEvent& dtde )
+ throw(RuntimeException);
+ virtual void SAL_CALL dropActionChanged( const DropTargetDragEvent& dtde )
+ throw(RuntimeException);
+};
+
+#endif \ No newline at end of file
diff --git a/dtrans/test/win32/dnd/transferable.cxx b/dtrans/test/win32/dnd/transferable.cxx
new file mode 100644
index 000000000000..c65b3191af9a
--- /dev/null
+++ b/dtrans/test/win32/dnd/transferable.cxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: transferable.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:10:33 $
+ *
+ * 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 "transferable.hxx"
+
+//----------------------------------------------------------------
+// ctor
+//----------------------------------------------------------------
+
+
+
+CTransferable::CTransferable( wchar_t* dataString ) :
+ m_seqDFlv( 1 ),
+ m_Data( dataString )
+{
+ DataFlavor df;
+
+ /*
+ df.MimeType = L"text/plain; charset=unicode";
+ df.DataType = getCppuType( ( OUString* )0 );
+
+ m_seqDFlv[0] = df;
+ */
+
+ //df.MimeType = L"text/plain; charset=windows1252";
+ df.MimeType = L"text/plain";
+ df.DataType = getCppuType( ( Sequence< sal_Int8 >* )0 );
+
+
+ m_seqDFlv[0] = df;
+}
+
+//----------------------------------------------------------------
+// getTransferData
+//----------------------------------------------------------------
+
+Any SAL_CALL CTransferable::getTransferData( const DataFlavor& aFlavor )
+ throw(UnsupportedFlavorException, IOException, RuntimeException)
+{
+ Any anyData;
+
+ /*if ( aFlavor == m_seqDFlv[0] )
+ {
+ anyData = makeAny( m_Data );
+ }
+ else*/ if ( aFlavor == m_seqDFlv[0] )
+ {
+ OString aStr( m_Data.getStr( ), m_Data.getLength( ), 1252 );
+ Sequence< sal_Int8 > sOfChars( aStr.getLength( ) );
+ sal_Int32 lenStr = aStr.getLength( );
+
+ for ( sal_Int32 i = 0; i < lenStr; ++i )
+ sOfChars[i] = aStr[i];
+
+ anyData = makeAny( sOfChars );
+ }
+
+ return anyData;
+}
+
+//----------------------------------------------------------------
+// getTransferDataFlavors
+//----------------------------------------------------------------
+
+Sequence< DataFlavor > SAL_CALL CTransferable::getTransferDataFlavors( )
+ throw(RuntimeException)
+{
+ return m_seqDFlv;
+}
+
+//----------------------------------------------------------------
+// isDataFlavorSupported
+//----------------------------------------------------------------
+
+sal_Bool SAL_CALL CTransferable::isDataFlavorSupported( const DataFlavor& aFlavor )
+ throw(RuntimeException)
+{
+ sal_Int32 nLength = m_seqDFlv.getLength( );
+ sal_Bool bRet = sal_False;
+
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ if ( m_seqDFlv[i] == aFlavor )
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+
+ return bRet;
+}
+
+//----------------------------------------------------------------
+// lostOwnership
+//----------------------------------------------------------------
+
+void SAL_CALL CTransferable::lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans )
+ throw(RuntimeException)
+{
+}
diff --git a/dtrans/test/win32/dnd/transferable.hxx b/dtrans/test/win32/dnd/transferable.hxx
new file mode 100644
index 000000000000..6e92346743e6
--- /dev/null
+++ b/dtrans/test/win32/dnd/transferable.hxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * $RCSfile: transferable.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: jl $ $Date: 2001-02-08 15:10:41 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _TRANSFERABLE_HXX_
+#define _TRANSFERABLE_HXX_
+
+//_________________________________________________________________________________________________________________________
+// interface includes
+//_________________________________________________________________________________________________________________________
+
+
+//#include "..\ImplHelper.hxx"
+
+//_________________________________________________________________________________________________________________________
+// other includes
+//_________________________________________________________________________________________________________________________
+
+#ifndef _CPPUHELPER_SERVICEFACTORY_HXX_
+#include <cppuhelper/servicefactory.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_DATATRANSFER_XTRANSFERABLE_HPP_
+#include <com/sun/star/datatransfer/XTransferable.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBOARD_XCLIPBOARDOWNER_HPP_
+#include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBOARD_XCLIPBOARDNOTIFIER_HPP_
+#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBOARD_XCLIPBOARDEX_HPP_
+#include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+#include <stdio.h>
+#include <windows.h>
+#include <objbase.h>
+
+#include <stl/memory>
+
+#include <process.h>
+
+#include "..\..\source\win32\ImplHelper.hxx"
+
+
+//-------------------------------------------------------------
+// my defines
+//-------------------------------------------------------------
+
+#define TEST_CLIPBOARD
+#define RDB_SYSPATH "d:\\projects\\src616\\dtrans\\wntmsci7\\bin\\applicat.rdb"
+#define WINCLIPBOARD_SERVICE_NAME L"com.sun.star.datatransfer.clipboard.SystemClipboard"
+#define WRITE_CB
+#define EVT_MANUAL_RESET TRUE
+#define EVT_INIT_NONSIGNALED FALSE
+#define EVT_NONAME ""
+
+//------------------------------------------------------------
+// namesapces
+//------------------------------------------------------------
+
+using namespace ::rtl;
+using namespace ::std;
+using namespace ::cppu;
+using namespace ::com::sun::star::datatransfer;
+using namespace ::com::sun::star::datatransfer::clipboard;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+
+//------------------------------------------------------------
+//
+//------------------------------------------------------------
+
+class CTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable >
+{
+public:
+ CTransferable( ){};
+ CTransferable( wchar_t* dataString);
+
+ //-------------------------------------------------
+ // XTransferable
+ //-------------------------------------------------
+
+ virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException);
+ virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors( ) throw(RuntimeException);
+ virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException);
+
+ //-------------------------------------------------
+ // XClipboardOwner
+ //-------------------------------------------------
+
+ virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException);
+
+private:
+ Sequence< DataFlavor > m_seqDFlv;
+ OUString m_Data;
+};
+
+
+#endif \ No newline at end of file