home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mavcl130.zip / MAVPRINT.HPP < prev    next >
Text File  |  1996-05-07  |  4KB  |  114 lines

  1. /*  File: MAVPRINT.HPP      Updated: Tue Aug 15 15:55:22 1995
  2. Copyright (c) Fabrizio Aversa
  3. ===========================================================*/
  4. #ifndef _MAVPRINT_HPP
  5. #define _MAVPRINT_HPP
  6.  
  7.  
  8. // Defines for resource compiler for setup.
  9. #define ID_PICKQ            22000
  10. #define IDC_LISTBOX         22001
  11. #define IDC_JOBPROP         22002
  12. #define IDC_ENTRY           22003
  13. #define IDC_TOFILE          22004
  14. #define ID_PICKQ_IT            22005
  15.  
  16. typedef struct _PRINTERSETUP {
  17.  
  18.    // INPUT PARAMETERS: assign these before calling SetupPrinter()
  19.    LONG           lWorldCoordinates; // PU_TWIPS or whatever
  20.    HAB            hab;               // application's anchor block
  21.  
  22.    // PROFILED PARAMETERS: store these two items on app close.
  23.    // Retrieve them on app open.
  24.    // Note pDriverData->cb is length of DRIVDATA structure.
  25.    CHAR           szPreferredQueue[ 64 ];  // name of user's preferred queue
  26.    PDRIVDATA      pDriverData;             // driver's data
  27.  
  28.    // OUTPUT PARAMETERS: for use by SetupPrinter() and the application
  29.    HDC            hdcPrinterInfo;    // printer info DC
  30.    HPS            hpsPrinterInfo;    // printer info PS
  31.    LONG           lDCType;           // DC type suitable for DevOpenDC() param 2
  32.    PDEVOPENDATA   pDevOpenData;      // suitable for DevOpenDC() parameter 5
  33.    DEVOPENSTRUC   devopenstruc;      // pdevopendata points to this.
  34.    LONG           cQueues;           // count of queues in PRQINFO3 array
  35.    PPRQINFO3      pQueueInfo;        // pointer to array of PRQINFO3
  36.    BOOL           fToFile;           // printing to file case
  37.    CHAR           szFileName[ CCHMAXPATH ];  // file name for print-to-file
  38.  
  39. } PRINTERSETUP;
  40. typedef PRINTERSETUP *PPRINTERSETUP;
  41.  
  42. class _Export MavPrint
  43. {
  44.  
  45.    private:
  46.  
  47.    PPRINTERSETUP pSetup;
  48.    FONTMETRICS fm; /* actual font metrics */
  49.    HDC hdc;
  50.    HPS hps;
  51.    LONG lLcIdCount; /* number of log fonts created during this hps life */
  52.    RECTL rctMargins;
  53.    SIZEL sizMarginedPage, sizPage, sizHeader, sizFooter;
  54.    USHORT * usFontSize;
  55.  
  56.    PPRQINFO3 FindQueue( PPRINTERSETUP );
  57.    char pszQueueProcParams[15];
  58.  
  59.    public:
  60.  
  61. HDC getHDC() { return hdc; }
  62. HPS getHPS() { return hps; }
  63. void setHAB(HAB h1) {pSetup->hab = h1;}
  64. void setWorldCoords(LONG l1) {pSetup->lWorldCoordinates = l1;}
  65. RECTL * getMargins() {return &rctMargins;}
  66. SIZEL * getMarginedPageSize() {return & sizMarginedPage;}
  67. SIZEL * getPageSize() {return & sizPage;}
  68. SIZEL * getHeaderSize() {return & sizHeader;}
  69. SIZEL * getFooterSize() {return & sizFooter;}
  70. PDEVOPENDATA getDevOpenData() {return pSetup->pDevOpenData;}
  71. PDRIVDATA getDrivData() {return pSetup->pDriverData;}
  72. FONTMETRICS * getPFM() {return & fm;}
  73.  
  74.    /*     setupPrinter       fills the PRINTERSETUP structure with relevant data.
  75.    call with empty pszUserQueueName if you want the default queue
  76.    call with pszUserQueueName if you want ta specific queue you know in advance, in
  77.    this case you can also use pszUserPrintFileName.
  78.    call with a valid owner if you want the print queue dialog to be shown.
  79.    returns TRUE if ok, otherwise FALSE.
  80.    Always call with PSZs allocated for the maximum queue name length, they will
  81.    be filled on successfull completion with queue/file names. */
  82.    Boolean setupPrinter(PSZ, PSZ, IWindow * = NULL, int = 1 );
  83.    Boolean setupPrinter(IWindow * = NULL, int = 1 );
  84.  
  85.    void cleanupPrinter( );
  86.    Boolean openPrinterJob(PSZ);
  87.    void closePrinterJob();
  88.    void abortPrinterJob();
  89.    Boolean newPage();
  90.    Boolean setMargins(LONG, LONG, LONG, LONG);
  91.  
  92.    Boolean printTextInBox(PRECTL, PSZ, LONG &, USHORT = 1, LONG = 0, LONG = 0);
  93.    Boolean printTextInBox(PRECTL, IString &, LONG &, USHORT = 1, LONG = 0, LONG = 0);
  94.  
  95.    Boolean printStringAt(PPOINTL, PSZ, LONG = 0);
  96.    Boolean printStringAt(PPOINTL, IString &, LONG = 0);
  97.  
  98.    PPOINTL coordsInHeader(PPOINTL, PPOINTL);
  99.    PPOINTL coordsInFooter(PPOINTL, PPOINTL);
  100.    PPOINTL coordsInMargins(PPOINTL, PPOINTL);
  101.    PRECTL rectlInMargins(PRECTL, PRECTL);
  102.  
  103.    LONG createFontMatching(PSZ, LONG, ULONG = 0, PBOOL = NULL, PSIZEF = NULL);
  104.    Boolean selectLogFont(LONG, PSIZEF = NULL);
  105.  
  106.    Boolean printBitmapInBox(RECTL *, PSZ, Boolean);
  107.  
  108.    MavPrint();
  109.    ~MavPrint();
  110.  
  111. };
  112.  
  113. #endif
  114.