// information functions STDMETHODIMP wxIDataObject::QueryGetData(FORMATETC *pformatetc) { // do we accept data in this format? if ( pformatetc == NULL ) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: invalid ptr.")); return E_INVALIDARG; } // the only one allowed by current COM implementation if ( pformatetc->lindex != -1 ) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: bad lindex %ld"), pformatetc->lindex); return DV_E_LINDEX; } // we don't support anything other (THUMBNAIL, ICON, DOCPRINT...) if ( pformatetc->dwAspect != DVASPECT_CONTENT ) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: bad dwAspect %ld"), pformatetc->dwAspect); return DV_E_DVASPECT; } // and now check the type of data requested wxDataFormat format = pformatetc->cfFormat; if ( m_pDataObject->IsSupportedFormat(format) ) { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: %s ok"), wxGetFormatName(format)); } else { wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: %s unsupported"), wxGetFormatName(format)); return DV_E_FORMATETC; } // we only transfer data by global memory, except for some particular cases DWORD tymed = pformatetc->tymed; if ( (format == wxDF_BITMAP && !(tymed & TYMED_GDI)) && !(tymed & TYMED_HGLOBAL) ) { // it's not what we're waiting for wxLogTrace(wxTRACE_OleCalls, wxT("wxIDataObject::QueryGetData: %s != %s"), GetTymedName(tymed), GetTymedName(format == wxDF_BITMAP ? TYMED_GDI : TYMED_HGLOBAL)); return DV_E_TYMED; } return S_OK; }
void CIDataObject::QueryGetData ( const wxDataFormat& rFormat ) { m_pDataObject->IsSupportedFormat(rFormat); } // end of CIDataObject::QueryGetData