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