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