43 static int compare(
const FORMATETC & v1,
const FORMATETC & v2) {
45 val =
pfc::compare_t(v1.cfFormat,v2.cfFormat);
if (val != 0)
return val;
46 val =
pfc::compare_t(v1.dwAspect,v2.dwAspect);
if (val != 0)
return val;
47 val =
pfc::compare_t(v1.lindex, v2.lindex );
if (val != 0)
return val;
56 HRESULT STDMETHODCALLTYPE GetData(FORMATETC * formatetc, STGMEDIUM * medium) {
57 return GetData_internal(formatetc,medium,
false);
60 HRESULT STDMETHODCALLTYPE
GetDataHere(FORMATETC * formatetc, STGMEDIUM * medium) {
61 return GetData_internal(formatetc,medium,
true);
65 if (formatetc == NULL)
return E_INVALIDARG;
67 if ((DataBlockToSTGMEDIUM_SupportedTymeds & formatetc->tymed) == 0)
return DV_E_TYMED;
70 return RenderDataTest(formatetc->cfFormat,formatetc->dwAspect,formatetc->lindex);
77 if (in == NULL || out == NULL)
80 return DATA_S_SAMEFORMATETC;
83 HRESULT STDMETHODCALLTYPE
EnumFormatEtc(DWORD dwDirection,IEnumFORMATETC ** ppenumFormatetc) {
84 if (dwDirection == DATADIR_GET) {
85 if (ppenumFormatetc == NULL)
return E_INVALIDARG;
86 return CreateIEnumFORMATETC(ppenumFormatetc);
87 }
else if (dwDirection == DATADIR_SET) {
94 HRESULT STDMETHODCALLTYPE
SetData(FORMATETC * pFormatetc, STGMEDIUM * pmedium,
BOOL fRelease) {
97 if (pFormatetc == NULL || pmedium == NULL)
return E_INVALIDARG;
109 if (FAILED(state))
return state;
110 m_entries.set(*pFormatetc,temp);
114 HRESULT STDMETHODCALLTYPE
DAdvise(FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD * pdwConnection) {
return OLE_E_ADVISENOTSUPPORTED;}
115 HRESULT STDMETHODCALLTYPE
DUnadvise(DWORD dwConnection) {
return OLE_E_ADVISENOTSUPPORTED;}
116 HRESULT STDMETHODCALLTYPE
EnumDAdvise(IEnumSTATDATA ** ppenumAdvise) {
return OLE_E_ADVISENOTSUPPORTED;}
120 fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = dataIndex;
126 return DV_E_FORMATETC;
130 fmt.cfFormat = format; fmt.dwAspect = aspect; fmt.lindex = dataIndex;
131 if (m_entries.have_item(fmt))
return S_OK;
132 return DV_E_FORMATETC;
138 fmt.dwAspect = DVASPECT_CONTENT;
141 for(
t_size medWalk = 0; medWalk < 32; ++medWalk) {
142 const DWORD med = 1 << medWalk;
143 if ((DataBlockToSTGMEDIUM_SupportedTymeds & med) != 0) {
153 formats.
add_item( walk->m_key.cfFormat );
156 AddFormat(out, *walk);
168 if (formatetc == NULL || medium == NULL)
return E_INVALIDARG;
172 HRESULT hr = RenderData(formatetc->cfFormat,formatetc->dwAspect,formatetc->lindex,out);
173 if (FAILED(hr))
return hr;
HRESULT STDMETHODCALLTYPE DUnadvise(DWORD dwConnection)
HRESULT STDMETHODCALLTYPE SetData(FORMATETC *pFormatetc, STGMEDIUM *pmedium, BOOL fRelease)
const t_item * get_ptr() const
HRESULT DataBlockToSTGMEDIUM(const void *blockPtr, t_size blockSize, STGMEDIUM *medium, DWORD tymed, bool bHere)
HRESULT SetDataObjectString(pfc::com_ptr_t< IDataObject > obj, const char *str)
HRESULT STDMETHODCALLTYPE EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumFormatetc)
HRESULT GetData_internal(FORMATETC *formatetc, STGMEDIUM *medium, bool bHere)
t_size add_item(const T &item)
HRESULT STDMETHODCALLTYPE EnumDAdvise(IEnumSTATDATA **ppenumAdvise)
HRESULT ExtractDataObjectString(pfc::com_ptr_t< IDataObject > obj, pfc::string_base &out)
static const DWORD DataBlockToSTGMEDIUM_SupportedTymeds
typedef BOOL(WINAPI *pPowerSetRequest_t)(__in HANDLE PowerRequest
HRESULT STDMETHODCALLTYPE DAdvise(FORMATETC *pFormatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
pfc::list_base_t< FORMATETC > TFormatList
ReleaseStgMediumScope(STGMEDIUM *medium)
pfc::map_t< FORMATETC, pfc::array_t< t_uint8 >, comparator_FORMATETC > t_entries
const t_item * get_ptr() const
HRESULT ExtractDataObjectContentTest(pfc::com_ptr_t< IDataObject > obj, UINT format, DWORD aspect, LONG index)
static void AddFormat(TFormatList &out, UINT code)
const_iterator first() const
HRESULT ExtractDataObjectContent(pfc::com_ptr_t< IDataObject > obj, UINT format, DWORD aspect, LONG index, pfc::array_t< t_uint8 > &out)
HRESULT PasteSucceeded(pfc::com_ptr_t< IDataObject > obj, DWORD effect)
virtual void EnumFormats(TFormatList &out) const
HRESULT ExtractDataObjectDWORD(pfc::com_ptr_t< IDataObject > obj, UINT format, DWORD &val)
int compare_t(const hasher_md5_result &p_item1, const hasher_md5_result &p_item2)
HRESULT STDMETHODCALLTYPE QueryGetData(FORMATETC *formatetc)
HRESULT STGMEDIUMToDataBlock(const STGMEDIUM &med, pfc::array_t< t_uint8 > &out)
HRESULT SetDataObjectContent(pfc::com_ptr_t< IDataObject > obj, UINT format, DWORD aspect, LONG index, const void *data, t_size dataSize)
HRESULT CreateIEnumFORMATETC(IEnumFORMATETC **outptr) const
HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc(FORMATETC *in, FORMATETC *out)
t_storage & add_item(t_param const &p_item)
virtual HRESULT RenderDataTest(UINT format, DWORD aspect, LONG dataIndex) const
HGLOBAL HGlobalFromMemblock(const void *ptr, t_size size)
HRESULT SetDataObjectDWORD(pfc::com_ptr_t< IDataObject > obj, UINT format, DWORD val)
HRESULT STDMETHODCALLTYPE GetDataHere(FORMATETC *formatetc, STGMEDIUM *medium)
static const DWORD ExtractDataObjectContent_SupportedTymeds
virtual HRESULT RenderData(UINT format, DWORD aspect, LONG dataIndex, stream_writer_formatter<> &out) const