kwmf.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef KWMF_H
00031 #define KWMF_H
00032
00033 #include <qvaluestack.h>
00034 #include <koffice_export.h>
00035 class QDataStream;
00036 class QPointArray;
00037
00038 class KOWMF_EXPORT KWmf
00039 {
00040 public:
00041
00042
00043
00044 KWmf(
00045 unsigned dpi);
00046 virtual ~KWmf();
00047
00048
00049
00050 bool parse(
00051 const QString &file);
00052 bool parse(
00053 QDataStream &stream,
00054 unsigned size);
00055
00056 class KOWMF_EXPORT DrawContext
00057 {
00058 public:
00059 DrawContext();
00060 bool m_winding;
00061 unsigned m_brushColour;
00062 unsigned m_brushStyle;
00063 unsigned m_penColour;
00064 unsigned m_penStyle;
00065 unsigned m_penWidth;
00066 };
00067
00068
00069
00070 void brushSet(
00071 unsigned colour,
00072 unsigned style);
00073 void penSet(
00074 unsigned colour,
00075 unsigned style,
00076 unsigned width);
00077
00078 protected:
00079
00080
00081 virtual void gotEllipse(
00082 const DrawContext &dc,
00083 QString type,
00084 QPoint topLeft,
00085 QSize halfAxes,
00086 unsigned startAngle,
00087 unsigned stopAngle) = 0;
00088 virtual void gotPolygon(
00089 const DrawContext &dc,
00090 const QPointArray &points) = 0;
00091 virtual void gotPolyline(
00092 const DrawContext &dc,
00093 const QPointArray &points) = 0;
00094 virtual void gotRectangle(
00095 const DrawContext &dc,
00096 const QPointArray &points) = 0;
00097
00098 private:
00099
00100
00101 static const int s_area;
00102
00103
00104
00105 typedef short S16;
00106 typedef int S32;
00107 typedef unsigned int U32;
00108
00109 int m_dpi;
00110 int m_windowOrgX;
00111 int m_windowOrgY;
00112 int m_windowFlipX;
00113 int m_windowFlipY;
00114 DrawContext m_dc;
00115 QValueStack<DrawContext> m_savedDcs;
00116 QPoint m_lineFrom;
00117
00118
00119
00120 class WinObjHandle
00121 {
00122 public:
00123 virtual ~WinObjHandle () {}
00124 virtual void apply(KWmf &p) = 0;
00125 };
00126
00127 class WinObjBrushHandle: public WinObjHandle
00128 {
00129 public:
00130 virtual void apply(KWmf &p);
00131 unsigned m_colour;
00132 unsigned m_style;
00133 };
00134
00135 class WinObjPenHandle: public WinObjHandle
00136 {
00137 public:
00138 virtual void apply(KWmf &p);
00139 unsigned m_colour;
00140 unsigned m_style;
00141 unsigned m_width;
00142 };
00143
00144 int handleIndex(void) const;
00145 WinObjPenHandle *handleCreatePen(void);
00146 WinObjBrushHandle *handleCreateBrush(void);
00147 void handleDelete(int idx);
00148 static const int s_maxHandles;
00149 WinObjHandle **m_objectHandles;
00150
00151 unsigned getColour(S32 colour);
00152 QPoint normalisePoint(
00153 QDataStream &operands);
00154 QSize normaliseSize(
00155 QDataStream &operands);
00156 void genericArc(
00157 QString type,
00158 QDataStream &operands);
00159
00160
00161
00162 void walk(
00163 U32 words,
00164 QDataStream &stream);
00165 void skip(
00166 U32 words,
00167 QDataStream &operands);
00168 void invokeHandler(
00169 S16 opcode,
00170 U32 words,
00171 QDataStream &operands);
00172
00173
00174
00175
00176 void opArc(U32 words, QDataStream &operands);
00177
00178 void opBrushCreateIndirect(U32 words, QDataStream &operands);
00179 void opEllipse(U32 words, QDataStream &operands);
00180
00181 void opLineTo(U32 words, QDataStream &operands);
00182
00183 void opMoveTo(U32 words, QDataStream &operands);
00184
00185 void opNoop(U32 words, QDataStream &operands);
00186
00187 void opObjectDelete(U32 words, QDataStream &operands);
00188
00189 void opObjectSelect(U32 words, QDataStream &operands);
00190
00191 void opPenCreateIndirect(U32 words, QDataStream &operands);
00192 void opPie(U32 words, QDataStream &operands);
00193
00194 void opPolygon(U32 words, QDataStream &operands);
00195
00196 void opPolygonSetFillMode(U32 words, QDataStream &operands);
00197
00198 void opPolyline(U32 words, QDataStream &operands);
00199 void opRectangle(U32 words, QDataStream &operands);
00200
00201 void opRestoreDc(U32 words, QDataStream &operands);
00202
00203 void opSaveDc(U32 words, QDataStream &operands);
00204
00205 void opWindowSetOrg(U32 words, QDataStream &operands);
00206
00207 void opWindowSetExt(U32 words, QDataStream &operands);
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218 };
00219
00220 #endif
This file is part of the documentation for lib Library Version 1.4.2.