Leaked source code of windows server 2003
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.

231 lines
7.6 KiB

  1. /*++
  2. Copyright (c) 1996-1997 Microsoft Corporation
  3. Module Name:
  4. gpc2gpd.h
  5. Abstract:
  6. Declarations for GPC-to-GPD converter
  7. Environment:
  8. User-mode, stand-alone utility tool
  9. Revision History:
  10. 10/16/96 -zhanw-
  11. Created it.
  12. --*/
  13. #ifndef _GPC2GPD_H_
  14. #define _GPC2GPD_H_
  15. #include <lib.h>
  16. // include GPC data structure definition.
  17. #include <win30def.h>
  18. #include <uni16gpc.h>
  19. #include <uni16cid.h>
  20. #include <gpd.h>
  21. typedef const TCHAR *PCTSTR;
  22. #define MAX_GPD_CMD_LINE_LENGTH 80
  23. #define MAX_GPD_ENTRY_BUFFER_SIZE 512 // may be multiple lines in GPD
  24. #define MAX_OPTION_NAME_LENGTH 64
  25. //
  26. // structure to track which PAPERSIZE or PAPERSOURCE structure has _EJECTFF
  27. // flag set.
  28. //
  29. typedef struct _PAPERINFO {
  30. BYTE aubOptName[MAX_OPTION_NAME_LENGTH];
  31. BOOL bEjectFF;
  32. DWORD dwPaperType; // GPC's PS_T_xxx bit flags
  33. DWORD dwTopMargin; // used by PaperSource only
  34. DWORD dwBottomMargin; // same as above
  35. } PAPERINFO, * PPAPERINFO;
  36. typedef struct _RESINFO {
  37. BYTE aubOptName[MAX_OPTION_NAME_LENGTH];
  38. DWORD dwXScale; // scale of this resolution, masterX/xdpi
  39. DWORD dwYScale;
  40. BOOL bColor; // whether this resolution can print color
  41. } RESINFO, * PRESINFO;
  42. //
  43. // Converter state tracking and info caching structure
  44. //
  45. typedef struct _CONVINFO {
  46. DWORD dwErrorCode; // error bit flags
  47. DWORD dwMode; // op mode flags. Used to pass info between routines
  48. DWORD dwStrType; // how to output display strings: macro, string, id
  49. BOOL bUseSystemPaperNames ; // emit RCID_DMPAPER_SYSTEM_NAME
  50. #if defined(__cplusplus)
  51. CStringArray *pcsaGPD; // Pointer to GPD memory image as array of strings
  52. #else
  53. HANDLE hGPDFile; // handle to the output file
  54. #endif
  55. PDH pdh; // pointer to the GPC data header
  56. PMODELDATA pmd; // pointer to MODELDATA structure of the given model
  57. PPAGECONTROL ppc; // pointer to PAGECONTROL structure used by the model
  58. OCD ocdPPOn; // OCD for PageProtection-On command
  59. OCD ocdPPOff; // OCD for PageProtection-Off command
  60. //
  61. // follow 3 fields are used to compose GPD cmds.
  62. //
  63. BYTE aubCmdBuf[MAX_GPD_ENTRY_BUFFER_SIZE]; // buffer for building cmd str
  64. WORD wCmdLen; // the cmd length, not including the terminating NUL
  65. WORD wCmdCallbackID; // 0 if no callback
  66. //
  67. // following dynamic buffers are used to track EJECTFF flag which could
  68. // come from either PAPERSIZE or PAPERSOURCE structures
  69. //
  70. DWORD dwNumOfSize;
  71. PPAPERINFO ppiSize; // track PAPERSIZE structures
  72. DWORD dwNumOfSrc;
  73. PPAPERINFO ppiSrc; // track PAPERSOURCE structures
  74. DWORD dwNumOfRes;
  75. PRESINFO presinfo; // track RESOLUTION structures
  76. //
  77. // other working buffers
  78. //
  79. PCURSORMOVE pcm; // the CURSORMOVE structure for the model
  80. PGPCRESOLUTION pres;// the current RESOLUTION structure being examined.
  81. // Used when CM_YM_RES_DEPENDENT bit is set.
  82. POINTw ptMoveScale; // masterUnit/moveUnit
  83. #if defined(__cplusplus)
  84. CMapWordToDWord *pcmw2dFonts; // Font mapping for PFM -> multiple UFM fix
  85. #endif
  86. } CONVINFO, * PCONVINFO;
  87. //
  88. // bit flags for dwErrorCode
  89. //
  90. #define ERR_BAD_GPCDATA 0x0001
  91. #define ERR_OUT_OF_MEMORY 0x0002
  92. #define ERR_WRITE_FILE 0x0004
  93. #define ERR_MD_CMD_CALLBACK 0x0008
  94. #define ERR_CM_GEN_FAV_XY 0x0010
  95. #define ERR_CM_XM_RESET_FONT 0x0020
  96. #define ERR_CM_XM_ABS_NO_LEFT 0x0040
  97. #define ERR_CM_YM_TRUNCATE 0x0080
  98. #define ERR_RF_MIN_IS_WHITE 0x0100
  99. #define ERR_INCONSISTENT_PAGEPROTECT 0x0200
  100. #define ERR_NON_ZERO_FEED_MARGINS_ON_RT90_PRINTER 0x0400
  101. #define ERR_BAD_GPC_CMD_STRING 0x0800
  102. #define ERR_RES_BO_RESET_FONT 0x1000
  103. #define ERR_RES_BO_OEMGRXFILTER 0x2000
  104. #define ERR_CM_YM_RES_DEPENDENT 0x4000
  105. #define ERR_MOVESCALE_NOT_FACTOR_OF_MASTERUNITS 0x8000
  106. #define ERR_NO_CMD_CALLBACK_PARAMS 0x00010000
  107. #define ERR_HAS_DUPLEX_ON_CMD 0x00020000
  108. #define ERR_PSRC_MAN_PROMPT 0x00040000
  109. #define ERR_PS_SUGGEST_LNDSCP 0x00080000
  110. #define ERR_HAS_SECOND_FONT_ID_CMDS 0x00100000
  111. #define ERR_DLI_FMT_CAPSL 0x00200000
  112. #define ERR_DLI_FMT_PPDS 0x00400000
  113. #define ERR_DLI_GEN_DLPAGE 0x00800000
  114. #define ERR_DLI_GEN_7BIT_CHARSET 0x01000000
  115. #define ERR_DC_SEND_PALETTE 0x02000000
  116. #define ERR_RES_BO_NO_ADJACENT 0x04000000
  117. #define ERR_MD_NO_ADJACENT 0x08000000
  118. #define ERR_CURSOR_ORIGIN_ADJUSTED 0x10000000
  119. #define ERR_PRINTABLE_ORIGIN_ADJUSTED 0x20000000
  120. #define ERR_PRINTABLE_AREA_ADJUSTED 0x40000000
  121. #define ERR_MOVESCALE_NOT_FACTOR_INTO_SOME_RESSCALE 0x80000000
  122. #define NUM_ERRS 32 // increment this number when defining new ERR_xxx!!!
  123. #if defined(__cplusplus)
  124. extern "C" {
  125. #endif
  126. extern DWORD gdwErrFlag[NUM_ERRS];
  127. extern PSTR gpstrErrMsg[NUM_ERRS];
  128. #if defined(__cplusplus)
  129. }
  130. #endif
  131. //
  132. // bit flags for dwMode
  133. //
  134. #define FM_SYN_PAGEPROTECT 0x0001
  135. #define FM_VOUT_LIST 0x0002
  136. #define FM_RES_DM_GDI 0x0004
  137. #define FM_RES_DM_DOWNLOAD_OUTLINE 0x0008
  138. #define FM_NO_RES_DM_DOWNLOAD_OUTLINE 0x0010
  139. #define FM_MEMORY_FEATURE_EXIST 0x0020
  140. #define FM_HAVE_SEEN_NON_ZERO_FEED_MARGINS 0x0040
  141. #define FM_HAVE_SAME_TOP_BOTTOM_MARGINS 0x0080
  142. #define FM_SET_CURSOR_ORIGIN 0x0100
  143. //
  144. // values for dwStrType field
  145. //
  146. #define STR_DIRECT 0 // output display strings directly. The default.
  147. #define STR_MACRO 1 // output display strings as value macros (see stdnames.gpd)
  148. #define STR_RCID 2 // output display strings as RC id's (see common.rc)
  149. #define STR_RCID_SYSTEM_PAPERNAMES 3 // output display strings as RC id's (see common.rc)
  150. // Except use spooler standard papernames
  151. //
  152. // macro definitions to hide differences between GPC2.0 and GPC3.0
  153. //
  154. #define GETEXTCD(pdh, pcd) (PEXTCD)((PBYTE)(pcd+1) + (pcd)->wLength + \
  155. (((pdh)->wVersion >= GPC_VERSION3) ? \
  156. (((pcd)->wLength) & 1) : 0))
  157. #define LETTER300X300MEM 1028 // page protection memory constant in GPC2
  158. #define GETPAGEPROMEM(pdh, pps) (((pdh)->wVersion >= GPC_VERSION3) ? \
  159. pps->wPageProtMem : LETTER300X300MEM)
  160. #define DHOFFSET(pdh, sHeapOffset) ((PSHORT)(((PBYTE)(pdh)) + (pdh)->loHeap + \
  161. sHeapOffset))
  162. // utility functions for accessing GPC data & file ops.
  163. #if defined(__cplusplus)
  164. extern "C" {
  165. #endif
  166. #if defined(DEVSTUDIO) && defined(__cplusplus)
  167. #include "..\GPC2GPD\Utils.H"
  168. #else
  169. #include "utils.h"
  170. #endif
  171. //
  172. // function prototypes
  173. //
  174. DWORD
  175. DwCalcMoveUnit(
  176. IN PCONVINFO pci,
  177. IN PCURSORMOVE pcm,
  178. IN WORD wMasterUnit,
  179. IN WORD wStartOCD,
  180. IN WORD wEndOCD);
  181. WORD WGetDefaultIndex(IN PCONVINFO pci, IN WORD wMDOI);
  182. void VOutputUIEntries(IN OUT PCONVINFO pci);
  183. void VOutputPrintingEntries(IN OUT PCONVINFO pci);
  184. #if defined(DEVSTUDIO)
  185. void vMapFontList(IN OUT PWORD pwFonts, IN DWORD dwcFonts, IN PCONVINFO pci);
  186. #endif
  187. #if defined(__cplusplus)
  188. }
  189. #endif
  190. #endif // !_GPC2GPD_H_