ReactOS 0.4.15-dev-5664-g3bf4ef6
IDataObjectImpl Struct Reference

implementation of IDataObject interface More...

#include <dragdropimpl.h>

Inheritance diagram for IDataObjectImpl:
Collaboration diagram for IDataObjectImpl:

Public Member Functions

 IDataObjectImpl (IDropSourceImpl *pDropSource)
 
virtual ~IDataObjectImpl ()
 
void CopyMedium (STGMEDIUM *pMedDest, STGMEDIUM *pMedSrc, FORMATETC *pFmtSrc)
 
virtual HRESULT STDMETHODCALLTYPE GetData (FORMATETC __RPC_FAR *pformatetcIn, STGMEDIUM __RPC_FAR *pmedium)
 
virtual HRESULT STDMETHODCALLTYPE GetDataHere (FORMATETC __RPC_FAR *pformatetc, STGMEDIUM __RPC_FAR *pmedium)
 
virtual HRESULT STDMETHODCALLTYPE QueryGetData (FORMATETC __RPC_FAR *pformatetc)
 
virtual HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc (FORMATETC __RPC_FAR *pformatectIn, FORMATETC __RPC_FAR *pformatetcOut)
 
virtual HRESULT STDMETHODCALLTYPE SetData (FORMATETC __RPC_FAR *pformatetc, STGMEDIUM __RPC_FAR *pmedium, BOOL fRelease)
 
virtual HRESULT STDMETHODCALLTYPE EnumFormatEtc (DWORD dwDirection, IEnumFORMATETC __RPC_FAR *__RPC_FAR *ppenumFormatEtc)
 
virtual HRESULT STDMETHODCALLTYPE DAdvise (FORMATETC __RPC_FAR *pformatetc, DWORD advf, IAdviseSink __RPC_FAR *pAdvSink, DWORD __RPC_FAR *pdwConnection)
 
virtual HRESULT STDMETHODCALLTYPE DUnadvise (DWORD dwConnection)
 
virtual HRESULT STDMETHODCALLTYPE EnumDAdvise (IEnumSTATDATA __RPC_FAR *__RPC_FAR *ppenumAdvise)
 
- Public Member Functions inherited from IComSrvBase< IDataObject, IDataObjectImpl >
 STDMETHODIMP_ (ULONG) AddRef()
 
 STDMETHODIMP_ (ULONG) Release()
 
- Public Member Functions inherited from IComSrvQI< BASE >
 IComSrvQI (REFIID uuid_base)
 
STDMETHODIMP QueryInterface (REFIID riid, LPVOID *ppv)
 
- Public Member Functions inherited from SimpleComObject
ULONG IncRef ()
 
ULONG DecRef ()
 

Public Attributes

IDataObject IDataObject_iface
 
LONG ref
 

Private Types

typedef IComSrvBase< IDataObject, IDataObjectImplsuper
 

Private Attributes

IDropSourceImplm_pDropSource
 
long m_cRefCount
 
StorageArray _storage
 

Additional Inherited Members

- Protected Member Functions inherited from IComSrvBase< IDataObject, IDataObjectImpl >
 IComSrvBase (REFIID uuid_base)
 
- Protected Member Functions inherited from IComSrvQI< BASE >
 IComSrvQI ()
 
virtual ~IComSrvQI ()
 
- Protected Member Functions inherited from ComSrvObject
 ComSrvObject ()
 
virtual ~ComSrvObject ()
 
- Protected Attributes inherited from IComSrvQI< BASE >
REFIID _uuid_base
 
- Protected Attributes inherited from ComSrvObject
ULONG _ref
 

Detailed Description

implementation of IDataObject interface

Definition at line 79 of file dragdropimpl.h.

Member Typedef Documentation

◆ super

Definition at line 83 of file dragdropimpl.h.

Constructor & Destructor Documentation

◆ IDataObjectImpl()

IDataObjectImpl::IDataObjectImpl ( IDropSourceImpl pDropSource)

Definition at line 24 of file dragdropimpl.cpp.

26 m_pDropSource(pDropSource),
28{
29}
IDropSourceImpl * m_pDropSource
Definition: dragdropimpl.h:85
IComSrvBase< IDataObject, IDataObjectImpl > super
Definition: dragdropimpl.h:83
const GUID IID_IDataObject

◆ ~IDataObjectImpl()

IDataObjectImpl::~IDataObjectImpl ( )
virtual

Definition at line 31 of file dragdropimpl.cpp.

32{
33 for(StorageArray::iterator it=_storage.begin(); it!=_storage.end(); ++it)
34 ReleaseStgMedium(it->_medium);
35}
StorageArray _storage
Definition: dragdropimpl.h:88
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2033
structure containing information for one format of EnumFormatEtcImpl
Definition: dragdropimpl.h:18
iterator end()
Definition: _vector.h:184
iterator begin()
Definition: _vector.h:182

Member Function Documentation

◆ CopyMedium()

void IDataObjectImpl::CopyMedium ( STGMEDIUM *  pMedDest,
STGMEDIUM *  pMedSrc,
FORMATETC *  pFmtSrc 
)

Definition at line 140 of file dragdropimpl.cpp.

141{
142 switch(pMedSrc->tymed)
143 {
144 case TYMED_HGLOBAL:
145 pMedDest->hGlobal = (HGLOBAL)OleDuplicateData(pMedSrc->hGlobal, pFmtSrc->cfFormat, 0);
146 break;
147 case TYMED_GDI:
148 pMedDest->hBitmap = (HBITMAP)OleDuplicateData(pMedSrc->hBitmap, pFmtSrc->cfFormat, 0);
149 break;
150 case TYMED_MFPICT:
151 pMedDest->hMetaFilePict = (HMETAFILEPICT)OleDuplicateData(pMedSrc->hMetaFilePict, pFmtSrc->cfFormat, 0);
152 break;
153 case TYMED_ENHMF:
154 pMedDest->hEnhMetaFile = (HENHMETAFILE)OleDuplicateData(pMedSrc->hEnhMetaFile, pFmtSrc->cfFormat, 0);
155 break;
156 case TYMED_FILE:
157 pMedDest->lpszFileName = (LPOLESTR)OleDuplicateData(pMedSrc->lpszFileName, pFmtSrc->cfFormat, 0);
158 break;
159 case TYMED_ISTREAM:
160 pMedDest->pstm = pMedSrc->pstm;
161 pMedSrc->pstm->AddRef();
162 break;
163 case TYMED_ISTORAGE:
164 pMedDest->pstg = pMedSrc->pstg;
165 pMedSrc->pstg->AddRef();
166 break;
167 case TYMED_NULL:
168 default:
169 break;
170 }
171 pMedDest->tymed = pMedSrc->tymed;
172 pMedDest->pUnkForRelease = pMedSrc->pUnkForRelease;
173}
nsrefcnt AddRef()
static HBITMAP
Definition: button.c:44
static LPOLESTR
Definition: stg_prop.c:27
HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
Definition: ole2impl.c:425
#define HGLOBAL
Definition: ole.h:15

Referenced by GetData(), and SetData().

◆ DAdvise()

STDMETHODIMP IDataObjectImpl::DAdvise ( FORMATETC __RPC_FAR pformatetc,
DWORD  advf,
IAdviseSink __RPC_FAR pAdvSink,
DWORD __RPC_FAR pdwConnection 
)
virtual

Definition at line 203 of file dragdropimpl.cpp.

208{
210}
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ DUnadvise()

STDMETHODIMP IDataObjectImpl::DUnadvise ( DWORD  dwConnection)
virtual

Definition at line 212 of file dragdropimpl.cpp.

214{
215 return E_NOTIMPL;
216}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumDAdvise()

HRESULT STDMETHODCALLTYPE IDataObjectImpl::EnumDAdvise ( IEnumSTATDATA __RPC_FAR *__RPC_FAR ppenumAdvise)
virtual

Definition at line 218 of file dragdropimpl.cpp.

220{
222}

◆ EnumFormatEtc()

STDMETHODIMP IDataObjectImpl::EnumFormatEtc ( DWORD  dwDirection,
IEnumFORMATETC __RPC_FAR *__RPC_FAR ppenumFormatEtc 
)
virtual

Definition at line 175 of file dragdropimpl.cpp.

178{
179 if (ppenumFormatEtc == NULL)
180 return E_POINTER;
181
182 *ppenumFormatEtc=NULL;
183 switch (dwDirection)
184 {
185 case DATADIR_GET:
186 *ppenumFormatEtc = new EnumFormatEtcImpl(_storage);
187
188 if (!*ppenumFormatEtc)
189 return E_OUTOFMEMORY;
190
191 (*ppenumFormatEtc)->AddRef();
192 break;
193
194 case DATADIR_SET:
195 default:
196 return E_NOTIMPL;
197 break;
198 }
199
200 return S_OK;
201}
implementation of IEnumFORMATETC interface
Definition: dragdropimpl.h:29
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetCanonicalFormatEtc()

STDMETHODIMP IDataObjectImpl::GetCanonicalFormatEtc ( FORMATETC __RPC_FAR pformatectIn,
FORMATETC __RPC_FAR pformatetcOut 
)
virtual

Definition at line 95 of file dragdropimpl.cpp.

98{
99 if (pformatetcOut == NULL)
100 return E_INVALIDARG;
101
103}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define DATA_S_SAMEFORMATETC
Definition: winerror.h:2674

◆ GetData()

STDMETHODIMP IDataObjectImpl::GetData ( FORMATETC __RPC_FAR pformatetcIn,
STGMEDIUM __RPC_FAR pmedium 
)
virtual

Definition at line 37 of file dragdropimpl.cpp.

40{
41 if (pformatetcIn == NULL || pmedium == NULL)
42 return E_INVALIDARG;
43
44 pmedium->hGlobal = NULL;
45
46 for(StorageArray::iterator it=_storage.begin(); it!=_storage.end(); ++it)
47 {
48 if (pformatetcIn->tymed & it->_format->tymed &&
49 pformatetcIn->dwAspect == it->_format->dwAspect &&
50 pformatetcIn->cfFormat == it->_format->cfFormat)
51 {
52 CopyMedium(pmedium, it->_medium, it->_format);
53 return S_OK;
54 }
55 }
56
57 return DV_E_FORMATETC;
58}
void CopyMedium(STGMEDIUM *pMedDest, STGMEDIUM *pMedSrc, FORMATETC *pFmtSrc)
#define DV_E_FORMATETC
Definition: winerror.h:2633

◆ GetDataHere()

STDMETHODIMP IDataObjectImpl::GetDataHere ( FORMATETC __RPC_FAR pformatetc,
STGMEDIUM __RPC_FAR pmedium 
)
virtual

Definition at line 60 of file dragdropimpl.cpp.

63{
64 return E_NOTIMPL;
65}

◆ QueryGetData()

STDMETHODIMP IDataObjectImpl::QueryGetData ( FORMATETC __RPC_FAR pformatetc)
virtual

Definition at line 67 of file dragdropimpl.cpp.

69{
70 if (pformatetc == NULL)
71 return E_INVALIDARG;
72
73 //support others if needed DVASPECT_THUMBNAIL //DVASPECT_ICON //DVASPECT_DOCPRINT
74 if (!(DVASPECT_CONTENT & pformatetc->dwAspect))
75 return (DV_E_DVASPECT);
76
78
79 for(StorageArray::iterator it=_storage.begin(); it!=_storage.end(); ++it)
80 {
81 if (pformatetc->tymed & it->_format->tymed)
82 {
83 if (pformatetc->cfFormat == it->_format->cfFormat)
84 return S_OK;
85 else
87 }
88 else
89 hr = DV_E_TYMED;
90 }
91
92 return hr;
93}
HRESULT hr
Definition: shlfolder.c:183
#define DV_E_TYMED
Definition: winerror.h:2638
#define DV_E_CLIPFORMAT
Definition: winerror.h:2639
#define DV_E_DVASPECT
Definition: winerror.h:2640

◆ SetData()

STDMETHODIMP IDataObjectImpl::SetData ( FORMATETC __RPC_FAR pformatetc,
STGMEDIUM __RPC_FAR pmedium,
BOOL  fRelease 
)
virtual

Definition at line 105 of file dragdropimpl.cpp.

109{
110 if (pformatetc == NULL || pmedium == NULL)
111 return E_INVALIDARG;
112
113 assert(pformatetc->tymed == pmedium->tymed);
114 FORMATETC* fetc=new FORMATETC;
115 STGMEDIUM* pStgMed = new STGMEDIUM;
116
117 if (fetc == NULL || pStgMed == NULL)
118 return E_OUTOFMEMORY;
119
120 ZeroMemory(fetc, sizeof(FORMATETC));
121 ZeroMemory(pStgMed, sizeof(STGMEDIUM));
122
123 *fetc = *pformatetc;
124
125 if (fRelease)
126 *pStgMed = *pmedium;
127 else
128 CopyMedium(pStgMed, pmedium, pformatetc);
129
130 DataStorage storage;
131
132 storage._format = fetc;
133 storage._medium = pStgMed;
134
135 _storage.push_back(storage);
136
137 return S_OK;
138}
#define assert(x)
Definition: debug.h:53
FORMATETC * _format
Definition: dragdropimpl.h:19
STGMEDIUM * _medium
Definition: dragdropimpl.h:20
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
Definition: _vector.h:379
#define ZeroMemory
Definition: winbase.h:1670

Member Data Documentation

◆ _storage

StorageArray IDataObjectImpl::_storage
private

Definition at line 88 of file dragdropimpl.h.

Referenced by EnumFormatEtc(), GetData(), QueryGetData(), SetData(), and ~IDataObjectImpl().

◆ IDataObject_iface

IDataObject IDataObjectImpl::IDataObject_iface

Definition at line 142 of file shlview.c.

◆ m_cRefCount

long IDataObjectImpl::m_cRefCount
private

Definition at line 86 of file dragdropimpl.h.

◆ m_pDropSource

IDropSourceImpl* IDataObjectImpl::m_pDropSource
private

Definition at line 85 of file dragdropimpl.h.

◆ ref

LONG IDataObjectImpl::ref

Definition at line 143 of file shlview.c.


The documentation for this struct was generated from the following files: