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 #include <systools/win32/comtools.hxx>
37 //------------------------------------------------------------------------
39 //------------------------------------------------------------------------
42 an APartment Neutral dataobject wrapper; this wrapper of a IDataObject
43 pointer can be used from any apartment without RPC_E_WRONG_THREAD
44 which normally occurs if an apartment tries to use an interface
45 pointer of another apartment; we use containment to hold the original
48 class CAPNDataObject
: public IDataObject
51 CAPNDataObject( IDataObjectPtr rIDataObject
);
52 virtual ~CAPNDataObject( );
54 //-----------------------------------------------------------------
55 //IUnknown interface methods
56 //-----------------------------------------------------------------
58 STDMETHODIMP
QueryInterface(REFIID iid
, LPVOID
* ppvObject
);
59 STDMETHODIMP_( ULONG
) AddRef( );
60 STDMETHODIMP_( ULONG
) Release( );
62 //-----------------------------------------------------------------
63 // IDataObject interface methods
64 //-----------------------------------------------------------------
66 STDMETHODIMP
GetData( LPFORMATETC pFormatetc
, LPSTGMEDIUM pmedium
);
67 STDMETHODIMP
GetDataHere( LPFORMATETC pFormatetc
, LPSTGMEDIUM pmedium
);
68 STDMETHODIMP
QueryGetData( LPFORMATETC pFormatetc
);
69 STDMETHODIMP
GetCanonicalFormatEtc( LPFORMATETC pFormatectIn
, LPFORMATETC pFormatetcOut
);
70 STDMETHODIMP
SetData( LPFORMATETC pFormatetc
, LPSTGMEDIUM pmedium
, BOOL fRelease
);
71 STDMETHODIMP
EnumFormatEtc( DWORD dwDirection
, IEnumFORMATETC
** ppenumFormatetc
);
72 STDMETHODIMP
DAdvise( LPFORMATETC pFormatetc
, DWORD advf
, LPADVISESINK pAdvSink
, DWORD
* pdwConnection
);
73 STDMETHODIMP
DUnadvise( DWORD dwConnection
);
74 STDMETHODIMP
EnumDAdvise( LPENUMSTATDATA
* ppenumAdvise
);
76 operator IDataObject
*( );
79 HRESULT
MarshalIDataObjectIntoCurrentApartment( IDataObject
** ppIDataObj
);
82 IDataObjectPtr m_rIDataObjectOrg
;
86 // prevent copy and assignment
88 CAPNDataObject( const CAPNDataObject
& theOther
);
89 CAPNDataObject
& operator=( const CAPNDataObject
& theOther
);