2 * PostScript driver Escape function
4 * Copyright 1998 Huw D M Davies
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.
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.
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
22 #include "wine/winuser16.h"
24 #include "wine/debug.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
30 /**********************************************************************
31 * ExtEscape (WINEPS.@)
33 INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID in_data,
34 INT cbOutput, LPVOID out_data )
39 if(cbInput < sizeof(INT))
41 WARN("cbInput < sizeof(INT) (=%d) for QUERYESCSUPPORT\n", cbInput);
44 UINT num = *(UINT *)in_data;
45 TRACE("QUERYESCSUPPORT for %d\n", num);
59 case POSTSCRIPT_PASSTHROUGH:
70 if(!physDev->job.banding) {
71 physDev->job.banding = TRUE;
74 r->right = physDev->horzRes;
75 r->bottom = physDev->vertRes;
76 TRACE("NEXTBAND returning %d,%d - %d,%d\n", r->left, r->top, r->right, r->bottom );
83 TRACE("NEXTBAND rect to 0,0 - 0,0\n" );
84 physDev->job.banding = FALSE;
85 return EndPage( physDev->hdc );
90 const INT *NumCopies = in_data;
91 INT *ActualCopies = out_data;
92 if(cbInput != sizeof(INT)) {
93 WARN("cbInput != sizeof(INT) (=%d) for SETCOPYCOUNT\n", cbInput);
96 TRACE("SETCOPYCOUNT %d\n", *NumCopies);
104 strcpy(p, "PostScript");
105 *(p + strlen(p) + 1) = '\0'; /* 2 '\0's at end of string */
111 INT newCap = *(INT *)in_data;
112 if(cbInput != sizeof(INT)) {
113 WARN("cbInput != sizeof(INT) (=%d) for SETLINECAP\n", cbInput);
116 TRACE("SETLINECAP %d\n", newCap);
122 INT newJoin = *(INT *)in_data;
123 if(cbInput != sizeof(INT)) {
124 WARN("cbInput != sizeof(INT) (=%d) for SETLINEJOIN\n", cbInput);
127 TRACE("SETLINEJOIN %d\n", newJoin);
133 INT newLimit = *(INT *)in_data;
134 if(cbInput != sizeof(INT)) {
135 WARN("cbInput != sizeof(INT) (=%d) for SETMITERLIMIT\n", cbInput);
138 TRACE("SETMITERLIMIT %d\n", newLimit);
143 /* Undocumented escape used by winword6.
144 Switches between ANSI and a special charset.
145 If *lpInData == 1 we require that
149 0x94 is quotedblright
153 0xa0 is non break space - yeah right.
155 If *lpInData == 0 we get ANSI.
156 Since there's nothing else there, let's just make these the default
157 anyway and see what happens...
161 case EXT_DEVICE_CAPS:
163 UINT cap = *(UINT *)in_data;
164 if(cbInput != sizeof(UINT)) {
165 WARN("cbInput != sizeof(UINT) (=%d) for EXT_DEVICE_CAPS\n", cbInput);
168 TRACE("EXT_DEVICE_CAPS %d\n", cap);
174 const RECT *r = in_data;
175 if(cbInput != sizeof(RECT)) {
176 WARN("cbInput != sizeof(RECT) (=%d) for SET_BOUNDS\n", cbInput);
179 TRACE("SET_BOUNDS (%d,%d) - (%d,%d)\n", r->left, r->top,
180 r->right, r->bottom);
186 UINT epsprint = *(UINT*)in_data;
187 /* FIXME: In this mode we do not need to send page intros and page
188 * ends according to the doc. But I just ignore that detail
191 TRACE("EPS Printing support %sable.\n",epsprint?"en":"dis");
195 case POSTSCRIPT_PASSTHROUGH:
197 /* Write directly to spool file, bypassing normal PS driver
198 * processing that is done along with writing PostScript code
200 * (Usually we have a WORD before the data counting the size, but
201 * cbInput is just this +2.)
203 return WriteSpool16(physDev->job.hJob,((char*)in_data)+2,cbInput-2);
206 case GETSETPRINTORIENT:
208 /* If lpInData is present, it is a 20 byte structure, first 32
209 * bit LONG value is the orientation. if lpInData is NULL, it
210 * returns the current orientation.
212 FIXME("GETSETPRINTORIENT not implemented (data %p)!\n",in_data);
216 FIXME("Unimplemented code 0x%x\n", nEscape);
221 /************************************************************************
224 INT PSDRV_StartPage( PSDRV_PDEVICE *physDev )
226 if(!physDev->job.OutOfPage) {
227 FIXME("Already started a page?\n");
230 physDev->job.PageNo++;
231 if(!PSDRV_WriteNewPage( physDev ))
233 physDev->job.OutOfPage = FALSE;
238 /************************************************************************
241 INT PSDRV_EndPage( PSDRV_PDEVICE *physDev )
243 if(physDev->job.OutOfPage) {
244 FIXME("Already ended a page?\n");
247 if(!PSDRV_WriteEndPage( physDev ))
249 physDev->job.OutOfPage = TRUE;
254 /************************************************************************
257 INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
259 if(physDev->job.hJob) {
260 FIXME("hJob != 0. Now what?\n");
264 if(doc->lpszOutput) {
265 HeapFree( PSDRV_Heap, 0, physDev->job.output );
266 physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(doc->lpszOutput)+1 );
267 strcpy( physDev->job.output, doc->lpszOutput );
269 physDev->job.hJob = OpenJob16(physDev->job.output, doc->lpszDocName, physDev->hdc );
270 if(!physDev->job.hJob) {
271 WARN("OpenJob failed\n");
274 physDev->job.banding = FALSE;
275 physDev->job.OutOfPage = TRUE;
276 physDev->job.PageNo = 0;
277 if(!PSDRV_WriteHeader( physDev, doc->lpszDocName ))
280 return physDev->job.hJob;
284 /************************************************************************
287 INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev )
289 if(!physDev->job.hJob) {
290 FIXME("hJob == 0. Now what?\n");
294 if(!physDev->job.OutOfPage) {
295 WARN("Somebody forgot a EndPage\n");
296 PSDRV_EndPage( physDev );
298 if(!PSDRV_WriteFooter( physDev ))
301 if( CloseJob16( physDev->job.hJob ) == SP_ERROR ) {
302 WARN("CloseJob error\n");
305 physDev->job.hJob = 0;