Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtPrintSupport/qprinter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QPRINTER_H
0005 #define QPRINTER_H
0006 
0007 #include <QtPrintSupport/qtprintsupportglobal.h>
0008 #include <QtCore/qstring.h>
0009 #include <QtCore/qscopedpointer.h>
0010 #include <QtGui/qpagedpaintdevice.h>
0011 
0012 QT_BEGIN_NAMESPACE
0013 
0014 
0015 #ifndef QT_NO_PRINTER
0016 
0017 #if defined(B0)
0018 #undef B0 // Terminal hang-up.  We assume that you do not want that.
0019 #endif
0020 
0021 class QPrinterPrivate;
0022 class QPaintEngine;
0023 class QPrintEngine;
0024 class QPrinterInfo;
0025 class QPageSize;
0026 
0027 class Q_PRINTSUPPORT_EXPORT QPrinter : public QPagedPaintDevice
0028 {
0029     Q_DECLARE_PRIVATE(QPrinter)
0030 public:
0031     enum PrinterMode { ScreenResolution, PrinterResolution, HighResolution };
0032 
0033     explicit QPrinter(PrinterMode mode = ScreenResolution);
0034     explicit QPrinter(const QPrinterInfo& printer, PrinterMode mode = ScreenResolution);
0035     ~QPrinter();
0036 
0037     int devType() const override;
0038 
0039     enum PageOrder   { FirstPageFirst,
0040                        LastPageFirst };
0041 
0042     enum ColorMode   { GrayScale,
0043                        Color };
0044 
0045     enum PaperSource { OnlyOne,
0046                        Lower,
0047                        Middle,
0048                        Manual,
0049                        Envelope,
0050                        EnvelopeManual,
0051                        Auto,
0052                        Tractor,
0053                        SmallFormat,
0054                        LargeFormat,
0055                        LargeCapacity,
0056                        Cassette,
0057                        FormSource,
0058                        MaxPageSource, // Deprecated
0059                        CustomSource,
0060                        LastPaperSource = CustomSource,
0061                        Upper = OnlyOne  // As defined in Windows
0062     };
0063 
0064     enum PrinterState { Idle,
0065                         Active,
0066                         Aborted,
0067                         Error };
0068 
0069     enum OutputFormat { NativeFormat, PdfFormat };
0070 
0071     // Keep in sync with QAbstractPrintDialog::PrintRange
0072     enum PrintRange { AllPages, Selection, PageRange, CurrentPage };
0073 
0074     enum Unit {
0075         Millimeter,
0076         Point,
0077         Inch,
0078         Pica,
0079         Didot,
0080         Cicero,
0081         DevicePixel
0082     };
0083 
0084     enum DuplexMode {
0085         DuplexNone = 0,
0086         DuplexAuto,
0087         DuplexLongSide,
0088         DuplexShortSide
0089     };
0090 
0091     void setOutputFormat(OutputFormat format);
0092     OutputFormat outputFormat() const;
0093 
0094     void setPdfVersion(PdfVersion version);
0095     PdfVersion pdfVersion() const;
0096 
0097     void setPrinterName(const QString &);
0098     QString printerName() const;
0099 
0100     bool isValid() const;
0101 
0102     void setOutputFileName(const QString &);
0103     QString outputFileName()const;
0104 
0105     void setPrintProgram(const QString &);
0106     QString printProgram() const;
0107 
0108     void setDocName(const QString &);
0109     QString docName() const;
0110 
0111     void setCreator(const QString &);
0112     QString creator() const;
0113 
0114     void setPageOrder(PageOrder);
0115     PageOrder pageOrder() const;
0116 
0117     void setResolution(int);
0118     int resolution() const;
0119 
0120     void setColorMode(ColorMode);
0121     ColorMode colorMode() const;
0122 
0123     void setCollateCopies(bool collate);
0124     bool collateCopies() const;
0125 
0126     void setFullPage(bool);
0127     bool fullPage() const;
0128 
0129     void setCopyCount(int);
0130     int copyCount() const;
0131     bool supportsMultipleCopies() const;
0132 
0133     void setPaperSource(PaperSource);
0134     PaperSource paperSource() const;
0135 
0136     void setDuplex(DuplexMode duplex);
0137     DuplexMode duplex() const;
0138 
0139     QList<int> supportedResolutions() const;
0140 
0141 #if defined(Q_OS_WIN) || defined(Q_QDOC)
0142     QList<PaperSource> supportedPaperSources() const;
0143 #endif
0144 
0145     void setFontEmbeddingEnabled(bool enable);
0146     bool fontEmbeddingEnabled() const;
0147 
0148     QRectF paperRect(Unit) const;
0149     QRectF pageRect(Unit) const;
0150 
0151     QString printerSelectionOption() const;
0152     void setPrinterSelectionOption(const QString &);
0153 
0154     bool newPage() override;
0155     bool abort();
0156 
0157     PrinterState printerState() const;
0158 
0159     QPaintEngine *paintEngine() const override;
0160     QPrintEngine *printEngine() const;
0161 
0162     void setFromTo(int fromPage, int toPage);
0163     int fromPage() const;
0164     int toPage() const;
0165 
0166     void setPrintRange(PrintRange range);
0167     PrintRange printRange() const;
0168 
0169 protected:
0170     int metric(PaintDeviceMetric) const override;
0171     void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
0172 
0173 private:
0174     Q_DISABLE_COPY(QPrinter)
0175 
0176     QScopedPointer<QPrinterPrivate> d_ptr;
0177 
0178     friend class QPrintDialogPrivate;
0179     friend class QAbstractPrintDialog;
0180     friend class QAbstractPrintDialogPrivate;
0181     friend class QPrintPreviewWidgetPrivate;
0182     friend class QTextDocument;
0183     friend class QPageSetupWidget;
0184 };
0185 
0186 #endif // QT_NO_PRINTER
0187 
0188 QT_END_NAMESPACE
0189 
0190 #endif // QPRINTER_H