Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

480 lines
15 KiB

  1. /*****************************************************************************\
  2. * *
  3. * dvobj.h - Data/View object definitions *
  4. * *
  5. * OLE Version 2.0 *
  6. * *
  7. * Copyright (c) 1992-1993, Microsoft Corp. All rights reserved. *
  8. * *
  9. \*****************************************************************************/
  10. #if !defined( _DVOBJ_H_ )
  11. #define _DVOBJ_H_
  12. /****** DV value types ******************************************************/
  13. // forward type declarations
  14. #if defined(__cplusplus)
  15. interface IStorage;
  16. interface IStream;
  17. interface IAdviseSink;
  18. interface IMoniker;
  19. #else
  20. typedef interface IStorage IStorage;
  21. typedef interface IStream IStream;
  22. typedef interface IAdviseSink IAdviseSink;
  23. typedef interface IMoniker IMoniker;
  24. #endif
  25. typedef IStorage FAR* LPSTORAGE;
  26. typedef IStream FAR* LPSTREAM;
  27. typedef IAdviseSink FAR* LPADVISESINK;
  28. typedef IMoniker FAR* LPMONIKER;
  29. #if !defined(_MAC)
  30. typedef WORD CLIPFORMAT;
  31. #else
  32. typedef unsigned long CLIPFORMAT; // ResType
  33. #endif
  34. typedef CLIPFORMAT FAR* LPCLIPFORMAT;
  35. // Data/View aspect; specifies the desired aspect of the object when
  36. // drawing or getting data.
  37. typedef enum tagDVASPECT
  38. {
  39. DVASPECT_CONTENT = 1,
  40. DVASPECT_THUMBNAIL = 2,
  41. DVASPECT_ICON = 4,
  42. DVASPECT_DOCPRINT = 8
  43. } DVASPECT;
  44. // Data/View target device; determines the device for drawing or gettting data
  45. typedef struct FARSTRUCT tagDVTARGETDEVICE
  46. {
  47. DWORD tdSize;
  48. WORD tdDriverNameOffset;
  49. WORD tdDeviceNameOffset;
  50. WORD tdPortNameOffset;
  51. WORD tdExtDevmodeOffset;
  52. BYTE tdData[1];
  53. } DVTARGETDEVICE;
  54. // Format, etc.; completely specifices the kind of data desired, including tymed
  55. typedef struct FARSTRUCT tagFORMATETC
  56. {
  57. CLIPFORMAT cfFormat;
  58. DVTARGETDEVICE FAR* ptd;
  59. DWORD dwAspect;
  60. LONG lindex;
  61. DWORD tymed;
  62. } FORMATETC, FAR* LPFORMATETC;
  63. // TYpes of storage MEDiums; determines how data is stored or passed around
  64. typedef enum tagTYMED
  65. {
  66. TYMED_HGLOBAL = 1,
  67. TYMED_FILE = 2,
  68. TYMED_ISTREAM = 4,
  69. TYMED_ISTORAGE = 8,
  70. TYMED_GDI = 16,
  71. TYMED_MFPICT = 32,
  72. TYMED_NULL = 0
  73. } TYMED;
  74. // DATA format DIRection
  75. typedef enum tagDATADIR
  76. {
  77. DATADIR_GET = 1,
  78. DATADIR_SET = 2,
  79. } DATADIR;
  80. // SToraGe MEDIUM; a block of data on a particular medium
  81. typedef struct FARSTRUCT tagSTGMEDIUM
  82. {
  83. DWORD tymed;
  84. union
  85. {
  86. HANDLE hGlobal;
  87. LPSTR lpszFileName;
  88. IStream FAR* pstm;
  89. IStorage FAR* pstg;
  90. }
  91. #ifdef NONAMELESSUNION
  92. u // add a tag when name less unions not supported
  93. #endif
  94. ;
  95. IUnknown FAR* pUnkForRelease;
  96. } STGMEDIUM, FAR* LPSTGMEDIUM;
  97. // Advise Flags
  98. typedef enum tagADVF
  99. {
  100. ADVF_NODATA = 1,
  101. ADVF_PRIMEFIRST = 2,
  102. ADVF_ONLYONCE = 4,
  103. ADVF_DATAONSTOP = 64,
  104. ADVFCACHE_NOHANDLER = 8,
  105. ADVFCACHE_FORCEBUILTIN = 16,
  106. ADVFCACHE_ONSAVE = 32
  107. } ADVF;
  108. // Stats for data; used by several enumerations and by at least one
  109. // implementation of IDataAdviseHolder; if a field is not used, it
  110. // will be NULL.
  111. typedef struct FARSTRUCT tagSTATDATA
  112. { // field used by:
  113. FORMATETC formatetc; // EnumAdvise, EnumData (cache), EnumFormats
  114. DWORD advf; // EnumAdvise, EnumData (cache)
  115. IAdviseSink FAR* pAdvSink; // EnumAdvise
  116. DWORD dwConnection; // EnumAdvise
  117. } STATDATA;
  118. typedef STATDATA FAR* LPSTATDATA;
  119. /****** DV Interfaces ***************************************************/
  120. #undef INTERFACE
  121. #define INTERFACE IEnumFORMATETC
  122. DECLARE_INTERFACE_(IEnumFORMATETC, IUnknown)
  123. {
  124. // *** IUnknown methods ***
  125. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppv) PURE;
  126. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  127. STDMETHOD_(ULONG,Release) (THIS) PURE;
  128. // *** IEnumFORMATETC methods ***
  129. STDMETHOD(Next) (THIS_ ULONG celt, FORMATETC FAR * rgelt, ULONG FAR* pceltFetched) PURE;
  130. STDMETHOD(Skip) (THIS_ ULONG celt) PURE;
  131. STDMETHOD(Reset) (THIS) PURE;
  132. STDMETHOD(Clone) (THIS_ IEnumFORMATETC FAR* FAR* ppenum) PURE;
  133. };
  134. typedef IEnumFORMATETC FAR* LPENUMFORMATETC;
  135. #undef INTERFACE
  136. #define INTERFACE IEnumSTATDATA
  137. DECLARE_INTERFACE_(IEnumSTATDATA, IUnknown)
  138. {
  139. // *** IUnknown methods ***
  140. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppv) PURE;
  141. STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  142. STDMETHOD_(ULONG, Release) (THIS) PURE;
  143. // *** IEnumSTATDATA methods ***
  144. STDMETHOD(Next) (THIS_ ULONG celt, STATDATA FAR * rgelt, ULONG FAR* pceltFetched) PURE;
  145. STDMETHOD(Skip) (THIS_ ULONG celt) PURE;
  146. STDMETHOD(Reset) (THIS) PURE;
  147. STDMETHOD(Clone) (THIS_ IEnumSTATDATA FAR* FAR* ppenum) PURE;
  148. };
  149. typedef IEnumSTATDATA FAR* LPENUMSTATDATA;
  150. #undef INTERFACE
  151. #define INTERFACE IDataObject
  152. #define DATA_E_FORMATETC DV_E_FORMATETC
  153. #define DATA_S_SAMEFORMATETC (DATA_S_FIRST + 0)
  154. DECLARE_INTERFACE_(IDataObject, IUnknown)
  155. {
  156. // *** IUnknown methods ***
  157. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  158. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  159. STDMETHOD_(ULONG, Release) (THIS) PURE;
  160. // *** IDataObject methods ***
  161. STDMETHOD(GetData) (THIS_ LPFORMATETC pformatetcIn,
  162. LPSTGMEDIUM pmedium ) PURE;
  163. STDMETHOD(GetDataHere) (THIS_ LPFORMATETC pformatetc,
  164. LPSTGMEDIUM pmedium ) PURE;
  165. STDMETHOD(QueryGetData) (THIS_ LPFORMATETC pformatetc ) PURE;
  166. STDMETHOD(GetCanonicalFormatEtc) (THIS_ LPFORMATETC pformatetc,
  167. LPFORMATETC pformatetcOut) PURE;
  168. STDMETHOD(SetData) (THIS_ LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
  169. BOOL fRelease) PURE;
  170. STDMETHOD(EnumFormatEtc) (THIS_ DWORD dwDirection,
  171. LPENUMFORMATETC FAR* ppenumFormatEtc) PURE;
  172. STDMETHOD(DAdvise) (THIS_ FORMATETC FAR* pFormatetc, DWORD advf,
  173. LPADVISESINK pAdvSink, DWORD FAR* pdwConnection) PURE;
  174. STDMETHOD(DUnadvise) (THIS_ DWORD dwConnection) PURE;
  175. STDMETHOD(EnumDAdvise) (THIS_ LPENUMSTATDATA FAR* ppenumAdvise) PURE;
  176. };
  177. typedef IDataObject FAR* LPDATAOBJECT;
  178. #undef INTERFACE
  179. #define INTERFACE IViewObject
  180. #define VIEW_E_DRAW (VIEW_E_FIRST)
  181. #define E_DRAW VIEW_E_DRAW
  182. #define VIEW_S_ALREADY_FROZEN (VIEW_S_FIRST)
  183. DECLARE_INTERFACE_(IViewObject, IUnknown)
  184. {
  185. // *** IUnknown methods ***
  186. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  187. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  188. STDMETHOD_(ULONG,Release) (THIS) PURE;
  189. // *** IViewObject methods ***
  190. STDMETHOD(Draw) (THIS_ DWORD dwDrawAspect, LONG lindex,
  191. void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  192. HDC hicTargetDev,
  193. HDC hdcDraw,
  194. LPCRECTL lprcBounds,
  195. LPCRECTL lprcWBounds,
  196. BOOL (CALLBACK * pfnContinue) (DWORD),
  197. DWORD dwContinue) PURE;
  198. STDMETHOD(GetColorSet) (THIS_ DWORD dwDrawAspect, LONG lindex,
  199. void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  200. HDC hicTargetDev,
  201. LPLOGPALETTE FAR* ppColorSet) PURE;
  202. STDMETHOD(Freeze)(THIS_ DWORD dwDrawAspect, LONG lindex,
  203. void FAR* pvAspect,
  204. DWORD FAR* pdwFreeze) PURE;
  205. STDMETHOD(Unfreeze) (THIS_ DWORD dwFreeze) PURE;
  206. STDMETHOD(SetAdvise) (THIS_ DWORD aspects, DWORD advf,
  207. LPADVISESINK pAdvSink) PURE;
  208. STDMETHOD(GetAdvise) (THIS_ DWORD FAR* pAspects, DWORD FAR* pAdvf,
  209. LPADVISESINK FAR* ppAdvSink) PURE;
  210. };
  211. typedef IViewObject FAR* LPVIEWOBJECT;
  212. #undef INTERFACE
  213. #define INTERFACE IViewObject2
  214. DECLARE_INTERFACE_(IViewObject2, IViewObject)
  215. {
  216. // *** IUnknown methods ***
  217. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  218. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  219. STDMETHOD_(ULONG,Release) (THIS) PURE;
  220. // *** IViewObject methods ***
  221. STDMETHOD(Draw) (THIS_ DWORD dwDrawAspect, LONG lindex,
  222. void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  223. HDC hicTargetDev,
  224. HDC hdcDraw,
  225. LPCRECTL lprcBounds,
  226. LPCRECTL lprcWBounds,
  227. BOOL (CALLBACK * pfnContinue) (DWORD),
  228. DWORD dwContinue) PURE;
  229. STDMETHOD(GetColorSet) (THIS_ DWORD dwDrawAspect, LONG lindex,
  230. void FAR* pvAspect, DVTARGETDEVICE FAR * ptd,
  231. HDC hicTargetDev,
  232. LPLOGPALETTE FAR* ppColorSet) PURE;
  233. STDMETHOD(Freeze)(THIS_ DWORD dwDrawAspect, LONG lindex,
  234. void FAR* pvAspect,
  235. DWORD FAR* pdwFreeze) PURE;
  236. STDMETHOD(Unfreeze) (THIS_ DWORD dwFreeze) PURE;
  237. STDMETHOD(SetAdvise) (THIS_ DWORD aspects, DWORD advf,
  238. LPADVISESINK pAdvSink) PURE;
  239. STDMETHOD(GetAdvise) (THIS_ DWORD FAR* pAspects, DWORD FAR* pAdvf,
  240. LPADVISESINK FAR* ppAdvSink) PURE;
  241. // *** IViewObject2 methods ***
  242. STDMETHOD(GetExtent) (THIS_ DWORD dwDrawAspect, LONG lindex,
  243. DVTARGETDEVICE FAR * ptd, LPSIZEL lpsizel) PURE;
  244. };
  245. typedef IViewObject2 FAR* LPVIEWOBJECT2;
  246. #undef INTERFACE
  247. #define INTERFACE IAdviseSink
  248. DECLARE_INTERFACE_(IAdviseSink, IUnknown)
  249. {
  250. // *** IUnknown methods ***
  251. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppv) PURE;
  252. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  253. STDMETHOD_(ULONG,Release) (THIS) PURE;
  254. // *** IAdviseSink methods ***
  255. STDMETHOD_(void,OnDataChange)(THIS_ FORMATETC FAR* pFormatetc,
  256. STGMEDIUM FAR* pStgmed) PURE;
  257. STDMETHOD_(void,OnViewChange)(THIS_ DWORD dwAspect, LONG lindex) PURE;
  258. STDMETHOD_(void,OnRename)(THIS_ LPMONIKER pmk) PURE;
  259. STDMETHOD_(void,OnSave)(THIS) PURE;
  260. STDMETHOD_(void,OnClose)(THIS) PURE;
  261. };
  262. typedef IAdviseSink FAR* LPADVISESINK;
  263. #undef INTERFACE
  264. #define INTERFACE IAdviseSink2
  265. DECLARE_INTERFACE_(IAdviseSink2, IAdviseSink)
  266. {
  267. // *** IUnknown methods ***
  268. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppv) PURE;
  269. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  270. STDMETHOD_(ULONG,Release) (THIS) PURE;
  271. // *** IAdviseSink methods ***
  272. STDMETHOD_(void,OnDataChange)(THIS_ FORMATETC FAR* pFormatetc,
  273. STGMEDIUM FAR* pStgmed) PURE;
  274. STDMETHOD_(void,OnViewChange)(THIS_ DWORD dwAspect, LONG lindex) PURE;
  275. STDMETHOD_(void,OnRename)(THIS_ LPMONIKER pmk) PURE;
  276. STDMETHOD_(void,OnSave)(THIS) PURE;
  277. STDMETHOD_(void,OnClose)(THIS) PURE;
  278. // *** IAdviseSink2 methods ***
  279. STDMETHOD_(void,OnLinkSrcChange)(THIS_ LPMONIKER pmk) PURE;
  280. };
  281. typedef IAdviseSink2 FAR* LPADVISESINK2;
  282. #undef INTERFACE
  283. #define INTERFACE IDataAdviseHolder
  284. DECLARE_INTERFACE_(IDataAdviseHolder, IUnknown)
  285. {
  286. // *** IUnknown methods ***
  287. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppv) PURE;
  288. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  289. STDMETHOD_(ULONG,Release) (THIS) PURE;
  290. // *** IDataAdviseHolder methods ***
  291. STDMETHOD(Advise)(THIS_ LPDATAOBJECT pDataObject, FORMATETC FAR* pFetc,
  292. DWORD advf, LPADVISESINK pAdvise, DWORD FAR* pdwConnection) PURE;
  293. STDMETHOD(Unadvise)(THIS_ DWORD dwConnection) PURE;
  294. STDMETHOD(EnumAdvise)(THIS_ LPENUMSTATDATA FAR* ppenumAdvise) PURE;
  295. STDMETHOD(SendOnDataChange)(THIS_ LPDATAOBJECT pDataObject, DWORD dwReserved, DWORD advf) PURE;
  296. };
  297. typedef IDataAdviseHolder FAR* LPDATAADVISEHOLDER;
  298. #undef INTERFACE
  299. #define INTERFACE IOleCache
  300. #define CACHE_E_NOCACHE_UPDATED (CACHE_E_FIRST)
  301. #define CACHE_S_FORMATETC_NOTSUPPORTED (CACHE_S_FIRST)
  302. #define CACHE_S_SAMECACHE (CACHE_S_FIRST+1)
  303. #define CACHE_S_SOMECACHES_NOTUPDATED (CACHE_S_FIRST+2)
  304. DECLARE_INTERFACE_(IOleCache, IUnknown)
  305. {
  306. // *** IUnknown methods ***
  307. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  308. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  309. STDMETHOD_(ULONG,Release) (THIS) PURE;
  310. // *** IOleCache methods ***
  311. STDMETHOD(Cache) (THIS_ LPFORMATETC lpFormatetc, DWORD advf, LPDWORD lpdwConnection) PURE;
  312. STDMETHOD(Uncache) (THIS_ DWORD dwConnection) PURE;
  313. STDMETHOD(EnumCache) (THIS_ LPENUMSTATDATA FAR* ppenumStatData) PURE;
  314. STDMETHOD(InitCache) (THIS_ LPDATAOBJECT pDataObject) PURE;
  315. STDMETHOD(SetData) (THIS_ LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
  316. BOOL fRelease) PURE;
  317. };
  318. typedef IOleCache FAR* LPOLECACHE;
  319. // Cache update Flags
  320. #define UPDFCACHE_NODATACACHE 0x00000001
  321. #define UPDFCACHE_ONSAVECACHE 0x00000002
  322. #define UPDFCACHE_ONSTOPCACHE 0x00000004
  323. #define UPDFCACHE_NORMALCACHE 0x00000008
  324. #define UPDFCACHE_IFBLANK 0x00000010
  325. #define UPDFCACHE_ONLYIFBLANK 0x80000000
  326. #define UPDFCACHE_IFBLANKORONSAVECACHE (UPDFCACHE_IFBLANK | UPDFCACHE_ONSAVECACHE )
  327. #define UPDFCACHE_ALL (~UPDFCACHE_ONLYIFBLANK)
  328. #define UPDFCACHE_ALLBUTNODATACACHE (UPDFCACHE_ALL & ~UPDFCACHE_NODATACACHE)
  329. // IOleCache2::DiscardCache options
  330. typedef enum tagDISCARDCACHE
  331. {
  332. DISCARDCACHE_SAVEIFDIRTY = 0, // Save all dirty cache before discarding
  333. DISCARDCACHE_NOSAVE = 1 // Don't save dirty caches before
  334. // discarding
  335. } DISCARDCACHE;
  336. #undef INTERFACE
  337. #define INTERFACE IOleCache2
  338. DECLARE_INTERFACE_(IOleCache2, IOleCache)
  339. {
  340. // *** IUnknown methods ***
  341. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  342. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  343. STDMETHOD_(ULONG, Release) (THIS) PURE;
  344. // *** IOleCache methods ***
  345. STDMETHOD(Cache) (THIS_ LPFORMATETC lpFormatetc, DWORD advf, LPDWORD lpdwConnection) PURE;
  346. STDMETHOD(Uncache) (THIS_ DWORD dwConnection) PURE;
  347. STDMETHOD(EnumCache) (THIS_ LPENUMSTATDATA FAR* ppenumStatData) PURE;
  348. STDMETHOD(InitCache) (THIS_ LPDATAOBJECT pDataObject) PURE;
  349. STDMETHOD(SetData) (THIS_ LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium,
  350. BOOL fRelease) PURE;
  351. // *** IOleCache2 methods ***
  352. STDMETHOD(UpdateCache) (THIS_ LPDATAOBJECT pDataObject, DWORD grfUpdf,
  353. LPVOID pReserved) PURE;
  354. STDMETHOD(DiscardCache) (THIS_ DWORD dwDiscardOptions) PURE;
  355. };
  356. typedef IOleCache2 FAR* LPOLECACHE2;
  357. #undef INTERFACE
  358. #define INTERFACE IOleCacheControl
  359. DECLARE_INTERFACE_(IOleCacheControl, IUnknown)
  360. {
  361. // *** IUnknown methods ***
  362. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  363. STDMETHOD_(ULONG,AddRef) (THIS) PURE;
  364. STDMETHOD_(ULONG, Release) (THIS) PURE;
  365. // *** IDataObject methods ***
  366. STDMETHOD(OnRun) (THIS_ LPDATAOBJECT pDataObject) PURE;
  367. STDMETHOD(OnStop) (THIS) PURE;
  368. };
  369. typedef IOleCacheControl FAR* LPOLECACHECONTROL;
  370. /****** DV APIs ***********************************************************/
  371. STDAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER FAR* ppDAHolder);
  372. STDAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid,
  373. REFIID iid, LPVOID FAR* ppv);
  374. #endif // _DVOBJ_H_