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 <librevenge/librevenge.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, ::librevenge::RVNGDrawingInterface *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 librevenge::RVNGBinaryData &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 _startDocument();
75  void _endDocument();
76  void _startPage(double width, double height);
77  void _endPage();
78  void _flushCurrentPath();
79 
80  void _fillProperties(librevenge::RVNGPropertyList &propList);
81  void _lineProperties(librevenge::RVNGPropertyList &propList);
82  void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor);
83 
84  librevenge::RVNGDrawingInterface *m_painter;
85 
90 
92  unsigned m_pageIndex;
95  unsigned m_spnd;
98  const std::vector<CDRTextLine> *m_currentText;
101 
108  std::stack<CDROutputElementList> *m_outputElements;
109  std::stack<CDROutputElementList> m_contentOutputElements;
110  std::stack<CDROutputElementList> m_fillOutputElements;
111  std::stack<unsigned> m_groupLevels;
112  std::stack<CDRTransforms> m_groupTransforms;
115 
117 };
118 
119 } // namespace libcdr
120 
121 #endif /* __CDRCOLLECTOR_H__ */
122 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
const std::vector< CDRTextLine > * m_currentText
Definition: CDRContentCollector.h:98
unsigned m_pageIndex
Definition: CDRContentCollector.h:92
void _flushCurrentPath()
Definition: CDRContentCollector.cpp:165
void collectOtherList()
Definition: CDRContentCollector.cpp:154
void collectColorProfile(const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:58
CDRFillStyle m_currentFillStyle
Definition: CDRContentCollector.h:93
std::stack< unsigned > m_groupLevels
Definition: CDRContentCollector.h:111
Definition: CDRTypes.h:23
CDRTransforms m_fillTransforms
Definition: CDRContentCollector.h:104
Definition: CDRPath.h:34
CDRPage m_page
Definition: CDRContentCollector.h:91
void collectFillOpacity(double opacity)
Definition: CDRContentCollector.cpp:1160
std::stack< CDRTransforms > m_groupTransforms
Definition: CDRContentCollector.h:112
CDRImage m_currentImage
Definition: CDRContentCollector.h:97
Definition: CDRTypes.h:225
void _generateBitmapFromPattern(librevenge::RVNGBinaryData &bitmap, const CDRPattern &pattern, const CDRColor &fgColor, const CDRColor &bgColor)
Definition: CDRContentCollector.cpp:1080
Definition: CDRTypes.h:84
void collectParagraphText(double x, double y, double width, double height)
Definition: CDRContentCollector.cpp:1231
unsigned m_currentPageLevel
Definition: CDRContentCollector.h:96
unsigned m_currentObjectLevel
Definition: CDRContentCollector.h:96
bool m_isInPolygon
Definition: CDRContentCollector.h:106
void collectBmp(unsigned, unsigned, unsigned, unsigned, unsigned, const std::vector< unsigned > &, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:50
void collectPpdt(const std::vector< std::pair< double, double > > &points, const std::vector< unsigned > &knotVector)
Definition: CDRContentCollector.cpp:1155
unsigned m_spnd
Definition: CDRContentCollector.h:95
Definition: CDRTypes.h:236
Definition: CDRTypes.h:136
unsigned m_currentVectLevel
Definition: CDRContentCollector.h:96
Definition: CDRTypes.h:100
void collectPath(const CDRPath &path)
Definition: CDRContentCollector.cpp:159
void collectPage(unsigned level)
Definition: CDRContentCollector.cpp:100
void collectVect(unsigned level)
Definition: CDRContentCollector.cpp:132
void collectGroup(unsigned level)
Definition: CDRContentCollector.cpp:119
Definition: CDRTypes.h:177
void collectSpline()
Definition: CDRContentCollector.cpp:601
void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform)
Definition: CDRContentCollector.cpp:491
bool m_ignorePage
Definition: CDRContentCollector.h:89
void collectPaletteEntry(unsigned, unsigned, const CDRColor &)
Definition: CDRContentCollector.h:62
void collectRotate(double angle, double cx, double cy)
Definition: CDRContentCollector.cpp:586
bool m_isInSpline
Definition: CDRContentCollector.h:107
void _endDocument()
Definition: CDRContentCollector.cpp:61
std::stack< CDROutputElementList > m_fillOutputElements
Definition: CDRContentCollector.h:110
CDRParserState & m_ps
Definition: CDRContentCollector.h:116
std::stack< CDROutputElementList > m_contentOutputElements
Definition: CDRContentCollector.h:109
void collectPolygon()
Definition: CDRContentCollector.cpp:596
void collectFlags(unsigned flags, bool considerFlags)
Definition: CDRContentCollector.cpp:142
void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2)
Definition: CDRContentCollector.cpp:1148
void _fillProperties(librevenge::RVNGPropertyList &propList)
Definition: CDRContentCollector.cpp:613
void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy)
Definition: CDRContentCollector.cpp:606
CDRLineStyle m_currentLineStyle
Definition: CDRContentCollector.h:94
void collectSpnd(unsigned spnd)
Definition: CDRContentCollector.cpp:1178
CDRBox m_currentTextBox
Definition: CDRContentCollector.h:100
void collectBBox(double x0, double y0, double x1, double y1)
Definition: CDRContentCollector.cpp:1165
CDRPolygon * m_polygon
Definition: CDRContentCollector.h:105
double m_fillOpacity
Definition: CDRContentCollector.h:114
CDRContentCollector & operator=(const CDRContentCollector &)
unsigned m_currentGroupLevel
Definition: CDRContentCollector.h:96
void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data)
Definition: CDRContentCollector.cpp:1186
void collectArtisticText(double x, double y)
Definition: CDRContentCollector.cpp:1222
bool m_isPageProperties
Definition: CDRContentCollector.h:87
void _startPage(double width, double height)
Definition: CDRContentCollector.cpp:72
CDRContentCollector(CDRParserState &ps,::librevenge::RVNGDrawingInterface *painter)
void _lineProperties(librevenge::RVNGPropertyList &propList)
Definition: CDRContentCollector.cpp:931
Definition: CDRContentCollector.h:26
std::stack< CDROutputElementList > * m_outputElements
Definition: CDRContentCollector.h:108
void _startDocument()
Definition: CDRContentCollector.cpp:51
Definition: CDRTypes.h:112
void collectFillStyle(unsigned short fillType, const CDRColor &color1, const CDRColor &color2, const CDRGradient &gradient, const CDRImageFill &imageFill)
Definition: CDRContentCollector.cpp:574
void collectLevel(unsigned level)
Definition: CDRContentCollector.cpp:504
void _endPage()
Definition: CDRContentCollector.cpp:86
bool m_isPageStarted
Definition: CDRContentCollector.h:88
void collectFillTransform(const CDRTransforms &fillTrafo)
Definition: CDRContentCollector.cpp:499
void collectObject(unsigned level)
Definition: CDRContentCollector.cpp:109
Definition: CDRCollector.h:32
void collectLineStyle(unsigned short lineType, unsigned short capsType, unsigned short joinType, double lineWidth, double stretch, double angle, const CDRColor &color, const std::vector< unsigned > &dashArray, const CDRPath &startMarker, const CDRPath &endMarker)
Definition: CDRContentCollector.cpp:579
void collectText(unsigned, unsigned, const std::vector< unsigned char > &, const std::vector< unsigned char > &, const std::map< unsigned, CDRCharacterStyle > &)
Definition: CDRContentCollector.h:63
Definition: CDRTypes.h:52
CDRTransforms m_currentTransforms
Definition: CDRContentCollector.h:103
Definition: CDRTypes.h:215
CDRBox m_currentBBox
Definition: CDRContentCollector.h:99
Definition: CDRTypes.h:70
CDRPath m_currentPath
Definition: CDRContentCollector.h:102
CDRSplineData m_splineData
Definition: CDRContentCollector.h:113
Definition: CDRTypes.h:191
virtual ~CDRContentCollector()
Definition: CDRContentCollector.cpp:43
void collectBmpf(unsigned, unsigned, unsigned, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:52
void collectBmp(unsigned, const std::vector< unsigned char > &)
Definition: CDRContentCollector.h:51
void collectPageSize(double, double, double, double)
Definition: CDRContentCollector.h:47
void collectStld(unsigned, const CDRCharacterStyle &)
Definition: CDRContentCollector.h:67
Definition: CDRTransforms.h:39
librevenge::RVNGDrawingInterface * m_painter
Definition: CDRContentCollector.h:84
Definition: CDRCollector.h:59
bool m_isDocumentStarted
Definition: CDRContentCollector.h:86

Generated for libcdr by doxygen 1.8.5