-rw-r--r-- | noncore/unsupported/qpdf/QOutputDev.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/QOutputDev.h b/noncore/unsupported/qpdf/QOutputDev.h index f3c5a01..874fd06 100644 --- a/noncore/unsupported/qpdf/QOutputDev.h +++ b/noncore/unsupported/qpdf/QOutputDev.h | |||
@@ -1,180 +1,182 @@ | |||
1 | 1 | ||
2 | //======================================================================== | 2 | //======================================================================== |
3 | // | 3 | // |
4 | // XOutputDev.h | 4 | // XOutputDev.h |
5 | // | 5 | // |
6 | // Copyright 1996 Derek B. Noonburg | 6 | // Copyright 1996 Derek B. Noonburg |
7 | // | 7 | // |
8 | //======================================================================== | 8 | //======================================================================== |
9 | 9 | ||
10 | #ifndef QOUTPUTDEV_H | 10 | #ifndef QOUTPUTDEV_H |
11 | #define QOUTPUTDEV_H | 11 | #define QOUTPUTDEV_H |
12 | 12 | ||
13 | #ifdef __GNUC__ | 13 | #ifdef __GNUC__ |
14 | #pragma interface | 14 | #pragma interface |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #include "aconf.h" | 17 | #include "aconf.h" |
18 | #include <stddef.h> | 18 | #include <stddef.h> |
19 | 19 | ||
20 | #include <qscrollview.h> | 20 | #include <qscrollview.h> |
21 | 21 | ||
22 | class Object; | 22 | class Object; |
23 | 23 | ||
24 | #include "config.h" | 24 | #include "config.h" |
25 | #include "CharTypes.h" | 25 | #include "CharTypes.h" |
26 | #include "GlobalParams.h" | 26 | #include "GlobalParams.h" |
27 | #include "OutputDev.h" | 27 | #include "OutputDev.h" |
28 | 28 | ||
29 | class GString; | 29 | class GString; |
30 | class GList; | 30 | class GList; |
31 | struct GfxRGB; | 31 | struct GfxRGB; |
32 | class GfxFont; | 32 | class GfxFont; |
33 | class GfxSubpath; | 33 | class GfxSubpath; |
34 | class TextPage; | 34 | class TextPage; |
35 | class XOutputFontCache; | 35 | class XOutputFontCache; |
36 | class Link; | 36 | class Link; |
37 | class Catalog; | 37 | class Catalog; |
38 | class DisplayFontParam; | 38 | class DisplayFontParam; |
39 | class UnicodeMap; | 39 | class UnicodeMap; |
40 | class CharCodeToUnicode; | 40 | class CharCodeToUnicode; |
41 | 41 | ||
42 | 42 | ||
43 | class QPainter; | 43 | class QPainter; |
44 | class QPixmap; | 44 | class QPixmap; |
45 | class QPointArray; | 45 | class QPointArray; |
46 | 46 | ||
47 | 47 | ||
48 | typedef fouble fp_t; | 48 | typedef fouble fp_t; |
49 | 49 | ||
50 | //------------------------------------------------------------------------ | 50 | //------------------------------------------------------------------------ |
51 | // Constants | 51 | // Constants |
52 | //------------------------------------------------------------------------ | 52 | //------------------------------------------------------------------------ |
53 | 53 | ||
54 | 54 | ||
55 | //------------------------------------------------------------------------ | 55 | //------------------------------------------------------------------------ |
56 | // Misc types | 56 | // Misc types |
57 | //------------------------------------------------------------------------ | 57 | //------------------------------------------------------------------------ |
58 | 58 | ||
59 | 59 | ||
60 | //------------------------------------------------------------------------ | 60 | //------------------------------------------------------------------------ |
61 | // XOutputDev | 61 | // XOutputDev |
62 | //------------------------------------------------------------------------ | 62 | //------------------------------------------------------------------------ |
63 | 63 | ||
64 | class QOutputDev : public QScrollView, public OutputDev { | 64 | class QOutputDev : public QScrollView, public OutputDev { |
65 | Q_OBJECT | ||
66 | |||
65 | public: | 67 | public: |
66 | 68 | ||
67 | // Constructor. | 69 | // Constructor. |
68 | QOutputDev( QWidget *parent = 0, const char *name = 0, int flags = 0 ); | 70 | QOutputDev( QWidget *parent = 0, const char *name = 0, int flags = 0 ); |
69 | 71 | ||
70 | // Destructor. | 72 | // Destructor. |
71 | virtual ~QOutputDev(); | 73 | virtual ~QOutputDev(); |
72 | 74 | ||
73 | //---- get info about output device | 75 | //---- get info about output device |
74 | 76 | ||
75 | // Does this device use upside-down coordinates? | 77 | // Does this device use upside-down coordinates? |
76 | // (Upside-down means (0,0) is the top left corner of the page.) | 78 | // (Upside-down means (0,0) is the top left corner of the page.) |
77 | virtual GBool upsideDown() { return gTrue; } | 79 | virtual GBool upsideDown() { return gTrue; } |
78 | 80 | ||
79 | // Does this device use drawChar() or drawString()? | 81 | // Does this device use drawChar() or drawString()? |
80 | virtual GBool useDrawChar() { return gTrue; } | 82 | virtual GBool useDrawChar() { return gTrue; } |
81 | 83 | ||
82 | // Does this device use beginType3Char/endType3Char? Otherwise, | 84 | // Does this device use beginType3Char/endType3Char? Otherwise, |
83 | // text in Type 3 fonts will be drawn with drawChar/drawString. | 85 | // text in Type 3 fonts will be drawn with drawChar/drawString. |
84 | virtual GBool interpretType3Chars() { return gFalse; } | 86 | virtual GBool interpretType3Chars() { return gFalse; } |
85 | 87 | ||
86 | // Does this device need non-text content? | 88 | // Does this device need non-text content? |
87 | virtual GBool needNonText() { return gFalse; } | 89 | virtual GBool needNonText() { return gFalse; } |
88 | 90 | ||
89 | //----- initialization and control | 91 | //----- initialization and control |
90 | 92 | ||
91 | // Start a page. | 93 | // Start a page. |
92 | virtual void startPage(int pageNum, GfxState *state); | 94 | virtual void startPage(int pageNum, GfxState *state); |
93 | 95 | ||
94 | // End a page. | 96 | // End a page. |
95 | virtual void endPage(); | 97 | virtual void endPage(); |
96 | 98 | ||
97 | //----- link borders | 99 | //----- link borders |
98 | virtual void drawLink(Link *link, Catalog *catalog); | 100 | virtual void drawLink(Link *link, Catalog *catalog); |
99 | 101 | ||
100 | //----- save/restore graphics state | 102 | //----- save/restore graphics state |
101 | virtual void saveState(GfxState *state); | 103 | virtual void saveState(GfxState *state); |
102 | virtual void restoreState(GfxState *state); | 104 | virtual void restoreState(GfxState *state); |
103 | 105 | ||
104 | //----- update graphics state | 106 | //----- update graphics state |
105 | virtual void updateAll(GfxState *state); | 107 | virtual void updateAll(GfxState *state); |
106 | virtual void updateCTM(GfxState *state, fp_t m11, fp_t m12, | 108 | virtual void updateCTM(GfxState *state, fp_t m11, fp_t m12, |
107 | fp_t m21, fp_t m22, fp_t m31, fp_t m32); | 109 | fp_t m21, fp_t m22, fp_t m31, fp_t m32); |
108 | virtual void updateLineDash(GfxState *state); | 110 | virtual void updateLineDash(GfxState *state); |
109 | virtual void updateFlatness(GfxState *state); | 111 | virtual void updateFlatness(GfxState *state); |
110 | virtual void updateLineJoin(GfxState *state); | 112 | virtual void updateLineJoin(GfxState *state); |
111 | virtual void updateLineCap(GfxState *state); | 113 | virtual void updateLineCap(GfxState *state); |
112 | virtual void updateMiterLimit(GfxState *state); | 114 | virtual void updateMiterLimit(GfxState *state); |
113 | virtual void updateLineWidth(GfxState *state); | 115 | virtual void updateLineWidth(GfxState *state); |
114 | virtual void updateFillColor(GfxState *state); | 116 | virtual void updateFillColor(GfxState *state); |
115 | virtual void updateStrokeColor(GfxState *state); | 117 | virtual void updateStrokeColor(GfxState *state); |
116 | 118 | ||
117 | //----- update text state | 119 | //----- update text state |
118 | virtual void updateFont(GfxState *state); | 120 | virtual void updateFont(GfxState *state); |
119 | 121 | ||
120 | //----- path painting | 122 | //----- path painting |
121 | virtual void stroke(GfxState *state); | 123 | virtual void stroke(GfxState *state); |
122 | virtual void fill(GfxState *state); | 124 | virtual void fill(GfxState *state); |
123 | virtual void eoFill(GfxState *state); | 125 | virtual void eoFill(GfxState *state); |
124 | 126 | ||
125 | //----- path clipping | 127 | //----- path clipping |
126 | virtual void clip(GfxState *state); | 128 | virtual void clip(GfxState *state); |
127 | virtual void eoClip(GfxState *state); | 129 | virtual void eoClip(GfxState *state); |
128 | 130 | ||
129 | //----- text drawing | 131 | //----- text drawing |
130 | virtual void beginString(GfxState *state, GString *s); | 132 | virtual void beginString(GfxState *state, GString *s); |
131 | virtual void endString(GfxState *state); | 133 | virtual void endString(GfxState *state); |
132 | virtual void drawChar(GfxState *state, fp_t x, fp_t y, | 134 | virtual void drawChar(GfxState *state, fp_t x, fp_t y, |
133 | fp_t dx, fp_t dy, | 135 | fp_t dx, fp_t dy, |
134 | fp_t originX, fp_t originY, | 136 | fp_t originX, fp_t originY, |
135 | CharCode code, Unicode *u, int uLen); | 137 | CharCode code, Unicode *u, int uLen); |
136 | 138 | ||
137 | //----- image drawing | 139 | //----- image drawing |
138 | virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, | 140 | virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, |
139 | int width, int height, GBool invert, | 141 | int width, int height, GBool invert, |
140 | GBool inlineImg); | 142 | GBool inlineImg); |
141 | virtual void drawImage(GfxState *state, Object *ref, Stream *str, | 143 | virtual void drawImage(GfxState *state, Object *ref, Stream *str, |
142 | int width, int height, GfxImageColorMap *colorMap, | 144 | int width, int height, GfxImageColorMap *colorMap, |
143 | int *maskColors, GBool inlineImg); | 145 | int *maskColors, GBool inlineImg); |
144 | 146 | ||
145 | // Find a string. If <top> is true, starts looking at <l>,<t>; | 147 | // Find a string. If <top> is true, starts looking at <l>,<t>; |
146 | // otherwise starts looking at top of page. If <bottom> is true, | 148 | // otherwise starts looking at top of page. If <bottom> is true, |
147 | // stops looking at <l+w-1>,<t+h-1>; otherwise stops looking at bottom | 149 | // stops looking at <l+w-1>,<t+h-1>; otherwise stops looking at bottom |
148 | // of page. If found, sets the text bounding rectange and returns | 150 | // of page. If found, sets the text bounding rectange and returns |
149 | // true; otherwise returns false. | 151 | // true; otherwise returns false. |
150 | GBool findText ( Unicode *s, int len, GBool top, GBool bottom, int *xMin, int *yMin, int *xMax, int *yMax ); | 152 | GBool findText ( Unicode *s, int len, GBool top, GBool bottom, int *xMin, int *yMin, int *xMax, int *yMax ); |
151 | 153 | ||
152 | //----- special QT access | 154 | //----- special QT access |
153 | 155 | ||
154 | bool findText ( const QString &str, int &l, int &t, int &w, int &h, bool top = 0, bool bottom = 0 ); | 156 | bool findText ( const QString &str, int &l, int &t, int &w, int &h, bool top = 0, bool bottom = 0 ); |
155 | bool findText ( const QString &str, QRect &r, bool top = 0, bool bottom = 0 ); | 157 | bool findText ( const QString &str, QRect &r, bool top = 0, bool bottom = 0 ); |
156 | 158 | ||
157 | // Get the text which is inside the specified rectangle. | 159 | // Get the text which is inside the specified rectangle. |
158 | QString getText ( int left, int top, int width, int height ); | 160 | QString getText ( int left, int top, int width, int height ); |
159 | QString getText ( const QRect &r ); | 161 | QString getText ( const QRect &r ); |
160 | 162 | ||
161 | protected: | 163 | protected: |
162 | virtual void drawContents ( QPainter *p, int, int, int, int ); | 164 | virtual void drawContents ( QPainter *p, int, int, int, int ); |
163 | 165 | ||
164 | private: | 166 | private: |
165 | QPixmap *m_pixmap; // pixmap to draw into | 167 | QPixmap *m_pixmap; // pixmap to draw into |
166 | QPainter *m_painter; | 168 | QPainter *m_painter; |
167 | 169 | ||
168 | TextPage *m_text; // text from the current page | 170 | TextPage *m_text; // text from the current page |
169 | 171 | ||
170 | private: | 172 | private: |
171 | QFont matchFont ( GfxFont *, fp_t m11, fp_t m12, fp_t m21, fp_t m22 ); | 173 | QFont matchFont ( GfxFont *, fp_t m11, fp_t m12, fp_t m21, fp_t m22 ); |
172 | 174 | ||
173 | void updateLineAttrs ( GfxState *state, GBool updateDash ); | 175 | void updateLineAttrs ( GfxState *state, GBool updateDash ); |
174 | void doFill ( GfxState *state, bool winding ); | 176 | void doFill ( GfxState *state, bool winding ); |
175 | void doClip ( GfxState *state, bool winding ); | 177 | void doClip ( GfxState *state, bool winding ); |
176 | int convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths ); | 178 | int convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths ); |
177 | int convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points ); | 179 | int convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points ); |
178 | }; | 180 | }; |
179 | 181 | ||
180 | #endif | 182 | #endif |