Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

QOutputDev.h

Go to the documentation of this file.
00001 
00002 //========================================================================
00003 //
00004 // XOutputDev.h
00005 //
00006 // Copyright 1996 Derek B. Noonburg
00007 //
00008 //========================================================================
00009 
00010 #ifndef QOUTPUTDEV_H
00011 #define QOUTPUTDEV_H
00012 
00013 #ifdef __GNUC__
00014 #pragma interface
00015 #endif
00016 
00017 #include "aconf.h"
00018 #include <stddef.h>
00019 
00020 #include <qscrollview.h>
00021 
00022 class Object;
00023 
00024 #include "config.h"
00025 #include "CharTypes.h"
00026 #include "GlobalParams.h"
00027 #include "OutputDev.h"
00028 
00029 class GString;
00030 class GList;
00031 struct GfxRGB;
00032 class GfxFont;
00033 class GfxSubpath;
00034 class TextPage;
00035 class XOutputFontCache;
00036 class Link;
00037 class Catalog;
00038 class DisplayFontParam;
00039 class UnicodeMap;
00040 class CharCodeToUnicode;
00041 
00042 
00043 class QPainter;
00044 class QPixmap;
00045 class QPointArray;
00046 
00047 
00048 typedef fouble fp_t;
00049 
00050 //------------------------------------------------------------------------
00051 // Constants
00052 //------------------------------------------------------------------------
00053 
00054 
00055 //------------------------------------------------------------------------
00056 // Misc types
00057 //------------------------------------------------------------------------
00058 
00059 
00060 //------------------------------------------------------------------------
00061 // XOutputDev
00062 //------------------------------------------------------------------------
00063 
00064 class QOutputDev : public QScrollView, public OutputDev {
00065         Q_OBJECT
00066 
00067 public:
00068 
00069         // Constructor.
00070         QOutputDev( QWidget *parent = 0, const char *name = 0, int flags = 0 );
00071 
00072         // Destructor.
00073         virtual ~QOutputDev();
00074 
00075         //---- get info about output device
00076 
00077         // Does this device use upside-down coordinates?
00078         // (Upside-down means (0,0) is the top left corner of the page.)
00079         virtual GBool upsideDown() { return gTrue; }
00080 
00081         // Does this device use drawChar() or drawString()?
00082         virtual GBool useDrawChar() { return gTrue; }
00083 
00084         // Does this device use beginType3Char/endType3Char?  Otherwise,
00085         // text in Type 3 fonts will be drawn with drawChar/drawString.
00086         virtual GBool interpretType3Chars() { return gFalse; }
00087        
00088         // Does this device need non-text content?
00089         virtual GBool needNonText() { return gFalse; }
00090 
00091         //----- initialization and control
00092 
00093         // Start a page.
00094         virtual void startPage(int pageNum, GfxState *state);
00095 
00096         // End a page.
00097         virtual void endPage();
00098 
00099         //----- link borders
00100         virtual void drawLink(Link *link, Catalog *catalog);
00101 
00102         //----- save/restore graphics state
00103         virtual void saveState(GfxState *state);
00104         virtual void restoreState(GfxState *state);
00105 
00106         //----- update graphics state
00107         virtual void updateAll(GfxState *state);
00108         virtual void updateCTM(GfxState *state, fp_t m11, fp_t m12,
00109                          fp_t m21, fp_t m22, fp_t m31, fp_t m32);
00110         virtual void updateLineDash(GfxState *state);
00111         virtual void updateFlatness(GfxState *state);
00112         virtual void updateLineJoin(GfxState *state);
00113         virtual void updateLineCap(GfxState *state);
00114         virtual void updateMiterLimit(GfxState *state);
00115         virtual void updateLineWidth(GfxState *state);
00116         virtual void updateFillColor(GfxState *state);
00117         virtual void updateStrokeColor(GfxState *state);
00118 
00119         //----- update text state
00120         virtual void updateFont(GfxState *state);
00121 
00122         //----- path painting
00123         virtual void stroke(GfxState *state);
00124         virtual void fill(GfxState *state);
00125         virtual void eoFill(GfxState *state);
00126 
00127         //----- path clipping
00128         virtual void clip(GfxState *state);
00129         virtual void eoClip(GfxState *state);
00130 
00131         //----- text drawing
00132         virtual void beginString(GfxState *state, GString *s);
00133         virtual void endString(GfxState *state);
00134         virtual void drawChar(GfxState *state, fp_t x, fp_t y,
00135                               fp_t dx, fp_t dy,
00136                               fp_t originX, fp_t originY,
00137                               CharCode code, Unicode *u, int uLen);
00138 
00139         //----- image drawing
00140         virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
00141                                   int width, int height, GBool invert,
00142                                   GBool inlineImg);
00143         virtual void drawImage(GfxState *state, Object *ref, Stream *str,
00144                                int width, int height, GfxImageColorMap *colorMap,
00145                                int *maskColors, GBool inlineImg);
00146 
00147         // Find a string.  If <top> is true, starts looking at <l>,<t>;
00148         // otherwise starts looking at top of page.  If <bottom> is true,
00149         // stops looking at <l+w-1>,<t+h-1>; otherwise stops looking at bottom
00150         // of page.  If found, sets the text bounding rectange and returns
00151         // true; otherwise returns false.
00152         GBool findText ( Unicode *s, int len, GBool top, GBool bottom, int *xMin, int *yMin, int *xMax, int *yMax );
00153         
00154         //----- special QT access
00155 
00156         bool findText ( const QString &str, int &l, int &t, int &w, int &h, bool top = 0, bool bottom = 0 );
00157         bool findText ( const QString &str, QRect &r, bool top = 0, bool bottom = 0 );
00158 
00159         // Get the text which is inside the specified rectangle.
00160         QString getText ( int left, int top, int width, int height );
00161         QString getText ( const QRect &r );
00162 
00163 protected:
00164         virtual void drawContents ( QPainter *p, int, int, int, int );
00165 
00166 private:
00167         QPixmap *m_pixmap;              // pixmap to draw into
00168         QPainter *m_painter;
00169 
00170         TextPage *m_text;               // text from the current page
00171 
00172 private:        
00173         QFont matchFont ( GfxFont *, fp_t m11, fp_t m12, fp_t m21, fp_t m22 );
00174 
00175         void updateLineAttrs ( GfxState *state, GBool updateDash );
00176         void doFill ( GfxState *state, bool winding );
00177         void doClip ( GfxState *state, bool winding );
00178         int convertPath ( GfxState *state, QPointArray &points, QArray<int> &lengths );
00179         int convertSubpath ( GfxState *state, GfxSubpath *subpath, QPointArray &points );
00180 };
00181 
00182 #endif

Generated on Sat Nov 5 16:18:12 2005 for OPIE by  doxygen 1.4.2