proptype.h
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 12k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // proptype.h
  4. //
  5. // Base types common to OLE Property Exchange and OLE Property Sets.
  6. // See "OLE 2 Programmer's Reference, Volume 1", Appendix B for the
  7. // published format for Property Sets.  The types defined here
  8. // follow that format.
  9. //
  10. // Notes:
  11. //  All strings in objects are stored in the following format:
  12. //   DWORD size of buffer, DWORD length of string, string data, terminating 0.
  13. //  The size of the buffer is inclusive of the DWORD, the length is not but
  14. //  does include the ending 0.
  15. //
  16. //  EXTREMELY IMPORTANT!  All strings buffers must align on 32-bit boundaries.
  17. //  Whenever one is allocated, the macro CBALIGN32 should be used to add
  18. //  enough bytes to pad it out.
  19. //
  20. // Change history:
  21. //
  22. // Date         Who             What
  23. // --------------------------------------------------------------------------
  24. // 06/01/94     B. Wentz        Created file
  25. //
  26. ////////////////////////////////////////////////////////////////////////////////
  27. #ifndef __proptype_h__
  28. #define __proptype_h__
  29. #include "nocrt.h"
  30. #include <objbase.h>
  31. #include <oleauto.h>
  32. #include "offcapi.h"
  33. #include "plex.h"
  34.   // Property Id's for Summary Info, as defined in OLE 2 Prog. Ref.
  35. #define PID_TITLE               0x00000002L
  36. #define PID_SUBJECT             0x00000003L
  37. #define PID_AUTHOR              0x00000004L
  38. #define PID_KEYWORDS            0x00000005L
  39. #define PID_COMMENTS            0x00000006L
  40. #define PID_TEMPLATE            0x00000007L
  41. #define PID_LASTAUTHOR          0x00000008L
  42. #define PID_REVNUMBER           0x00000009L
  43. #define PID_EDITTIME            0x0000000aL
  44. #define PID_LASTPRINTED         0x0000000bL
  45. #define PID_CREATE_DTM          0x0000000cL
  46. #define PID_LASTSAVE_DTM        0x0000000dL
  47. #define PID_PAGECOUNT           0x0000000eL
  48. #define PID_WORDCOUNT           0x0000000fL
  49. #define PID_CHARCOUNT           0x00000010L
  50. #define PID_THUMBNAIL           0x00000011L
  51. #define PID_APPNAME             0x00000012L
  52. #define PID_DOC_SECURITY        0x00000013L
  53.   // Range of PId's we understand
  54. #define PID_SIFIRST             0x00000002L
  55. #define PID_SILAST              0x00000013L
  56. #define NUM_SI_PROPERTIES       (PID_SILAST - PID_SIFIRST + 1)
  57.   // Property Id's for Document Summary Info, as define in OLE Property Exchange spec
  58. #define PID_CATEGORY            0x00000002L
  59. #define PID_PRESFORMAT          0x00000003L
  60. #define PID_BYTECOUNT           0x00000004L
  61. #define PID_LINECOUNT           0x00000005L
  62. #define PID_PARACOUNT           0x00000006L
  63. #define PID_SLIDECOUNT          0x00000007L
  64. #define PID_NOTECOUNT           0x00000008L
  65. #define PID_HIDDENCOUNT         0x00000009L
  66. #define PID_MMCLIPCOUNT         0x0000000aL
  67. #define PID_SCALE               0x0000000bL
  68. #define PID_HEADINGPAIR         0x0000000cL
  69. #define PID_DOCPARTS            0x0000000dL
  70. #define PID_MANAGER             0x0000000eL
  71. #define PID_COMPANY             0x0000000fL
  72. #define PID_LINKSDIRTY          0x00000010L
  73.   // Range of PID's we understand
  74. #define PID_DSIFIRST            0x00000002L
  75. #define PID_DSILAST             0x00000010L
  76. #define NUM_DSI_PROPERTIES      (PID_DSILAST - PID_DSIFIRST + 1)
  77.   // Beginning of the User-Defined range of properties.
  78. #define PID_UDFIRST             0x00000002L
  79.   // Predefined Property Id's in the standard
  80. #define PID_DICT                0x00000000L  /* Property Id for the Property Set Dictionary */
  81. #define PID_DOC_CODEPAGE        0x00000001L  /* Property Id for the Code Page */
  82.   // Property Id masks to identify links and IMonikers
  83. #define PID_LINKMASK            0x01000000L
  84. #define PID_IMONIKERMASK        0x10000000L
  85.   // Predefined Clipboard Format Identifiers in the standard
  86. #define CFID_NONE        0L     /* No format name */
  87. #define CFID_WINDOWS    -1L     /* Windows built-in clipboard format */
  88. #define CFID_MACINTOSH  -2L     /* Macintosh format value */
  89. #define CFID_FMTID      -3L     /* A FMTID */
  90.  
  91.   // Type for linked-lists.
  92. typedef struct _LLIST *LPLLIST;
  93. typedef struct _LLIST
  94. {
  95.   LPLLIST lpllistNext;
  96.   LPLLIST lpllistPrev;
  97. } LLIST;
  98.   // Cache struct for linked-list routines
  99. typedef struct _LLCACHE
  100. {
  101.   DWORD idw;
  102.   LPLLIST lpllist;
  103. } LLCACHE, FAR * LPLLCACHE;
  104.   // Structure to hold the document headings
  105. typedef struct _xheadpart
  106. {
  107.   BOOL fHeading;           // Is this node a heading??
  108.   DWORD dwParts;           // Number of sections for this heading
  109.   DWORD iHeading;          // Which heading does this document part belong to
  110.   LPTSTR lpstz;             // The heading or the document part
  111. } XHEADPART;
  112. DEFPL (PLXHEADPART, XHEADPART, ixheadpartMax, ixheadpartMac, rgxheadpart);
  113. typedef PLXHEADPART *LPPLXHEADPART;
  114. typedef XHEADPART *LPXHEADPART;
  115.   // Structure for linked list of User-defined properties
  116.   // Note: This structure and everything it points to is allocated
  117.   // with CoTaskMemAlloc.
  118. typedef struct _UDPROP *LPUDPROP;
  119. typedef struct _UDPROP
  120. {
  121.   LLIST         llist;
  122.   LPTSTR        lpstzName;
  123.   PROPID        propid;
  124.   LPPROPVARIANT lppropvar;
  125.   LPTSTR        lpstzLink;
  126.   BOOL          fLinkInvalid;
  127. } UDPROP;              
  128.   // Macro to calculate how many bytes needed to round up to a 32-bit boundary.
  129. #define CBALIGN32(cb) ((((cb+3) >> 2) << 2) - cb)
  130.   // Macro to give the buffer size
  131.   // (No longer used because we use PropVariants instead of the serialized
  132.   // property set format)
  133. //#define CBBUF(lpstz) (*(DWORD *) &((lpstz)[0]))
  134.   // Macro to give string length
  135.   // (No longer used because we use PropVariants instead of the serialized
  136.   // property set format)
  137. //#define CCHSTR(lpstz) (*(DWORD *) &(((LPBYTE)(lpstz))[sizeof(DWORD)]))
  138. #define CBTSTR(lpstz) ( ( CchTszLen(lpstz) + 1 ) * sizeof(TCHAR) )
  139.   // Macro to give pointer to beginning of lpsz
  140.   // (No longer used because we use PropVariants instead of the serialized
  141.   // property set format)
  142. #define PSTR(lpstz) (lpstz)
  143.   // Macro to give pointer to beginning of lpstz
  144.   // (No longer used because we use PropVariants instead of the serialized
  145.   // property set format)
  146. #define PSTZ(lpstz) (lpstz)
  147. //
  148. // Our internal data for Summary Info
  149. //
  150.   // Max number of strings we store
  151. #define cSIStringsMax           0x13      // The is actual PID of last string + 1
  152.                                           // makes it easy to lookup string based on PID in array
  153.   // Max number of filetimes we store, the offset to subtract from the index
  154. #define cSIFTMax                0x4       // same as for cSIStringsMax
  155. #define cSIFTOffset             0xa
  156. // These are used to indicate whether a property has been set or not
  157. #define bEditTime  1
  158. #define bLastPrint 2
  159. #define bCreated   4
  160. #define bLastSave  8
  161. #define bPageCount 16
  162. #define bWordCount 32
  163. #define bCharCount 64
  164. #define bSecurity  128
  165.   // Max number of VT_I4's we store
  166. #define cdwSIMax                0x6    // same as for cSIStringsMax
  167. #define cdwSIOffset             0xe
  168. #define ifnSIMax                  4
  169. // Used for OLE Automation
  170. typedef struct _docprop
  171. {
  172.    LPVOID pIDocProp;              // Pointer to a DocumentProperty object
  173. } DOCPROP;
  174. DEFPL (PLDOCPROP, DOCPROP, idocpropMax, idocpropMac, rgdocprop);
  175. // SummaryInformation data.
  176. typedef struct _SINFO
  177. {
  178.   PROPVARIANT rgpropvar[ NUM_SI_PROPERTIES ];         // The actual properties.
  179.   BOOL     fSaveSINail;         // Should we save the thumbnail?
  180.   BOOL     fNoTimeTracking;     // Is time tracking disabled (Germany)
  181.   BOOL (*lpfnFCPConvert)(LPTSTR, DWORD, DWORD, BOOL); // Code page converter
  182.   BOOL (*lpfnFSzToNum)(NUM *, LPTSTR);                // Convert sz to double
  183.   BOOL (*lpfnFNumToSz)(NUM *, LPTSTR, DWORD);         // Convert double to sz
  184.   BOOL (*lpfnFUpdateStats)(HWND, LPSIOBJ, LPDSIOBJ);  // Update stats on stat tab
  185. } SINFO, FAR * LPSINFO;
  186.   // Macro to access the SINFO structure within the OFFICESUMINFO structure.
  187. #define GETSINFO(lpSInfo) ( (LPSINFO) lpSInfo->m_lpData )
  188.   // Indices into SINFO.rgpropvar array.
  189. #define PVSI_TITLE               0x00L
  190. #define PVSI_SUBJECT             0x01L
  191. #define PVSI_AUTHOR              0x02L
  192. #define PVSI_KEYWORDS            0x03L
  193. #define PVSI_COMMENTS            0x04L
  194. #define PVSI_TEMPLATE            0x05L
  195. #define PVSI_LASTAUTHOR          0x06L
  196. #define PVSI_REVNUMBER           0x07L
  197. #define PVSI_EDITTIME            0x08L
  198. #define PVSI_LASTPRINTED         0x09L
  199. #define PVSI_CREATE_DTM          0x0aL
  200. #define PVSI_LASTSAVE_DTM        0x0bL
  201. #define PVSI_PAGECOUNT           0x0cL
  202. #define PVSI_WORDCOUNT           0x0dL
  203. #define PVSI_CHARCOUNT           0x0eL
  204. #define PVSI_THUMBNAIL           0x0fL
  205. #define PVSI_APPNAME             0x10L
  206. #define PVSI_DOC_SECURITY        0x11L
  207. //
  208. // Our internal data for Document Summary Info
  209. //
  210.   // Max number of strings we store.
  211. #define cDSIStringsMax          0x10   // same as for cSIStringsMax
  212.   // Max number of VT_I4's we store
  213. #define cdwDSIMax               0xe    // same as for cSIStringsMax
  214. // These are used to indicate whether a property has been set or not
  215. #define bByteCount   1
  216. #define bLineCount   2
  217. #define bParCount    4
  218. #define bSlideCount  8
  219. #define bNoteCount   16
  220. #define bHiddenCount 32
  221. #define bMMClipCount 64
  222. #define ifnDSIMax                  1    // DSIObj only has one callback
  223. typedef struct _DSINFO
  224. {
  225.   PROPVARIANT   rgpropvar[ NUM_DSI_PROPERTIES ];
  226.   BYTE          bPropSet;
  227.   BOOL (*lpfnFCPConvert)(LPTSTR, DWORD, DWORD, BOOL); // Code page converter
  228. } DSINFO, FAR * LPDSINFO;
  229.   // Macro to access the DSINFO structure within the OFFICESUMINFO structure.
  230. #define GETDSINFO(lpDSInfo) ( (LPDSINFO) lpDSInfo->m_lpData )
  231.   // Indices into ALLOBJS.propvarDocSumInfo array.
  232. #define PVDSI_CATEGORY            0x00L
  233. #define PVDSI_PRESFORMAT          0x01L
  234. #define PVDSI_BYTECOUNT           0x02L
  235. #define PVDSI_LINECOUNT           0x03L
  236. #define PVDSI_PARACOUNT           0x04L
  237. #define PVDSI_SLIDECOUNT          0x05L
  238. #define PVDSI_NOTECOUNT           0x06L
  239. #define PVDSI_HIDDENCOUNT         0x07L
  240. #define PVDSI_MMCLIPCOUNT         0x08L
  241. #define PVDSI_SCALE               0x09L
  242. #define PVDSI_HEADINGPAIR         0x0AL
  243. #define PVDSI_DOCPARTS            0x0BL
  244. #define PVDSI_MANAGER             0x0CL
  245. #define PVDSI_COMPANY             0x0DL
  246. #define PVDSI_LINKSDIRTY          0x0EL
  247. //
  248. // Our internal data for User-defined properties
  249. //
  250. #define ifnUDMax                  ifnMax
  251.   // The prefix for hidden property names
  252. #define HIDDENPREFIX TEXT('_')
  253.   // An iterator for User-defined Properties
  254. typedef struct _UDITER
  255. {
  256.   LPUDPROP lpudp;
  257. } UDITER;
  258. typedef struct _UDINFO
  259. {
  260.     // Real object data
  261.   DWORD     dwcLinks;                   // Number of links
  262.   DWORD     dwcProps;                   // Number of user-defined properties
  263.   LPUDPROP  lpudpHead;                  // Head of list of properties
  264.   LPUDPROP  lpudpCache;
  265.   CLSID     clsid;                      // The ClassID from the property set.
  266.     // Temporary object data
  267.   DWORD     dwcTmpLinks;                // Number of links
  268.   DWORD     dwcTmpProps;                // Number of user-defined properties
  269.   LPUDPROP  lpudpTmpHead;               // Head of list of properties
  270.   LPUDPROP  lpudpTmpCache;
  271.     // Application callback functions
  272.   BOOL (*lpfnFCPConvert)(LPTSTR, DWORD, DWORD, BOOL); // Code page converter
  273.   BOOL (*lpfnFSzToNum)(NUM *, LPTSTR);             // Convert sz to double
  274.   BOOL (*lpfnFNumToSz)(NUM *, LPTSTR, DWORD);      // Convert double to sz
  275. } UDINFO, FAR * LPUDINFO;
  276.   // Macro to access the UDINFO structure within the OFFICESUMINFO structure.
  277. #define GETUDINFO(lpUDInfo) ( (LPUDINFO) lpUDInfo->m_lpData )
  278.   // Number of PIds we do understand.
  279. #define cSIPIDS                   18
  280. //Number of doc sum Pids
  281. #define cDSIPIDS   16
  282. #endif // __proptype_h__