1fbcf0fe9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3fbcf0fe9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4fbcf0fe9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5fbcf0fe9SAndrew Rist  * distributed with this work for additional information
6fbcf0fe9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7fbcf0fe9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8fbcf0fe9SAndrew Rist  * "License"); you may not use this file except in compliance
9fbcf0fe9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10fbcf0fe9SAndrew Rist  *
11fbcf0fe9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12fbcf0fe9SAndrew Rist  *
13fbcf0fe9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14fbcf0fe9SAndrew Rist  * software distributed under the License is distributed on an
15fbcf0fe9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16fbcf0fe9SAndrew Rist  * KIND, either express or implied.  See the License for the
17fbcf0fe9SAndrew Rist  * specific language governing permissions and limitations
18fbcf0fe9SAndrew Rist  * under the License.
19fbcf0fe9SAndrew Rist  *
20fbcf0fe9SAndrew Rist  *************************************************************/
21fbcf0fe9SAndrew Rist 
22fbcf0fe9SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _OS2CLIPBOARD_HXX_
25cdf0e10cSrcweir #define _OS2CLIPBOARD_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ustring.hxx>
28cdf0e10cSrcweir #include <sal/types.h>
29cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx>
30cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
31cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
32cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
33cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
36cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp>
37cdf0e10cSrcweir #include "Os2Transferable.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // the service names
40cdf0e10cSrcweir #define OS2_CLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard"
41cdf0e10cSrcweir 
42cdf0e10cSrcweir // the implementation names
43*168c4287SYuri Dario #define OS2_CLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.ClipboardW32"
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace os2 {
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class Os2Clipboard :
48cdf0e10cSrcweir 	//public cppu::WeakComponentImplHelper3< ::com::sun::star::datatransfer::clipboard::XClipboardEx, ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, ::com::sun::star::lang::XServiceInfo >
49cdf0e10cSrcweir     public ::cppu::WeakComponentImplHelper4 < \
50cdf0e10cSrcweir     ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
51cdf0e10cSrcweir     ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \
52cdf0e10cSrcweir     ::com::sun::star::lang::XServiceInfo, \
53cdf0e10cSrcweir     ::com::sun::star::lang::XInitialization >
54cdf0e10cSrcweir {
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 	Os2Clipboard();
58cdf0e10cSrcweir 	~Os2Clipboard();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	/*
61cdf0e10cSrcweir 	 * XInitialization
62cdf0e10cSrcweir 	 */
63cdf0e10cSrcweir 	virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
64cdf0e10cSrcweir 		throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	/*
67cdf0e10cSrcweir 	 * XServiceInfo
68cdf0e10cSrcweir 	 */
69cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName()
70cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
72cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
75cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	/*
78cdf0e10cSrcweir 	 * XClipboard
79cdf0e10cSrcweir 	 */
80cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
81cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
82cdf0e10cSrcweir 	virtual void SAL_CALL setContents( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
83cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
84cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getName()
85cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	/*
88cdf0e10cSrcweir 	 * XClipboardEx
89cdf0e10cSrcweir 	 */
90cdf0e10cSrcweir 	virtual sal_Int8 SAL_CALL getRenderingCapabilities()
91cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	/*
94cdf0e10cSrcweir 	 * XClipboardNotifier
95cdf0e10cSrcweir 	 */
96cdf0e10cSrcweir 	virtual void SAL_CALL addClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
97cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
98cdf0e10cSrcweir 	virtual void SAL_CALL removeClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
99cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
100cdf0e10cSrcweir 	void SAL_CALL notifyAllClipboardListener( );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir 	sal_Bool m_bInSetClipboardData;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir private:
106cdf0e10cSrcweir 	HAB	hAB;
107cdf0e10cSrcweir 	HWND	hObjWnd;
108cdf0e10cSrcweir 	ULONG	hText, hBitmap;	// handles to previous clipboard data
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	::osl::Mutex m_aMutex;
111cdf0e10cSrcweir 	::rtl::OUString m_aName;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
114cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	sal_Bool m_bInitialized;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir } // namespace Os2
121cdf0e10cSrcweir 
122cdf0e10cSrcweir // ------------------------------------------------------------------------
123cdf0e10cSrcweir 
124cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Os2Clipboard_getSupportedServiceNames();
125cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Os2Clipboard_createInstance(
126cdf0e10cSrcweir 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
127cdf0e10cSrcweir 
128cdf0e10cSrcweir #endif
129cdf0e10cSrcweir 
130