xref: /AOO41X/main/dtrans/source/win32/dtobj/XNotifyingDataObject.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 _XNOTIFYINGDATAOBJECT_HXX_
26cdf0e10cSrcweir #define _XNOTIFYINGDATAOBJECT_HXX_
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //------------------------------------------------------------------------
30cdf0e10cSrcweir // includes
31cdf0e10cSrcweir //------------------------------------------------------------------------
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <com/sun/star/datatransfer/XTransferable.hpp>
34cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #if defined _MSC_VER
37cdf0e10cSrcweir #pragma warning(push,1)
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #include <objidl.h>
40cdf0e10cSrcweir #include <windows.h>
41cdf0e10cSrcweir #if defined _MSC_VER
42cdf0e10cSrcweir #pragma warning(pop)
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include <systools/win32/comtools.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir /*--------------------------------------------------------------------------
48cdf0e10cSrcweir 	To implement the lostOwnership mechanism cleanly we need this wrapper
49cdf0e10cSrcweir 	object
50cdf0e10cSrcweir ----------------------------------------------------------------------------*/
51cdf0e10cSrcweir 
52cdf0e10cSrcweir // forward
53cdf0e10cSrcweir class CWinClipbImpl;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class CXNotifyingDataObject : public IDataObject
56cdf0e10cSrcweir {
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir 	CXNotifyingDataObject(
59cdf0e10cSrcweir 		const IDataObjectPtr& aIDataObject,
60cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable,
61cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner >& aXClipOwner,
62cdf0e10cSrcweir 		CWinClipbImpl* theWinClipImpl );
63cdf0e10cSrcweir 
~CXNotifyingDataObject()64cdf0e10cSrcweir     virtual ~CXNotifyingDataObject() {}
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	//-----------------------------------------------------------------
67cdf0e10cSrcweir 	// ole interface implementation
68cdf0e10cSrcweir 	//-----------------------------------------------------------------
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     //IUnknown interface methods
71cdf0e10cSrcweir     STDMETHODIMP           QueryInterface(REFIID iid, LPVOID* ppvObject);
72cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) AddRef( );
73cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) Release( );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     // IDataObject interface methods
76cdf0e10cSrcweir     STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
77cdf0e10cSrcweir     STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
78cdf0e10cSrcweir     STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
79cdf0e10cSrcweir     STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
80cdf0e10cSrcweir     STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
81cdf0e10cSrcweir     STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
82cdf0e10cSrcweir     STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
83cdf0e10cSrcweir     STDMETHODIMP DUnadvise( DWORD dwConnection );
84cdf0e10cSrcweir     STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	operator IDataObject*( );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir private:
89cdf0e10cSrcweir 	void SAL_CALL lostOwnership( );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir private:
92cdf0e10cSrcweir 	sal_Int32																							m_nRefCnt;
93cdf0e10cSrcweir 	IDataObjectPtr																						m_aIDataObject;
94cdf0e10cSrcweir 	const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >					m_XTransferable;
95cdf0e10cSrcweir 	const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner >	m_XClipboardOwner;
96cdf0e10cSrcweir 	CWinClipbImpl*																						m_pWinClipImpl;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	friend class CWinClipbImpl;
99cdf0e10cSrcweir };
100cdf0e10cSrcweir 
101cdf0e10cSrcweir #endif
102