Update shell xxxAW wrapper prototypes for fixed SHLWAPI functions.
[wine] / dlls / wineps / psdrv.h
1 /*
2  *      PostScript driver definitions
3  *
4  *      Copyright 1998  Huw D M Davies
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_PSDRV_H
22 #define __WINE_PSDRV_H
23
24 #include "windef.h"
25 #include "wingdi.h"
26 #include "gdi.h"
27 #include "wine/wingdi16.h"
28 #include "winspool.h"
29
30 typedef struct {
31     INT             index;
32     LPCSTR          sz;
33 } GLYPHNAME;
34
35 typedef struct {
36     LONG            UV;
37     const GLYPHNAME *name;
38 } UNICODEGLYPH;
39
40 typedef struct {
41     float       llx, lly, urx, ury;
42 } AFMBBOX;
43
44 typedef struct _tagAFMLIGS {
45     char                *successor;
46     char                *ligature;
47     struct _tagAFMLIGS  *next;
48 } AFMLIGS;
49
50 typedef struct {
51     int                 C;              /* character */  
52     LONG                UV;
53     float               WX;
54     const GLYPHNAME     *N;             /* name */
55     AFMBBOX             B;
56     const AFMLIGS       *L;             /* Ligatures */
57 } OLD_AFMMETRICS;
58
59 typedef struct {
60     INT                 C;                      /* AFM encoding (or -1) */
61     LONG                UV;                     /* Unicode value */
62     FLOAT               WX;                     /* Advance width */
63     const GLYPHNAME     *N;                     /* Glyph name */
64 } AFMMETRICS;
65
66 typedef struct {
67     USHORT              usUnitsPerEm;           /* head:unitsPerEm */
68     SHORT               sAscender;              /* hhea:Ascender */
69     SHORT               sDescender;             /* hhea:Descender */
70     SHORT               sLineGap;               /* hhea:LineGap */
71     SHORT               sAvgCharWidth;          /* OS/2:xAvgCharWidth */
72     SHORT               sTypoAscender;          /* OS/2:sTypoAscender */
73     SHORT               sTypoDescender;         /* OS/2:sTypoDescender */
74     SHORT               sTypoLineGap;           /* OS/2:sTypeLineGap */
75     USHORT              usWinAscent;            /* OS/2:usWinAscent */
76     USHORT              usWinDescent;           /* OS/2:usWinDescent */
77 } WINMETRICS;
78
79 typedef struct _tagAFM {
80     LPCSTR              FontName;
81     LPCSTR              FullName;
82     LPCSTR              FamilyName;
83     LPCSTR              EncodingScheme;
84     LONG                Weight;                 /* FW_NORMAL etc. */
85     float               ItalicAngle;
86     BOOL                IsFixedPitch;
87     float               UnderlinePosition;
88     float               UnderlineThickness;
89     AFMBBOX             FontBBox;
90     float               Ascender;
91     float               Descender;
92     WINMETRICS          WinMetrics;
93     int                 NumofMetrics;
94     const AFMMETRICS    *Metrics;
95 } AFM;
96
97 /* Note no 'next' in AFM. Use AFMLISTENTRY as a container. This allow more than
98    one list to exist without having to reallocate the entire AFM structure. We
99    keep a global list of all afms (PSDRV_AFMFontList) plus a list of available
100    fonts for each DC (dc->physDev->Fonts) */
101
102 typedef struct _tagAFMLISTENTRY {
103     const AFM                   *afm;
104     struct _tagAFMLISTENTRY     *next;
105 } AFMLISTENTRY;
106
107 typedef struct _tagFONTFAMILY {
108     char                        *FamilyName; /* family name */
109     AFMLISTENTRY                *afmlist;    /* list of afms for this family */
110     struct _tagFONTFAMILY       *next;       /* next family */
111 } FONTFAMILY;
112
113 extern FONTFAMILY   *PSDRV_AFMFontList;
114 extern const AFM    *const PSDRV_BuiltinAFMs[];     /* last element is NULL */
115
116 typedef struct _tagFONTNAME {
117     char                *Name;
118     struct _tagFONTNAME *next;
119 } FONTNAME;
120
121 typedef struct {
122     float       llx, lly, urx, ury;
123 } IMAGEABLEAREA;
124
125 typedef struct {
126     float       x, y;
127 } PAPERDIMENSION;
128
129 /* Solaris kludge */
130 #undef PAGESIZE
131 typedef struct _tagPAGESIZE {
132     char                *Name;
133     char                *FullName;
134     char                *InvocationString;
135     IMAGEABLEAREA       *ImageableArea;
136     PAPERDIMENSION      *PaperDimension;
137     WORD                WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
138     struct _tagPAGESIZE *next;
139 } PAGESIZE;
140
141
142 typedef struct _tagOPTIONENTRY {
143     char                        *Name;          /* eg "True" */
144     char                        *FullName;      /* eg "Installed" */
145     char                        *InvocationString; /* Often NULL */
146     struct _tagOPTIONENTRY      *next;
147 } OPTIONENTRY;
148
149 typedef struct _tagOPTION { /* Treat bool as a special case of pickone */
150     char                        *OptionName;    /* eg "*Option1" */
151     char                        *FullName;      /* eg "Envelope Feeder" */
152     char                        *DefaultOption; /* eg "False" */
153     OPTIONENTRY                 *Options;
154     struct _tagOPTION           *next;
155 } OPTION;
156
157 typedef struct _tagCONSTRAINT {
158     char                        *Feature1;
159     char                        *Value1;
160     char                        *Feature2;
161     char                        *Value2;
162     struct _tagCONSTRAINT       *next;
163 } CONSTRAINT;
164
165 typedef struct _tagINPUTSLOT {
166     char                        *Name;
167     char                        *FullName;
168     char                        *InvocationString;
169     WORD                        WinBin; /* eg DMBIN_LOWER */
170     struct _tagINPUTSLOT        *next;
171 } INPUTSLOT;
172
173 typedef struct {
174     char                *NickName;
175     int                 LanguageLevel;
176     BOOL                ColorDevice;
177     int                 DefaultResolution;
178     signed int          LandscapeOrientation;
179     char                *JCLBegin;
180     char                *JCLToPSInterpreter;
181     char                *JCLEnd;
182     char                *DefaultFont;
183     FONTNAME            *InstalledFonts; /* ptr to a list of FontNames */
184     PAGESIZE            *PageSizes;
185     OPTION              *InstalledOptions;
186     CONSTRAINT          *Constraints;
187     INPUTSLOT           *InputSlots;
188 } PPD;
189
190 typedef struct {
191     DEVMODEA                    dmPublic;
192     struct _tagdocprivate {
193       int dummy;
194     }                           dmDocPrivate;
195     struct _tagdrvprivate {
196       UINT      numInstalledOptions; /* Options at end of struct */
197     }                           dmDrvPrivate;
198
199 /* Now comes:
200
201 numInstalledOptions of OPTIONs
202
203 */
204
205 } PSDRV_DEVMODEA;
206
207 typedef struct _tagPI {
208     char                    *FriendlyName;
209     PPD                     *ppd;
210     PSDRV_DEVMODEA          *Devmode;
211     FONTFAMILY              *Fonts;
212     PPRINTER_ENUM_VALUESA   FontSubTable;
213     DWORD                   FontSubTableSize;
214     struct _tagPI           *next;
215 } PRINTERINFO;
216
217 typedef struct {
218     float               r, g, b;
219 } PSRGB;
220
221 typedef struct {
222     float               i;
223 } PSGRAY;
224
225
226 /* def's for PSCOLOR.type */
227 #define PSCOLOR_GRAY    0
228 #define PSCOLOR_RGB     1
229
230 typedef struct {
231     int                 type;
232     union {
233         PSRGB  rgb;
234         PSGRAY gray;
235     }                   value;
236 } PSCOLOR;
237
238 typedef struct {
239     const AFM           *afm;
240     TEXTMETRICW         tm;
241     INT                 size;
242     float               scale;
243     INT                 escapement;
244     PSCOLOR             color;
245     BOOL                set;            /* Have we done a setfont yet */
246 } PSFONT;
247
248 typedef struct {
249     PSCOLOR             color;
250     BOOL                set;
251 } PSBRUSH;
252
253 typedef struct {
254     INT                 style;
255     INT         width;
256     char                *dash;
257     PSCOLOR             color;
258     BOOL                set;
259 } PSPEN;
260
261 typedef struct {
262     HANDLE16            hJob;
263     LPSTR               output;         /* Output file/port */
264     BOOL                banding;        /* Have we received a NEXTBAND */
265     BOOL                OutOfPage;      /* Page header not sent yet */
266     INT                 PageNo;
267 } JOB;
268
269 typedef struct {
270     PSFONT              font;           /* Current PS font */
271     PSPEN               pen;
272     PSBRUSH             brush;
273     PSCOLOR             bkColor;
274     PSCOLOR             inkColor;       /* Last colour set */
275     JOB                 job;
276     PSDRV_DEVMODEA      *Devmode;
277     PRINTERINFO         *pi;
278     RECT                PageSize;      /* Imageable area in device co-ords */
279     int                 horzRes;       /* device caps */
280     int                 vertRes;
281     int                 horzSize;
282     int                 vertSize;
283     int                 logPixelsX;
284     int                 logPixelsY;
285 } PSDRV_PDEVICE;
286
287 typedef struct {
288     PRINTERINFO *pi;
289     PSDRV_DEVMODEA *dlgdm;
290 } PSDRV_DLGINFO;
291
292
293 /*
294  *  Every glyph name in the Adobe Glyph List and the 35 core PostScript fonts
295  */
296  
297 extern const INT    PSDRV_AGLGlyphNamesSize;
298 extern GLYPHNAME    PSDRV_AGLGlyphNames[];
299
300
301 /*
302  *  The AGL encoding vector
303  */
304  
305 extern const INT            PSDRV_AGLbyNameSize;    /* sorted by name -     */
306 extern const UNICODEGLYPH   PSDRV_AGLbyName[];      /*  duplicates omitted  */
307
308 extern const INT            PSDRV_AGLbyUVSize;      /* sorted by UV -       */
309 extern const UNICODEGLYPH   PSDRV_AGLbyUV[];        /*  duplicates included */
310
311
312 extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
313                     LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort,
314                     LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode);
315
316 extern HANDLE PSDRV_Heap;
317 extern char *PSDRV_ANSIVector[256];
318
319 extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
320                          PRINTERINFO *pi);
321 extern BOOL PSDRV_GetFontMetrics(void);
322 extern PPD *PSDRV_ParsePPD(char *fname);
323 extern PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name);
324 extern const AFM *PSDRV_FindAFMinList(FONTFAMILY *head, LPCSTR name);
325 extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
326         BOOL *p_added);
327 extern void PSDRV_FreeAFMList( FONTFAMILY *head );
328
329 extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
330 extern HFONT PSDRV_FONT_SelectObject( DC *dc, HFONT hfont );
331 extern HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen );
332 extern HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
333
334 extern BOOL PSDRV_Brush(DC *dc, BOOL EO);
335 extern BOOL PSDRV_SetFont( DC *dc );
336 extern BOOL PSDRV_SetPen( DC *dc );
337
338 extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
339 extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
340 extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
341                      COLORREF wincolor );
342 extern char PSDRV_UnicodeToANSI(int u);
343
344 extern INT PSDRV_WriteHeader( DC *dc, LPCSTR title );
345 extern INT PSDRV_WriteFooter( DC *dc );
346 extern INT PSDRV_WriteNewPage( DC *dc );
347 extern INT PSDRV_WriteEndPage( DC *dc );
348 extern BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y);
349 extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y);
350 extern BOOL PSDRV_WriteStroke(DC *dc);
351 extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width, 
352                         INT height);
353 extern BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width, 
354                         INT height);
355 extern BOOL PSDRV_WriteSetFont(DC *dc);
356 extern BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count);
357 extern BOOL PSDRV_WriteSetPen(DC *dc);
358 extern BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h,
359                              double ang1, double ang2);
360 extern BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
361 extern BOOL PSDRV_WriteSetBrush(DC *dc);
362 extern BOOL PSDRV_WriteFill(DC *dc);
363 extern BOOL PSDRV_WriteEOFill(DC *dc);
364 extern BOOL PSDRV_WriteGSave(DC *dc);
365 extern BOOL PSDRV_WriteGRestore(DC *dc);
366 extern BOOL PSDRV_WriteNewPath(DC *dc);
367 extern BOOL PSDRV_WriteClosePath(DC *dc);
368 extern BOOL PSDRV_WriteInitClip(DC *dc);
369 extern BOOL PSDRV_WriteClip(DC *dc);
370 extern BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h);
371 extern BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName);
372 extern BOOL PSDRV_WriteEOClip(DC *dc);
373 extern BOOL PSDRV_WriteHatch(DC *dc);
374 extern BOOL PSDRV_WriteRotate(DC *dc, float ang);
375 extern BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size);
376 extern BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc);
377 extern BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number);
378 extern BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
379                                  INT widthDst, INT heightDst, INT widthSrc,
380                                  INT heightSrc, char *bits);
381 extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number);
382 extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number);
383 extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number);
384 extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number);
385 extern int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch);
386 extern BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits);
387 extern BOOL PSDRV_WriteArrayPut(DC *dc, CHAR *pszArrayName, INT nIndex, LONG lCoord);
388 extern BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize);
389
390 extern BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right,
391                          INT bottom, INT xstart, INT ystart,
392                          INT xend, INT yend );
393 extern BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right,
394                            INT bottom, INT xstart, INT ystart,
395                            INT xend, INT yend );
396 extern BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right,
397                              INT bottom );
398 extern INT PSDRV_EndDoc( DC *dc );
399 extern INT PSDRV_EndPage( DC *dc );
400 extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, 
401                                    DEVICEFONTENUMPROC proc, LPARAM lp );
402 extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, 
403                            SEGPTR lpInData, SEGPTR lpOutData );
404 extern BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
405                                 const RECT *lprect, LPCWSTR str, UINT count,
406                                 const INT *lpDx );
407 extern BOOL PSDRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar,
408                                   LPINT buffer );
409 extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
410                                         LPSIZE size );
411 extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics );
412 extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y );
413 extern BOOL PSDRV_PatBlt( DC *dc, INT x, INT y, INT width, INT height, DWORD
414                           dwRop);
415 extern BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right,
416                          INT bottom, INT xstart, INT ystart,
417                          INT xend, INT yend );
418 extern BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count );
419 extern BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count );
420 extern BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts,
421                                  UINT polygons );
422 extern BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
423                                   DWORD polylines );
424 extern BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right,
425                               INT bottom );
426 extern BOOL PSDRV_RoundRect(DC *dc, INT left, INT top, INT right,
427                               INT bottom, INT ell_width, INT ell_height);
428 extern HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle );
429 extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
430 extern VOID PSDRV_SetDeviceClipping( DC *dc );
431 extern COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color );
432 extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
433 extern INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc );
434 extern INT PSDRV_StartPage( DC *dc );
435 extern INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst,
436                                 INT widthDst, INT heightDst, INT xSrc,
437                                 INT ySrc, INT widthSrc, INT heightSrc,
438                                 const void *bits, const BITMAPINFO *info,
439                                 UINT wUsage, DWORD dwRop );
440
441 extern INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
442                                LPDEVMODEA lpdmOutput,
443                                LPSTR lpszDevice, LPSTR lpszPort,
444                                LPDEVMODEA lpdmInput, LPSTR lpszProfile,
445                                DWORD dwMode);
446 extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
447                                       LPCSTR lpszPort,
448                                       WORD fwCapability, LPSTR lpszOutput,
449                                       LPDEVMODEA lpdm);
450 VOID PSDRV_DrawLine( DC *dc );
451 INT PSDRV_GlyphListInit(void);
452 const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
453 VOID PSDRV_IndexGlyphList(void);
454 BOOL PSDRV_GetTrueTypeMetrics(void);
455 BOOL PSDRV_GetType1Metrics(void);
456 const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm);
457 SHORT PSDRV_CalcAvgCharWidth(const AFM *afm);
458
459 #endif
460
461