00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __CDRCOLLECTOR_H__
00011 #define __CDRCOLLECTOR_H__
00012
00013 #include <map>
00014 #include <vector>
00015 #include <stack>
00016 #include <librevenge/librevenge.h>
00017 #include <librevenge-stream/librevenge-stream.h>
00018 #include <lcms2.h>
00019 #include "CDRTypes.h"
00020 #include "CDRPath.h"
00021 #include "CDROutputElementList.h"
00022 #include "libcdr_utils.h"
00023
00024 namespace
00025 {
00026 #include "CDRColorProfiles.h"
00027 }
00028
00029 namespace libcdr
00030 {
00031
00032 class CDRParserState
00033 {
00034 public:
00035 CDRParserState();
00036 ~CDRParserState();
00037 std::map<unsigned, librevenge::RVNGBinaryData> m_bmps;
00038 std::map<unsigned, CDRPattern> m_patterns;
00039 std::map<unsigned, librevenge::RVNGBinaryData> m_vects;
00040 std::vector<CDRPage> m_pages;
00041 std::map<unsigned, CDRColor> m_documentPalette;
00042 std::map<unsigned, std::vector<CDRTextLine> > m_texts;
00043
00044 unsigned _getRGBColor(const CDRColor &color);
00045 unsigned getBMPColor(const CDRColor &color);
00046 librevenge::RVNGString getRGBColorString(const CDRColor &color);
00047 cmsHTRANSFORM m_colorTransformCMYK2RGB;
00048 cmsHTRANSFORM m_colorTransformLab2RGB;
00049 cmsHTRANSFORM m_colorTransformRGB2RGB;
00050
00051 void setColorTransform(const std::vector<unsigned char> &profile);
00052 void setColorTransform(librevenge::RVNGInputStream *input);
00053
00054 private:
00055 CDRParserState(const CDRParserState &);
00056 CDRParserState &operator=(const CDRParserState &);
00057 };
00058
00059 class CDRCollector
00060 {
00061 public:
00062 CDRCollector() {}
00063 virtual ~CDRCollector() {}
00064
00065
00066 virtual void collectPage(unsigned level) = 0;
00067 virtual void collectObject(unsigned level) = 0;
00068 virtual void collectGroup(unsigned level) = 0;
00069 virtual void collectVect(unsigned level) = 0;
00070 virtual void collectOtherList() = 0;
00071 virtual void collectPath(const CDRPath &path) = 0;
00072 virtual void collectLevel(unsigned level) = 0;
00073 virtual void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) = 0;
00074 virtual void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill) = 0;
00075 virtual void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
00076 double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
00077 const CDRPath &startMarker, const CDRPath &endMarker) = 0;
00078 virtual void collectRotate(double angle, double cx, double cy) = 0;
00079 virtual void collectFlags(unsigned flags, bool considerFlags) = 0;
00080 virtual void collectPageSize(double width, double height, double offsetX, double offsetY) = 0;
00081 virtual void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) = 0;
00082 virtual void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) = 0;
00083 virtual void collectBmp(unsigned imageId, unsigned colorModel, unsigned width, unsigned height, unsigned bpp, const std::vector<unsigned> &palette, const std::vector<unsigned char> &bitmap) = 0;
00084 virtual void collectBmp(unsigned imageId, const std::vector<unsigned char> &bitmap) = 0;
00085 virtual void collectBmpf(unsigned patternId, unsigned width, unsigned height, const std::vector<unsigned char> &pattern) = 0;
00086 virtual void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) = 0;
00087 virtual void collectFillTransform(const CDRTransforms &fillTrafos) = 0;
00088 virtual void collectFillOpacity(double opacity) = 0;
00089 virtual void collectPolygon() = 0;
00090 virtual void collectSpline() = 0;
00091 virtual void collectColorProfile(const std::vector<unsigned char> &profile) = 0;
00092 virtual void collectBBox(double x0, double y0, double x1, double y1) = 0;
00093 virtual void collectSpnd(unsigned spnd) = 0;
00094 virtual void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) = 0;
00095 virtual void collectPaletteEntry(unsigned colorId, unsigned userId, const CDRColor &color) = 0;
00096 virtual void collectText(unsigned textId, unsigned styleId, const std::vector<unsigned char> &data,
00097 const std::vector<unsigned char> &charDescriptions, const std::map<unsigned, CDRCharacterStyle> &styleOverrides) = 0;
00098 virtual void collectArtisticText(double x, double y) = 0;
00099 virtual void collectParagraphText(double x, double y, double width, double height) = 0;
00100 virtual void collectStld(unsigned id, const CDRCharacterStyle &charStyle) = 0;
00101 };
00102
00103 }
00104
00105 #endif
00106