Go to the documentation of this file.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 #ifndef __POLYGONUTILS_H__
00030 #define __POLYGONUTILS_H__
00031
00032 #include <vector>
00033
00034 #include <libwpg/libwpg.h>
00035 #include <boost/function.hpp>
00036
00037 #include "VectorTransformation2D.h"
00038 #include "Coordinate.h"
00039 #include "Line.h"
00040
00041 namespace libmspub
00042 {
00043 const int PROP_ADJUST_VAL_FIRST = 327;
00044 const int PROP_ADJUST_VAL_LAST = 336;
00045 const int PROP_GEO_LEFT = 320;
00046 const int PROP_GEO_TOP = 321;
00047 const int PROP_GEO_RIGHT = 322;
00048 const int PROP_GEO_BOTTOM = 323;
00049
00050 const int OTHER_CALC_VAL = 0x400;
00051 const int ASPECT_RATIO = 0x600;
00052
00053 class MSPUBCollector;
00054
00055 typedef struct
00056 {
00057 int m_x;
00058 int m_y;
00059 } Vertex;
00060
00061 typedef struct
00062 {
00063 int m_flags;
00064 int m_argOne;
00065 int m_argTwo;
00066 int m_argThree;
00067 } Calculation;
00068
00069 typedef struct
00070 {
00071 Vertex first;
00072 Vertex second;
00073 } TextRectangle;
00074
00075 struct CustomShape
00076 {
00077 const Vertex *mp_vertices;
00078 unsigned m_numVertices;
00079 const unsigned short *mp_elements;
00080 unsigned m_numElements;
00081 const Calculation *mp_calculations;
00082 unsigned m_numCalculations;
00083 const int *mp_defaultAdjustValues;
00084 unsigned m_numDefaultAdjustValues;
00085 const TextRectangle *mp_textRectangles;
00086 unsigned m_numTextRectangles;
00087 unsigned m_coordWidth;
00088 unsigned m_coordHeight;
00089 const Vertex *mp_gluePoints;
00090 unsigned m_numGluePoints;
00091 unsigned char m_adjustShiftMask;
00092
00093 Coordinate getTextRectangle(double x, double y, double width, double height, boost::function<double (unsigned index)> calculator) const;
00094
00095 CustomShape(const Vertex *p_vertices, unsigned numVertices, const unsigned short *p_elements, unsigned numElements, const Calculation *p_calculations, unsigned numCalculations, const int *p_defaultAdjustValues, unsigned numDefaultAdjustValues, const TextRectangle *p_textRectangles, unsigned numTextRectangles, unsigned coordWidth, unsigned coordHeight, const Vertex *p_gluePoints, unsigned numGluePoints, unsigned char adjustShiftMask = 0) :
00096 mp_vertices(p_vertices), m_numVertices(numVertices),
00097 mp_elements(p_elements), m_numElements(numElements),
00098 mp_calculations(p_calculations), m_numCalculations(numCalculations),
00099 mp_defaultAdjustValues(p_defaultAdjustValues), m_numDefaultAdjustValues(numDefaultAdjustValues),
00100 mp_textRectangles(p_textRectangles), m_numTextRectangles(numTextRectangles),
00101 m_coordWidth(coordWidth), m_coordHeight(coordHeight),
00102 mp_gluePoints(p_gluePoints), m_numGluePoints(numGluePoints),
00103 m_adjustShiftMask(adjustShiftMask)
00104 {
00105 }
00106 };
00107
00108 const CustomShape *getCustomShape(ShapeType type);
00109 bool isShapeTypeRectangle(ShapeType type);
00110 void writeCustomShape(ShapeType shapeType, WPXPropertyList &graphicsProps, libwpg::WPGPaintInterface *painter, double x, double y, double height, double width, bool closeEverything, VectorTransformation2D transform, std::vector<Line> lines, boost::function<double(unsigned index)> calculator, const std::vector<Color> &palette);
00111
00112 }
00113 #endif
00114