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.

181 lines
6.9 KiB

  1. /****************************************************************************
  2. QuickDraw PICT Import Filter
  3. *****************************************************************************
  4. This file contains the interface for the QuickDraw import filter
  5. that reads Mac pictures from disk and/or memory. In addition to the
  6. Aldus filter interface, it also supports a parameterized interface
  7. for Microsoft applications to control some conversion results.
  8. ****************************************************************************/
  9. /*--- Possible Aldus-defined error code returns ---*/
  10. #define NOERR 0 // Conversion succeeded
  11. #define IE_NOT_MY_FILE 5301 // Invalid version (not version 1 or 2 PICT)
  12. // Invalid QD2GDI structure version (greater than 2)
  13. // Ill-formed PICT header record sequence
  14. #define IE_TOO_BIG 5302 // Image extents exceed 32K
  15. #define IE_BAD_FILE_DATA 5309 // Image bounding box is empty
  16. // Attempt to read past end of picture
  17. // Corrupted input file
  18. // Zero-length record
  19. #define IE_IMPORT_ABORT 5310 // Opening of source image failed
  20. // Read failure (network failure, floppy popped)
  21. // Most I/O errors
  22. #define IE_MEM_FULL 5311 // CreateMetaFile() failure
  23. // CloseMetaFile() failure
  24. // Unable to allocate memory (out of memory)
  25. #define IE_MEM_FAIL 5315 // Handle lock failure
  26. #define IE_NOPICTURES 5317 // Empty bounding rectangle or nothing drawn
  27. #define IE_UNSUPP_VERSION 5342 // User-defined abort performed
  28. /*--- Aldus-defined file access block ---*/
  29. typedef DWORD FILETYPE;
  30. typedef struct
  31. {
  32. unsigned slippery : 1; /* TRUE if file may disappear. */
  33. unsigned write : 1; /* TRUE if open for write. */
  34. unsigned unnamed : 1; /* TRUE if unnamed. */
  35. unsigned linked : 1; /* Linked to an FS FCB. */
  36. unsigned mark : 1; /* Generic mark bit. */
  37. FILETYPE fType; /* The file type. */
  38. #define IBMFNSIZE 124
  39. short handle; /* MS-DOS open file handle. */
  40. char fullName[IBMFNSIZE]; /* Device, path, file names. */
  41. DWORD filePos; /* Our current file posn. */
  42. } FILESPEC, FAR *LPFILESPEC;
  43. /*--- Aldus-defined picture info structure ---*/
  44. typedef struct {
  45. HANDLE hmf; /* Global memory handle to the metafile */
  46. RECT bbox; /* Tightly bounding rectangle in metafile units */
  47. DC inch; /* Length of an inch in metafile units */
  48. } PICTINFO;
  49. /*--- Preferences memory block ---*/
  50. typedef struct /* "old" version 1 USERPREFS */
  51. {
  52. char signature[6];
  53. WORD version;
  54. LPSTR sourceFilename;
  55. HANDLE sourceHandle;
  56. LPSTR destinationFilename;
  57. BYTE penPatternAction;
  58. BYTE nonSquarePenAction;
  59. BYTE penModeAction;
  60. BYTE textModeAction;
  61. BYTE charLock;
  62. BYTE nonRectRegionAction;
  63. BOOL PICTinComment;
  64. BOOL optimizePP;
  65. WORD lineClipWidthThreshold;
  66. WORD reserved[6];
  67. } USERPREFS_V1, FAR *LPUSERPREFS_V1;
  68. typedef struct /* current version 3 USERPREFS */
  69. {
  70. char signature[6];
  71. WORD version;
  72. WORD size;
  73. LPSTR sourceFilename;
  74. HANDLE sourceHandle;
  75. LPSTR destinationFilename;
  76. BYTE penPatternAction;
  77. BYTE nonSquarePenAction;
  78. BYTE penModeAction;
  79. BYTE textModeAction;
  80. BYTE nonRectRegionAction;
  81. BOOL optimizePP;
  82. BYTE noRLE; // new (split out from reserved[0] in version 3)
  83. BYTE reservedByte; // rest of first reserved word
  84. WORD reserved[5];
  85. } USERPREFS, FAR * LPUSERPREFS;
  86. /*********************** Exported Function Definitions **********************/
  87. #ifdef WIN32
  88. int WINAPI GetFilterInfo( short PM_Version, LPSTR lpIni,
  89. HANDLE FAR * lphPrefMem,
  90. HANDLE FAR * lphFileTypes );
  91. #else
  92. int FAR PASCAL GetFilterInfo( short PM_Version, LPSTR lpIni,
  93. HANDLE FAR * lphPrefMem,
  94. HANDLE FAR * lphFileTypes );
  95. #endif
  96. /* Returns information about this filter.
  97. Input parameters are PM_Version which is the filter interface version#
  98. and lpIni which is a copy of the win.ini entry
  99. Output parameters are lphPrefMem which is a handle to moveable global
  100. memory which will be allocated and initialized.
  101. lphFileTypes is a structure that contains the file types
  102. that this filter can import. (For MAC only)
  103. This routine should be called once, just before the filter is to be used
  104. the first time. */
  105. #ifdef WIN32
  106. void WINAPI GetFilterPref( HANDLE hInst, HANDLE hWnd, HANDLE hPrefMem, WORD wFlags );
  107. #else
  108. void FAR PASCAL GetFilterPref( HANDLE hInst, HANDLE hWnd, HANDLE hPrefMem, WORD wFlags );
  109. #endif
  110. /* Input parameters are hInst (in order to access resources), hWnd (to
  111. allow the DLL to display a dialog box), and hPrefMem (memory allocated
  112. in the GetFilterInfo() entry point). WFlags is currently unused, but
  113. should be set to 1 for Aldus' compatability */
  114. #ifdef WIN32
  115. short WINAPI ImportGR( HDC hdcPrint, LPFILESPEC lpFileSpec,
  116. PICTINFO FAR * lpPict, HANDLE hPrefMem );
  117. #else
  118. short FAR PASCAL ImportGR( HDC hdcPrint, LPFILESPEC lpFileSpec,
  119. PICTINFO FAR * lpPict, HANDLE hPrefMem );
  120. #endif
  121. /* Import the metafile in the file indicated by the lpFileSpec. The
  122. metafile generated will be returned in lpPict. */
  123. #ifdef WIN32
  124. short WINAPI ImportEmbeddedGr( HDC hdcPrint, LPFILESPEC lpFileSpec,
  125. PICTINFO FAR * lpPict, HANDLE hPrefMem,
  126. DWORD dwSize, LPSTR lpMetafileName );
  127. #else
  128. short FAR PASCAL ImportEmbeddedGr( HDC hdcPrint, LPFILESPEC lpFileSpec,
  129. PICTINFO FAR * lpPict, HANDLE hPrefMem,
  130. DWORD dwSize, LPSTR lpMetafileName );
  131. #endif
  132. /* Import the metafile in using the previously opened file handle in
  133. the structure field lpFileSpec->handle. Reading begins at offset
  134. lpFileSpect->filePos, and the convertor will NOT expect to find the
  135. 512 byte PICT header. The metafile generated will be returned in
  136. lpPict and can be specified via lpMetafileName (NIL = memory metafile,
  137. otherwise, fully qualified filename. */
  138. #ifdef WIN32
  139. short WINAPI QD2GDI( LPUSERPREFS lpPrefMem, PICTINFO FAR * lpPict );
  140. #else
  141. short FAR PASCAL QD2GDI( LPUSERPREFS lpPrefMem, PICTINFO FAR * lpPict );
  142. #endif
  143. /* Import the metafile as specified using the parameters supplied in the
  144. lpPrefMem. The metafile will be returned in lpPict. */