Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtGui/qpagesize.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) 2014 John Layt <jlayt@kde.org>
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 QPAGESIZE_H
0005 #define QPAGESIZE_H
0006 
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtCore/qsharedpointer.h>
0009 
0010 QT_BEGIN_NAMESPACE
0011 
0012 #if defined(B0)
0013 #undef B0 // Terminal hang-up.  We assume that you do not want that.
0014 #endif
0015 
0016 class QPageSizePrivate;
0017 class QString;
0018 class QSize;
0019 class QSizeF;
0020 
0021 class Q_GUI_EXPORT QPageSize
0022 {
0023 public:
0024 
0025     enum PageSizeId {
0026         // Old Qt sizes
0027         Letter,
0028         Legal,
0029         Executive,
0030         A0,
0031         A1,
0032         A2,
0033         A3,
0034         A4,
0035         A5,
0036         A6,
0037         A7,
0038         A8,
0039         A9,
0040         A10,
0041         B0,
0042         B1,
0043         B2,
0044         B3,
0045         B4,
0046         B5,
0047         B6,
0048         B7,
0049         B8,
0050         B9,
0051         B10,
0052         C5E,
0053         Comm10E,
0054         DLE,
0055         Folio,
0056         Ledger,
0057         Tabloid,
0058         Custom,
0059 
0060         // New values derived from PPD standard
0061         A3Extra,
0062         A4Extra,
0063         A4Plus,
0064         A4Small,
0065         A5Extra,
0066         B5Extra,
0067 
0068         JisB0,
0069         JisB1,
0070         JisB2,
0071         JisB3,
0072         JisB4,
0073         JisB5,
0074         JisB6,
0075         JisB7,
0076         JisB8,
0077         JisB9,
0078         JisB10,
0079 
0080         // AnsiA = Letter,
0081         // AnsiB = Ledger,
0082         AnsiC,
0083         AnsiD,
0084         AnsiE,
0085         LegalExtra,
0086         LetterExtra,
0087         LetterPlus,
0088         LetterSmall,
0089         TabloidExtra,
0090 
0091         ArchA,
0092         ArchB,
0093         ArchC,
0094         ArchD,
0095         ArchE,
0096 
0097         Imperial7x9,
0098         Imperial8x10,
0099         Imperial9x11,
0100         Imperial9x12,
0101         Imperial10x11,
0102         Imperial10x13,
0103         Imperial10x14,
0104         Imperial12x11,
0105         Imperial15x11,
0106 
0107         ExecutiveStandard,
0108         Note,
0109         Quarto,
0110         Statement,
0111         SuperA,
0112         SuperB,
0113         Postcard,
0114         DoublePostcard,
0115         Prc16K,
0116         Prc32K,
0117         Prc32KBig,
0118 
0119         FanFoldUS,
0120         FanFoldGerman,
0121         FanFoldGermanLegal,
0122 
0123         EnvelopeB4,
0124         EnvelopeB5,
0125         EnvelopeB6,
0126         EnvelopeC0,
0127         EnvelopeC1,
0128         EnvelopeC2,
0129         EnvelopeC3,
0130         EnvelopeC4,
0131         // EnvelopeC5 = C5E,
0132         EnvelopeC6,
0133         EnvelopeC65,
0134         EnvelopeC7,
0135         // EnvelopeDL = DLE,
0136 
0137         Envelope9,
0138         // Envelope10 = Comm10E,
0139         Envelope11,
0140         Envelope12,
0141         Envelope14,
0142         EnvelopeMonarch,
0143         EnvelopePersonal,
0144 
0145         EnvelopeChou3,
0146         EnvelopeChou4,
0147         EnvelopeInvite,
0148         EnvelopeItalian,
0149         EnvelopeKaku2,
0150         EnvelopeKaku3,
0151         EnvelopePrc1,
0152         EnvelopePrc2,
0153         EnvelopePrc3,
0154         EnvelopePrc4,
0155         EnvelopePrc5,
0156         EnvelopePrc6,
0157         EnvelopePrc7,
0158         EnvelopePrc8,
0159         EnvelopePrc9,
0160         EnvelopePrc10,
0161         EnvelopeYou4,
0162 
0163         // Last item
0164         LastPageSize = EnvelopeYou4,
0165 
0166         // Convenience overloads for naming consistency
0167         AnsiA = Letter,
0168         AnsiB = Ledger,
0169         EnvelopeC5 = C5E,
0170         EnvelopeDL = DLE,
0171         Envelope10 = Comm10E
0172     };
0173 
0174     // NOTE: Must keep in sync with QPageLayout::Unit and QPrinter::Unit
0175     enum Unit {
0176         Millimeter,
0177         Point,
0178         Inch,
0179         Pica,
0180         Didot,
0181         Cicero
0182     };
0183 
0184     enum SizeMatchPolicy {
0185         FuzzyMatch,
0186         FuzzyOrientationMatch,
0187         ExactMatch
0188     };
0189 
0190     QPageSize();
0191     Q_IMPLICIT QPageSize(PageSizeId pageSizeId);
0192     explicit QPageSize(const QSize &pointSize,
0193                        const QString &name = QString(),
0194                        SizeMatchPolicy matchPolicy = FuzzyMatch);
0195     explicit QPageSize(const QSizeF &size, Unit units,
0196                        const QString &name = QString(),
0197                        SizeMatchPolicy matchPolicy = FuzzyMatch);
0198     QPageSize(const QPageSize &other);
0199     QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPageSize)
0200     QPageSize &operator=(const QPageSize &other);
0201     ~QPageSize();
0202 
0203 
0204     void swap(QPageSize &other) noexcept { d.swap(other.d); }
0205 
0206 #if QT_GUI_REMOVED_SINCE(6, 4)
0207     friend Q_GUI_EXPORT bool operator==(const QPageSize &lhs, const QPageSize &rhs);
0208 #endif
0209     bool isEquivalentTo(const QPageSize &other) const;
0210 
0211     bool isValid() const;
0212 
0213     QString key() const;
0214     QString name() const;
0215 
0216     PageSizeId id() const;
0217 
0218     int windowsId() const;
0219 
0220     QSizeF definitionSize() const;
0221     Unit definitionUnits() const;
0222 
0223     QSizeF size(Unit units) const;
0224     QSize sizePoints() const;
0225     QSize sizePixels(int resolution) const;
0226 
0227     QRectF rect(Unit units) const;
0228     QRect rectPoints() const;
0229     QRect rectPixels(int resolution) const;
0230 
0231     static QString key(PageSizeId pageSizeId);
0232     static QString name(PageSizeId pageSizeId);
0233 
0234     static PageSizeId id(const QSize &pointSize,
0235                          SizeMatchPolicy matchPolicy = FuzzyMatch);
0236     static PageSizeId id(const QSizeF &size, Unit units,
0237                          SizeMatchPolicy matchPolicy = FuzzyMatch);
0238 
0239     static PageSizeId id(int windowsId);
0240     static int windowsId(PageSizeId pageSizeId);
0241 
0242     static QSizeF definitionSize(PageSizeId pageSizeId);
0243     static Unit definitionUnits(PageSizeId pageSizeId);
0244 
0245     static QSizeF size(PageSizeId pageSizeId, Unit units);
0246     static QSize sizePoints(PageSizeId pageSizeId);
0247     static QSize sizePixels(PageSizeId pageSizeId, int resolution);
0248 
0249 private:
0250     friend class QPageSizePrivate;
0251     friend class QPlatformPrintDevice;
0252 
0253     bool equals(const QPageSize &other) const;
0254     friend inline bool operator==(const QPageSize &lhs, const QPageSize &rhs)
0255     { return lhs.equals(rhs); }
0256     friend inline bool operator!=(const QPageSize &lhs, const QPageSize &rhs)
0257     { return !(lhs == rhs); }
0258 
0259     QPageSize(const QString &key, const QSize &pointSize, const QString &name);
0260     QPageSize(int windowsId, const QSize &pointSize, const QString &name);
0261     QPageSize(QPageSizePrivate &dd);
0262     QSharedDataPointer<QPageSizePrivate> d;
0263 };
0264 
0265 Q_DECLARE_SHARED(QPageSize)
0266 
0267 #ifndef QT_NO_DEBUG_STREAM
0268 Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize);
0269 #endif
0270 
0271 QT_END_NAMESPACE
0272 
0273 QT_DECL_METATYPE_EXTERN(QPageSize, Q_GUI_EXPORT)
0274 QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::PageSizeId, QPageSize__PageSizeId, Q_GUI_EXPORT)
0275 QT_DECL_METATYPE_EXTERN_TAGGED(QPageSize::Unit, QPageSize__Unit, Q_GUI_EXPORT)
0276 
0277 #endif // QPAGESIZE_H