xref: /AOO41X/main/dtrans/test/win32/dnd/transferable.hxx (revision fbcf0fe955ab8df0a2f1d76ae10cf7d5c87503b1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _TRANSFERABLE_HXX_
24 #define _TRANSFERABLE_HXX_
25 
26 //_________________________________________________________________________________________________________________________
27 //  interface includes
28 //_________________________________________________________________________________________________________________________
29 
30 
31 //#include "..\ImplHelper.hxx"
32 
33 //_________________________________________________________________________________________________________________________
34 //  other includes
35 //_________________________________________________________________________________________________________________________
36 
37 #include <cppuhelper/servicefactory.hxx>
38 #include <com/sun/star/datatransfer/XTransferable.hpp>
39 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
40 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
41 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
42 #include <com/sun/star/lang/XComponent.hpp>
43 #include <cppuhelper/implbase2.hxx>
44 #include <rtl/ustring.hxx>
45 #include <sal/types.h>
46 #include <osl/diagnose.h>
47 
48 #include <stdio.h>
49 #if defined _MSC_VER
50 #pragma warning(push,1)
51 #endif
52 #include <windows.h>
53 #include <objbase.h>
54 #if defined _MSC_VER
55 #pragma warning(pop)
56 #endif
57 
58 #include <memory>
59 
60 #include <process.h>
61 
62 #include "..\..\source\win32\ImplHelper.hxx"
63 
64 
65 //-------------------------------------------------------------
66 // my defines
67 //-------------------------------------------------------------
68 
69 #define TEST_CLIPBOARD
70 #define RDB_SYSPATH  "d:\\projects\\src616\\dtrans\\wntmsci7\\bin\\applicat.rdb"
71 #define WINCLIPBOARD_SERVICE_NAME L"com.sun.star.datatransfer.clipboard.SystemClipboard"
72 #define  WRITE_CB
73 #define EVT_MANUAL_RESET     TRUE
74 #define EVT_INIT_NONSIGNALED FALSE
75 #define EVT_NONAME           ""
76 
77 //------------------------------------------------------------
78 //  namesapces
79 //------------------------------------------------------------
80 
81 using namespace ::rtl;
82 using namespace ::std;
83 using namespace ::cppu;
84 using namespace ::com::sun::star::datatransfer;
85 using namespace ::com::sun::star::datatransfer::clipboard;
86 using namespace ::com::sun::star::uno;
87 using namespace ::com::sun::star::io;
88 using namespace ::com::sun::star::lang;
89 
90 //------------------------------------------------------------
91 //
92 //------------------------------------------------------------
93 
94 class CTransferable : public WeakImplHelper2< XClipboardOwner, XTransferable >
95 {
96 public:
CTransferable()97     CTransferable( ){};
98     CTransferable( wchar_t* dataString);
99 
100     //-------------------------------------------------
101     // XTransferable
102     //-------------------------------------------------
103 
104     virtual Any SAL_CALL getTransferData( const DataFlavor& aFlavor ) throw(UnsupportedFlavorException, IOException, RuntimeException);
105     virtual Sequence< DataFlavor > SAL_CALL getTransferDataFlavors(  ) throw(RuntimeException);
106     virtual sal_Bool SAL_CALL isDataFlavorSupported( const DataFlavor& aFlavor ) throw(RuntimeException);
107 
108     //-------------------------------------------------
109     // XClipboardOwner
110     //-------------------------------------------------
111 
112     virtual void SAL_CALL lostOwnership( const Reference< XClipboard >& xClipboard, const Reference< XTransferable >& xTrans ) throw(RuntimeException);
113 
114 private:
115     Sequence< DataFlavor > m_seqDFlv;
116     OUString               m_Data;
117 };
118 
119 
120 #endif
121