CDRCollector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is part of the libcdr project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef __CDRCOLLECTOR_H__
11 #define __CDRCOLLECTOR_H__
12 
13 #include <map>
14 #include <vector>
15 #include <stack>
16 #include <libwpg/libwpg.h>
17 #include <libwpd-stream/libwpd-stream.h>
18 #include <lcms2.h>
19 #include "CDRTypes.h"
20 #include "CDRPath.h"
21 #include "CDROutputElementList.h"
22 #include "libcdr_utils.h"
23 
24 namespace
25 {
26 #include "CDRColorProfiles.h"
27 }
28 
29 namespace libcdr
30 {
31 
33 {
34 public:
37  std::map<unsigned, WPXBinaryData> m_bmps;
38  std::map<unsigned, CDRPattern> m_patterns;
39  std::map<unsigned, WPXBinaryData> m_vects;
40  std::vector<CDRPage> m_pages;
41  std::map<unsigned, CDRColor> m_documentPalette;
42  std::map<unsigned, std::vector<CDRTextLine> > m_texts;
43 
44  unsigned _getRGBColor(const CDRColor &color);
45  unsigned getBMPColor(const CDRColor &color);
46  WPXString getRGBColorString(const CDRColor &color);
47  cmsHTRANSFORM m_colorTransformCMYK2RGB;
48  cmsHTRANSFORM m_colorTransformLab2RGB;
49  cmsHTRANSFORM m_colorTransformRGB2RGB;
50 
51  void setColorTransform(const std::vector<unsigned char> &profile);
52  void setColorTransform(WPXInputStream *input);
53 
54 private:
57 };
58 
60 {
61 public:
63  virtual ~CDRCollector() {}
64 
65  // collector functions
66  virtual void collectPage(unsigned level) = 0;
67  virtual void collectObject(unsigned level) = 0;
68  virtual void collectGroup(unsigned level) = 0;
69  virtual void collectVect(unsigned level) = 0;
70  virtual void collectOtherList() = 0;
71  virtual void collectPath(const CDRPath &path) = 0;
72  virtual void collectLevel(unsigned level) = 0;
73  virtual void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) = 0;
74  virtual void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill) = 0;
75  virtual void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
76  double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
77  const CDRPath &startMarker, const CDRPath &endMarker) = 0;
78  virtual void collectRotate(double angle, double cx, double cy) = 0;
79  virtual void collectFlags(unsigned flags, bool considerFlags) = 0;
80  virtual void collectPageSize(double width, double height, double offsetX, double offsetY) = 0;
81  virtual void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) = 0;
82  virtual void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) = 0;
83  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;
84  virtual void collectBmp(unsigned imageId, const std::vector<unsigned char> &bitmap) = 0;
85  virtual void collectBmpf(unsigned patternId, unsigned width, unsigned height, const std::vector<unsigned char> &pattern) = 0;
86  virtual void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) = 0;
87  virtual void collectFillTransform(const CDRTransforms &fillTrafos) = 0;
88  virtual void collectFillOpacity(double opacity) = 0;
89  virtual void collectPolygon() = 0;
90  virtual void collectSpline() = 0;
91  virtual void collectColorProfile(const std::vector<unsigned char> &profile) = 0;
92  virtual void collectBBox(double x0, double y0, double x1, double y1) = 0;
93  virtual void collectSpnd(unsigned spnd) = 0;
94  virtual void collectVectorPattern(unsigned id, const WPXBinaryData &data) = 0;
95  virtual void collectPaletteEntry(unsigned colorId, unsigned userId, const CDRColor &color) = 0;
96  virtual void collectText(unsigned textId, unsigned styleId, const std::vector<unsigned char> &data,
97  const std::vector<unsigned char> &charDescriptions, const std::map<unsigned, CDRCharacterStyle> &styleOverrides) = 0;
98  virtual void collectArtisticText(double x, double y) = 0;
99  virtual void collectParagraphText(double x, double y, double width, double height) = 0;
100  virtual void collectStld(unsigned id, const CDRCharacterStyle &charStyle) = 0;
101 };
102 
103 } // namespace libcdr
104 
105 #endif /* __CDRCOLLECTOR_H__ */
106 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libcdr by doxygen 1.8.3.1