Qt 4.8
Public Functions | Properties | List of all members
QOleDataObject Class Reference

#include <qdnd_p.h>

Inheritance diagram for QOleDataObject:

Public Functions

STDMETHOD() DAdvise (FORMATETC FAR *pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD FAR *pdwConnection)
 
STDMETHOD() DUnadvise (DWORD dwConnection)
 
STDMETHOD() EnumDAdvise (LPENUMSTATDATA FAR *ppenumAdvise)
 
STDMETHOD() EnumFormatEtc (DWORD dwDirection, LPENUMFORMATETC FAR *ppenumFormatEtc)
 
STDMETHOD() GetCanonicalFormatEtc (LPFORMATETC pformatetc, LPFORMATETC pformatetcOut)
 
STDMETHOD() GetData (LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium)
 
STDMETHOD() GetDataHere (LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)
 
const QMimeDatamimeData () const
 
 QOleDataObject (QMimeData *mimeData)
 
STDMETHOD() QueryGetData (LPFORMATETC pformatetc)
 
STDMETHOD() QueryInterface (REFIID riid, void FAR *FAR *ppvObj)
 
void releaseQt ()
 
DWORD reportedPerformedEffect () const
 
STDMETHOD() SetData (LPFORMATETC pformatetc, STGMEDIUM FAR *pmedium, BOOL fRelease)
 
 STDMETHOD_ (ULONG, AddRef)(void)
 
 STDMETHOD_ (ULONG, Release)(void)
 
virtual ~QOleDataObject ()
 

Properties

int CF_PERFORMEDDROPEFFECT
 
QPointer< QMimeDatadata
 
ULONG m_refs
 
DWORD performedEffect
 

Detailed Description

Definition at line 104 of file qdnd_p.h.

Constructors and Destructors

◆ QOleDataObject()

QOleDataObject::QOleDataObject ( QMimeData mimeData)
explicit

Definition at line 77 of file qdnd_win.cpp.

78 {
79  m_refs = 1;
80  data = mimeData;
81  CF_PERFORMEDDROPEFFECT = RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
82  performedEffect = DROPEFFECT_NONE;
83 }
QPointer< QMimeData > data
Definition: qdnd_p.h:134
DWORD performedEffect
Definition: qdnd_p.h:136
#define CFSTR_PERFORMEDDROPEFFECT
ULONG m_refs
Definition: qdnd_p.h:133
int CF_PERFORMEDDROPEFFECT
Definition: qdnd_p.h:135
const QMimeData * mimeData() const
Definition: qdnd_win.cpp:94

◆ ~QOleDataObject()

QOleDataObject::~QOleDataObject ( )
virtual

Definition at line 85 of file qdnd_win.cpp.

86 {
87 }

Functions

◆ DAdvise()

STDMETHODIMP QOleDataObject::DAdvise ( FORMATETC FAR *  pFormatetc,
DWORD  advf,
LPADVISESINK  pAdvSink,
DWORD FAR *  pdwConnection 
)

Definition at line 254 of file qdnd_win.cpp.

256 {
257  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
258 }

◆ DUnadvise()

STDMETHODIMP QOleDataObject::DUnadvise ( DWORD  dwConnection)

Definition at line 262 of file qdnd_win.cpp.

263 {
264  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
265 }

◆ EnumDAdvise()

STDMETHODIMP QOleDataObject::EnumDAdvise ( LPENUMSTATDATA FAR *  ppenumAdvise)

Definition at line 268 of file qdnd_win.cpp.

269 {
270  return ResultFromScode(OLE_E_ADVISENOTSUPPORTED);
271 }

◆ EnumFormatEtc()

STDMETHODIMP QOleDataObject::EnumFormatEtc ( DWORD  dwDirection,
LPENUMFORMATETC FAR *  ppenumFormatEtc 
)

Definition at line 218 of file qdnd_win.cpp.

219 {
220 #ifdef QDND_DEBUG
221  qDebug("QOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppenumFormatEtc)");
222 #endif
223 
224  if (!data)
225  return ResultFromScode(DATA_E_FORMATETC);
226 
227  SCODE sc = S_OK;
228 
229  QVector<FORMATETC> fmtetcs;
230  if (dwDirection == DATADIR_GET) {
232  } else {
233  FORMATETC formatetc;
234  formatetc.cfFormat = CF_PERFORMEDDROPEFFECT;
235  formatetc.dwAspect = DVASPECT_CONTENT;
236  formatetc.lindex = -1;
237  formatetc.ptd = NULL;
238  formatetc.tymed = TYMED_HGLOBAL;
239  fmtetcs.append(formatetc);
240  }
241 
242  QOleEnumFmtEtc *enumFmtEtc = new QOleEnumFmtEtc(fmtetcs);
243  *ppenumFormatEtc = enumFmtEtc;
244  if (enumFmtEtc->isNull()) {
245  delete enumFmtEtc;
246  *ppenumFormatEtc = NULL;
247  sc = E_OUTOFMEMORY;
248  }
249 
250  return ResultFromScode(sc);
251 }
bool isNull() const
Definition: qole_win.cpp:111
QPointer< QMimeData > data
Definition: qdnd_p.h:134
struct tagFORMATETC FORMATETC
Definition: qmime.h:66
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
Q_CORE_EXPORT void qDebug(const char *,...)
int CF_PERFORMEDDROPEFFECT
Definition: qdnd_p.h:135
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
static QVector< FORMATETC > allFormatsForMime(const QMimeData *mimeData)
Definition: qmime_win.cpp:375

◆ GetCanonicalFormatEtc()

STDMETHODIMP QOleDataObject::GetCanonicalFormatEtc ( LPFORMATETC  pformatetc,
LPFORMATETC  pformatetcOut 
)

Definition at line 196 of file qdnd_win.cpp.

197 {
198  pformatetcOut->ptd = NULL;
199  return ResultFromScode(E_NOTIMPL);
200 }

◆ GetData()

STDMETHODIMP QOleDataObject::GetData ( LPFORMATETC  pformatetcIn,
LPSTGMEDIUM  pmedium 
)

Definition at line 152 of file qdnd_win.cpp.

153 {
154 #ifdef QDND_DEBUG
155  qDebug("QOleDataObject::GetData(LPFORMATETC pformatetc, LPSTGMEDIUM pmedium)");
156 #ifndef Q_OS_WINCE
157  wchar_t buf[256] = {0};
158  GetClipboardFormatName(pformatetc->cfFormat, buf, 255);
159  qDebug("CF = %d : %s", pformatetc->cfFormat, QString::fromWCharArray(buf));
160 #endif
161 #endif
162 
163  if (!data)
164  return ResultFromScode(DATA_E_FORMATETC);
165 
166  QWindowsMime *converter = QWindowsMime::converterFromMime(*pformatetc, data);
167 
168  if (converter && converter->convertFromMime(*pformatetc, data, pmedium))
169  return ResultFromScode(S_OK);
170  else
171  return ResultFromScode(DATA_E_FORMATETC);
172 }
static QString fromWCharArray(const wchar_t *, int size=-1)
Returns a copy of the string, where the encoding of string depends on the size of wchar...
Definition: qstring.cpp:1019
The QWindowsMime class maps open-standard MIME to Window Clipboard formats.
Definition: qmime.h:79
QPointer< QMimeData > data
Definition: qdnd_p.h:134
Q_CORE_EXPORT void qDebug(const char *,...)
virtual bool convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM *pmedium) const =0
Convert the mimeData to the format specified in formatetc.
static QWindowsMime * converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData)
Definition: qmime_win.cpp:355

◆ GetDataHere()

STDMETHODIMP QOleDataObject::GetDataHere ( LPFORMATETC  pformatetc,
LPSTGMEDIUM  pmedium 
)

Definition at line 175 of file qdnd_win.cpp.

176 {
177  return ResultFromScode(DATA_E_FORMATETC);
178 }

◆ mimeData()

const QMimeData * QOleDataObject::mimeData ( ) const

Definition at line 94 of file qdnd_win.cpp.

Referenced by isProcessBeingDebugged(), QOleDataObject(), QtCeSetClipboard(), and QClipboard::~QClipboard().

95 {
96  return data;
97 }
QPointer< QMimeData > data
Definition: qdnd_p.h:134

◆ QueryGetData()

STDMETHODIMP QOleDataObject::QueryGetData ( LPFORMATETC  pformatetc)

Definition at line 181 of file qdnd_win.cpp.

182 {
183 #ifdef QDND_DEBUG
184  qDebug("QOleDataObject::QueryGetData(LPFORMATETC pformatetc)");
185 #endif
186 
187  if (!data)
188  return ResultFromScode(DATA_E_FORMATETC);
189 
190  if (QWindowsMime::converterFromMime(*pformatetc, data))
191  return ResultFromScode(S_OK);
192  return ResultFromScode(S_FALSE);
193 }
QPointer< QMimeData > data
Definition: qdnd_p.h:134
Q_CORE_EXPORT void qDebug(const char *,...)
static QWindowsMime * converterFromMime(const FORMATETC &formatetc, const QMimeData *mimeData)
Definition: qmime_win.cpp:355

◆ QueryInterface()

STDMETHODIMP QOleDataObject::QueryInterface ( REFIID  riid,
void FAR *FAR *  ppvObj 
)

Definition at line 109 of file qdnd_win.cpp.

110 {
111  if (iid == IID_IUnknown || iid == IID_IDataObject) {
112  *ppv = this;
113  AddRef();
114  return NOERROR;
115  }
116  *ppv = NULL;
117  return ResultFromScode(E_NOINTERFACE);
118 }

◆ releaseQt()

void QOleDataObject::releaseQt ( )

Definition at line 89 of file qdnd_win.cpp.

Referenced by QOleDropTarget::Drop(), and QueryInterface().

90 {
91  data = 0;
92 }
QPointer< QMimeData > data
Definition: qdnd_p.h:134

◆ reportedPerformedEffect()

DWORD QOleDataObject::reportedPerformedEffect ( ) const

Definition at line 99 of file qdnd_win.cpp.

Referenced by QOleDropTarget::Drop().

100 {
101  return performedEffect;
102 }
DWORD performedEffect
Definition: qdnd_p.h:136

◆ SetData()

STDMETHODIMP QOleDataObject::SetData ( LPFORMATETC  pformatetc,
STGMEDIUM FAR *  pmedium,
BOOL  fRelease 
)

Definition at line 203 of file qdnd_win.cpp.

204 {
205  if (pFormatetc->cfFormat == CF_PERFORMEDDROPEFFECT && pMedium->tymed == TYMED_HGLOBAL) {
206  DWORD * val = (DWORD*)GlobalLock(pMedium->hGlobal);
207  performedEffect = *val;
208  GlobalUnlock(pMedium->hGlobal);
209  if (fRelease)
210  ReleaseStgMedium(pMedium);
211  return ResultFromScode(S_OK);
212  }
213  return ResultFromScode(E_NOTIMPL);
214 }
DWORD performedEffect
Definition: qdnd_p.h:136
int CF_PERFORMEDDROPEFFECT
Definition: qdnd_p.h:135

◆ STDMETHOD_() [1/2]

QOleDataObject::STDMETHOD_ ( ULONG  ,
AddRef   
)

◆ STDMETHOD_() [2/2]

QOleDataObject::STDMETHOD_ ( ULONG  ,
Release   
)

Properties

◆ CF_PERFORMEDDROPEFFECT

int QOleDataObject::CF_PERFORMEDDROPEFFECT
private

Definition at line 135 of file qdnd_p.h.

Referenced by EnumFormatEtc(), QOleDataObject(), and SetData().

◆ data

QPointer<QMimeData> QOleDataObject::data
private

◆ m_refs

ULONG QOleDataObject::m_refs
private

◆ performedEffect

DWORD QOleDataObject::performedEffect
private

Definition at line 136 of file qdnd_p.h.

Referenced by QOleDataObject(), reportedPerformedEffect(), and SetData().


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