CDRContentCollector.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 __CDRCONTENTCOLLECTOR_H__
11 #define __CDRCONTENTCOLLECTOR_H__
12 
13 #include <map>
14 #include <vector>
15 #include <stack>
16 #include <libwpg/libwpg.h>
17 #include <lcms2.h>
18 #include "CDRTypes.h"
19 #include "CDRPath.h"
20 #include "CDROutputElementList.h"
21 #include "CDRCollector.h"
22 
23 namespace libcdr
24 {
25 
27 {
28 public:
29  CDRContentCollector(CDRParserState &ps, ::libwpg::WPGPaintInterface *painter);
30  virtual ~CDRContentCollector();
31 
32  // collector functions
33  void collectPage(unsigned level);
34  void collectObject(unsigned level);
35  void collectGroup(unsigned level);
36  void collectVect(unsigned level);
37  void collectOtherList();
38  void collectPath(const CDRPath &path);
39  void collectLevel(unsigned level);
40  void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform);
41  void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill);
42  void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth,
43  double stretch, double angle, const CDRColor &color, const std::vector<unsigned> &dashArray,
44  const CDRPath &startMarker, const CDRPath &endMarker);
45  void collectRotate(double angle, double cx, double cy);
46  void collectFlags(unsigned flags, bool considerFlags);
47  void collectPageSize(double, double, double, double) {}
48  void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy);
49  void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2);
50  void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector<unsigned> &, const std::vector<unsigned char> &) {}
51  void collectBmp(unsigned, const std::vector<unsigned char> &) {}
52  void collectBmpf(unsigned, unsigned, unsigned, const std::vector<unsigned char> &) {}
53  void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector);
54  void collectFillTransform(const CDRTransforms &fillTrafo);
55  void collectFillOpacity(double opacity);
56  void collectPolygon();
57  void collectSpline();
58  void collectColorProfile(const std::vector<unsigned char> &) {}
59  void collectBBox(double x0, double y0, double x1, double y1);
60  void collectSpnd(unsigned spnd);
61  void collectVectorPattern(unsigned id, const WPXBinaryData &data);
62  void collectPaletteEntry(unsigned, unsigned, const CDRColor &) {}
63  void collectText(unsigned, unsigned, const std::vector<unsigned char> &,
64  const std::vector<unsigned char> &, const std::map<unsigned, CDRCharacterStyle> &) {}
65  void collectArtisticText(double x, double y);
66  void collectParagraphText(double x, double y, double width, double height);
67  void collectStld(unsigned, const CDRCharacterStyle &) {}
68 
69 private:
72 
73  // helper functions
74  void _startPage(double width, double height);
75  void _endPage();
76  void _flushCurrentPath();
77 
78  void _fillProperties(WPXPropertyList &propList, WPXPropertyListVector &vec);
79  void _lineProperties(WPXPropertyList &propList);
80  void _generateBitmapFromPattern(WPXBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
81 
82  libwpg::WPGPaintInterface *m_painter;
83 
87 
89  unsigned m_pageIndex;
92  unsigned m_spnd;
95  const std::vector<CDRTextLine> *m_currentText;
98 
105  std::stack<CDROutputElementList> *m_outputElements;
106  std::stack<CDROutputElementList> m_contentOutputElements;
107  std::stack<CDROutputElementList> m_fillOutputElements;
108  std::stack<unsigned> m_groupLevels;
109  std::stack<CDRTransforms> m_groupTransforms;
112 
114 };
115 
116 } // namespace libcdr
117 
118 #endif /* __CDRCOLLECTOR_H__ */
119 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libcdr by doxygen 1.8.3.1