28 #ifndef __WPG2PARSER_H__ 29 #define __WPG2PARSER_H__ 34 #include <librevenge/librevenge.h> 49 element[0][0] = element[1][1] = 1;
51 element[0][1] = element[0][2] = 0;
52 element[1][0] = element[1][2] = 0;
53 element[2][0] = element[2][1] = 0;
58 const double rx = element[0][0]*x + element[1][0]*y + element[2][0];
59 const double ry = element[0][1]*x + element[1][1]*y + element[2][1];
64 librevenge::RVNGPropertyList
transformPoint(const ::librevenge::RVNGPropertyList &p)
const 66 librevenge::RVNGPropertyList propList;
67 propList.insert(
"svg:x", (element[0][0]*p[
"svg:x"]->getDouble() + element[1][0]*p[
"svg:y"]->getDouble() + element[2][0]));
68 propList.insert(
"svg:y", (element[0][1]*p[
"svg:x"]->getDouble() + element[1][1]*p[
"svg:y"]->getDouble() + element[2][1]));
72 librevenge::RVNGPropertyList
transformRect(const ::librevenge::RVNGPropertyList &r)
const 74 librevenge::RVNGPropertyList propList;
75 double oldx1 = r[
"svg:x"]->getDouble();
76 double oldy1 = r[
"svg:y"]->getDouble();
77 double oldx2 = r[
"svg:x"]->getDouble() + r[
"svg:width"]->getDouble();
78 double oldy2 = r[
"svg:y"]->getDouble() + r[
"svg:height"]->getDouble();
80 double newx1 = element[0][0]*oldx1 + element[1][0]*oldy1 + element[2][0];
81 double newy1 = element[0][1]*oldx1 + element[1][1]*oldy1 + element[2][1];
82 double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0];
83 double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1];
85 propList.insert(
"svg:x", (
double)newx1);
86 propList.insert(
"svg:y", (
double)newy1);
87 propList.insert(
"svg:width", (newx2-newx1));
88 propList.insert(
"svg:height", (newy2-newy1));
96 for (
int i = 0; i < 3; i++)
97 for (
int j = 0; j < 3; j++)
100 for (
int k = 0; k < 3; k++)
101 result[i][j] += m.
element[i][k]*element[k][j];
104 for (
int x = 0; x < 3; x++)
105 for (
int y = 0; y < 3; y++)
106 element[x][y] = result[x][y];
114 if (d >
double(std::numeric_limits<long>::max()))
115 return std::numeric_limits<long>::max();
116 else if (d <
double(std::numeric_limits<long>::min()))
117 return std::numeric_limits<long>::min();
147 compoundPath(), compoundMatrix(), compoundWindingRule(false),
148 compoundFilled(false), compoundFramed(true), compoundClosed(false) {}
152 return parentType == 0x1a;
159 double x1, y1, x2,
y2;
167 double x1, y1, x2,
y2;
176 double x1, y1, x2,
y2;
181 WPGTextDataContext(): x1(0), y1(0), x2(0), y2(0), flags(), vertAlign(), horAlign(), baseLineAngle(0.0) {}
187 WPG2Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter,
bool isEmbedded =
false);
188 bool parse()
override;
191 void handleStartWPG();
193 void handleFormSettings();
195 void handleCompoundPolygon();
197 void handlePenStyleDefinition();
199 void handleColorPalette();
200 void handleDPColorPalette();
201 void handlePenForeColor();
202 void handleDPPenForeColor();
203 void handlePenBackColor();
204 void handleDPPenBackColor();
205 void handlePenStyle();
206 void handlePenSize();
207 void handleDPPenSize();
208 void handleLineCap();
209 void handleLineJoin();
210 void handleBrushGradient();
211 void handleDPBrushGradient();
212 void handleBrushForeColor();
213 void handleDPBrushForeColor();
214 void handleBrushBackColor();
215 void handleDPBrushBackColor();
216 void handleBrushPattern();
218 void handlePolyline();
219 void handlePolyspline();
220 void handlePolycurve();
221 void handleRectangle();
225 void handleBitmapData();
227 void handleTextData();
228 void handleTextLine();
229 void handleTextBlock();
230 void handleTextPath();
232 void handleObjectCapsule();
233 void handleObjectImage();
236 void flushCompoundPolygon();
239 unsigned int getRemainingRecordLength()
const;
240 bool checkRLESize(
unsigned bytes)
const;
242 double toDouble(
long x)
const;
243 void transformXY(
long &x,
long &y)
const;
268 unsigned int m_layerId;
292 #endif // __WPG2PARSER_H__ libwpg::WPGColor m_brushForeColor
Definition: WPG2Parser.h:261
libwpg::WPGDashArray m_dashArray
Definition: WPG2Parser.h:263
Definition: WPG2Parser.cpp:194
libwpg::WPGColor m_brushBackColor
Definition: WPG2Parser.h:262
long vres
Definition: WPG2Parser.h:160
libwpg::WPGColor m_penForeColor
Definition: WPG2Parser.h:259
int objectIndex
Definition: WPG2Parser.h:168
Definition: WPG2Parser.h:164
Definition: WPG2Parser.h:173
int m_recordLength
Definition: WPG2Parser.h:246
Definition: WPGDashArray.h:36
std::map< unsigned int, libwpg::WPGDashArray > m_dashArrayStyles
Definition: WPG2Parser.h:265
unsigned int m_yres
Definition: WPG2Parser.h:252
unsigned char horAlign
Definition: WPG2Parser.h:179
Definition: WPGColor.h:34
librevenge::RVNGPropertyList m_gradientRef
Definition: WPG2Parser.h:272
WPGBinaryDataContext()
Definition: WPG2Parser.h:170
bool compoundClosed
Definition: WPG2Parser.h:144
bool m_compoundFilled
Definition: WPG2Parser.h:276
std::stack< WPGGroupContext > m_groupStack
Definition: WPG2Parser.h:273
bool isFilled
Definition: WPG2Parser.h:127
bool isFramed
Definition: WPG2Parser.h:128
bool m_doublePrecision
Definition: WPG2Parser.h:257
WPGBitmapContext()
Definition: WPG2Parser.h:161
bool m_drawTextData
Definition: WPG2Parser.h:283
bool m_exit
Definition: WPG2Parser.h:249
unsigned short flags
Definition: WPG2Parser.h:177
bool m_layerOpened
Definition: WPG2Parser.h:266
bool isCompoundPolygon() const
Definition: WPG2Parser.h:150
WPG2TransformMatrix m_matrix
Definition: WPG2Parser.h:270
double y2
Definition: WPG2Parser.h:167
Definition: WPG2Parser.h:134
long m_yofs
Definition: WPG2Parser.h:254
bool m_success
Definition: WPG2Parser.h:248
WPGTextDataContext m_textData
Definition: WPG2Parser.h:282
WPG2TransformMatrix m_compoundMatrix
Definition: WPG2Parser.h:274
bool m_compoundClosed
Definition: WPG2Parser.h:278
libwpg::WPGColor m_penBackColor
Definition: WPG2Parser.h:260
WPG2TransformMatrix compoundMatrix
Definition: WPG2Parser.h:140
long m_width
Definition: WPG2Parser.h:255
WPG2TransformMatrix matrix
Definition: WPG2Parser.h:126
double y2
Definition: WPG2Parser.h:159
bool compoundWindingRule
Definition: WPG2Parser.h:141
double m_gradientAngle
Definition: WPG2Parser.h:271
Definition: WPG2Parser.h:184
Definition: WPG2Parser.h:123
std::vector< librevenge::RVNGString > mimeTypes
Definition: WPG2Parser.h:169
unsigned subIndex
Definition: WPG2Parser.h:137
double y2
Definition: WPG2Parser.h:176
librevenge::RVNGPropertyListVector m_gradient
Definition: WPG2Parser.h:264
bool m_graphicsStarted
Definition: WPG2Parser.h:250
bool m_compoundWindingRule
Definition: WPG2Parser.h:275
long m_recordEnd
Definition: WPG2Parser.h:247
bool isClosed
Definition: WPG2Parser.h:129
librevenge::RVNGPropertyList m_style
Definition: WPG2Parser.h:258
unsigned int m_xres
Definition: WPG2Parser.h:251
WPGCompoundPolygon()
Definition: WPG2Parser.h:131
bool m_compoundFramed
Definition: WPG2Parser.h:277
int parentType
Definition: WPG2Parser.h:138
Definition: WPGXParser.h:38
bool compoundFramed
Definition: WPG2Parser.h:143
long m_xofs
Definition: WPG2Parser.h:253
WPGTextDataContext()
Definition: WPG2Parser.h:181
double baseLineAngle
Definition: WPG2Parser.h:180
long m_height
Definition: WPG2Parser.h:256
librevenge::RVNGPropertyListVector compoundPath
Definition: WPG2Parser.h:139
Definition: WPG2Parser.h:156
WPGBinaryDataContext m_binaryData
Definition: WPG2Parser.h:280
unsigned char vertAlign
Definition: WPG2Parser.h:178
bool compoundFilled
Definition: WPG2Parser.h:142
WPGBitmapContext m_bitmap
Definition: WPG2Parser.h:279
bool m_vFlipped
Definition: WPG2Parser.h:281
WPGGroupContext()
Definition: WPG2Parser.h:146