xref: /trunk/main/dtrans/test/win32/dnd/transferable.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _TRANSFERABLE_HXX_
28 #define _TRANSFERABLE_HXX_
29 
30 //_________________________________________________________________________________________________________________________
31 //  interface includes
32 //_________________________________________________________________________________________________________________________
33 
34 
35 //#include "..\ImplHelper.hxx"
36 
37 //_________________________________________________________________________________________________________________________
38 //  other includes
39 //_________________________________________________________________________________________________________________________
40 
41 #include <cppuhelper/servicefactory.hxx>
42 #include <com/sun/star/datatransfer/XTransferable.hpp>
43 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
44 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
45 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
46 #include <com/sun/star/lang/XComponent.hpp>
47 #include <cppuhelper/implbase2.hxx>
48 #include <rtl/ustring.hxx>
49 #include <sal/types.h>
50 #include <osl/diagnose.h>
51 
52 #include <stdio.h>
53 #if defined _MSC_VER
54 #pragma warning(push,1)
55 #endif
56 #include <windows.h>
57 #include <objbase.h>
58 #if defined _MSC_VER
59 #pragma warning(pop)
60 #endif
61 
62 #include <memory>
63 
64 #include <process.h>
65 
66 #include "..\..\source\win32\ImplHelper.hxx"
67 
68 
69 //-------------------------------------------------------------
70 // my defines
71 //-------------------------------------------------------------
72 
73 #define TEST_CLIPBOARD
74 #define RDB_SYSPATH  "d:\\projects\\src616\\dtrans\\wntmsci7\\bin\\applicat.rdb"
75 #define WINCLIPBOARD_SERVICE_NAME L"com.sun.star.datatransfer.clipboard.SystemClipboard"
76 #define  WRITE_CB
77 #define EVT_MANUAL_RESET     TRUE
78 #define EVT_INIT_NONSIGNALED FALSE
79 #define EVT_NONAME           ""
80 
81 //------------------------------------------------------------
82 //  namesapces
83 //------------------------------------------------------------
84 
85 using namespace ::rtl;
86 using namespace ::std;
87 using namespace ::cppu;
88 using namespace ::com::sun::star::datatransfer;
89 using namespace ::com::sun::star::datatransfer::clipboard;
90 using namespace ::com::sun::star::uno;
91 using namespace ::com::sun::star::io;
92 using namespace ::com::sun::star::lang;
93 
94 //------------------------------------------------------------
95 //
96 //------------------------------------------------------------
97 
98 class CTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable >
99 {
100 public:
101     CTransferable( ){};
102     CTransferable( wchar_t* dataString);
103 
104     //-------------------------------------------------
105     // XTransferable
106     //-------------------------------------------------
107 
108     virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException);
109     virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors(  ) throw(RuntimeException);
110     virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException);
111 
112     //-------------------------------------------------
113     // XClipboardOwner
114     //-------------------------------------------------
115 
116     virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException);
117 
118 private:
119     Sequence< DataFlavor > m_seqDFlv;
120     OUString               m_Data;
121 };
122 
123 
124 #endif
125