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.

177 lines
4.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: mf.h
  7. //
  8. // Contents: Declaration of CMfObject (metafile presentation object)
  9. //
  10. // Classes: CMfObject
  11. //
  12. // Functions:
  13. //
  14. // History: dd-mmm-yy Author Comment
  15. // 01-Feb-95 t-ScottH add Dump method to CMfObject
  16. // 24-Jan-94 alexgo first pass converting to Cairo style
  17. // memory allocation
  18. // 29-Nov-93 alexgo 32bit port
  19. //
  20. //--------------------------------------------------------------------------
  21. #include "olepres.h"
  22. #include "olecache.h"
  23. #include "cachenod.h"
  24. #define RECORD_COUNT 16
  25. #ifndef _MAC
  26. typedef struct _METADC
  27. {
  28. int xMwo;
  29. int yMwo;
  30. int xMwe;
  31. int yMwe;
  32. int xre;
  33. int yre;
  34. struct _METADC FAR* pNext;
  35. } METADC, *PMETADC, FAR* LPMETADC;
  36. typedef struct _METAINFO
  37. {
  38. METADC headDc;
  39. int xwo;
  40. int ywo;
  41. int xwe;
  42. int ywe;
  43. int xro;
  44. int yro;
  45. } METAINFO, *PMETAINFO, FAR* LPMETAINFO;
  46. #endif
  47. //+-------------------------------------------------------------------------
  48. //
  49. // Class: CMfObject
  50. //
  51. // Purpose: Metafile presentation object
  52. //
  53. // Interface: IOlePresObj
  54. //
  55. // History: dd-mmm-yy Author Comment
  56. // 01-Feb-95 t-ScottH add Dump method (_DEBUG only) (this method
  57. // is also a method in IOlePresObj
  58. // 29-Nov-93 alexgo 32bit port
  59. //
  60. // Notes:
  61. //
  62. //--------------------------------------------------------------------------
  63. class FAR CMfObject : public IOlePresObj, public CPrivAlloc
  64. {
  65. public:
  66. CMfObject(LPCACHENODE pCacheNode, DWORD dwAspect,
  67. BOOL fConvert = FALSE);
  68. ~CMfObject(void);
  69. STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR* ppvObj);
  70. STDMETHOD_(ULONG,AddRef) (THIS) ;
  71. STDMETHOD_(ULONG,Release) (THIS);
  72. STDMETHOD(GetData) (THIS_ LPFORMATETC pformatetcIn,
  73. LPSTGMEDIUM pmedium );
  74. STDMETHOD(GetDataHere) (THIS_ LPFORMATETC pformatetcIn,
  75. LPSTGMEDIUM pmedium );
  76. STDMETHOD(SetDataWDO) (THIS_ LPFORMATETC pformatetc,
  77. STGMEDIUM FAR * pmedium,
  78. BOOL fRelease, IDataObject * pdo);
  79. STDMETHOD(Draw) (THIS_ void FAR* pvAspect, HDC hicTargetDev,
  80. HDC hdcDraw,
  81. LPCRECTL lprcBounds,
  82. LPCRECTL lprcWBounds,
  83. BOOL (CALLBACK * pfnContinue)(ULONG_PTR),
  84. ULONG_PTR dwContinue);
  85. STDMETHOD(GetExtent) (THIS_ DWORD dwAspect, LPSIZEL lpsizel);
  86. STDMETHOD(Load) (THIS_ LPSTREAM pstm, BOOL fReadHeaderOnly = FALSE);
  87. STDMETHOD(Save) (THIS_ LPSTREAM pstm);
  88. STDMETHOD(GetColorSet) (void FAR* pvAspect, HDC hicTargetDev,
  89. LPLOGPALETTE FAR* ppColorSet);
  90. STDMETHOD_(BOOL, IsBlank) (THIS);
  91. STDMETHOD_(void, DiscardHPRES)(THIS);
  92. #ifndef _MAC
  93. inline int CallbackFuncForDraw(HDC hdc, LPHANDLETABLE lpHTable,
  94. LPMETARECORD lpMFR, int nObj);
  95. inline int CallbackFuncForGetColorSet(HDC hdc, LPHANDLETABLE lpHTable,
  96. LPMETARECORD lpMFR, int nObj);
  97. #endif
  98. #ifdef _DEBUG
  99. STDMETHOD(Dump) (THIS_ char **ppszDump, ULONG ulFlag, int nIndentLevel);
  100. #endif // _DEBUG
  101. private:
  102. #ifndef _MAC
  103. INTERNAL_(HANDLE) GetHmfp (void);
  104. INTERNAL_(BOOL) PopDc (void);
  105. INTERNAL_(BOOL) PushDc (void);
  106. INTERNAL_(void) CleanStack(void);
  107. #endif
  108. INTERNAL ChangeData (HANDLE hMfp, BOOL fDelete);
  109. INTERNAL_(HANDLE) LoadHPRES(void);
  110. INTERNAL_(HANDLE) GetCopyOfHPRES(void);
  111. INTERNAL_(void) SetPictOrg (HDC, int, int, BOOL);
  112. INTERNAL_(void) SetPictExt (HDC, int, int);
  113. INTERNAL_(void) ScalePictExt (HDC, int, int, int, int);
  114. INTERNAL_(void) ScaleRectExt (HDC, int, int, int, int);
  115. shared_state:
  116. ULONG m_ulRefs;
  117. #ifdef _MAC
  118. PicHandle m_hPres;
  119. #else
  120. HMETAFILE m_hPres;
  121. // these are used only during draw
  122. LPMETAINFO m_pMetaInfo;
  123. LPMETADC m_pCurMdc;
  124. BOOL m_fMetaDC;
  125. int m_nRecord;
  126. HRESULT m_error;
  127. LPLOGPALETTE m_pColorSet;
  128. BOOL m_fConvert;
  129. #endif
  130. BOOL (CALLBACK * m_pfnContinue)(ULONG_PTR);
  131. ULONG_PTR m_dwContinue;
  132. DWORD m_dwAspect;
  133. DWORD m_dwSize;
  134. LONG m_lWidth;
  135. LONG m_lHeight;
  136. LPCACHENODE m_pCacheNode;
  137. HPALETTE m_hPalDCOriginal;
  138. HPALETTE m_hPalLast;
  139. };
  140. INTERNAL_(DWORD) MfGetSize (LPHANDLE lphmf);
  141. #ifndef _MAC
  142. FARINTERNAL_(HMETAFILE) QD2GDI(HANDLE);
  143. int CALLBACK __loadds MfCallbackFuncForDraw(HDC hdc, HANDLETABLE FAR* lpHTable,
  144. METARECORD FAR* lpMFR, int nObj, LPARAM lpobj);
  145. int CALLBACK __loadds MfCallbackFuncForGetColorSet(HDC hdc,
  146. HANDLETABLE FAR* lpHTable,
  147. METARECORD FAR* lpMFR, int nObj, LPARAM lpobj);
  148. #endif