1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: APNDataObject.hxx,v $
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 //------------------------------------------------------------------------
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
46 class CAPNDataObject
: public IDataObject
49 CAPNDataObject( IDataObjectPtr rIDataObject
);
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
*( );
77 HRESULT
MarshalIDataObjectIntoCurrentApartment( IDataObject
** ppIDataObj
);
80 IDataObjectPtr m_rIDataObjectOrg
;
84 // prevent copy and assignment
86 CAPNDataObject( const CAPNDataObject
& theOther
);
87 CAPNDataObject
& operator=( const CAPNDataObject
& theOther
);