Update ooo320-m1
[ooovba.git] / dtrans / source / win32 / dtobj / XNotifyingDataObject.hxx
blobd81356503fd8425ea42ab34e63bde7f312cf6c54
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XNotifyingDataObject.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _XNOTIFYINGDATAOBJECT_HXX_
33 #define _XNOTIFYINGDATAOBJECT_HXX_
36 //------------------------------------------------------------------------
37 // includes
38 //------------------------------------------------------------------------
40 #include <com/sun/star/datatransfer/XTransferable.hpp>
41 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
43 #if defined _MSC_VER
44 #pragma warning(push,1)
45 #endif
46 #include <objidl.h>
47 #include <windows.h>
48 #if defined _MSC_VER
49 #pragma warning(pop)
50 #endif
52 #include <systools/win32/comtools.hxx>
54 /*--------------------------------------------------------------------------
55 To implement the lostOwnership mechanism cleanly we need this wrapper
56 object
57 ----------------------------------------------------------------------------*/
59 // forward
60 class CWinClipbImpl;
62 class CXNotifyingDataObject : public IDataObject
64 public:
65 CXNotifyingDataObject(
66 const IDataObjectPtr& aIDataObject,
67 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable,
68 const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner >& aXClipOwner,
69 CWinClipbImpl* theWinClipImpl );
71 virtual ~CXNotifyingDataObject() {}
73 //-----------------------------------------------------------------
74 // ole interface implementation
75 //-----------------------------------------------------------------
77 //IUnknown interface methods
78 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
79 STDMETHODIMP_( ULONG ) AddRef( );
80 STDMETHODIMP_( ULONG ) Release( );
82 // IDataObject interface methods
83 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
84 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
85 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
86 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
87 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
88 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
89 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
90 STDMETHODIMP DUnadvise( DWORD dwConnection );
91 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
93 operator IDataObject*( );
95 private:
96 void SAL_CALL lostOwnership( );
98 private:
99 sal_Int32 m_nRefCnt;
100 IDataObjectPtr m_aIDataObject;
101 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > m_XTransferable;
102 const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner > m_XClipboardOwner;
103 CWinClipbImpl* m_pWinClipImpl;
105 friend class CWinClipbImpl;
108 #endif