Qt 4.8
qprintengine_qws_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QPRINTENGINE_QWS_P_H
43 #define QPRINTENGINE_QWS_P_H
44 
45 //
46 // W A R N I N G
47 // -------------
48 //
49 // This file is not part of the Qt API. It exists for the convenience
50 // of other Qt classes. This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55 
56 #include "QtGui/qprinter.h"
57 
58 #ifndef QT_NO_PRINTER
59 
60 #include "QtGui/qprintengine.h"
61 #include "QtCore/qbytearray.h"
62 #include "private/qpaintengine_p.h"
63 
65 
67 class QRasterPaintEngine;
68 class QPrinterPrivate;
69 class QImage;
70 
72 {
74 public:
76 
77  // override QWSPaintEngine
78  bool begin(QPaintDevice *dev);
79  bool end();
80  void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
81  void drawTextItem(const QPointF &p, const QTextItem &ti);
83 
84  QPaintEngine *paintEngine() const;
85 
86  void updateState(const QPaintEngineState &state);
87 
88  QRect paperRect() const;
89  QRect pageRect() const;
90 
91  bool newPage();
92  bool abort();
93 
95 
96  int metric(QPaintDevice::PaintDeviceMetric metricType) const;
97 
99  void setProperty(PrintEnginePropertyKey key, const QVariant &value);
100 
101 private:
102  friend class QPrintDialog;
103  friend class QPageSetupDialog;
104 
105  void clearPage();
106  void flushPage();
107 };
108 
110 {
111 public:
112  QtopiaPrintBuffer( bool bigEndian=FALSE ) { _bigEndian = bigEndian; }
114 
115  const QByteArray& data() const { return _data; }
116 
117  int size() const { return _data.size(); }
118 
119  void clear() { _data.clear(); }
120 
121  void append( char value ) { _data.append( value ); }
122  void append( short value );
123  void append( int value );
124  void append( const QByteArray& array ) { _data.append( array ); }
125 
126  void patch( int posn, int value );
127 
128  void pad();
129 
130 private:
133 };
134 
135 #define QT_QWS_PRINTER_DEFAULT_DPI 200
136 
138 {
140 public:
142  mode(m),
143  printerState(QPrinter::Idle),
144  orientation(QPrinter::Portrait),
145  paperSize(QPrinter::A4),
146  pageOrder(QPrinter::FirstPageFirst),
147  colorMode(QPrinter::GrayScale),
148  paperSource(QPrinter::OnlyOne),
149  resolution(QT_QWS_PRINTER_DEFAULT_DPI),
150  _paintEngine(0),
151  numCopies(1),
152  outputToFile(false),
153  fullPage(false),
154  collateCopies(false),
155  pageNumber(0),
156  pageImage(0),
157  partialByte(0),
158  partialBits(0)
159  {
160  }
162 
163  void initialize();
165 
167 
173 
175 
181 
185 
187  bool fullPage;
189 
191 
193 
195 
196  // Definitions that are only relevant to G3FAX output.
197  int ifdPatch;
200  void writeG3FaxHeader();
201  void writeG3FaxPage();
202  int writeG3IFDEntry( int tag, int type, int count, int value );
203  void writeG3Code( int code, int bits );
204  void writeG3WhiteRun( int len );
205  void writeG3BlackRun( int len );
206  void writeG3EOL();
207 };
208 
210 
211 #endif // QT_NO_PRINTER
212 
213 #endif // QPRINTENGINE_QWS_P_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QRect paperRect() const
#define QT_QWS_PRINTER_DEFAULT_DPI
QPrinter::PaperSize paperSize
void append(const QByteArray &array)
void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
PaperSize paperSize(QPrinter::PaperSize paperSize)
Definition: qpdf.cpp:905
QPrinter::Orientation orientation
PrinterState
Definition: qprinter.h:119
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QPrinter::PrinterState printerState() const
Returns the current state of the printer being used by the print engine.
QPrinter::PaperSource paperSource
QPaintEngineState * state
Definition: qpaintengine.h:239
PrinterMode
This enum describes the mode the printer should work in.
Definition: qprinter.h:70
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
Orientation
This enum type (not to be confused with Orientation) is used to specify each page's orientation...
Definition: qprinter.h:78
bool end()
Reimplement this function to finish painting on the current paint device.
The QString class provides a Unicode character string.
Definition: qstring.h:83
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
QPaintEngine * paintEngine() const
QRect pageRect() const
The QPrintDialog class provides a dialog for specifying the printer's configuration.
Definition: qprintdialog.h:81
QtopiaPrintEngine(QPrinter::PrinterMode mode)
The QPageSetupDialog class provides a configuration dialog for the page-related options on a printer...
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QPrintEngine class defines an interface for how QPrinter interacts with a given printing subsyste...
Definition: qprintengine.h:56
The QPrinter class is a paint device that paints on a printer.
Definition: qprinter.h:66
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define FALSE
Synonym for false.
Definition: qglobal.h:1019
bool newPage()
Instructs the print engine to start a new page.
bool begin(QPaintDevice *dev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void append(char value)
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
QtopiaPrintBuffer(bool bigEndian=FALSE)
const QByteArray & data() const
QPrinter::ColorMode colorMode
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
QtopiaPrintEnginePrivate(QPrinter::PrinterMode m)
void drawTextItem(const QPointF &p, const QTextItem &ti)
This function draws the text item textItem at position p.
bool abort()
Instructs the print engine to abort the printing process.
QPrinter::PrinterMode mode
PaperSize
This enum type specifies what paper size QPrinter should use.
Definition: qprinter.h:91
int key
ColorMode
This enum type is used to indicate whether QPrinter should print in color or not. ...
Definition: qprinter.h:100
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
PageOrder
This enum type is used by QPrinter to tell the application program how to print.
Definition: qprinter.h:97
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
The QPaintEngineState class provides information about the active paint engine's current state...
Definition: qpaintengine.h:289
QPrinter::PrinterState printerState
QPaintEngine::Type type() const
Reimplement this function to return the paint engine Type.
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
QVariant property(PrintEnginePropertyKey key) const
Returns the print engine's property specified by key.
QPrinter::PageOrder pageOrder
void setProperty(PrintEnginePropertyKey key, const QVariant &value)
Sets the print engine's property specified by key to the given value.
int metric(QPaintDevice::PaintDeviceMetric metricType) const
Returns the metric for the given id.
PaperSource
This enum type specifies what paper source QPrinter is to use.
Definition: qprinter.h:103
PrintEnginePropertyKey
This enum is used to communicate properties between the print engine and QPrinter.
Definition: qprintengine.h:60