xref: /AOO41X/main/dtrans/source/os2/clipb/Os2Transferable.hxx (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
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 
24 #ifndef _DTRANS_OS2_TRANSFERABLE_HXX_
25 #define _DTRANS_OS2_TRANSFERABLE_HXX_
26 
27 #include <com/sun/star/datatransfer/XTransferable.hpp>
28 
29 #ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HDL_
30 #include <com/sun/star/lang/XEventListener.hpp>
31 #endif
32 #include <cppuhelper/implbase1.hxx>
33 #include <osl/thread.h>
34 
35 #include <errno.h>
36 
37 #include <uclip.h>
38 
39 #define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer
40 
41 #if OSL_DEBUG_LEVEL>1
42 //extern "C" int debug_printf(const char *f, ...);
43 #define debug_printf( ...) { 1; }
44 #else
45 #define debug_printf( ...) { 1; }
46 #endif
47 
48 #define CPPUTYPE_SEQSALINT8       getCppuType( (const Sequence< sal_Int8 >*) 0 )
49 #define CPPUTYPE_DEFAULT          CPPUTYPE_SEQSALINT8
50 
51 using namespace com::sun::star::uno;
52 HBITMAP OOoBmpToOS2Handle( Any &aAnyB);
53 int OS2HandleToOOoBmp( HBITMAP hbm, Sequence< sal_Int8 >* winDIBStream);
54 
55 namespace os2 {
56 
57     class Os2Transferable : public ::cppu::WeakImplHelper1 <
58         ::com::sun::star::datatransfer::XTransferable >
59     {
60         HAB         hAB;
61         ::rtl::OUString clipText;
62         ::com::sun::star::datatransfer::DataFlavor aFlavor;
63         ::osl::Mutex m_aMutex;
64         ::com::sun::star::uno::Reference< XInterface >          m_xCreator;
65 
66     public:
67         Os2Transferable( const ::com::sun::star::uno::Reference< XInterface >& xCreator);
68         virtual ~Os2Transferable();
69 
70         /*
71          * XTransferable
72          */
73 
74         virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
75             throw(::com::sun::star::datatransfer::UnsupportedFlavorException,
76                   ::com::sun::star::io::IOException,
77                   ::com::sun::star::uno::RuntimeException
78                   );
79 
80         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors(  )
81             throw(::com::sun::star::uno::RuntimeException);
82 
83         virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
84             throw(::com::sun::star::uno::RuntimeException);
85     };
86 
87 } // namespace
88 
89 #endif
90 
91