xref: /AOO41X/main/dtrans/source/win32/clipb/WinClipbImpl.hxx (revision fbcf0fe955ab8df0a2f1d76ae10cf7d5c87503b1)
1*fbcf0fe9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*fbcf0fe9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*fbcf0fe9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*fbcf0fe9SAndrew Rist  * distributed with this work for additional information
6*fbcf0fe9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*fbcf0fe9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*fbcf0fe9SAndrew Rist  * "License"); you may not use this file except in compliance
9*fbcf0fe9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*fbcf0fe9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*fbcf0fe9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*fbcf0fe9SAndrew Rist  * software distributed under the License is distributed on an
15*fbcf0fe9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*fbcf0fe9SAndrew Rist  * KIND, either express or implied.  See the License for the
17*fbcf0fe9SAndrew Rist  * specific language governing permissions and limitations
18*fbcf0fe9SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*fbcf0fe9SAndrew Rist  *************************************************************/
21*fbcf0fe9SAndrew Rist 
22*fbcf0fe9SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _WINCLIPBIMPL_HXX_
26cdf0e10cSrcweir #define _WINCLIPBIMPL_HXX_
27cdf0e10cSrcweir 
28cdf0e10cSrcweir //------------------------------------------------------------------------
29cdf0e10cSrcweir // includes
30cdf0e10cSrcweir //------------------------------------------------------------------------
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <sal/types.h>
33cdf0e10cSrcweir #include <rtl/ustring.hxx>
34cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp>
35cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
36cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
37cdf0e10cSrcweir #include "..\..\inc\MtaOleClipb.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #if defined _MSC_VER
40cdf0e10cSrcweir #pragma warning(push,1)
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <windows.h>
43cdf0e10cSrcweir #if defined _MSC_VER
44cdf0e10cSrcweir #pragma warning(pop)
45cdf0e10cSrcweir #endif
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class CWinClipboard;
48cdf0e10cSrcweir class CXNotifyingDataObject;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir //---------------------------------------------------
51cdf0e10cSrcweir // impl class to avoid deadlocks between XTDataObject
52cdf0e10cSrcweir // and the clipboard implementation
53cdf0e10cSrcweir //---------------------------------------------------
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class CWinClipbImpl
56cdf0e10cSrcweir {
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir 	~CWinClipbImpl( );
59cdf0e10cSrcweir 
60cdf0e10cSrcweir protected:
61cdf0e10cSrcweir 	CWinClipbImpl( const ::rtl::OUString& aClipboardName, CWinClipboard* theWinClipboard );
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents(  )
64cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	void SAL_CALL setContents(
67cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
68cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
69cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     ::rtl::OUString SAL_CALL getName(  ) throw( ::com::sun::star::uno::RuntimeException );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	//------------------------------------------------
74cdf0e10cSrcweir 	// XClipboardEx
75cdf0e10cSrcweir 	//------------------------------------------------
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	sal_Int8 SAL_CALL getRenderingCapabilities(  ) throw( ::com::sun::star::uno::RuntimeException );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	//------------------------------------------------
80cdf0e10cSrcweir 	// XFlushableClipboard
81cdf0e10cSrcweir 	//------------------------------------------------
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	//------------------------------------------------
86cdf0e10cSrcweir 	// XComponent
87cdf0e10cSrcweir 	//------------------------------------------------
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	void SAL_CALL dispose( ) throw( ::com::sun::star::uno::RuntimeException );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	//------------------------------------------------
92cdf0e10cSrcweir 	// member functions
93cdf0e10cSrcweir 	//------------------------------------------------
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	void SAL_CALL registerClipboardViewer( );
96cdf0e10cSrcweir 	void SAL_CALL unregisterClipboardViewer( );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	static void WINAPI onClipboardContentChanged( void );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir private:
101cdf0e10cSrcweir 	void SAL_CALL onReleaseDataObject( CXNotifyingDataObject* theCaller );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir private:
104cdf0e10cSrcweir 	::rtl::OUString			m_itsName;
105cdf0e10cSrcweir 	CMtaOleClipboard		m_MtaOleClipboard;
106cdf0e10cSrcweir 	CWinClipboard*			m_pWinClipboard;
107cdf0e10cSrcweir 	CXNotifyingDataObject*	m_pCurrentClipContent;
108cdf0e10cSrcweir     osl::Mutex              m_ClipContentMutex;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	static osl::Mutex		s_aMutex;
111cdf0e10cSrcweir 	static CWinClipbImpl*	s_pCWinClipbImpl;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir private:
114cdf0e10cSrcweir 	CWinClipbImpl( const CWinClipbImpl& );
115cdf0e10cSrcweir 	CWinClipbImpl& operator=( const CWinClipbImpl& );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	friend class CWinClipboard;
118cdf0e10cSrcweir 	friend class CXNotifyingDataObject;
119cdf0e10cSrcweir };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir #endif
122