Eneboo - Documentación para desarrolladores
src/qt/include/qprinter.h
Ir a la documentación de este archivo.
00001 /**********************************************************************
00002 ** $Id: qt/qprinter.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QPrinter class
00005 **
00006 ** Created : 940927
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QPRINTER_H
00039 #define QPRINTER_H
00040 
00041 #ifndef QT_H
00042 #include "qpaintdevice.h"
00043 #include "qstring.h"
00044 #include "qstringlist.h"
00045 #endif // QT_H
00046 
00047 #ifndef QT_NO_PRINTER
00048 
00049 #if defined(B0)
00050 #undef B0 // Terminal hang-up.  We assume that you do not want that.
00051 #endif
00052 
00053 class QPrinterPrivate;
00054 
00055 class Q_EXPORT QPrinter : public QPaintDevice
00056 {
00057 public:
00058   enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution, Compatible };
00059 
00060   QPrinter(PrinterMode mode = ScreenResolution);
00061   ~QPrinter();
00062 
00063   enum Orientation { Portrait, Landscape };
00064 
00065   enum PageSize    { A4, B5, Letter, Legal, Executive,
00066                      A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
00067                      B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
00068                      DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom
00069                    };
00070 
00071   enum PageOrder   { FirstPageFirst, LastPageFirst };
00072 
00073   enum ColorMode   { GrayScale, Color };
00074 
00075   enum PaperSource { OnlyOne, Lower, Middle, Manual, Envelope,
00076                      EnvelopeManual, Auto, Tractor, SmallFormat,
00077                      LargeFormat, LargeCapacity, Cassette, FormSource
00078                    };
00079 
00080   enum PrintRange   { AllPages,
00081                       Selection,
00082                       PageRange
00083                     };
00084 
00085   enum PrinterOption { PrintToFile,
00086                        PrintSelection,
00087                        PrintPageRange
00088                      };
00089 
00090   QString printerName() const;
00091   virtual void setPrinterName(const QString &);
00092   bool outputToFile() const;
00093   virtual void setOutputToFile(bool);
00094   QString outputFileName()const;
00095   virtual void setOutputFileName(const QString &);
00096 
00097   QString printProgram() const;
00098   virtual void setPrintProgram(const QString &);
00099 
00100   QString printerSelectionOption() const;
00101   virtual void setPrinterSelectionOption(const QString &);
00102 
00103   QString docName() const;
00104   virtual void setDocName(const QString &);
00105   QString creator() const;
00106   virtual void setCreator(const QString &);
00107 
00108   Orientation orientation()   const;
00109   virtual void setOrientation(Orientation);
00110   PageSize pageSize()      const;
00111   virtual void setPageSize(PageSize);
00112 #ifdef Q_WS_WIN
00113   void setWinPageSize(short winPageSize);
00114   short winPageSize() const;
00115 #endif
00116 #ifdef Q_WS_MAC
00117   bool printSetup();
00118   bool pageSetup();
00119 #endif
00120   virtual void setPageOrder(PageOrder);
00121   PageOrder   pageOrder() const;
00122 
00123   void setResolution(int);
00124   int resolution() const;
00125 
00126   virtual void setColorMode(ColorMode);
00127   ColorMode   colorMode() const;
00128 
00129   virtual void        setFullPage(bool);
00130   bool                fullPage() const;
00131   QSize       margins()       const;
00132   void setMargins(uint top, uint left, uint bottom, uint right);
00133   void margins(uint *top, uint *left, uint *bottom, uint *right) const;
00134 
00135   int         fromPage()      const;
00136   int         toPage()        const;
00137   virtual void setFromTo(int fromPage, int toPage);
00138   int         minPage()       const;
00139   int         maxPage()       const;
00140   virtual void setMinMax(int minPage, int maxPage);
00141   int         numCopies()     const;
00142   virtual void setNumCopies(int);
00143 
00144   bool  collateCopiesEnabled() const;
00145   void  setCollateCopiesEnabled(bool);
00146 
00147   bool  collateCopies() const;
00148   void  setCollateCopies(bool);
00149 
00150   PrintRange  printRange() const;
00151   void  setPrintRange(PrintRange range);
00152 
00153   bool        newPage();
00154   bool        abort();
00155   bool        aborted()       const;
00156 
00157   bool        setup(QWidget *parent = 0);
00158 
00159   PaperSource paperSource()   const;
00160   virtual void setPaperSource(PaperSource);
00161 
00162   void setOptionEnabled(PrinterOption, bool enable);
00163   bool isOptionEnabled(PrinterOption);
00164 
00165 protected:
00166   bool        cmd(int, QPainter *, QPDevCmdParam *);
00167   int         metric(int) const;
00168 
00169 #if defined(Q_WS_WIN)
00170   virtual void        setActive();
00171   virtual void        setIdle();
00172 #endif
00173 
00174 private:
00175 #if defined(Q_WS_X11) || defined(Q_WS_QWS)
00176   QPaintDevice *pdrv;
00177   int         pid;
00178 #endif
00179 #if defined(Q_WS_MAC)
00180   friend class QPrinterPrivate;
00181   PMPageFormat pformat;
00182   PMPrintSettings psettings;
00183   PMPrintSession psession;
00184   bool prepare(PMPrintSettings *);
00185   bool prepare(PMPageFormat *);
00186   void interpret(PMPrintSettings *);
00187   void interpret(PMPageFormat *);
00188 #endif
00189 #if defined(Q_WS_WIN)
00190   void        readPdlg(void *);
00191   void        readPdlgA(void *);
00192   void  writeDevmode(Qt::HANDLE);
00193   void  writeDevmodeA(Qt::HANDLE);
00194   void  reinit();
00195 
00196   bool        viewOffsetDone;
00197   QPainter   *painter;
00198   Qt::HANDLE hdevmode;
00199   Qt::HANDLE hdevnames;
00200 #endif
00201 
00202   int         state;
00203   QString     printer_name;
00204   QString     option_string;
00205   QString     output_filename;
00206   bool        output_file;
00207   QString     print_prog;
00208   QString     doc_name;
00209   QString     creator_name;
00210 
00211   PageSize    page_size;
00212   PaperSource paper_source;
00213   PageOrder   page_order;
00214   ColorMode   color_mode;
00215   Orientation orient;
00216   uint  to_edge : 1;
00217   uint  appcolcopies : 1;
00218   uint  usercolcopies : 1;
00219   uint  res_set : 1;
00220   short       from_pg, to_pg;
00221   short       min_pg,  max_pg;
00222   short       ncopies;
00223   int         res;
00224   QPrinterPrivate *d;
00225 
00226   // ### AbanQ
00227   QSize customPaperSize_;
00228 public:
00229   void setCustomPaperSize(const QSize &s) {
00230     customPaperSize_ = s;
00231   }
00232   QSize customPaperSize() const {
00233     return customPaperSize_;
00234   }
00235   // ### AbanQ
00236 
00237 private:        // Disabled copy constructor and operator=
00238 #if defined(Q_DISABLE_COPY)
00239   QPrinter(const QPrinter &);
00240   QPrinter &operator=(const QPrinter &);
00241 #endif
00242 };
00243 
00244 
00245 inline QString QPrinter::printerName() const
00246 {
00247   return printer_name;
00248 }
00249 
00250 inline bool QPrinter::outputToFile() const
00251 {
00252   return output_file;
00253 }
00254 
00255 inline QString QPrinter::outputFileName() const
00256 {
00257   return output_filename;
00258 }
00259 
00260 inline QString QPrinter::printProgram() const
00261 {
00262   return print_prog;
00263 }
00264 
00265 inline QString QPrinter::docName() const
00266 {
00267   return doc_name;
00268 }
00269 
00270 inline QString QPrinter::creator() const
00271 {
00272   return creator_name;
00273 }
00274 
00275 inline QPrinter::PageSize QPrinter::pageSize() const
00276 {
00277   return page_size;
00278 }
00279 
00280 inline QPrinter::Orientation QPrinter::orientation() const
00281 {
00282   return orient;
00283 }
00284 
00285 inline int QPrinter::fromPage() const
00286 {
00287   return from_pg;
00288 }
00289 
00290 inline int QPrinter::toPage() const
00291 {
00292   return to_pg;
00293 }
00294 
00295 inline int QPrinter::minPage() const
00296 {
00297   return min_pg;
00298 }
00299 
00300 inline int QPrinter::maxPage() const
00301 {
00302   return max_pg;
00303 }
00304 
00305 inline int QPrinter::numCopies() const
00306 {
00307   return ncopies;
00308 }
00309 
00310 inline bool QPrinter::collateCopiesEnabled() const
00311 {
00312   return appcolcopies;
00313 }
00314 
00315 inline void QPrinter::setCollateCopiesEnabled(bool v)
00316 {
00317   appcolcopies = v;
00318 }
00319 
00320 inline bool QPrinter::collateCopies() const
00321 {
00322   return usercolcopies;
00323 }
00324 
00325 
00326 #endif // QT_NO_PRINTER
00327 
00328 #endif // QPRINTER_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'