- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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