home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qprinter.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  7KB  |  261 lines

  1. /**********************************************************************
  2. ** $Id:  qt/qprinter.h   3.0.0   edited Oct 6 22:28 $
  3. **
  4. ** Definition of QPrinter class
  5. **
  6. ** Created : 940927
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the kernel module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QPRINTER_H
  39. #define QPRINTER_H
  40.  
  41. #ifndef QT_H
  42. #include "qpaintdevice.h"
  43. #include "qstring.h"
  44. #endif // QT_H
  45.  
  46. #ifndef QT_NO_PRINTER
  47.  
  48. #ifdef Q_WS_WIN
  49. #include "qt_windows.h"
  50. #endif
  51.  
  52. #if defined(B0)
  53. #undef B0 // Terminal hang-up.  We assume that you do not want that.
  54. #endif
  55.  
  56. class QPrinterPrivate;
  57.  
  58. class Q_EXPORT QPrinter : public QPaintDevice
  59. {
  60. public:
  61.     enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution, Compatible };
  62.  
  63.     QPrinter( PrinterMode mode = ScreenResolution );
  64.    ~QPrinter();
  65.  
  66.     enum Orientation { Portrait, Landscape };
  67.  
  68.     enum PageSize    { A4, B5, Letter, Legal, Executive,
  69.                A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
  70.                B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
  71.                DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom };
  72.  
  73.     enum PageOrder   { FirstPageFirst, LastPageFirst };
  74.  
  75.     enum ColorMode   { GrayScale, Color };
  76.  
  77.     enum PaperSource { OnlyOne, Lower, Middle, Manual, Envelope,
  78.                        EnvelopeManual, Auto, Tractor, SmallFormat,
  79.                        LargeFormat, LargeCapacity, Cassette, FormSource };
  80.  
  81.     QString printerName() const;
  82.     virtual void setPrinterName( const QString &);
  83.     bool outputToFile() const;
  84.     virtual void setOutputToFile( bool );
  85.     QString outputFileName()const;
  86.     virtual void setOutputFileName( const QString &);
  87.  
  88.     QString printProgram() const;
  89.     virtual void setPrintProgram( const QString &);
  90.  
  91.     QString printerSelectionOption() const;
  92.     virtual void setPrinterSelectionOption( const QString & );
  93.  
  94.     QString docName() const;
  95.     virtual void setDocName( const QString &);
  96.     QString creator() const;
  97.     virtual void setCreator( const QString &);
  98.  
  99.     Orientation orientation()   const;
  100.     virtual void setOrientation( Orientation );
  101.     PageSize    pageSize()      const;
  102.     virtual void setPageSize( PageSize );
  103. #ifdef Q_WS_WIN
  104.     short winPageSize() const;
  105. #endif
  106.  
  107.     virtual void setPageOrder( PageOrder );
  108.     PageOrder   pageOrder() const;
  109.  
  110.     void setResolution( int );
  111.     int resolution() const;
  112.  
  113.     virtual void setColorMode( ColorMode );
  114.     ColorMode   colorMode() const;
  115.  
  116.     virtual void        setFullPage( bool );
  117.     bool                fullPage() const;
  118.     QSize       margins()       const;
  119.  
  120.     int         fromPage()      const;
  121.     int         toPage()        const;
  122.     virtual void setFromTo( int fromPage, int toPage );
  123.     int         minPage()       const;
  124.     int         maxPage()       const;
  125.     virtual void setMinMax( int minPage, int maxPage );
  126.     int         numCopies()     const;
  127.     virtual void setNumCopies( int );
  128.  
  129.     bool    collateCopiesEnabled() const;    
  130.     void    setCollateCopiesEnabled(bool );
  131.  
  132.     bool    collateCopies() const;
  133.     void    setCollateCopies(bool );
  134.  
  135.     bool        newPage();
  136.     bool        abort();
  137.     bool        aborted()       const;
  138.  
  139.     bool        setup( QWidget *parent = 0 );
  140.  
  141.     PaperSource paperSource()   const;
  142.     virtual void setPaperSource( PaperSource );
  143.  
  144. protected:
  145.     bool        cmd( int, QPainter *, QPDevCmdParam * );
  146.     int         metric( int ) const;
  147.  
  148. #if defined(Q_WS_WIN)
  149.     virtual void        setActive();
  150.     virtual void        setIdle();
  151. #endif
  152.  
  153. private:
  154. #if defined(Q_WS_X11) || defined(Q_WS_QWS)
  155.     QPaintDevice *pdrv;
  156.     int         pid;
  157. #endif
  158. #if defined(Q_WS_MAC)
  159.     PMPageFormat pformat;
  160.     PMPrintSettings psettings;
  161.     PMPrintSession psession;
  162.     bool prepare(PMPrintSettings *);
  163.     bool prepare(PMPageFormat *);
  164. #endif
  165. #if defined(Q_WS_WIN)
  166.     void        readPdlg( void* );
  167.     void        readPdlgA( void* );
  168.     void    writeDevmode( HANDLE );
  169.     void    writeDevmodeA( HANDLE );
  170.     void    reinit();
  171.  
  172.     bool        viewOffsetDone;
  173.     QPainter*   painter;
  174.     HANDLE hdevmode;
  175.     HANDLE hdevnames;
  176. #endif
  177.  
  178.     int         state;
  179.     QString     printer_name;
  180.     QString     option_string;
  181.     QString     output_filename;
  182.     bool        output_file;
  183.     QString     print_prog;
  184.     QString     doc_name;
  185.     QString     creator_name;
  186.  
  187.     PageSize    page_size;
  188.     PaperSource paper_source;
  189.     PageOrder   page_order;
  190.     ColorMode   color_mode;
  191.     Orientation orient;
  192.     uint    to_edge : 1;
  193.     uint    appcolcopies : 1;
  194.     uint    usercolcopies : 1;
  195.     short       from_pg, to_pg;
  196.     short       min_pg,  max_pg;
  197.     short       ncopies;
  198.     int         res;
  199.     QPrinterPrivate *d;
  200.  
  201. private:        // Disabled copy constructor and operator=
  202. #if defined(Q_DISABLE_COPY)
  203.     QPrinter( const QPrinter & );
  204.     QPrinter &operator=( const QPrinter & );
  205. #endif
  206. };
  207.  
  208.  
  209. inline QString QPrinter::printerName() const
  210. { return printer_name; }
  211.  
  212. inline bool QPrinter::outputToFile() const
  213. { return output_file; }
  214.  
  215. inline QString QPrinter::outputFileName() const
  216. { return output_filename; }
  217.  
  218. inline QString QPrinter::printProgram() const
  219. { return print_prog; }
  220.  
  221. inline QString QPrinter::docName() const
  222. { return doc_name; }
  223.  
  224. inline QString QPrinter::creator() const
  225. { return creator_name; }
  226.  
  227. inline QPrinter::PageSize QPrinter::pageSize() const
  228. { return page_size; }
  229.  
  230. inline QPrinter::Orientation QPrinter::orientation() const
  231. { return orient; }
  232.  
  233. inline int QPrinter::fromPage() const
  234. { return from_pg; }
  235.  
  236. inline int QPrinter::toPage() const
  237. { return to_pg; }
  238.  
  239. inline int QPrinter::minPage() const
  240. { return min_pg; }
  241.  
  242. inline int QPrinter::maxPage() const
  243. { return max_pg; }
  244.  
  245. inline int QPrinter::numCopies() const
  246. { return ncopies; }
  247.  
  248. inline bool QPrinter::collateCopiesEnabled() const
  249. { return appcolcopies; }
  250.  
  251. inline void QPrinter::setCollateCopiesEnabled(bool v)
  252. { appcolcopies = v; }
  253.  
  254. inline bool QPrinter::collateCopies() const
  255. { return usercolcopies; }
  256.  
  257.  
  258. #endif // QT_NO_PRINTER
  259.  
  260. #endif // QPRINTER_H
  261.