summaryrefslogtreecommitdiff
path: root/libs/mTextControl/src/dataobject.h
blob: b0547367c01e58d4751f192c74c705f1c7f86cee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once

class CDataObject : public IDataObject
{
public:
	//
	// IUnknown members
	//
	HRESULT __stdcall QueryInterface(REFIID iid, void** ppvObject);
	ULONG   __stdcall AddRef(void);
	ULONG   __stdcall Release(void);

	//
	// IDataObject members
	//
	HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium);
	HRESULT __stdcall GetDataHere(FORMATETC* pFormatEtc, STGMEDIUM* pMedium);
	HRESULT __stdcall QueryGetData(FORMATETC* pFormatEtc);
	HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC* pFormatEct, FORMATETC* pFormatEtcOut);
	HRESULT __stdcall SetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium, BOOL fRelease);
	HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC** ppEnumFormatEtc);
	HRESULT __stdcall DAdvise(FORMATETC* pFormatEtc, DWORD advf, IAdviseSink* pAdvSink, DWORD* pdwConnection);
	HRESULT __stdcall DUnadvise(DWORD dwConnection);
	HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** ppEnumAdvise);

	//
	// Constructor / Destructor
	//
	CDataObject();
	CDataObject(const FORMATETC* fmt, const STGMEDIUM* stgmed, int count);
	~CDataObject();

protected:
	void UpdateData(const FORMATETC* pFormatEtc, const STGMEDIUM* pMedium, int count);

private:

	int LookupFormatEtc(FORMATETC* pFormatEtc);

	//
	// any private members and functions
	//
	LONG	   m_lRefCount;

	FORMATETC* m_pFormatEtc;
	STGMEDIUM* m_pStgMedium;
	LONG	   m_nNumFormats;

};

class CEMFObject : public CDataObject
{
public:
	// IDataObject members
	HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium);

	// Constructor / Destructor
	CEMFObject(HENHMETAFILE hEmf);
	~CEMFObject();

private:
	HENHMETAFILE m_hEmf;

};