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.

281 lines
9.7 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. --*/
  4. #ifndef _PDEV_H
  5. #define _PDEV_H
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include <minidrv.h>
  10. #include <stdio.h>
  11. #include <prcomoem.h>
  12. #define VALID_PDEVOBJ(pdevobj) \
  13. ((pdevobj) && (pdevobj)->dwSize >= sizeof(DEVOBJ) && \
  14. (pdevobj)->hEngine && (pdevobj)->hPrinter && \
  15. (pdevobj)->pPublicDM && (pdevobj)->pDrvProcs )
  16. #define ASSERT_VALID_PDEVOBJ(pdevobj) ASSERT(VALID_PDEVOBJ(pdevobj))
  17. // Debug text.
  18. #define ERRORTEXT(s) "ERROR " DLLTEXT(s)
  19. //
  20. // OEM Signature and version.
  21. //
  22. #define OEM_SIGNATURE 'APDL'
  23. #define DLLTEXT(s) "APDL: " s
  24. #define OEM_VERSION 0x00010000L
  25. /*--------------------------------------------------------------------------*/
  26. /* D E F I N E V A L U E */
  27. /*--------------------------------------------------------------------------*/
  28. #define PAPER_SRC_FTRAY 20
  29. #define PAPER_SRC_CAS1 21
  30. #define PAPER_SRC_CAS2 22
  31. #define PAPER_SRC_CAS3 23
  32. #define PAPER_SRC_AUTO 24 //Not use by NT driver
  33. #define PAPER_DEST_SCALETOFIT_ON 25
  34. #define PAPER_DEST_SCALETOFIT_OFF 26
  35. #define PAPER_SRC_AUTO_SELECT 27
  36. #define PAGECONTROL_BEGIN_JOB 140
  37. #define PAGECONTROL_BEGIN_DOC 30
  38. #define PAGECONTROL_BEGIN_PAGE 31
  39. #define PAGECONTROL_END_DOC 32
  40. #define PAGECONTROL_END_PAGE 33
  41. #define PAGECONTROL_DUPLEX_OFF 34
  42. #define PAGECONTROL_ABORT_DOC 35
  43. #define PAGECONTROL_POTRAIT 36
  44. #define PAGECONTROL_LANDSCAPE 37
  45. #define PAGECONTROL_MULTI_COPIES 38
  46. #define PAGECONTROL_DUPLEX_UPDOWN 39
  47. #define PAGECONTROL_DUPLEX_RIGHTUP 40
  48. #define PAPERSIZE_MAGIC 50 // this ID - 50 = Actual ID of A/PDL
  49. #define PHYS_PAPER_A3 50
  50. #define PHYS_PAPER_A4 51
  51. #define PHYS_PAPER_A5 52
  52. #define PHYS_PAPER_A6 53 // Reserved
  53. #define PHYS_PAPER_B4 54
  54. #define PHYS_PAPER_B5 55
  55. #define PHYS_PAPER_B6 56 // Reserved
  56. #define PHYS_PAPER_LETTER 57
  57. #define PHYS_PAPER_LEGAL 58
  58. #define PHYS_PAPER_POSTCARD 59
  59. #define PHYS_PAPER_EXECUTIVE 60 // Reserved
  60. #define PHYS_PAPER_UNFIXED 61
  61. #define X_ABS_MOVE 70
  62. #define Y_ABS_MOVE 71
  63. #define XY_ABS_MOVE 78
  64. #define X_REL_MOVE_RIGHT 110
  65. #define Y_REL_MOVE_DOWN 111
  66. #define CR_EMULATION 79
  67. #define DUMMY_LF 80
  68. #define FF_EJECTPAGE 81
  69. #define BOLD_ON 72
  70. #define BOLD_OFF 73
  71. #define ITALIC_ON 74
  72. #define ITALIC_OFF 75
  73. #define SELECT_SINGLE_BYTE 120
  74. #define SELECT_DOUBLE_BYTE 121
  75. #define RESOLUTION_300 76
  76. #define RESOLUTION_600 77
  77. #define SEND_BLOCK_DATA 82
  78. #define TONER_SAVE_OFF 100
  79. #define TONER_SAVE_DARK 101
  80. #define TONER_SAVE_LIGHT 102
  81. // #278517: RectFill
  82. #define RECT_SET_WIDTH 130
  83. #define RECT_SET_HEIGHT 131
  84. #define RECT_FILL_BLACK 132
  85. #define MASTER_UNIT 600
  86. #define LINE_PER_BAND 32
  87. #define CCHMAXCMDLEN 128
  88. #define MAXIMGSIZE 0xF000
  89. #define NRPEAK 0x7F
  90. #define RPEAK 0x80
  91. // for download
  92. #define SET_FONT_ID 110
  93. #define SELECT_FONT_ID 111
  94. #define SET_CUR_GLYPHID 112
  95. #define DELETE_FONT 113
  96. #define MAXGLYPHSIZE 0x4000
  97. #define MAXGLYPHWIDTH 0x80
  98. #define MAXGLYPHHEIGHT 0x80
  99. // Font ID definition in GPD -> Min 24 Max 48
  100. #define FONT_ID_DIFF 24
  101. #define MAX_FONT_ID 24
  102. #define MAX_GLYPH_ID 1024
  103. #define MIN_GLYPH_ID 32
  104. #define MAX_DOWNLOAD_CHAR MAX_FONT_ID * MAX_GLYPH_ID
  105. // for fGeneral(font sim and X/Y move) flags
  106. #define CURSORMOVE_MASK 0x03 // 1 2 bit
  107. #define FONTSIM_MASK 0x30 // 5 6 bit
  108. // Bit Flags
  109. #define BIT_XMOVE_ABS 0x01 // 1 Bit
  110. #define BIT_YMOVE_ABS 0x02 // 2 Bit
  111. #define BIT_FONTSIM_ITALIC 0x10 // 5 Bit (Command spec)
  112. #define BIT_FONTSIM_BOLD 0x20 // 6 Bit (Command spec)
  113. #define BIT_FONTSIM_RESET 0x40 // 7 Bit
  114. // Max num of spooled device font character
  115. #define MAXDEVFONT 1024
  116. // Current text mode DBCS/SBCS
  117. #define BYTE_BYTEMODE_RESET 0
  118. #define BYTE_SINGLE_BYTE 1
  119. #define BYTE_DOUBLE_BYTE 2
  120. // Command length
  121. #define BYTE_WITH_ITALIC 11
  122. #define BYTE_WITHOUT_ITALIC 7
  123. #define BYTE_XY_ABS 6
  124. #define BYTE_SIMPLE_ABS 4
  125. // device font face
  126. #define MINCHO_HORI 1
  127. #define MINCHO_VERT 2
  128. #define GOTHIC_HORI 3
  129. #define GOTHIC_VERT 4
  130. // @Aug/31/98 ->
  131. #define MAX_COPIES_VALUE 255
  132. // @Aug/31/98 <-
  133. // Fail-safe values.
  134. #define HORZ_RES_DEFAULT 300
  135. #define VERT_RES_DEFAULT 300
  136. /*--------------------------------------------------------------------------*/
  137. /* S T R U C T U R E D E F I N E */
  138. /*--------------------------------------------------------------------------*/
  139. typedef struct tagPAPER {
  140. WORD wWidth;
  141. WORD wHeight;
  142. } PHYSIZE, FAR * LPPHYSIZE;
  143. typedef struct tag_TTDLCHAR {
  144. WORD wCharID; // Downloaded char ID for device
  145. WORD wXIncrement; // Increment value
  146. WORD wXAdjust; // Adjust value for x
  147. WORD wYAdjust; // Adjust value for y
  148. } DLCHAR, *PDLCHAR;
  149. typedef struct tag_APDLPDEV {
  150. // Private extention
  151. ULONG ulHorzRes; // width of the physical surface
  152. ULONG ulVertRes; // height of the physical surface
  153. SIZEL szlPhysSize; // size of unwriteable margin
  154. POINTL ptlPhysOffset; // size of entire surface with unwriteable margin
  155. BOOL fSendSetPhysPaper;// flag for sending set physical paper command
  156. BOOL fDuplex; // TRUE = duplex mode is selected
  157. BOOL fScaleToFit; // for set auto tray mode in Set Physical Paper
  158. BOOL fOrientation; // for set media origin in Define Drawing Area
  159. WORD wWidths; // move current position afer print device font
  160. BYTE fGeneral; // font sim and cursor move infomation
  161. BYTE fCurFontSim; // Currnet settings of font sim
  162. BYTE bCurByteMode; // for x position adjustment in vertical font
  163. WORD wXPosition; // Current X position
  164. WORD wYPosition; // Current Y position
  165. BYTE bFontID; // device font ID based on .rc file
  166. WORD wUpdateXPos; // for relative X move
  167. WORD wCachedBytes; // Bytes of cached device font character
  168. BYTE bCharData[MAXDEVFONT]; // Actual char data
  169. WORD wFontHeight; // Device font height
  170. DLCHAR DLCharID[MAX_FONT_ID][MAX_GLYPH_ID]; // Downloaded char data
  171. WORD wNumDLChar; // Num of downloaded char
  172. WORD wGlyphID; // Current GlyphID
  173. WORD wImgWidth;
  174. WORD wImgHeight;
  175. // Temp. buffer (dynamically allocated)
  176. // used for data compressoin work area, etc.
  177. PBYTE pjTempBuf;
  178. DWORD dwTempBufLen;
  179. // Command string buffers to keep status among
  180. // the Unidrv to minidriver callbacks.
  181. BYTE ajCmdSetPhysPaper[19];
  182. BYTE ajCmdSetPhysPage[16];
  183. BYTE ajCmdDefDrawArea[16];
  184. // #278517: RectFill
  185. WORD wRectWidth;
  186. WORD wRectHeight;
  187. } APDLPDEV, *PAPDLPDEV;
  188. //+---------------------------------------------------------------------------+
  189. //| F U N C T I O N P R O T O T Y P E |
  190. //+---------------------------------------------------------------------------+
  191. BYTE SetDrawArea(PDEVOBJ, DWORD);
  192. DWORD BRL_ECmd(PBYTE, PBYTE, DWORD, DWORD);
  193. VOID VOutputText( PDEVOBJ );
  194. VOID VSetFontSimulation( PDEVOBJ );
  195. BOOL bSendCursorMoveCommand( PDEVOBJ, BOOL );
  196. INT
  197. bCommandCallback(
  198. PDEVOBJ pdevobj,
  199. DWORD dwCmdCbID,
  200. DWORD dwCount,
  201. PDWORD pdwParams,
  202. INT *piResult );
  203. BOOL
  204. bOutputCharStr(
  205. PDEVOBJ pdevobj,
  206. PUNIFONTOBJ pUFObj,
  207. DWORD dwType,
  208. DWORD dwCount,
  209. PVOID pGlyph );
  210. /*--------------------------------------------------------------------------*/
  211. /* D E F I N E M A C R O */
  212. /*--------------------------------------------------------------------------*/
  213. #define WRITESPOOLBUF(p, s, n) \
  214. ((p)->pDrvProcs->DrvWriteSpoolBuf(p, (PBYTE)(s), (DWORD)(n)))
  215. #define PARAM(p,n) \
  216. (NULL == (p) ? 0 : *((DWORD *)(p)+(n)))
  217. #define ABS(n) \
  218. ((n) > 0 ? (n) : -(n))
  219. #define STDVAR_BUFSIZE(n) \
  220. (sizeof (GETINFO_STDVAR) + sizeof(DWORD) * 2 * ((n) - 1))
  221. #define ISVERTICALFONT(n) \
  222. ( (n == MINCHO_VERT || n == GOTHIC_VERT) ? TRUE : FALSE )
  223. #ifdef __cplusplus
  224. }
  225. #endif
  226. #endif //_PDEV_H