28 #ifndef __WPG2PARSER_H__ 29 #define __WPG2PARSER_H__ 36 #include <librevenge/librevenge.h> 50 element[0][0] = element[1][1] = 1;
52 element[0][1] = element[0][2] = 0;
53 element[1][0] = element[1][2] = 0;
54 element[2][0] = element[2][1] = 0;
59 const double rx = element[0][0]*x + element[1][0]*y + element[2][0];
60 const double ry = element[0][1]*x + element[1][1]*y + element[2][1];
65 librevenge::RVNGPropertyList
transformPoint(const ::librevenge::RVNGPropertyList &p)
const 67 librevenge::RVNGPropertyList propList;
68 propList.insert(
"svg:x", (element[0][0]*p[
"svg:x"]->getDouble() + element[1][0]*p[
"svg:y"]->getDouble() + element[2][0]));
69 propList.insert(
"svg:y", (element[0][1]*p[
"svg:x"]->getDouble() + element[1][1]*p[
"svg:y"]->getDouble() + element[2][1]));
73 librevenge::RVNGPropertyList
transformRect(const ::librevenge::RVNGPropertyList &r)
const 75 librevenge::RVNGPropertyList propList;
76 double oldx1 = r[
"svg:x"]->getDouble();
77 double oldy1 = r[
"svg:y"]->getDouble();
78 double oldx2 = r[
"svg:x"]->getDouble() + r[
"svg:width"]->getDouble();
79 double oldy2 = r[
"svg:y"]->getDouble() + r[
"svg:height"]->getDouble();
81 double newx1 = element[0][0]*oldx1 + element[1][0]*oldy1 + element[2][0];
82 double newy1 = element[0][1]*oldx1 + element[1][1]*oldy1 + element[2][1];
83 double newx2 = element[0][0]*oldx2 + element[1][0]*oldy2 + element[2][0];
84 double newy2 = element[0][1]*oldx2 + element[1][1]*oldy2 + element[2][1];
86 propList.insert(
"svg:x", (
double)newx1);
87 propList.insert(
"svg:y", (
double)newy1);
88 propList.insert(
"svg:width", (newx2-newx1));
89 propList.insert(
"svg:height", (newy2-newy1));
97 for (
int i = 0; i < 3; i++)
98 for (
int j = 0; j < 3; j++)
101 for (
int k = 0; k < 3; k++)
102 result[i][j] += m.
element[i][k]*element[k][j];
105 for (
int x = 0; x < 3; x++)
106 for (
int y = 0; y < 3; y++)
107 element[x][y] = result[x][y];
115 if (d >
double(std::numeric_limits<long>::max()))
116 return std::numeric_limits<long>::max();
117 else if (d <
double(std::numeric_limits<long>::min()))
118 return std::numeric_limits<long>::min();
148 compoundPath(), compoundMatrix(), compoundWindingRule(false),
149 compoundFilled(false), compoundFramed(true), compoundClosed(false) {}
153 return parentType == 0x1a;
160 double x1, y1, x2,
y2;
168 double x1, y1, x2,
y2;
177 double x1, y1, x2,
y2;
182 WPGTextDataContext(): x1(0), y1(0), x2(0), y2(0), flags(), vertAlign(), horAlign(), baseLineAngle(0.0) {}
188 WPG2Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter,
bool isEmbedded =
false);
189 bool parse()
override;
192 void handleStartWPG();
194 void handleFormSettings();
196 void handleCompoundPolygon();
198 void handlePenStyleDefinition();
200 void handleColorPalette();
201 void handleDPColorPalette();
202 void handlePenForeColor();
203 void handleDPPenForeColor();
204 void handlePenBackColor();
205 void handleDPPenBackColor();
206 void handlePenStyle();
207 void handlePenSize();
208 void handleDPPenSize();
209 void handleLineCap();
210 void handleLineJoin();
211 void handleBrushGradient();
212 void handleDPBrushGradient();
213 void handleBrushForeColor();
214 void handleDPBrushForeColor();
215 void handleBrushBackColor();
216 void handleDPBrushBackColor();
217 void handleBrushPattern();
219 void handlePolyline();
220 void handlePolyspline();
221 void handlePolycurve();
222 void handleRectangle();
226 void handleBitmapData();
228 void handleTextData();
229 void handleTextLine();
230 void handleTextBlock();
231 void handleTextPath();
233 void handleObjectCapsule();
234 void handleObjectImage();
237 void flushCompoundPolygon();
240 unsigned int getRemainingRecordLength()
const;
241 bool checkRLESize(
unsigned bytes)
const;
243 double toDouble(
long x)
const;
244 void transformXY(
long &x,
long &y)
const;
269 unsigned int m_layerId;
293 #endif // __WPG2PARSER_H__ libwpg::WPGColor m_brushForeColor
Definition: WPG2Parser.h:262
libwpg::WPGDashArray m_dashArray
Definition: WPG2Parser.h:264
Definition: WPG2Parser.cpp:198
libwpg::WPGColor m_brushBackColor
Definition: WPG2Parser.h:263
long vres
Definition: WPG2Parser.h:161
libwpg::WPGColor m_penForeColor
Definition: WPG2Parser.h:260
int objectIndex
Definition: WPG2Parser.h:169
Definition: WPG2Parser.h:165
Definition: WPG2Parser.h:174
int m_recordLength
Definition: WPG2Parser.h:247
Definition: WPGDashArray.h:36
std::map< unsigned int, libwpg::WPGDashArray > m_dashArrayStyles
Definition: WPG2Parser.h:266
unsigned int m_yres
Definition: WPG2Parser.h:253
unsigned char horAlign
Definition: WPG2Parser.h:180
Definition: WPGColor.h:34
librevenge::RVNGPropertyList m_gradientRef
Definition: WPG2Parser.h:273
WPGBinaryDataContext()
Definition: WPG2Parser.h:171
bool compoundClosed
Definition: WPG2Parser.h:145
bool m_compoundFilled
Definition: WPG2Parser.h:277
std::stack< WPGGroupContext > m_groupStack
Definition: WPG2Parser.h:274
bool isFilled
Definition: WPG2Parser.h:128
bool isFramed
Definition: WPG2Parser.h:129
bool m_doublePrecision
Definition: WPG2Parser.h:258
WPGBitmapContext()
Definition: WPG2Parser.h:162
bool m_drawTextData
Definition: WPG2Parser.h:284
bool m_exit
Definition: WPG2Parser.h:250
unsigned short flags
Definition: WPG2Parser.h:178
bool m_layerOpened
Definition: WPG2Parser.h:267
bool isCompoundPolygon() const
Definition: WPG2Parser.h:151
WPG2TransformMatrix m_matrix
Definition: WPG2Parser.h:271
double y2
Definition: WPG2Parser.h:168
Definition: WPG2Parser.h:135
long m_yofs
Definition: WPG2Parser.h:255
bool m_success
Definition: WPG2Parser.h:249
WPGTextDataContext m_textData
Definition: WPG2Parser.h:283
WPG2TransformMatrix m_compoundMatrix
Definition: WPG2Parser.h:275
bool m_compoundClosed
Definition: WPG2Parser.h:279
libwpg::WPGColor m_penBackColor
Definition: WPG2Parser.h:261
WPG2TransformMatrix compoundMatrix
Definition: WPG2Parser.h:141
long m_width
Definition: WPG2Parser.h:256
WPG2TransformMatrix matrix
Definition: WPG2Parser.h:127
double y2
Definition: WPG2Parser.h:160
bool compoundWindingRule
Definition: WPG2Parser.h:142
double m_gradientAngle
Definition: WPG2Parser.h:272
Definition: WPG2Parser.h:185
Definition: WPG2Parser.h:124
std::vector< librevenge::RVNGString > mimeTypes
Definition: WPG2Parser.h:170
unsigned subIndex
Definition: WPG2Parser.h:138
double y2
Definition: WPG2Parser.h:177
librevenge::RVNGPropertyListVector m_gradient
Definition: WPG2Parser.h:265
bool m_graphicsStarted
Definition: WPG2Parser.h:251
bool m_compoundWindingRule
Definition: WPG2Parser.h:276
long m_recordEnd
Definition: WPG2Parser.h:248
bool isClosed
Definition: WPG2Parser.h:130
librevenge::RVNGPropertyList m_style
Definition: WPG2Parser.h:259
unsigned int m_xres
Definition: WPG2Parser.h:252
WPGCompoundPolygon()
Definition: WPG2Parser.h:132
bool m_compoundFramed
Definition: WPG2Parser.h:278
int parentType
Definition: WPG2Parser.h:139
Definition: WPGXParser.h:39
bool compoundFramed
Definition: WPG2Parser.h:144
long m_xofs
Definition: WPG2Parser.h:254
WPGTextDataContext()
Definition: WPG2Parser.h:182
double baseLineAngle
Definition: WPG2Parser.h:181
long m_height
Definition: WPG2Parser.h:257
librevenge::RVNGPropertyListVector compoundPath
Definition: WPG2Parser.h:140
Definition: WPG2Parser.h:157
WPGBinaryDataContext m_binaryData
Definition: WPG2Parser.h:281
unsigned char vertAlign
Definition: WPG2Parser.h:179
bool compoundFilled
Definition: WPG2Parser.h:143
WPGBitmapContext m_bitmap
Definition: WPG2Parser.h:280
bool m_vFlipped
Definition: WPG2Parser.h:282
WPGGroupContext()
Definition: WPG2Parser.h:147