Update ooo320-m1
[ooovba.git] / dtrans / source / win32 / clipb / APNDataObject.hxx
blob278828b24ca0a1ea8456309ed8d3c800b894c1ec
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: APNDataObject.hxx,v $
10 * $Revision: 1.7 $
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 _APNDATAOBJECT_HXX_
33 #define _APNDATAOBJECT_HXX_
35 //------------------------------------------------------------------------
36 // deklarations
37 //------------------------------------------------------------------------
40 an APartment Neutral dataobject wrapper; this wrapper of a IDataObject
41 pointer can be used from any apartment without RPC_E_WRONG_THREAD
42 which normally occurs if an apartment tries to use an interface
43 pointer of another apartment; we use containment to hold the original
44 DataObject
46 class CAPNDataObject : public IDataObject
48 public:
49 CAPNDataObject( IDataObjectPtr rIDataObject );
50 ~CAPNDataObject( );
52 //-----------------------------------------------------------------
53 //IUnknown interface methods
54 //-----------------------------------------------------------------
56 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
57 STDMETHODIMP_( ULONG ) AddRef( );
58 STDMETHODIMP_( ULONG ) Release( );
60 //-----------------------------------------------------------------
61 // IDataObject interface methods
62 //-----------------------------------------------------------------
64 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
65 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
66 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
67 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
68 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
69 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
70 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
71 STDMETHODIMP DUnadvise( DWORD dwConnection );
72 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
74 operator IDataObject*( );
76 private:
77 HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
79 private:
80 IDataObjectPtr m_rIDataObjectOrg;
81 HGLOBAL m_hGlobal;
82 LONG m_nRefCnt;
84 // prevent copy and assignment
85 private:
86 CAPNDataObject( const CAPNDataObject& theOther );
87 CAPNDataObject& operator=( const CAPNDataObject& theOther );
90 #endif