1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // use this define to disable the DJP support 29*cdf0e10cSrcweir // #define NO_DJP 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define INCL_DOSMODULEMGR 32*cdf0e10cSrcweir #define INCL_DEV 33*cdf0e10cSrcweir #define INCL_SPL 34*cdf0e10cSrcweir #define INCL_SPLERRORS 35*cdf0e10cSrcweir #define INCL_SPLDOSPRINT 36*cdf0e10cSrcweir #define INCL_DEVDJP 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #define INCL_GPI 39*cdf0e10cSrcweir #define INCL_DOSSEMAPHORES 40*cdf0e10cSrcweir #define INCL_PM 41*cdf0e10cSrcweir #include <svpm.h> 42*cdf0e10cSrcweir #include <pmdjp.h> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <string.h> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #define _SV_SALPRN_CXX 47*cdf0e10cSrcweir #include <tools/debug.hxx> 48*cdf0e10cSrcweir #include <saldata.hxx> 49*cdf0e10cSrcweir #include <salinst.h> 50*cdf0e10cSrcweir #include <salgdi.h> 51*cdf0e10cSrcweir #include <salframe.h> 52*cdf0e10cSrcweir #include <vcl/salptype.hxx> 53*cdf0e10cSrcweir #include <salprn.h> 54*cdf0e10cSrcweir #include <vcl/print.h> 55*cdf0e10cSrcweir #include <vcl/jobset.h> 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #ifndef __H_FT2LIB 58*cdf0e10cSrcweir #include <wingdi.h> 59*cdf0e10cSrcweir #include <ft2lib.h> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // ======================================================================= 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir // ----------------------- 65*cdf0e10cSrcweir // - struct ImplFormInfo - 66*cdf0e10cSrcweir // ----------------------- 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir struct ImplFormInfo 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir long mnPaperWidth; 71*cdf0e10cSrcweir long mnPaperHeight; 72*cdf0e10cSrcweir #ifndef NO_DJP 73*cdf0e10cSrcweir DJPT_PAPERSIZE mnId; 74*cdf0e10cSrcweir #endif 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir // ======================================================================= 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir // ----------------------- 80*cdf0e10cSrcweir // - struct ImplTrayInfo - 81*cdf0e10cSrcweir // ----------------------- 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir struct ImplTrayInfo 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir CHAR maName[32]; 86*cdf0e10cSrcweir CHAR maDisplayName[64]; 87*cdf0e10cSrcweir DJPT_TRAYTYPE mnId; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir ImplTrayInfo( const char* pTrayName, 90*cdf0e10cSrcweir const char* pTrayDisplayName ) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir strcpy( maName, pTrayName); 93*cdf0e10cSrcweir strcpy( maDisplayName, pTrayDisplayName); 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir }; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // ======================================================================= 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir struct ImplQueueSalSysData 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir ByteString maPrinterName; // pszPrinters 102*cdf0e10cSrcweir ByteString maName; // pszName bzw. LogAddress 103*cdf0e10cSrcweir ByteString maOrgDriverName; // pszDriverName (maDriverName.maDeviceName) 104*cdf0e10cSrcweir ByteString maDriverName; // pszDriverName bis . 105*cdf0e10cSrcweir ByteString maDeviceName; // pszDriverName nach . 106*cdf0e10cSrcweir PDRIVDATA mpDrivData; 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir ImplQueueSalSysData( const ByteString& rPrinterName, 109*cdf0e10cSrcweir const ByteString& rName, 110*cdf0e10cSrcweir const ByteString& rDriverName, 111*cdf0e10cSrcweir const ByteString& rDeviceName, 112*cdf0e10cSrcweir const ByteString& rOrgDriverName, 113*cdf0e10cSrcweir PDRIVDATA pDrivData ); 114*cdf0e10cSrcweir ~ImplQueueSalSysData(); 115*cdf0e10cSrcweir }; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir // ----------------------------------------------------------------------- 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir ImplQueueSalSysData::ImplQueueSalSysData( const ByteString& rPrinterName, 120*cdf0e10cSrcweir const ByteString& rName, 121*cdf0e10cSrcweir const ByteString& rOrgDriverName, 122*cdf0e10cSrcweir const ByteString& rDriverName, 123*cdf0e10cSrcweir const ByteString& rDeviceName, 124*cdf0e10cSrcweir PDRIVDATA pDrivData ) : 125*cdf0e10cSrcweir maPrinterName( rPrinterName ), 126*cdf0e10cSrcweir maName( rName ), 127*cdf0e10cSrcweir maOrgDriverName( rName ), 128*cdf0e10cSrcweir maDriverName( rDriverName ), 129*cdf0e10cSrcweir maDeviceName( rDeviceName ) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir if ( pDrivData ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir mpDrivData = (PDRIVDATA)new BYTE[pDrivData->cb]; 134*cdf0e10cSrcweir memcpy( mpDrivData, pDrivData, pDrivData->cb ); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir else 137*cdf0e10cSrcweir mpDrivData = NULL; 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // ----------------------------------------------------------------------- 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir ImplQueueSalSysData::~ImplQueueSalSysData() 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir delete mpDrivData; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir // ======================================================================= 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir static ULONG ImplPMQueueStatusToSal( USHORT nPMStatus ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir ULONG nStatus = 0; 152*cdf0e10cSrcweir if ( nPMStatus & PRQ3_PAUSED ) 153*cdf0e10cSrcweir nStatus |= QUEUE_STATUS_PAUSED; 154*cdf0e10cSrcweir if ( nPMStatus & PRQ3_PENDING ) 155*cdf0e10cSrcweir nStatus |= QUEUE_STATUS_PENDING_DELETION; 156*cdf0e10cSrcweir if ( !nStatus ) 157*cdf0e10cSrcweir nStatus |= QUEUE_STATUS_READY; 158*cdf0e10cSrcweir return nStatus; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // ----------------------------------------------------------------------- 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir void Os2SalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir APIRET rc; 166*cdf0e10cSrcweir ULONG nNeeded; 167*cdf0e10cSrcweir ULONG nReturned; 168*cdf0e10cSrcweir ULONG nTotal; 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir // query needed size of the buffer for the QueueInfo 171*cdf0e10cSrcweir rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); 172*cdf0e10cSrcweir if( nNeeded == 0 ) 173*cdf0e10cSrcweir return; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir // create the buffer for the QueueInfo 176*cdf0e10cSrcweir PCHAR pQueueData = new CHAR[nNeeded]; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // query QueueInfos 179*cdf0e10cSrcweir rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; 182*cdf0e10cSrcweir for ( int i = 0; i < nReturned; i++ ) 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir // create entry for the QueueInfo array 185*cdf0e10cSrcweir SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir ByteString aOrgDriverName( pPrqInfo->pszDriverName); 188*cdf0e10cSrcweir ByteString aName( pPrqInfo->pszName); 189*cdf0e10cSrcweir pInfo->maDriver = ::rtl::OStringToOUString (aOrgDriverName, gsl_getSystemTextEncoding()); 190*cdf0e10cSrcweir pInfo->maPrinterName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); 191*cdf0e10cSrcweir pInfo->maLocation = ::rtl::OStringToOUString (aName, gsl_getSystemTextEncoding()); 192*cdf0e10cSrcweir pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); 193*cdf0e10cSrcweir pInfo->mnJobs = pPrqInfo->cJobs; 194*cdf0e10cSrcweir // pInfo->maComment = !!! 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir // Feststellen, ob Name doppelt 197*cdf0e10cSrcweir PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; 198*cdf0e10cSrcweir for ( int j = 0; j < nReturned; j++ ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir // Wenn Name doppelt, erweitern wir diesen um die Location 201*cdf0e10cSrcweir if ( (j != i) && 202*cdf0e10cSrcweir (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir pInfo->maPrinterName += ';'; 205*cdf0e10cSrcweir pInfo->maPrinterName += pInfo->maLocation; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir pTempPrqInfo++; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir // pszDriver in DriverName (bis .) und DeviceName (nach .) aufsplitten 211*cdf0e10cSrcweir PSZ pDriverName; 212*cdf0e10cSrcweir PSZ pDeviceName; 213*cdf0e10cSrcweir if ( (pDriverName = strchr( pPrqInfo->pszDriverName, '.' )) != 0 ) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir *pDriverName = 0; 216*cdf0e10cSrcweir pDeviceName = pDriverName + 1; 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir else 219*cdf0e10cSrcweir pDeviceName = NULL; 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit 222*cdf0e10cSrcweir // ein memcmp vom JobSetup auch funktioniert 223*cdf0e10cSrcweir if ( pPrqInfo->pDriverData && 224*cdf0e10cSrcweir (pPrqInfo->pDriverData->cb >= sizeof( pPrqInfo->pDriverData )) ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir int nDeviceNameLen = strlen( pPrqInfo->pDriverData->szDeviceName ); 227*cdf0e10cSrcweir memset( pPrqInfo->pDriverData->szDeviceName+nDeviceNameLen, 228*cdf0e10cSrcweir 0, 229*cdf0e10cSrcweir sizeof( pPrqInfo->pDriverData->szDeviceName )-nDeviceNameLen ); 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir // save driver data and driver names 233*cdf0e10cSrcweir ByteString aPrinterName( pPrqInfo->pszPrinters); 234*cdf0e10cSrcweir ByteString aDriverName( pPrqInfo->pszDriverName); 235*cdf0e10cSrcweir ByteString aDeviceName; 236*cdf0e10cSrcweir if ( pDeviceName ) 237*cdf0e10cSrcweir aDeviceName = pDeviceName; 238*cdf0e10cSrcweir pInfo->mpSysData = new ImplQueueSalSysData( aPrinterName, aName, 239*cdf0e10cSrcweir aOrgDriverName, 240*cdf0e10cSrcweir aDriverName, aDeviceName, 241*cdf0e10cSrcweir pPrqInfo->pDriverData ); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir // add queue to the list 244*cdf0e10cSrcweir pList->Add( pInfo ); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // increment to next element of the QueueInfo array 247*cdf0e10cSrcweir pPrqInfo++; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir delete [] pQueueData; 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir // ----------------------------------------------------------------------- 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir void Os2SalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir APIRET rc; 258*cdf0e10cSrcweir ULONG nNeeded; 259*cdf0e10cSrcweir ULONG nReturned; 260*cdf0e10cSrcweir ULONG nTotal; 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir // query needed size of the buffer for the QueueInfo 263*cdf0e10cSrcweir rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); 264*cdf0e10cSrcweir if( nNeeded == 0 ) 265*cdf0e10cSrcweir return; 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir // create the buffer for the QueueInfo 268*cdf0e10cSrcweir PCHAR pQueueData = new CHAR[nNeeded]; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir // query QueueInfos 271*cdf0e10cSrcweir rc = SplEnumQueue( (PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir PPRQINFO3 pPrqInfo = (PPRQINFO3)pQueueData; 274*cdf0e10cSrcweir for ( int i = 0; i < nReturned; i++ ) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir ImplQueueSalSysData* pSysData = (ImplQueueSalSysData*)(pInfo->mpSysData); 277*cdf0e10cSrcweir if ( pSysData->maPrinterName.Equals( pPrqInfo->pszPrinters ) && 278*cdf0e10cSrcweir pSysData->maName.Equals( pPrqInfo->pszName ) && 279*cdf0e10cSrcweir pSysData->maOrgDriverName.Equals( pPrqInfo->pszDriverName ) ) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir pInfo->mnStatus = ImplPMQueueStatusToSal( pPrqInfo->fsStatus ); 282*cdf0e10cSrcweir pInfo->mnJobs = pPrqInfo->cJobs; 283*cdf0e10cSrcweir break; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir // increment to next element of the QueueInfo array 287*cdf0e10cSrcweir pPrqInfo++; 288*cdf0e10cSrcweir } 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir delete [] pQueueData; 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir // ----------------------------------------------------------------------- 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir void Os2SalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir delete ((ImplQueueSalSysData*)(pInfo->mpSysData)); 298*cdf0e10cSrcweir delete pInfo; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir // ----------------------------------------------------------------------- 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir XubString Os2SalInstance::GetDefaultPrinter() 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir APIRET rc; 306*cdf0e10cSrcweir ULONG nNeeded; 307*cdf0e10cSrcweir ULONG nReturned; 308*cdf0e10cSrcweir ULONG nTotal; 309*cdf0e10cSrcweir char szQueueName[255]; 310*cdf0e10cSrcweir XubString aDefaultName; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir // query default queue 313*cdf0e10cSrcweir if ( !PrfQueryProfileString( HINI_PROFILE, SPL_INI_SPOOLER, "QUEUE", 0, szQueueName, sizeof( szQueueName ) ) ) 314*cdf0e10cSrcweir return aDefaultName; 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // extract first queue name 317*cdf0e10cSrcweir PSZ pStr; 318*cdf0e10cSrcweir if ( (pStr = strchr( szQueueName, ';' )) != 0 ) 319*cdf0e10cSrcweir *pStr = 0; 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir // query needed size of the buffer for the QueueInfo 322*cdf0e10cSrcweir rc = SplEnumQueue( (PSZ)NULL, 3, NULL, 0, &nReturned, &nTotal, &nNeeded, NULL ); 323*cdf0e10cSrcweir if ( nNeeded == 0 ) 324*cdf0e10cSrcweir return aDefaultName; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir // create the buffer for the QueueInfo 327*cdf0e10cSrcweir PCHAR pQueueData = new CHAR[ nNeeded ]; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir // query QueueInfos 330*cdf0e10cSrcweir rc = SplEnumQueue ((PSZ)NULL, 3, pQueueData, nNeeded, &nReturned, &nTotal, &nNeeded, NULL ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // find printer name for default queue 333*cdf0e10cSrcweir PPRQINFO3 pPrqInfo = (PPRQINFO3) pQueueData; 334*cdf0e10cSrcweir for ( int i = 0; i < nReturned; i++ ) 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir if ( strcmp( pPrqInfo->pszName, szQueueName ) == 0 ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir aDefaultName = ::rtl::OStringToOUString (pPrqInfo->pszComment, gsl_getSystemTextEncoding()); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir // Feststellen, ob Name doppelt 341*cdf0e10cSrcweir PPRQINFO3 pTempPrqInfo = (PPRQINFO3)pQueueData; 342*cdf0e10cSrcweir for ( int j = 0; j < nReturned; j++ ) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir // Wenn Name doppelt, erweitern wir diesen um die Location 345*cdf0e10cSrcweir if ( (j != i) && 346*cdf0e10cSrcweir (strcmp( pPrqInfo->pszComment, pTempPrqInfo->pszComment ) == 0) ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir String pszName( ::rtl::OStringToOUString (pPrqInfo->pszName, gsl_getSystemTextEncoding())); 349*cdf0e10cSrcweir aDefaultName += ';'; 350*cdf0e10cSrcweir aDefaultName += pszName; 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir pTempPrqInfo++; 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir break; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir // increment to next element of the QueueInfo array 358*cdf0e10cSrcweir pPrqInfo++; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir delete [] pQueueData; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir return aDefaultName; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir // ======================================================================= 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir static void* ImplAllocPrnMemory( size_t n ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir return calloc( n, 1); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // ----------------------------------------------------------------------- 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir inline void ImplFreePrnMemory( void* p ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir free( p ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // ----------------------------------------------------------------------- 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir static PDRIVDATA ImplPrnDrivData( const ImplJobSetup* pSetupData ) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf 385*cdf0e10cSrcweir // unseren Daten arbeiten, da es durch Konfigurationsprobleme 386*cdf0e10cSrcweir // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. 387*cdf0e10cSrcweir // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. 388*cdf0e10cSrcweir // sind dadurch leichter zu finden 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir if ( !pSetupData->mpDriverData ) 391*cdf0e10cSrcweir return NULL; 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir DBG_ASSERT( ((PDRIVDATA)(pSetupData->mpDriverData))->cb == pSetupData->mnDriverDataLen, 394*cdf0e10cSrcweir "ImplPrnDrivData() - SetupDataLen != DriverDataLen" ); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir PDRIVDATA pDrivData = (PDRIVDATA)ImplAllocPrnMemory( pSetupData->mnDriverDataLen ); 397*cdf0e10cSrcweir memcpy( pDrivData, pSetupData->mpDriverData, pSetupData->mnDriverDataLen ); 398*cdf0e10cSrcweir return pDrivData; 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir // ----------------------------------------------------------------------- 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir static void ImplUpdateSetupData( const PDRIVDATA pDrivData, ImplJobSetup* pSetupData ) 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir // Diese Funktion wird eingesetzt, damit Druckertreiber nicht auf 406*cdf0e10cSrcweir // unseren Daten arbeiten, da es durch Konfigurationsprobleme 407*cdf0e10cSrcweir // sein kann, das der Druckertreiber bei uns Daten ueberschreibt. 408*cdf0e10cSrcweir // Durch diese vorgehensweise werden einige Abstuerze vermieden, bzw. 409*cdf0e10cSrcweir // sind dadurch leichter zu finden 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir if ( !pDrivData || !pDrivData->cb ) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir if ( pSetupData->mpDriverData ) 414*cdf0e10cSrcweir rtl_freeMemory( pSetupData->mpDriverData ); 415*cdf0e10cSrcweir pSetupData->mpDriverData = NULL; 416*cdf0e10cSrcweir pSetupData->mnDriverDataLen = 0; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir else 419*cdf0e10cSrcweir { 420*cdf0e10cSrcweir // Alle Bytes hinter dem DeviceNamen auf 0 initialisieren, damit 421*cdf0e10cSrcweir // ein memcmp vom JobSetup auch funktioniert 422*cdf0e10cSrcweir if ( pDrivData->cb >= sizeof( pDrivData ) ) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir int nDeviceNameLen = strlen( pDrivData->szDeviceName ); 425*cdf0e10cSrcweir memset( pDrivData->szDeviceName+nDeviceNameLen, 426*cdf0e10cSrcweir 0, 427*cdf0e10cSrcweir sizeof( pDrivData->szDeviceName )-nDeviceNameLen ); 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir if ( pSetupData->mpDriverData ) 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir if ( pSetupData->mnDriverDataLen != pDrivData->cb ) 433*cdf0e10cSrcweir rtl_freeMemory( pSetupData->mpDriverData ); 434*cdf0e10cSrcweir pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir else 437*cdf0e10cSrcweir pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDrivData->cb); 438*cdf0e10cSrcweir pSetupData->mnDriverDataLen = pDrivData->cb; 439*cdf0e10cSrcweir memcpy( pSetupData->mpDriverData, pDrivData, pDrivData->cb ); 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir if ( pDrivData ) 443*cdf0e10cSrcweir ImplFreePrnMemory( pDrivData ); 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir // ----------------------------------------------------------------------- 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir static BOOL ImplPaperSizeEqual( long nPaperWidth1, long nPaperHeight1, 449*cdf0e10cSrcweir long nPaperWidth2, long nPaperHeight2 ) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir return (((nPaperWidth1 >= nPaperWidth2-1) && (nPaperWidth1 <= nPaperWidth2+1)) && 452*cdf0e10cSrcweir ((nPaperHeight1 >= nPaperHeight2-1) && (nPaperHeight1 <= nPaperHeight2+1))); 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir // ----------------------------------------------------------------------- 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir static BOOL ImplIsDriverDJPEnabled( HDC hDC ) 458*cdf0e10cSrcweir { 459*cdf0e10cSrcweir #ifdef NO_DJP 460*cdf0e10cSrcweir return FALSE; 461*cdf0e10cSrcweir #else 462*cdf0e10cSrcweir // Ueber OS2-Ini kann DJP disablte werden 463*cdf0e10cSrcweir if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_USEDJP, 1 ) ) 464*cdf0e10cSrcweir return FALSE; 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir // Testen, ob DJP-Interface am Drucker vorhanden 467*cdf0e10cSrcweir LONG lQuery; 468*cdf0e10cSrcweir APIRET rc; 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir lQuery = DEVESC_QUERYSIZE; 471*cdf0e10cSrcweir rc = DevEscape( hDC, 472*cdf0e10cSrcweir DEVESC_QUERYESCSUPPORT, 473*cdf0e10cSrcweir sizeof( lQuery ), 474*cdf0e10cSrcweir (PBYTE)&lQuery, 475*cdf0e10cSrcweir 0, 476*cdf0e10cSrcweir (PBYTE)NULL ); 477*cdf0e10cSrcweir if ( DEV_OK != rc ) 478*cdf0e10cSrcweir return FALSE; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir lQuery = DEVESC_QUERYJOBPROPERTIES; 481*cdf0e10cSrcweir rc = DevEscape( hDC, 482*cdf0e10cSrcweir DEVESC_QUERYESCSUPPORT, 483*cdf0e10cSrcweir sizeof( lQuery ), 484*cdf0e10cSrcweir (PBYTE)&lQuery, 485*cdf0e10cSrcweir 0, 486*cdf0e10cSrcweir (PBYTE)NULL ); 487*cdf0e10cSrcweir if ( DEV_OK != rc ) 488*cdf0e10cSrcweir return FALSE; 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir lQuery = DEVESC_SETJOBPROPERTIES; 491*cdf0e10cSrcweir rc = DevEscape( hDC, 492*cdf0e10cSrcweir DEVESC_QUERYESCSUPPORT, 493*cdf0e10cSrcweir sizeof( lQuery ), 494*cdf0e10cSrcweir (PBYTE)&lQuery, 495*cdf0e10cSrcweir 0, 496*cdf0e10cSrcweir (PBYTE)NULL ); 497*cdf0e10cSrcweir if ( DEV_OK != rc ) 498*cdf0e10cSrcweir return FALSE; 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir return TRUE; 501*cdf0e10cSrcweir #endif 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir // ----------------------------------------------------------------------- 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir static void ImplFormatInputList( PDJP_ITEM pDJP, PQUERYTUPLE pTuple ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir // Loop through the query elements 509*cdf0e10cSrcweir BOOL fContinue = TRUE; 510*cdf0e10cSrcweir do 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir pDJP->cb = sizeof (DJP_ITEM); 513*cdf0e10cSrcweir pDJP->ulProperty = pTuple->ulProperty; 514*cdf0e10cSrcweir pDJP->lType = pTuple->lType; 515*cdf0e10cSrcweir pDJP->ulNumReturned = 0; 516*cdf0e10cSrcweir pDJP->ulValue = DJP_NONE; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // at EOL? 519*cdf0e10cSrcweir fContinue = DJP_NONE != pTuple->ulProperty; 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir // Move to next item structure and tuplet 522*cdf0e10cSrcweir pDJP++; 523*cdf0e10cSrcweir pTuple++; 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir while ( fContinue ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir // ----------------------------------------------------------------------- 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir if ( pOs2SalInfoPrinter->mnFormCount ) 533*cdf0e10cSrcweir { 534*cdf0e10cSrcweir for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnFormCount; i++ ) 535*cdf0e10cSrcweir delete pOs2SalInfoPrinter->mpFormArray[i]; 536*cdf0e10cSrcweir delete [] pOs2SalInfoPrinter->mpFormArray; 537*cdf0e10cSrcweir pOs2SalInfoPrinter->mnFormCount = 0; 538*cdf0e10cSrcweir } 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir if ( pOs2SalInfoPrinter->mnTrayCount ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir for ( USHORT i = 0; i < pOs2SalInfoPrinter->mnTrayCount; i++ ) 543*cdf0e10cSrcweir delete pOs2SalInfoPrinter->mpTrayArray[i]; 544*cdf0e10cSrcweir delete [] pOs2SalInfoPrinter->mpTrayArray; 545*cdf0e10cSrcweir pOs2SalInfoPrinter->mnTrayCount = 0; 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir // ----------------------------------------------------------------------- 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir ImplFreeFormAndTrayList( pOs2SalInfoPrinter ); 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir LONG alQuery[] = 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir 0, 0, // First two members of QUERYSIZE 558*cdf0e10cSrcweir DJP_CJ_FORM, DJP_ALL, 559*cdf0e10cSrcweir DJP_CJ_TRAYNAME, DJP_ALL, 560*cdf0e10cSrcweir DJP_NONE, DJP_NONE // EOL marker 561*cdf0e10cSrcweir }; 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir APIRET rc; 564*cdf0e10cSrcweir PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; 565*cdf0e10cSrcweir PBYTE pBuffer = NULL; 566*cdf0e10cSrcweir LONG nAlloc = 0; 567*cdf0e10cSrcweir PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); 568*cdf0e10cSrcweir LONG nDrivDataSize = pCopyDrivData->cb; 569*cdf0e10cSrcweir PBYTE pDrivData = (PBYTE)pCopyDrivData; 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir // find out how many bytes to allocate 572*cdf0e10cSrcweir pQuerySize->cb = sizeof( alQuery ); 573*cdf0e10cSrcweir rc = DevEscape( pOs2SalInfoPrinter->mhDC, 574*cdf0e10cSrcweir DEVESC_QUERYSIZE, 575*cdf0e10cSrcweir sizeof( alQuery ), 576*cdf0e10cSrcweir (PBYTE)pQuerySize, 577*cdf0e10cSrcweir &nDrivDataSize, 578*cdf0e10cSrcweir pDrivData ); 579*cdf0e10cSrcweir if ( DEV_OK != rc ) 580*cdf0e10cSrcweir { 581*cdf0e10cSrcweir ImplFreePrnMemory( pCopyDrivData ); 582*cdf0e10cSrcweir return; 583*cdf0e10cSrcweir } 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir // allocate the memory 586*cdf0e10cSrcweir nAlloc = pQuerySize->ulSizeNeeded; 587*cdf0e10cSrcweir pBuffer = (PBYTE)new BYTE[nAlloc]; 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir // set up the input 590*cdf0e10cSrcweir PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; 591*cdf0e10cSrcweir ImplFormatInputList( pDJP, pQuerySize->aTuples ); 592*cdf0e10cSrcweir 593*cdf0e10cSrcweir // do it! 594*cdf0e10cSrcweir rc = DevEscape( pOs2SalInfoPrinter->mhDC, 595*cdf0e10cSrcweir DEVESC_QUERYJOBPROPERTIES, 596*cdf0e10cSrcweir nAlloc, 597*cdf0e10cSrcweir pBuffer, 598*cdf0e10cSrcweir &nDrivDataSize, 599*cdf0e10cSrcweir pDrivData ); 600*cdf0e10cSrcweir ImplFreePrnMemory( pCopyDrivData ); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir // Loop through the query elements 605*cdf0e10cSrcweir PQUERYTUPLE pTuple = pQuerySize->aTuples; 606*cdf0e10cSrcweir while ( DJP_NONE != pTuple->ulProperty ) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir if ( pDJP->ulProperty == DJP_CJ_FORM ) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir if ( pDJP->ulNumReturned ) 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir pOs2SalInfoPrinter->mnFormCount = pDJP->ulNumReturned; 615*cdf0e10cSrcweir pOs2SalInfoPrinter->mpFormArray = new PIMPLFORMINFO[pOs2SalInfoPrinter->mnFormCount]; 616*cdf0e10cSrcweir for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir ImplFormInfo* pInfo = new ImplFormInfo; 619*cdf0e10cSrcweir pInfo->mnPaperWidth = pElm->hcInfo.cx; 620*cdf0e10cSrcweir pInfo->mnPaperHeight = pElm->hcInfo.cy; 621*cdf0e10cSrcweir pInfo->mnId = pElm->djppsFormID; 622*cdf0e10cSrcweir pOs2SalInfoPrinter->mpFormArray[i] = pInfo; 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir } 626*cdf0e10cSrcweir else if ( pDJP->ulProperty == DJP_CJ_TRAYNAME ) 627*cdf0e10cSrcweir { 628*cdf0e10cSrcweir if ( pDJP->ulNumReturned ) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir PDJPT_TRAYNAME pElm = DJP_ELEMENTP( *pDJP, DJPT_TRAYNAME ); 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir pOs2SalInfoPrinter->mnTrayCount = pDJP->ulNumReturned; 633*cdf0e10cSrcweir pOs2SalInfoPrinter->mpTrayArray = new PIMPLTRAYINFO[pOs2SalInfoPrinter->mnTrayCount]; 634*cdf0e10cSrcweir for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir ImplTrayInfo* pInfo = new ImplTrayInfo( pElm->szTrayname, pElm->szDisplayTrayname ); 637*cdf0e10cSrcweir pInfo->mnId = pElm->djpttTrayID; 638*cdf0e10cSrcweir pOs2SalInfoPrinter->mpTrayArray[i] = pInfo; 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir } 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir pDJP = DJP_NEXT_STRUCTP( pDJP ); 644*cdf0e10cSrcweir pTuple++; 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir delete [] pBuffer; 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir // ----------------------------------------------------------------------- 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir static BOOL ImplGetCurrentSettings( Os2SalInfoPrinter* pOs2SalInfoPrinter, ImplJobSetup* pSetupData ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir // Um den aktuellen Tray zu ermitteln, brauchen wir auch die Listen dazu 656*cdf0e10cSrcweir if ( !pOs2SalInfoPrinter->mnFormCount ) 657*cdf0e10cSrcweir ImplGetFormAndTrayList( pOs2SalInfoPrinter, pSetupData ); 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir LONG alQuery[] = 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir 0, 0, // First two members of QUERYSIZE 662*cdf0e10cSrcweir DJP_SJ_ORIENTATION, DJP_CURRENT, 663*cdf0e10cSrcweir DJP_CJ_FORM, DJP_CURRENT, 664*cdf0e10cSrcweir DJP_NONE, DJP_NONE // EOL marker 665*cdf0e10cSrcweir }; 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir APIRET rc; 668*cdf0e10cSrcweir PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; 669*cdf0e10cSrcweir PBYTE pBuffer = NULL; 670*cdf0e10cSrcweir LONG nAlloc = 0; 671*cdf0e10cSrcweir PDRIVDATA pCopyDrivData = ImplPrnDrivData( pSetupData ); 672*cdf0e10cSrcweir LONG nDrivDataSize = pCopyDrivData->cb; 673*cdf0e10cSrcweir PBYTE pDrivData = (PBYTE)pCopyDrivData; 674*cdf0e10cSrcweir BOOL bResult; 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir // find out how many bytes to allocate 677*cdf0e10cSrcweir pQuerySize->cb = sizeof( alQuery ); 678*cdf0e10cSrcweir rc = DevEscape( pOs2SalInfoPrinter->mhDC, 679*cdf0e10cSrcweir DEVESC_QUERYSIZE, 680*cdf0e10cSrcweir sizeof( alQuery ), 681*cdf0e10cSrcweir (PBYTE)pQuerySize, 682*cdf0e10cSrcweir &nDrivDataSize, 683*cdf0e10cSrcweir pDrivData ); 684*cdf0e10cSrcweir if ( DEV_OK != rc ) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir ImplFreePrnMemory( pCopyDrivData ); 687*cdf0e10cSrcweir return FALSE; 688*cdf0e10cSrcweir } 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir // allocate the memory 691*cdf0e10cSrcweir nAlloc = pQuerySize->ulSizeNeeded; 692*cdf0e10cSrcweir pBuffer = (PBYTE)new BYTE[nAlloc]; 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir // set up the input 695*cdf0e10cSrcweir PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; 696*cdf0e10cSrcweir ImplFormatInputList( pDJP, pQuerySize->aTuples ); 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir rc = DevEscape( pOs2SalInfoPrinter->mhDC, 699*cdf0e10cSrcweir DEVESC_QUERYJOBPROPERTIES, 700*cdf0e10cSrcweir nAlloc, 701*cdf0e10cSrcweir pBuffer, 702*cdf0e10cSrcweir &nDrivDataSize, 703*cdf0e10cSrcweir pDrivData ); 704*cdf0e10cSrcweir if ( (DEV_OK == rc) || (DEV_WARNING == rc) ) 705*cdf0e10cSrcweir { 706*cdf0e10cSrcweir // aktuelle Setup-Daten uebernehmen 707*cdf0e10cSrcweir ImplUpdateSetupData( pCopyDrivData, pSetupData ); 708*cdf0e10cSrcweir 709*cdf0e10cSrcweir // Loop through the query elements 710*cdf0e10cSrcweir PQUERYTUPLE pTuple = pQuerySize->aTuples; 711*cdf0e10cSrcweir while ( DJP_NONE != pTuple->ulProperty ) 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir if ( pDJP->ulProperty == DJP_SJ_ORIENTATION ) 714*cdf0e10cSrcweir { 715*cdf0e10cSrcweir if ( pDJP->ulNumReturned ) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION ); 718*cdf0e10cSrcweir if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) ) 719*cdf0e10cSrcweir pSetupData->meOrientation = ORIENTATION_PORTRAIT; 720*cdf0e10cSrcweir else 721*cdf0e10cSrcweir pSetupData->meOrientation = ORIENTATION_LANDSCAPE; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir else if ( pDJP->ulProperty == DJP_CJ_FORM ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir if ( pDJP->ulNumReturned ) 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir PDJPT_FORM pElm = DJP_ELEMENTP( *pDJP, DJPT_FORM ); 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir pSetupData->mnPaperWidth = pElm->hcInfo.cx*100; 731*cdf0e10cSrcweir pSetupData->mnPaperHeight = pElm->hcInfo.cy*100; 732*cdf0e10cSrcweir switch( pElm->djppsFormID ) 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir case DJP_PSI_A3: 735*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_A3; 736*cdf0e10cSrcweir break; 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir case DJP_PSI_A4: 739*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_A4; 740*cdf0e10cSrcweir break; 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir case DJP_PSI_A5: 743*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_A5; 744*cdf0e10cSrcweir break; 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir case DJP_PSI_B4: 747*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_B4; 748*cdf0e10cSrcweir break; 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir case DJP_PSI_B5: 751*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_B5; 752*cdf0e10cSrcweir break; 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir case DJP_PSI_LETTER: 755*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_LETTER; 756*cdf0e10cSrcweir break; 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir case DJP_PSI_LEGAL: 759*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_LEGAL; 760*cdf0e10cSrcweir break; 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir case DJP_PSI_TABLOID: 763*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_TABLOID; 764*cdf0e10cSrcweir break; 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir default: 767*cdf0e10cSrcweir pSetupData->mePaperFormat = PAPER_USER; 768*cdf0e10cSrcweir break; 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir // Wir suchen zuerst ueber den Namen/Id und dann ueber die Id 772*cdf0e10cSrcweir BOOL bTrayFound = FALSE; 773*cdf0e10cSrcweir USHORT j; 774*cdf0e10cSrcweir for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir if ( (pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID) && 777*cdf0e10cSrcweir (pOs2SalInfoPrinter->mpTrayArray[j]->maName == pElm->szTrayname) ) 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir pSetupData->mnPaperBin = j; 780*cdf0e10cSrcweir bTrayFound = TRUE; 781*cdf0e10cSrcweir break; 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir } 784*cdf0e10cSrcweir if ( !bTrayFound ) 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir for ( j = 0; j < pOs2SalInfoPrinter->mnTrayCount; j++ ) 787*cdf0e10cSrcweir { 788*cdf0e10cSrcweir if ( pOs2SalInfoPrinter->mpTrayArray[j]->mnId == pElm->djpttTrayID ) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir pSetupData->mnPaperBin = j; 791*cdf0e10cSrcweir bTrayFound = TRUE; 792*cdf0e10cSrcweir break; 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir } 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir // Wenn wir Ihn immer noch nicht gefunden haben, setzen 797*cdf0e10cSrcweir // wir ihn auf DontKnow 798*cdf0e10cSrcweir if ( !bTrayFound ) 799*cdf0e10cSrcweir pSetupData->mnPaperBin = 0xFFFF; 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir pDJP = DJP_NEXT_STRUCTP( pDJP ); 804*cdf0e10cSrcweir pTuple++; 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir bResult = TRUE; 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir else 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir ImplFreePrnMemory( pCopyDrivData ); 812*cdf0e10cSrcweir bResult = FALSE; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir delete [] pBuffer; 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir return bResult; 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir // ----------------------------------------------------------------------- 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir static BOOL ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData, 823*cdf0e10cSrcweir Orientation eOrientation ) 824*cdf0e10cSrcweir { 825*cdf0e10cSrcweir LONG alQuery[] = 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir 0, 0, // First two members of QUERYSIZE 828*cdf0e10cSrcweir DJP_SJ_ORIENTATION, DJP_CURRENT, 829*cdf0e10cSrcweir DJP_NONE, DJP_NONE // EOL marker 830*cdf0e10cSrcweir }; 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir APIRET rc; 833*cdf0e10cSrcweir PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; 834*cdf0e10cSrcweir PBYTE pBuffer = NULL; 835*cdf0e10cSrcweir LONG nAlloc = 0; 836*cdf0e10cSrcweir LONG nDrivDataSize = pDriverData->cb; 837*cdf0e10cSrcweir 838*cdf0e10cSrcweir // find out how many bytes to allocate 839*cdf0e10cSrcweir pQuerySize->cb = sizeof( alQuery ); 840*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 841*cdf0e10cSrcweir DEVESC_QUERYSIZE, 842*cdf0e10cSrcweir sizeof( alQuery ), 843*cdf0e10cSrcweir (PBYTE)pQuerySize, 844*cdf0e10cSrcweir &nDrivDataSize, 845*cdf0e10cSrcweir (PBYTE)pDriverData ); 846*cdf0e10cSrcweir if ( DEV_OK != rc ) 847*cdf0e10cSrcweir return FALSE; 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir // allocate the memory 850*cdf0e10cSrcweir nAlloc = pQuerySize->ulSizeNeeded; 851*cdf0e10cSrcweir pBuffer = (PBYTE)new BYTE[nAlloc]; 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir // set up the input 854*cdf0e10cSrcweir PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; 855*cdf0e10cSrcweir ImplFormatInputList( pDJP, pQuerySize->aTuples ); 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir pDJP->cb = sizeof( DJP_ITEM ); 858*cdf0e10cSrcweir pDJP->ulProperty = DJP_SJ_ORIENTATION; 859*cdf0e10cSrcweir pDJP->lType = DJP_CURRENT; 860*cdf0e10cSrcweir pDJP->ulValue = (eOrientation == ORIENTATION_PORTRAIT) 861*cdf0e10cSrcweir ? DJP_ORI_PORTRAIT 862*cdf0e10cSrcweir : DJP_ORI_LANDSCAPE; 863*cdf0e10cSrcweir 864*cdf0e10cSrcweir // do it! 865*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 866*cdf0e10cSrcweir DEVESC_SETJOBPROPERTIES, 867*cdf0e10cSrcweir nAlloc, 868*cdf0e10cSrcweir pBuffer, 869*cdf0e10cSrcweir &nDrivDataSize, 870*cdf0e10cSrcweir (PBYTE)pDriverData ); 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir delete [] pBuffer; 873*cdf0e10cSrcweir 874*cdf0e10cSrcweir return ((DEV_OK == rc) || (DEV_WARNING == rc)); 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir // ----------------------------------------------------------------------- 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir static BOOL ImplSetPaperSize( HDC hPrinterDC, PDRIVDATA pDriverData, 880*cdf0e10cSrcweir DJPT_PAPERSIZE nOS2PaperFormat ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir LONG alQuery[] = 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir 0, 0, // First two members of QUERYSIZE 885*cdf0e10cSrcweir DJP_SJ_PAPERSIZE, DJP_CURRENT, 886*cdf0e10cSrcweir DJP_NONE, DJP_NONE // EOL marker 887*cdf0e10cSrcweir }; 888*cdf0e10cSrcweir 889*cdf0e10cSrcweir APIRET rc; 890*cdf0e10cSrcweir PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; 891*cdf0e10cSrcweir PBYTE pBuffer = NULL; 892*cdf0e10cSrcweir LONG nAlloc = 0; 893*cdf0e10cSrcweir LONG nDrivDataSize = pDriverData->cb; 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir // find out how many bytes to allocate 896*cdf0e10cSrcweir pQuerySize->cb = sizeof( alQuery ); 897*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 898*cdf0e10cSrcweir DEVESC_QUERYSIZE, 899*cdf0e10cSrcweir sizeof( alQuery ), 900*cdf0e10cSrcweir (PBYTE)pQuerySize, 901*cdf0e10cSrcweir &nDrivDataSize, 902*cdf0e10cSrcweir (PBYTE)pDriverData ); 903*cdf0e10cSrcweir if ( DEV_OK != rc ) 904*cdf0e10cSrcweir return FALSE; 905*cdf0e10cSrcweir 906*cdf0e10cSrcweir // allocate the memory 907*cdf0e10cSrcweir nAlloc = pQuerySize->ulSizeNeeded; 908*cdf0e10cSrcweir pBuffer = (PBYTE)new BYTE[nAlloc]; 909*cdf0e10cSrcweir 910*cdf0e10cSrcweir // set up the input 911*cdf0e10cSrcweir PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; 912*cdf0e10cSrcweir PDJP_ITEM pStartDJP = pDJP; 913*cdf0e10cSrcweir ImplFormatInputList( pDJP, pQuerySize->aTuples ); 914*cdf0e10cSrcweir 915*cdf0e10cSrcweir // Neue Daten zuweisen 916*cdf0e10cSrcweir pDJP->cb = sizeof( DJP_ITEM ); 917*cdf0e10cSrcweir pDJP->ulProperty = DJP_SJ_PAPERSIZE; 918*cdf0e10cSrcweir pDJP->lType = DJP_CURRENT; 919*cdf0e10cSrcweir pDJP->ulValue = nOS2PaperFormat; 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir // und setzen 922*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 923*cdf0e10cSrcweir DEVESC_SETJOBPROPERTIES, 924*cdf0e10cSrcweir nAlloc, 925*cdf0e10cSrcweir pBuffer, 926*cdf0e10cSrcweir &nDrivDataSize, 927*cdf0e10cSrcweir (PBYTE)pDriverData ); 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir delete [] pBuffer; 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir return ((DEV_OK == rc) || (DEV_WARNING == rc)); 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir // ----------------------------------------------------------------------- 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir static BOOL ImplSetPaperBin( HDC hPrinterDC, PDRIVDATA pDriverData, 937*cdf0e10cSrcweir ImplTrayInfo* pTrayInfo ) 938*cdf0e10cSrcweir { 939*cdf0e10cSrcweir LONG alQuery[] = 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir 0, 0, // First two members of QUERYSIZE 942*cdf0e10cSrcweir DJP_SJ_TRAYTYPE, DJP_CURRENT, 943*cdf0e10cSrcweir DJP_NONE, DJP_NONE // EOL marker 944*cdf0e10cSrcweir }; 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir APIRET rc; 947*cdf0e10cSrcweir PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; 948*cdf0e10cSrcweir PBYTE pBuffer = NULL; 949*cdf0e10cSrcweir LONG nAlloc = 0; 950*cdf0e10cSrcweir LONG nDrivDataSize = pDriverData->cb; 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir // find out how many bytes to allocate 953*cdf0e10cSrcweir pQuerySize->cb = sizeof( alQuery ); 954*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 955*cdf0e10cSrcweir DEVESC_QUERYSIZE, 956*cdf0e10cSrcweir sizeof( alQuery ), 957*cdf0e10cSrcweir (PBYTE)pQuerySize, 958*cdf0e10cSrcweir &nDrivDataSize, 959*cdf0e10cSrcweir (PBYTE)pDriverData ); 960*cdf0e10cSrcweir if ( DEV_OK != rc ) 961*cdf0e10cSrcweir return FALSE; 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir // allocate the memory 964*cdf0e10cSrcweir nAlloc = pQuerySize->ulSizeNeeded; 965*cdf0e10cSrcweir pBuffer = (PBYTE)new BYTE[nAlloc]; 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir // set up the input 968*cdf0e10cSrcweir PDJP_ITEM pDJP = (PDJP_ITEM)pBuffer; 969*cdf0e10cSrcweir ImplFormatInputList( pDJP, pQuerySize->aTuples ); 970*cdf0e10cSrcweir 971*cdf0e10cSrcweir // Neue Daten zuweisen 972*cdf0e10cSrcweir pDJP->cb = sizeof( DJP_ITEM ); 973*cdf0e10cSrcweir pDJP->ulProperty = DJP_SJ_TRAYTYPE; 974*cdf0e10cSrcweir pDJP->lType = DJP_CURRENT; 975*cdf0e10cSrcweir pDJP->ulValue = pTrayInfo->mnId; 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir // und setzen 978*cdf0e10cSrcweir rc = DevEscape( hPrinterDC, 979*cdf0e10cSrcweir DEVESC_SETJOBPROPERTIES, 980*cdf0e10cSrcweir nAlloc, 981*cdf0e10cSrcweir pBuffer, 982*cdf0e10cSrcweir &nDrivDataSize, 983*cdf0e10cSrcweir (PBYTE)pDriverData ); 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir delete [] pBuffer; 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir return ((DEV_OK == rc) || (DEV_WARNING == rc)); 988*cdf0e10cSrcweir } 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir // ======================================================================= 991*cdf0e10cSrcweir 992*cdf0e10cSrcweir static BOOL ImplSalCreateInfoPrn( Os2SalInfoPrinter* pPrinter, PDRIVDATA pDriverData, 993*cdf0e10cSrcweir HDC& rDC, HPS& rPS ) 994*cdf0e10cSrcweir { 995*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir // create info context 998*cdf0e10cSrcweir DEVOPENSTRUC devOpenStruc; 999*cdf0e10cSrcweir memset( &devOpenStruc, 0, sizeof( devOpenStruc ) ); 1000*cdf0e10cSrcweir devOpenStruc.pszLogAddress = (char*)pPrinter->maName.GetBuffer(); 1001*cdf0e10cSrcweir devOpenStruc.pszDriverName = (char*)pPrinter->maDriverName.GetBuffer(); 1002*cdf0e10cSrcweir devOpenStruc.pdriv = pDriverData; 1003*cdf0e10cSrcweir devOpenStruc.pszDataType = "PM_Q_STD"; 1004*cdf0e10cSrcweir 1005*cdf0e10cSrcweir HDC hDC = DevOpenDC( pSalData->mhAB, OD_INFO, "*", 1006*cdf0e10cSrcweir 4, (PDEVOPENDATA)&devOpenStruc, (HDC)NULL); 1007*cdf0e10cSrcweir if ( !hDC ) 1008*cdf0e10cSrcweir return FALSE; 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir // create presentation space 1011*cdf0e10cSrcweir SIZEL sizel; 1012*cdf0e10cSrcweir sizel.cx = 0; 1013*cdf0e10cSrcweir sizel.cy = 0; 1014*cdf0e10cSrcweir HPS hPS = Ft2CreatePS( pSalData->mhAB, hDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); 1015*cdf0e10cSrcweir if ( !hPS ) 1016*cdf0e10cSrcweir { 1017*cdf0e10cSrcweir DevCloseDC( hDC ); 1018*cdf0e10cSrcweir return FALSE; 1019*cdf0e10cSrcweir } 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir rDC = hDC; 1022*cdf0e10cSrcweir rPS = hPS; 1023*cdf0e10cSrcweir return TRUE; 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir static void ImplSalDestroyInfoPrn( Os2SalInfoPrinter* pPrinter ) 1029*cdf0e10cSrcweir { 1030*cdf0e10cSrcweir ImplSalDeInitGraphics( pPrinter->mpGraphics); 1031*cdf0e10cSrcweir Ft2Associate( pPrinter->mhPS, 0 ); 1032*cdf0e10cSrcweir Ft2DestroyPS( pPrinter->mhPS ); 1033*cdf0e10cSrcweir DevCloseDC( pPrinter->mhDC ); 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir // ======================================================================= 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir SalInfoPrinter* Os2SalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, 1039*cdf0e10cSrcweir ImplJobSetup* pSetupData ) 1040*cdf0e10cSrcweir { 1041*cdf0e10cSrcweir ImplQueueSalSysData* pSysQueueData = (ImplQueueSalSysData*)(pQueueInfo->mpSysData); 1042*cdf0e10cSrcweir Os2SalInfoPrinter* pPrinter = new Os2SalInfoPrinter; 1043*cdf0e10cSrcweir pPrinter->maPrinterName = pSysQueueData->maPrinterName; 1044*cdf0e10cSrcweir pPrinter->maName = pSysQueueData->maName; 1045*cdf0e10cSrcweir pPrinter->maDriverName = pSysQueueData->maDriverName; 1046*cdf0e10cSrcweir pPrinter->maDeviceName = pSysQueueData->maDeviceName; 1047*cdf0e10cSrcweir 1048*cdf0e10cSrcweir // Nur Setup-Daten uebernehmen, wenn Treiber und Laenge der Treiberdaten 1049*cdf0e10cSrcweir // uebereinstimmt 1050*cdf0e10cSrcweir PDRIVDATA pDriverData; 1051*cdf0e10cSrcweir BOOL bUpdateDriverData; 1052*cdf0e10cSrcweir if ( pSetupData->mpDriverData && pSysQueueData->mpDrivData && 1053*cdf0e10cSrcweir (pSetupData->mnSystem == JOBSETUP_SYSTEM_OS2) && 1054*cdf0e10cSrcweir (pSetupData->mnDriverDataLen == pSysQueueData->mpDrivData->cb) && 1055*cdf0e10cSrcweir (strcmp( ((PDRIVDATA)pSetupData->mpDriverData)->szDeviceName, 1056*cdf0e10cSrcweir pSysQueueData->mpDrivData->szDeviceName ) == 0) ) 1057*cdf0e10cSrcweir { 1058*cdf0e10cSrcweir pDriverData = PDRIVDATA( pSetupData->mpDriverData ); 1059*cdf0e10cSrcweir bUpdateDriverData = FALSE; 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir else 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir pDriverData = pSysQueueData->mpDrivData; 1064*cdf0e10cSrcweir bUpdateDriverData = TRUE; 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir if ( pDriverData ) 1067*cdf0e10cSrcweir pPrinter->maJobSetupDeviceName = pDriverData->szDeviceName; 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir if ( !ImplSalCreateInfoPrn( pPrinter, pDriverData, 1070*cdf0e10cSrcweir pPrinter->mhDC, 1071*cdf0e10cSrcweir pPrinter->mhPS ) ) 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir delete pPrinter; 1074*cdf0e10cSrcweir return NULL; 1075*cdf0e10cSrcweir } 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir // create graphics object for output 1078*cdf0e10cSrcweir Os2SalGraphics* pGraphics = new Os2SalGraphics; 1079*cdf0e10cSrcweir pGraphics->mhDC = pPrinter->mhDC; 1080*cdf0e10cSrcweir pGraphics->mhPS = pPrinter->mhPS; 1081*cdf0e10cSrcweir pGraphics->mhWnd = 0; 1082*cdf0e10cSrcweir pGraphics->mbPrinter = TRUE; 1083*cdf0e10cSrcweir pGraphics->mbVirDev = FALSE; 1084*cdf0e10cSrcweir pGraphics->mbWindow = FALSE; 1085*cdf0e10cSrcweir pGraphics->mbScreen = FALSE; 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir ImplSalInitGraphics( pGraphics ); 1088*cdf0e10cSrcweir pPrinter->mpGraphics = pGraphics; 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir // check printer driver for DJP support 1091*cdf0e10cSrcweir pPrinter->mbDJPSupported = ImplIsDriverDJPEnabled( pPrinter->mhDC ); 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir if ( bUpdateDriverData ) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir if ( pSetupData->mpDriverData ) 1096*cdf0e10cSrcweir rtl_freeMemory( pSetupData->mpDriverData); 1097*cdf0e10cSrcweir pSetupData->mpDriverData = (BYTE*)rtl_allocateMemory( pDriverData->cb); 1098*cdf0e10cSrcweir memcpy( pSetupData->mpDriverData, pDriverData, pDriverData->cb ); 1099*cdf0e10cSrcweir pSetupData->mnDriverDataLen = pDriverData->cb; 1100*cdf0e10cSrcweir } 1101*cdf0e10cSrcweir 1102*cdf0e10cSrcweir // retrieve current settings from printer driver and store them to system independend data! 1103*cdf0e10cSrcweir if ( pPrinter->mbDJPSupported ) 1104*cdf0e10cSrcweir ImplGetCurrentSettings( pPrinter, pSetupData ); 1105*cdf0e10cSrcweir pSetupData->mnSystem = JOBSETUP_SYSTEM_OS2; 1106*cdf0e10cSrcweir 1107*cdf0e10cSrcweir return pPrinter; 1108*cdf0e10cSrcweir } 1109*cdf0e10cSrcweir 1110*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir void Os2SalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir delete pPrinter; 1115*cdf0e10cSrcweir } 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir // ======================================================================= 1118*cdf0e10cSrcweir 1119*cdf0e10cSrcweir Os2SalInfoPrinter::Os2SalInfoPrinter() 1120*cdf0e10cSrcweir { 1121*cdf0e10cSrcweir mhDC = 0; 1122*cdf0e10cSrcweir mhPS = 0; 1123*cdf0e10cSrcweir mpGraphics = NULL; 1124*cdf0e10cSrcweir mbGraphics = FALSE; 1125*cdf0e10cSrcweir mbDJPSupported = FALSE; 1126*cdf0e10cSrcweir mnFormCount = 0; 1127*cdf0e10cSrcweir mpFormArray = NULL; 1128*cdf0e10cSrcweir mnTrayCount = 0; 1129*cdf0e10cSrcweir mpTrayArray = NULL; 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir 1132*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1133*cdf0e10cSrcweir 1134*cdf0e10cSrcweir Os2SalInfoPrinter::~Os2SalInfoPrinter() 1135*cdf0e10cSrcweir { 1136*cdf0e10cSrcweir if ( mpGraphics ) 1137*cdf0e10cSrcweir { 1138*cdf0e10cSrcweir ImplSalDestroyInfoPrn( this ); 1139*cdf0e10cSrcweir delete mpGraphics; 1140*cdf0e10cSrcweir } 1141*cdf0e10cSrcweir 1142*cdf0e10cSrcweir ImplFreeFormAndTrayList( this ); 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir 1145*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir SalGraphics* Os2SalInfoPrinter::GetGraphics() 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir if ( mbGraphics ) 1150*cdf0e10cSrcweir return NULL; 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir if ( mpGraphics ) 1153*cdf0e10cSrcweir mbGraphics = TRUE; 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir return mpGraphics; 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1159*cdf0e10cSrcweir 1160*cdf0e10cSrcweir void Os2SalInfoPrinter::ReleaseGraphics( SalGraphics* ) 1161*cdf0e10cSrcweir { 1162*cdf0e10cSrcweir mbGraphics = FALSE; 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1166*cdf0e10cSrcweir 1167*cdf0e10cSrcweir BOOL Os2SalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) 1168*cdf0e10cSrcweir { 1169*cdf0e10cSrcweir PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); 1170*cdf0e10cSrcweir if ( !pDrivData ) 1171*cdf0e10cSrcweir return FALSE; 1172*cdf0e10cSrcweir 1173*cdf0e10cSrcweir APIRET rc = DevPostDeviceModes( GetSalData()->mhAB, pDrivData, 1174*cdf0e10cSrcweir maDriverName.GetBuffer(), 1175*cdf0e10cSrcweir maDeviceName.GetBuffer(), 1176*cdf0e10cSrcweir maPrinterName.GetBuffer(), 1177*cdf0e10cSrcweir DPDM_POSTJOBPROP ); 1178*cdf0e10cSrcweir if ( rc == DEV_OK ) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir ImplUpdateSetupData( pDrivData, pSetupData ); 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir // update DC and PS 1183*cdf0e10cSrcweir HDC hDC; 1184*cdf0e10cSrcweir HPS hPS; 1185*cdf0e10cSrcweir if ( !ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) 1186*cdf0e10cSrcweir return FALSE; 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir // Alten Printer DC/PS zerstoeren 1189*cdf0e10cSrcweir ImplSalDestroyInfoPrn( this ); 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir // Neue Daten setzen und initialisieren 1192*cdf0e10cSrcweir mhDC = hDC; 1193*cdf0e10cSrcweir mhPS = hPS; 1194*cdf0e10cSrcweir mpGraphics->mhDC = mhDC; 1195*cdf0e10cSrcweir mpGraphics->mhPS = mhPS; 1196*cdf0e10cSrcweir ImplSalInitGraphics( mpGraphics ); 1197*cdf0e10cSrcweir 1198*cdf0e10cSrcweir // retrieve current settings from printer driver and store them to system independend data! 1199*cdf0e10cSrcweir ImplFreeFormAndTrayList( this ); 1200*cdf0e10cSrcweir if ( mbDJPSupported ) 1201*cdf0e10cSrcweir ImplGetCurrentSettings( this, pSetupData ); 1202*cdf0e10cSrcweir 1203*cdf0e10cSrcweir return TRUE; 1204*cdf0e10cSrcweir } 1205*cdf0e10cSrcweir else 1206*cdf0e10cSrcweir { 1207*cdf0e10cSrcweir ImplFreePrnMemory( pDrivData ); 1208*cdf0e10cSrcweir return FALSE; 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir } 1211*cdf0e10cSrcweir 1212*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1213*cdf0e10cSrcweir 1214*cdf0e10cSrcweir BOOL Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) 1215*cdf0e10cSrcweir { 1216*cdf0e10cSrcweir // Wir koennen nur Treiberdaten von OS2 setzen 1217*cdf0e10cSrcweir if ( pSetupData->mnSystem != JOBSETUP_SYSTEM_OS2 ) 1218*cdf0e10cSrcweir return FALSE; 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir PDRIVDATA pNewDrivData = (PDRIVDATA)(pSetupData->mpDriverData); 1221*cdf0e10cSrcweir if ( !pNewDrivData ) 1222*cdf0e10cSrcweir return FALSE; 1223*cdf0e10cSrcweir 1224*cdf0e10cSrcweir // Testen, ob Printerdaten fuer den gleichen Printer uebergeben werden, 1225*cdf0e10cSrcweir // da einige Treiber zu Abstuerzen neigen, wenn Daten von einem anderen 1226*cdf0e10cSrcweir // Printer gesetzt werden 1227*cdf0e10cSrcweir if ( !maJobSetupDeviceName.Equals( pNewDrivData->szDeviceName )) 1228*cdf0e10cSrcweir return FALSE; 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir // update DC and PS 1231*cdf0e10cSrcweir HDC hDC; 1232*cdf0e10cSrcweir HPS hPS; 1233*cdf0e10cSrcweir if ( !ImplSalCreateInfoPrn( this, pNewDrivData, hDC, hPS ) ) 1234*cdf0e10cSrcweir return FALSE; 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir // Alten Printer DC/PS zerstoeren 1237*cdf0e10cSrcweir ImplSalDestroyInfoPrn( this ); 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir // Neue Daten setzen und initialisieren 1240*cdf0e10cSrcweir mhDC = hDC; 1241*cdf0e10cSrcweir mhPS = hPS; 1242*cdf0e10cSrcweir mpGraphics->mhDC = mhDC; 1243*cdf0e10cSrcweir mpGraphics->mhPS = mhPS; 1244*cdf0e10cSrcweir ImplSalInitGraphics( mpGraphics ); 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir // retrieve current settings from printer driver and store them to system independend data! 1247*cdf0e10cSrcweir ImplFreeFormAndTrayList( this ); 1248*cdf0e10cSrcweir if ( mbDJPSupported ) 1249*cdf0e10cSrcweir ImplGetCurrentSettings( this, pSetupData ); 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir return TRUE; 1252*cdf0e10cSrcweir } 1253*cdf0e10cSrcweir 1254*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir BOOL Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) 1257*cdf0e10cSrcweir { 1258*cdf0e10cSrcweir // needs DJP support 1259*cdf0e10cSrcweir if ( !mbDJPSupported ) 1260*cdf0e10cSrcweir return FALSE; 1261*cdf0e10cSrcweir 1262*cdf0e10cSrcweir PDRIVDATA pDrivData = ImplPrnDrivData( pSetupData ); 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir if ( !pDrivData ) 1265*cdf0e10cSrcweir return FALSE; 1266*cdf0e10cSrcweir 1267*cdf0e10cSrcweir BOOL bOK = FALSE; 1268*cdf0e10cSrcweir 1269*cdf0e10cSrcweir // set orientation 1270*cdf0e10cSrcweir if ( nFlags & SAL_JOBSET_ORIENTATION ) 1271*cdf0e10cSrcweir { 1272*cdf0e10cSrcweir if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) ) 1273*cdf0e10cSrcweir bOK = TRUE; 1274*cdf0e10cSrcweir } 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir // set paper size 1277*cdf0e10cSrcweir if ( nFlags & SAL_JOBSET_PAPERSIZE ) 1278*cdf0e10cSrcweir { 1279*cdf0e10cSrcweir // Papierformat ermitteln 1280*cdf0e10cSrcweir DJPT_PAPERSIZE nOS2PaperFormat; 1281*cdf0e10cSrcweir switch ( pSetupData->mePaperFormat ) 1282*cdf0e10cSrcweir { 1283*cdf0e10cSrcweir case PAPER_A3: 1284*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_A3; 1285*cdf0e10cSrcweir break; 1286*cdf0e10cSrcweir 1287*cdf0e10cSrcweir case PAPER_A4: 1288*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_A4; 1289*cdf0e10cSrcweir break; 1290*cdf0e10cSrcweir 1291*cdf0e10cSrcweir case PAPER_A5: 1292*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_A5; 1293*cdf0e10cSrcweir break; 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir case PAPER_B4: 1296*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_B4; 1297*cdf0e10cSrcweir break; 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir case PAPER_B5: 1300*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_B5; 1301*cdf0e10cSrcweir break; 1302*cdf0e10cSrcweir 1303*cdf0e10cSrcweir case PAPER_LETTER: 1304*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_LETTER; 1305*cdf0e10cSrcweir break; 1306*cdf0e10cSrcweir 1307*cdf0e10cSrcweir case PAPER_LEGAL: 1308*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_LEGAL; 1309*cdf0e10cSrcweir break; 1310*cdf0e10cSrcweir 1311*cdf0e10cSrcweir case PAPER_TABLOID: 1312*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_TABLOID; 1313*cdf0e10cSrcweir break; 1314*cdf0e10cSrcweir 1315*cdf0e10cSrcweir default: 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir nOS2PaperFormat = DJP_PSI_NONE; 1318*cdf0e10cSrcweir // OS2 rechnet in Millimetern 1319*cdf0e10cSrcweir long nPaperWidth = pSetupData->mnPaperWidth / 100; 1320*cdf0e10cSrcweir long nPaperHeight = pSetupData->mnPaperHeight / 100; 1321*cdf0e10cSrcweir // Ansonsten ueber die Papiergroesse suchen 1322*cdf0e10cSrcweir for( int i = 0; i < mnFormCount; i++ ) 1323*cdf0e10cSrcweir { 1324*cdf0e10cSrcweir ImplFormInfo* pFormInfo = mpFormArray[i]; 1325*cdf0e10cSrcweir if ( ImplPaperSizeEqual( nPaperWidth, nPaperHeight, 1326*cdf0e10cSrcweir pFormInfo->mnPaperWidth, pFormInfo->mnPaperHeight ) ) 1327*cdf0e10cSrcweir { 1328*cdf0e10cSrcweir nOS2PaperFormat = pFormInfo->mnId; 1329*cdf0e10cSrcweir break; 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir } 1332*cdf0e10cSrcweir } 1333*cdf0e10cSrcweir break; 1334*cdf0e10cSrcweir } 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir if ( nOS2PaperFormat != DJP_PSI_NONE ) 1337*cdf0e10cSrcweir { 1338*cdf0e10cSrcweir if ( ImplSetPaperSize( mhDC, pDrivData, nOS2PaperFormat ) ) 1339*cdf0e10cSrcweir bOK = TRUE; 1340*cdf0e10cSrcweir } 1341*cdf0e10cSrcweir } 1342*cdf0e10cSrcweir 1343*cdf0e10cSrcweir // set paper tray 1344*cdf0e10cSrcweir if ( (nFlags & SAL_JOBSET_PAPERBIN) && (pSetupData->mnPaperBin < mnTrayCount) ) 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir if ( ImplSetPaperBin( mhDC, pDrivData, 1347*cdf0e10cSrcweir mpTrayArray[pSetupData->mnPaperBin] ) ) 1348*cdf0e10cSrcweir bOK = TRUE; 1349*cdf0e10cSrcweir } 1350*cdf0e10cSrcweir 1351*cdf0e10cSrcweir if ( bOK ) 1352*cdf0e10cSrcweir { 1353*cdf0e10cSrcweir ImplUpdateSetupData( pDrivData, pSetupData ); 1354*cdf0e10cSrcweir 1355*cdf0e10cSrcweir // query current driver settings 1356*cdf0e10cSrcweir ImplFreeFormAndTrayList( this ); 1357*cdf0e10cSrcweir if ( ImplGetCurrentSettings( this, pSetupData ) ) 1358*cdf0e10cSrcweir { 1359*cdf0e10cSrcweir // update DC and PS 1360*cdf0e10cSrcweir HDC hDC; 1361*cdf0e10cSrcweir HPS hPS; 1362*cdf0e10cSrcweir if ( ImplSalCreateInfoPrn( this, (PDRIVDATA)(pSetupData->mpDriverData), hDC, hPS ) ) 1363*cdf0e10cSrcweir { 1364*cdf0e10cSrcweir // Alten Printer DC/PS zerstoeren 1365*cdf0e10cSrcweir ImplSalDestroyInfoPrn( this ); 1366*cdf0e10cSrcweir 1367*cdf0e10cSrcweir // Neue Daten setzen und initialisieren 1368*cdf0e10cSrcweir mhDC = hDC; 1369*cdf0e10cSrcweir mhPS = hPS; 1370*cdf0e10cSrcweir mpGraphics->mhDC = mhDC; 1371*cdf0e10cSrcweir mpGraphics->mhPS = mhPS; 1372*cdf0e10cSrcweir ImplSalInitGraphics( mpGraphics ); 1373*cdf0e10cSrcweir } 1374*cdf0e10cSrcweir else 1375*cdf0e10cSrcweir bOK = FALSE; 1376*cdf0e10cSrcweir } 1377*cdf0e10cSrcweir else 1378*cdf0e10cSrcweir bOK = FALSE; 1379*cdf0e10cSrcweir } 1380*cdf0e10cSrcweir 1381*cdf0e10cSrcweir return bOK; 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir 1384*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir ULONG Os2SalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pJobSetup ) 1387*cdf0e10cSrcweir { 1388*cdf0e10cSrcweir if ( !mbDJPSupported ) 1389*cdf0e10cSrcweir return 1; 1390*cdf0e10cSrcweir 1391*cdf0e10cSrcweir // init paperbinlist if empty 1392*cdf0e10cSrcweir if ( !mnTrayCount ) 1393*cdf0e10cSrcweir ImplGetFormAndTrayList( this, pJobSetup ); 1394*cdf0e10cSrcweir 1395*cdf0e10cSrcweir // Wir haben immer einen PaperTray und wenn, das eben einen ohne 1396*cdf0e10cSrcweir // Namen 1397*cdf0e10cSrcweir if ( !mnTrayCount ) 1398*cdf0e10cSrcweir return 1; 1399*cdf0e10cSrcweir else 1400*cdf0e10cSrcweir return mnTrayCount; 1401*cdf0e10cSrcweir } 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1404*cdf0e10cSrcweir 1405*cdf0e10cSrcweir XubString Os2SalInfoPrinter::GetPaperBinName( const ImplJobSetup* pJobSetup, 1406*cdf0e10cSrcweir ULONG nPaperBin ) 1407*cdf0e10cSrcweir { 1408*cdf0e10cSrcweir XubString aPaperBinName; 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir if ( mbDJPSupported ) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir // init paperbinlist if empty 1413*cdf0e10cSrcweir if ( !mnTrayCount ) 1414*cdf0e10cSrcweir ImplGetFormAndTrayList( this, pJobSetup ); 1415*cdf0e10cSrcweir 1416*cdf0e10cSrcweir if ( nPaperBin < mnTrayCount ) 1417*cdf0e10cSrcweir aPaperBinName = ::rtl::OStringToOUString (mpTrayArray[nPaperBin]->maDisplayName, gsl_getSystemTextEncoding()); 1418*cdf0e10cSrcweir } 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir return aPaperBinName; 1421*cdf0e10cSrcweir } 1422*cdf0e10cSrcweir 1423*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1424*cdf0e10cSrcweir 1425*cdf0e10cSrcweir ULONG Os2SalInfoPrinter::GetCapabilities( const ImplJobSetup*, USHORT nType ) 1426*cdf0e10cSrcweir { 1427*cdf0e10cSrcweir switch ( nType ) 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir case PRINTER_CAPABILITIES_SUPPORTDIALOG: 1430*cdf0e10cSrcweir return TRUE; 1431*cdf0e10cSrcweir case PRINTER_CAPABILITIES_COPIES: 1432*cdf0e10cSrcweir return 0xFFFF; 1433*cdf0e10cSrcweir case PRINTER_CAPABILITIES_COLLATECOPIES: 1434*cdf0e10cSrcweir return 0; 1435*cdf0e10cSrcweir case PRINTER_CAPABILITIES_SETORIENTATION: 1436*cdf0e10cSrcweir case PRINTER_CAPABILITIES_SETPAPERBIN: 1437*cdf0e10cSrcweir case PRINTER_CAPABILITIES_SETPAPERSIZE: 1438*cdf0e10cSrcweir case PRINTER_CAPABILITIES_SETPAPER: 1439*cdf0e10cSrcweir return mbDJPSupported; 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir return 0; 1443*cdf0e10cSrcweir } 1444*cdf0e10cSrcweir 1445*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1446*cdf0e10cSrcweir 1447*cdf0e10cSrcweir void Os2SalInfoPrinter::GetPageInfo( const ImplJobSetup*, 1448*cdf0e10cSrcweir long& rOutWidth, long& rOutHeight, 1449*cdf0e10cSrcweir long& rPageOffX, long& rPageOffY, 1450*cdf0e10cSrcweir long& rPageWidth, long& rPageHeight ) 1451*cdf0e10cSrcweir { 1452*cdf0e10cSrcweir HDC hDC = mhDC; 1453*cdf0e10cSrcweir 1454*cdf0e10cSrcweir // search current form 1455*cdf0e10cSrcweir HCINFO aInfo; 1456*cdf0e10cSrcweir int nForms = DevQueryHardcopyCaps( hDC, 0, 0, &aInfo ); 1457*cdf0e10cSrcweir for( int i = 0; i < nForms; i++ ) 1458*cdf0e10cSrcweir { 1459*cdf0e10cSrcweir if ( DevQueryHardcopyCaps( hDC, i, 1, &aInfo ) >= 0 ) 1460*cdf0e10cSrcweir { 1461*cdf0e10cSrcweir if ( aInfo.flAttributes & HCAPS_CURRENT ) 1462*cdf0e10cSrcweir { 1463*cdf0e10cSrcweir // query resolution 1464*cdf0e10cSrcweir long nXResolution; 1465*cdf0e10cSrcweir long nYResolution; 1466*cdf0e10cSrcweir DevQueryCaps( hDC, CAPS_HORIZONTAL_RESOLUTION, 1, &nXResolution ); 1467*cdf0e10cSrcweir DevQueryCaps( hDC, CAPS_VERTICAL_RESOLUTION, 1, &nYResolution ); 1468*cdf0e10cSrcweir rPageOffX = aInfo.xLeftClip * nXResolution / 1000; 1469*cdf0e10cSrcweir rPageOffY = (aInfo.cy-aInfo.yTopClip) * nYResolution / 1000; 1470*cdf0e10cSrcweir rPageWidth = aInfo.cx * nXResolution / 1000; 1471*cdf0e10cSrcweir rPageHeight = aInfo.cy * nYResolution / 1000; 1472*cdf0e10cSrcweir rOutWidth = aInfo.xPels; 1473*cdf0e10cSrcweir rOutHeight = aInfo.yPels; 1474*cdf0e10cSrcweir return; 1475*cdf0e10cSrcweir } 1476*cdf0e10cSrcweir } 1477*cdf0e10cSrcweir } 1478*cdf0e10cSrcweir 1479*cdf0e10cSrcweir // use device caps if no form selected/found 1480*cdf0e10cSrcweir long lCapsWidth = 0; 1481*cdf0e10cSrcweir long lCapsHeight = 0; 1482*cdf0e10cSrcweir DevQueryCaps( hDC, CAPS_WIDTH, 1L, &lCapsWidth ); 1483*cdf0e10cSrcweir DevQueryCaps( hDC, CAPS_HEIGHT, 1L, &lCapsHeight ); 1484*cdf0e10cSrcweir rPageOffX = 0; 1485*cdf0e10cSrcweir rPageOffY = 0; 1486*cdf0e10cSrcweir rOutWidth = lCapsWidth; 1487*cdf0e10cSrcweir rOutHeight = lCapsHeight; 1488*cdf0e10cSrcweir rPageWidth = rOutWidth; 1489*cdf0e10cSrcweir rPageHeight = rOutHeight; 1490*cdf0e10cSrcweir } 1491*cdf0e10cSrcweir 1492*cdf0e10cSrcweir // ======================================================================= 1493*cdf0e10cSrcweir 1494*cdf0e10cSrcweir static BOOL ImplIsDriverPrintDJPEnabled( HDC hDC ) 1495*cdf0e10cSrcweir { 1496*cdf0e10cSrcweir #ifdef NO_DJP 1497*cdf0e10cSrcweir return FALSE; 1498*cdf0e10cSrcweir #else 1499*cdf0e10cSrcweir // Ueber OS2-Ini kann DJP disablte werden 1500*cdf0e10cSrcweir if ( !PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTDJP, 1 ) ) 1501*cdf0e10cSrcweir return FALSE; 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir // Testen, ob DJP-Interface am Drucker vorhanden 1504*cdf0e10cSrcweir LONG lQuery; 1505*cdf0e10cSrcweir APIRET rc; 1506*cdf0e10cSrcweir 1507*cdf0e10cSrcweir lQuery = DEVESC_QUERYSIZE; 1508*cdf0e10cSrcweir rc = DevEscape( hDC, 1509*cdf0e10cSrcweir DEVESC_QUERYESCSUPPORT, 1510*cdf0e10cSrcweir sizeof( lQuery ), 1511*cdf0e10cSrcweir (PBYTE)&lQuery, 1512*cdf0e10cSrcweir 0, 1513*cdf0e10cSrcweir (PBYTE)NULL ); 1514*cdf0e10cSrcweir if ( DEV_OK != rc ) 1515*cdf0e10cSrcweir return FALSE; 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir return TRUE; 1518*cdf0e10cSrcweir #endif 1519*cdf0e10cSrcweir } 1520*cdf0e10cSrcweir 1521*cdf0e10cSrcweir // ======================================================================= 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir SalPrinter* Os2SalInstance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) 1524*cdf0e10cSrcweir { 1525*cdf0e10cSrcweir Os2SalPrinter* pPrinter = new Os2SalPrinter; 1526*cdf0e10cSrcweir pPrinter->mpInfoPrinter = static_cast<Os2SalInfoPrinter*>(pInfoPrinter); 1527*cdf0e10cSrcweir return pPrinter; 1528*cdf0e10cSrcweir } 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1531*cdf0e10cSrcweir 1532*cdf0e10cSrcweir void Os2SalInstance::DestroyPrinter( SalPrinter* pPrinter ) 1533*cdf0e10cSrcweir { 1534*cdf0e10cSrcweir delete pPrinter; 1535*cdf0e10cSrcweir } 1536*cdf0e10cSrcweir 1537*cdf0e10cSrcweir // ======================================================================= 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir Os2SalPrinter::Os2SalPrinter() 1540*cdf0e10cSrcweir { 1541*cdf0e10cSrcweir mhDC = 0; 1542*cdf0e10cSrcweir mhPS = 0; 1543*cdf0e10cSrcweir mpGraphics = NULL; 1544*cdf0e10cSrcweir mbAbort = FALSE; 1545*cdf0e10cSrcweir mbPrintDJPSupported = FALSE; 1546*cdf0e10cSrcweir } 1547*cdf0e10cSrcweir 1548*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir Os2SalPrinter::~Os2SalPrinter() 1551*cdf0e10cSrcweir { 1552*cdf0e10cSrcweir } 1553*cdf0e10cSrcweir 1554*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1555*cdf0e10cSrcweir 1556*cdf0e10cSrcweir BOOL Os2SalPrinter::StartJob( const XubString* pFileName, 1557*cdf0e10cSrcweir const XubString& rJobName, 1558*cdf0e10cSrcweir const XubString& rAppName, 1559*cdf0e10cSrcweir ULONG nCopies, 1560*cdf0e10cSrcweir bool bCollate, 1561*cdf0e10cSrcweir bool bDirect, 1562*cdf0e10cSrcweir ImplJobSetup* pSetupData ) 1563*cdf0e10cSrcweir { 1564*cdf0e10cSrcweir DEVOPENSTRUC aDevOpenStruc; 1565*cdf0e10cSrcweir LONG lType; 1566*cdf0e10cSrcweir APIRET rc; 1567*cdf0e10cSrcweir 1568*cdf0e10cSrcweir // prepare queue information 1569*cdf0e10cSrcweir memset( &aDevOpenStruc, 0, sizeof( aDevOpenStruc ) ); 1570*cdf0e10cSrcweir aDevOpenStruc.pszDriverName = (PSZ)(mpInfoPrinter->maDriverName.GetBuffer()); 1571*cdf0e10cSrcweir 1572*cdf0e10cSrcweir // print into file? 1573*cdf0e10cSrcweir if ( pFileName ) 1574*cdf0e10cSrcweir { 1575*cdf0e10cSrcweir aDevOpenStruc.pszLogAddress = (PSZ)pFileName->GetBuffer(); 1576*cdf0e10cSrcweir aDevOpenStruc.pszDataType = "PM_Q_RAW"; 1577*cdf0e10cSrcweir lType = OD_DIRECT; 1578*cdf0e10cSrcweir } 1579*cdf0e10cSrcweir else 1580*cdf0e10cSrcweir { 1581*cdf0e10cSrcweir aDevOpenStruc.pszLogAddress = (PSZ)(mpInfoPrinter->maName.GetBuffer()); 1582*cdf0e10cSrcweir if ( PrfQueryProfileInt( HINI_PROFILE, SAL_PROFILE_APPNAME, SAL_PROFILE_PRINTRAW, 0 ) ) 1583*cdf0e10cSrcweir aDevOpenStruc.pszDataType = "PM_Q_RAW"; 1584*cdf0e10cSrcweir else 1585*cdf0e10cSrcweir aDevOpenStruc.pszDataType = "PM_Q_STD"; 1586*cdf0e10cSrcweir lType = OD_QUEUED; 1587*cdf0e10cSrcweir } 1588*cdf0e10cSrcweir 1589*cdf0e10cSrcweir #if 0 // YD FIXME 1590*cdf0e10cSrcweir // Set comment (AppName nur bis zum 1. Space-Zeichen nehmen) 1591*cdf0e10cSrcweir const xub_Unicode* pComment = rAppName; 1592*cdf0e10cSrcweir USHORT nCommentLen = 0; 1593*cdf0e10cSrcweir memset( maCommentBuf, 0, sizeof( maCommentBuf ) ); 1594*cdf0e10cSrcweir while ( (nCommentLen < 32) && 1595*cdf0e10cSrcweir (((*pComment >= 'a') && (*pComment <= 'z')) || 1596*cdf0e10cSrcweir ((*pComment >= 'A') && (*pComment <= 'Z')) || 1597*cdf0e10cSrcweir ((*pComment >= '0') && (*pComment <= '9')) || 1598*cdf0e10cSrcweir (*pComment == '-'))) 1599*cdf0e10cSrcweir { 1600*cdf0e10cSrcweir maCommentBuf[nCommentLen] = (char)(*pComment); 1601*cdf0e10cSrcweir nCommentLen++; 1602*cdf0e10cSrcweir pComment++; 1603*cdf0e10cSrcweir } 1604*cdf0e10cSrcweir aDevOpenStruc.pszComment = (PSZ)maCommentBuf; 1605*cdf0e10cSrcweir #endif 1606*cdf0e10cSrcweir ByteString jobName( rJobName, gsl_getSystemTextEncoding()); 1607*cdf0e10cSrcweir aDevOpenStruc.pszComment = (PSZ)jobName.GetBuffer(); 1608*cdf0e10cSrcweir 1609*cdf0e10cSrcweir // Kopien 1610*cdf0e10cSrcweir if ( nCopies > 1 ) 1611*cdf0e10cSrcweir { 1612*cdf0e10cSrcweir // OS2 kann maximal 999 Kopien 1613*cdf0e10cSrcweir if ( nCopies > 999 ) 1614*cdf0e10cSrcweir nCopies = 999; 1615*cdf0e10cSrcweir sprintf( maCopyBuf, "COP=%d", nCopies); 1616*cdf0e10cSrcweir aDevOpenStruc.pszQueueProcParams = (PSZ)maCopyBuf; 1617*cdf0e10cSrcweir } 1618*cdf0e10cSrcweir 1619*cdf0e10cSrcweir // open device context 1620*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 1621*cdf0e10cSrcweir HAB hAB = pSalData->mhAB; 1622*cdf0e10cSrcweir aDevOpenStruc.pdriv = (PDRIVDATA)pSetupData->mpDriverData; 1623*cdf0e10cSrcweir mhDC = DevOpenDC( hAB, 1624*cdf0e10cSrcweir lType, 1625*cdf0e10cSrcweir "*", 1626*cdf0e10cSrcweir 7, 1627*cdf0e10cSrcweir (PDEVOPENDATA)&aDevOpenStruc, 1628*cdf0e10cSrcweir 0 ); 1629*cdf0e10cSrcweir if ( mhDC == 0 ) 1630*cdf0e10cSrcweir { 1631*cdf0e10cSrcweir ERRORID nLastError = WinGetLastError( hAB ); 1632*cdf0e10cSrcweir if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) 1633*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_ABORT; 1634*cdf0e10cSrcweir else 1635*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_GENERALERROR; 1636*cdf0e10cSrcweir return FALSE; 1637*cdf0e10cSrcweir } 1638*cdf0e10cSrcweir 1639*cdf0e10cSrcweir // open presentation space 1640*cdf0e10cSrcweir SIZEL sizel; 1641*cdf0e10cSrcweir sizel.cx = 0; 1642*cdf0e10cSrcweir sizel.cy = 0; 1643*cdf0e10cSrcweir mhPS = Ft2CreatePS( hAB, mhDC, &sizel, GPIA_ASSOC | GPIT_MICRO | PU_PELS ); 1644*cdf0e10cSrcweir if ( !mhPS ) 1645*cdf0e10cSrcweir { 1646*cdf0e10cSrcweir DevCloseDC( mhDC ); 1647*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_GENERALERROR; 1648*cdf0e10cSrcweir return NULL; 1649*cdf0e10cSrcweir } 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir // Can we print with DJP 1652*cdf0e10cSrcweir mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC ); 1653*cdf0e10cSrcweir 1654*cdf0e10cSrcweir // JobName ermitteln und Job starten 1655*cdf0e10cSrcweir PSZ pszJobName = NULL; 1656*cdf0e10cSrcweir int nJobNameLen = 0; 1657*cdf0e10cSrcweir if ( jobName.Len() > 0 ) 1658*cdf0e10cSrcweir { 1659*cdf0e10cSrcweir pszJobName = (PSZ)jobName.GetBuffer(); 1660*cdf0e10cSrcweir nJobNameLen = jobName.Len(); 1661*cdf0e10cSrcweir } 1662*cdf0e10cSrcweir rc = DevEscape( mhDC, 1663*cdf0e10cSrcweir DEVESC_STARTDOC, 1664*cdf0e10cSrcweir nJobNameLen, (PBYTE)pszJobName, 1665*cdf0e10cSrcweir 0, (PBYTE)NULL ); 1666*cdf0e10cSrcweir 1667*cdf0e10cSrcweir if ( rc != DEV_OK ) 1668*cdf0e10cSrcweir { 1669*cdf0e10cSrcweir ERRORID nLastError = WinGetLastError( hAB ); 1670*cdf0e10cSrcweir if ( (nLastError & 0xFFFF) == PMERR_SPL_PRINT_ABORT ) 1671*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_ABORT; 1672*cdf0e10cSrcweir else 1673*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_GENERALERROR; 1674*cdf0e10cSrcweir Ft2Associate( mhPS, NULL ); 1675*cdf0e10cSrcweir Ft2DestroyPS( mhPS ); 1676*cdf0e10cSrcweir DevCloseDC( mhDC ); 1677*cdf0e10cSrcweir return FALSE; 1678*cdf0e10cSrcweir } 1679*cdf0e10cSrcweir 1680*cdf0e10cSrcweir // init for first page 1681*cdf0e10cSrcweir mbFirstPage = TRUE; 1682*cdf0e10cSrcweir mnError = 0; 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir return TRUE; 1685*cdf0e10cSrcweir } 1686*cdf0e10cSrcweir 1687*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1688*cdf0e10cSrcweir 1689*cdf0e10cSrcweir BOOL Os2SalPrinter::EndJob() 1690*cdf0e10cSrcweir { 1691*cdf0e10cSrcweir APIRET rc; 1692*cdf0e10cSrcweir rc = DevEscape( mhDC, 1693*cdf0e10cSrcweir DEVESC_ENDDOC, 1694*cdf0e10cSrcweir 0, NULL, 1695*cdf0e10cSrcweir 0, NULL); 1696*cdf0e10cSrcweir 1697*cdf0e10cSrcweir // destroy presentation space and device context 1698*cdf0e10cSrcweir Ft2Associate( mhPS, NULL ); 1699*cdf0e10cSrcweir Ft2DestroyPS( mhPS ); 1700*cdf0e10cSrcweir DevCloseDC( mhDC ); 1701*cdf0e10cSrcweir return TRUE; 1702*cdf0e10cSrcweir } 1703*cdf0e10cSrcweir 1704*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1705*cdf0e10cSrcweir 1706*cdf0e10cSrcweir BOOL Os2SalPrinter::AbortJob() 1707*cdf0e10cSrcweir { 1708*cdf0e10cSrcweir APIRET rc; 1709*cdf0e10cSrcweir 1710*cdf0e10cSrcweir rc = DevEscape( mhDC, 1711*cdf0e10cSrcweir DEVESC_ABORTDOC, 1712*cdf0e10cSrcweir 0, NULL, 1713*cdf0e10cSrcweir 0, NULL ); 1714*cdf0e10cSrcweir 1715*cdf0e10cSrcweir // destroy SalGraphics 1716*cdf0e10cSrcweir if ( mpGraphics ) 1717*cdf0e10cSrcweir { 1718*cdf0e10cSrcweir ImplSalDeInitGraphics( mpGraphics ); 1719*cdf0e10cSrcweir delete mpGraphics; 1720*cdf0e10cSrcweir mpGraphics = NULL; 1721*cdf0e10cSrcweir } 1722*cdf0e10cSrcweir 1723*cdf0e10cSrcweir // destroy presentation space and device context 1724*cdf0e10cSrcweir Ft2Associate( mhPS, NULL ); 1725*cdf0e10cSrcweir Ft2DestroyPS( mhPS ); 1726*cdf0e10cSrcweir DevCloseDC( mhDC ); 1727*cdf0e10cSrcweir return TRUE; 1728*cdf0e10cSrcweir } 1729*cdf0e10cSrcweir 1730*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1731*cdf0e10cSrcweir 1732*cdf0e10cSrcweir SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, BOOL bNewJobSetup ) 1733*cdf0e10cSrcweir { 1734*cdf0e10cSrcweir APIRET rc; 1735*cdf0e10cSrcweir 1736*cdf0e10cSrcweir if ( mbFirstPage ) 1737*cdf0e10cSrcweir mbFirstPage = FALSE; 1738*cdf0e10cSrcweir else 1739*cdf0e10cSrcweir { 1740*cdf0e10cSrcweir PBYTE pJobData; 1741*cdf0e10cSrcweir LONG nJobDataSize; 1742*cdf0e10cSrcweir LONG nEscape; 1743*cdf0e10cSrcweir if ( mbPrintDJPSupported && bNewJobSetup ) 1744*cdf0e10cSrcweir { 1745*cdf0e10cSrcweir nEscape = DEVESC_NEWFRAME_WPROP; 1746*cdf0e10cSrcweir nJobDataSize = ((PDRIVDATA)(pSetupData->mpDriverData))->cb; 1747*cdf0e10cSrcweir pJobData = (PBYTE)(pSetupData->mpDriverData); 1748*cdf0e10cSrcweir } 1749*cdf0e10cSrcweir else 1750*cdf0e10cSrcweir { 1751*cdf0e10cSrcweir nEscape = DEVESC_NEWFRAME; 1752*cdf0e10cSrcweir nJobDataSize = 0; 1753*cdf0e10cSrcweir pJobData = NULL; 1754*cdf0e10cSrcweir } 1755*cdf0e10cSrcweir rc = DevEscape( mhDC, 1756*cdf0e10cSrcweir nEscape, 1757*cdf0e10cSrcweir 0, NULL, 1758*cdf0e10cSrcweir &nJobDataSize, pJobData ); 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir if ( rc != DEV_OK ) 1761*cdf0e10cSrcweir { 1762*cdf0e10cSrcweir DevEscape( mhDC, DEVESC_ENDDOC, 0, NULL, 0, NULL); 1763*cdf0e10cSrcweir Ft2Associate( mhPS, NULL ); 1764*cdf0e10cSrcweir Ft2DestroyPS( mhPS ); 1765*cdf0e10cSrcweir DevCloseDC( mhDC ); 1766*cdf0e10cSrcweir mnError = SAL_PRINTER_ERROR_GENERALERROR; 1767*cdf0e10cSrcweir return NULL; 1768*cdf0e10cSrcweir } 1769*cdf0e10cSrcweir } 1770*cdf0e10cSrcweir 1771*cdf0e10cSrcweir // create SalGraphics with copy of hPS 1772*cdf0e10cSrcweir Os2SalGraphics* pGraphics = new Os2SalGraphics; 1773*cdf0e10cSrcweir pGraphics->mhDC = mhDC; 1774*cdf0e10cSrcweir pGraphics->mhPS = mhPS; 1775*cdf0e10cSrcweir pGraphics->mhWnd = 0; 1776*cdf0e10cSrcweir pGraphics->mbPrinter = TRUE; 1777*cdf0e10cSrcweir pGraphics->mbVirDev = FALSE; 1778*cdf0e10cSrcweir pGraphics->mbWindow = FALSE; 1779*cdf0e10cSrcweir pGraphics->mbScreen = FALSE; 1780*cdf0e10cSrcweir pGraphics->mnHeight = 0; 1781*cdf0e10cSrcweir // search current form for actual page height 1782*cdf0e10cSrcweir HCINFO aInfo; 1783*cdf0e10cSrcweir int nForms = DevQueryHardcopyCaps( mhDC, 0, 0, &aInfo ); 1784*cdf0e10cSrcweir for( int i = 0; i < nForms; i++ ) 1785*cdf0e10cSrcweir { 1786*cdf0e10cSrcweir if ( DevQueryHardcopyCaps( mhDC, i, 1, &aInfo ) >= 0 ) 1787*cdf0e10cSrcweir { 1788*cdf0e10cSrcweir if ( aInfo.flAttributes & HCAPS_CURRENT ) 1789*cdf0e10cSrcweir pGraphics->mnHeight = aInfo.yPels; 1790*cdf0e10cSrcweir } 1791*cdf0e10cSrcweir } 1792*cdf0e10cSrcweir // use device caps if no form selected/found 1793*cdf0e10cSrcweir if ( !pGraphics->mnHeight ) 1794*cdf0e10cSrcweir DevQueryCaps( mhDC, CAPS_HEIGHT, 1L, &pGraphics->mnHeight ); 1795*cdf0e10cSrcweir 1796*cdf0e10cSrcweir ImplSalInitGraphics( pGraphics ); 1797*cdf0e10cSrcweir mpGraphics = pGraphics; 1798*cdf0e10cSrcweir 1799*cdf0e10cSrcweir return pGraphics; 1800*cdf0e10cSrcweir } 1801*cdf0e10cSrcweir 1802*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1803*cdf0e10cSrcweir 1804*cdf0e10cSrcweir BOOL Os2SalPrinter::EndPage() 1805*cdf0e10cSrcweir { 1806*cdf0e10cSrcweir if ( mpGraphics ) 1807*cdf0e10cSrcweir { 1808*cdf0e10cSrcweir // destroy SalGraphics 1809*cdf0e10cSrcweir ImplSalDeInitGraphics( mpGraphics ); 1810*cdf0e10cSrcweir delete mpGraphics; 1811*cdf0e10cSrcweir mpGraphics = NULL; 1812*cdf0e10cSrcweir } 1813*cdf0e10cSrcweir 1814*cdf0e10cSrcweir return TRUE; 1815*cdf0e10cSrcweir } 1816*cdf0e10cSrcweir 1817*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1818*cdf0e10cSrcweir 1819*cdf0e10cSrcweir ULONG Os2SalPrinter::GetErrorCode() 1820*cdf0e10cSrcweir { 1821*cdf0e10cSrcweir return mnError; 1822*cdf0e10cSrcweir } 1823*cdf0e10cSrcweir 1824*cdf0e10cSrcweir void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData ) 1825*cdf0e10cSrcweir { 1826*cdf0e10cSrcweir printf("Os2SalInfoPrinter::InitPaperFormats\n"); 1827*cdf0e10cSrcweir } 1828*cdf0e10cSrcweir int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData ) 1829*cdf0e10cSrcweir { 1830*cdf0e10cSrcweir printf("Os2SalInfoPrinter::GetLandscapeAngle\n"); 1831*cdf0e10cSrcweir return 0; 1832*cdf0e10cSrcweir } 1833*cdf0e10cSrcweir 1834