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.

152 lines
5.8 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. /*--- Preferences memory block ---*/
  44. typedef struct // "old" version 1 USERPREFS
  45. {
  46. char signature[6];
  47. WORD version;
  48. LPSTR sourceFilename;
  49. HANDLE sourceHandle;
  50. LPSTR destinationFilename;
  51. BYTE penPatternAction;
  52. BYTE nonSquarePenAction;
  53. BYTE penModeAction;
  54. BYTE textModeAction;
  55. BYTE charLock;
  56. BYTE nonRectRegionAction;
  57. BOOL PICTinComment;
  58. BOOL optimizePP;
  59. WORD lineClipWidthThreshold;
  60. WORD reserved[6];
  61. } USERPREFS_V1, FAR *LPUSERPREFS_V1;
  62. typedef struct // current version 2 USERPREFS
  63. {
  64. char signature[6];
  65. WORD version;
  66. WORD size;
  67. LPSTR sourceFilename;
  68. HANDLE sourceHandle;
  69. LPSTR destinationFilename;
  70. BYTE penPatternAction;
  71. BYTE nonSquarePenAction;
  72. BYTE penModeAction;
  73. BYTE textModeAction;
  74. BYTE nonRectRegionAction;
  75. BOOL optimizePP;
  76. WORD reserved[6];
  77. } USERPREFS, FAR * LPUSERPREFS;
  78. typedef struct {
  79. HANDLE hmf; //handle to resulting
  80. RECT bbox; //bounding box
  81. WORD inch; //metafile units/inch (for image size)
  82. }PICTINFO;
  83. /*********************** Exported Function Definitions **********************/
  84. int FAR PASCAL GetFilterInfo( short PM_Version, LPSTR lpIni,
  85. HANDLE FAR * lphPrefMem,
  86. HANDLE FAR * lphFileTypes );
  87. /* Returns information about this filter.
  88. Input parameters are PM_Version which is the filter interface version#
  89. and lpIni which is a copy of the win.ini entry
  90. Output parameters are lphPrefMem which is a handle to moveable global
  91. memory which will be allocated and initialized.
  92. lphFileTypes is a structure that contains the file types
  93. that this filter can import. (For MAC only)
  94. This routine should be called once, just before the filter is to be used
  95. the first time. */
  96. void FAR PASCAL GetFilterPref( HANDLE hInst, HANDLE hWnd, HANDLE hPrefMem, WORD wFlags );
  97. /* Input parameters are hInst (in order to access resources), hWnd (to
  98. allow the DLL to display a dialog box), and hPrefMem (memory allocated
  99. in the GetFilterInfo() entry point). WFlags is currently unused, but
  100. should be set to 1 for Aldus' compatability */
  101. short FAR PASCAL ImportGR( HDC hdcPrint, LPFILESPEC lpFileSpec,
  102. PICTINFO FAR * lpPict, HANDLE hPrefMem );
  103. /* Import the metafile in the file indicated by the lpFileSpec. The
  104. metafile generated will be returned in lpPict. */
  105. short FAR PASCAL ImportEmbeddedGr( HDC hdcPrint, LPFILESPEC lpFileSpec,
  106. PICTINFO FAR * lpPict, HANDLE hPrefMem,
  107. DWORD dwSize, LPSTR lpMetafileName );
  108. /* Import the metafile in using the previously opened file handle in
  109. the structure field lpFileSpec->handle. Reading begins at offset
  110. lpFileSpect->filePos, and the convertor will NOT expect to find the
  111. 512 byte PICT header. The metafile generated will be returned in
  112. lpPict and can be specified via lpMetafileName (NIL = memory metafile,
  113. otherwise, fully qualified filename. */
  114. short FAR PASCAL QD2GDI( LPUSERPREFS lpPrefMem, PICTINFO FAR * lpPict );
  115. /* Import the metafile as specified using the parameters supplied in the
  116. lpPrefMem. The metafile will be returned in lpPict. */
  117.