CDRCollector.h Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 <librevenge/librevenge.h>
17 #include <librevenge-stream/librevenge-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
32 class CDRParserState
33 {
34 public:
35 CDRParserState();
36 ~CDRParserState();
37 std::map<unsigned, librevenge::RVNGBinaryData> m_bmps;
38 std::map<unsigned, CDRPattern> m_patterns;
39 std::map<unsigned, librevenge::RVNGBinaryData> 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 std::map<unsigned, CDRStyle> m_styles;
44 std::map<unsigned, CDRFillStyle> m_fillStyles;
45 std::map<unsigned, CDRLineStyle> m_lineStyles;
46
47 unsigned _getRGBColor(const CDRColor &color);
48 unsigned getBMPColor(const CDRColor &color);
49 librevenge::RVNGString getRGBColorString(const CDRColor &color);
50 cmsHTRANSFORM m_colorTransformCMYK2RGB;
51 cmsHTRANSFORM m_colorTransformLab2RGB;
52 cmsHTRANSFORM m_colorTransformRGB2RGB;
53
54 void setColorTransform(const std::vector<unsigned char> &profile);
55 void setColorTransform(librevenge::RVNGInputStream *input);
56 void getRecursedStyle(CDRStyle &style, unsigned styleId);
57
58 private:
59 CDRParserState(const CDRParserState &);
60 CDRParserState &operator=(const CDRParserState &);
61 };
62
63 class CDRCollector
64 {
65 public:
66 CDRCollector() {}
67 virtual ~CDRCollector() {}
68
69 // collector functions
70 virtual void collectPage(unsigned level) = 0;
71 virtual void collectObject(unsigned level) = 0;
72 virtual void collectGroup(unsigned level) = 0;
73 virtual void collectVect(unsigned level) = 0;
74 virtual void collectOtherList() = 0;
75 virtual void collectPath(const CDRPath &path) = 0;
76 virtual void collectLevel(unsigned level) = 0;
77 virtual void collectTransform(const CDRTransforms &transforms, bool considerGroupTransform) = 0;
78 virtual void collectFillStyle(unsigned id, const CDRFillStyle &fillStyle) = 0;
79 virtual void collectFillStyleId(unsigned id) = 0;
80 virtual void collectLineStyle(unsigned id, const CDRLineStyle &lineStyle) = 0;
81 virtual void collectLineStyleId(unsigned id) = 0;
82 virtual void collectRotate(double angle, double cx, double cy) = 0;
83 virtual void collectFlags(unsigned flags, bool considerFlags) = 0;
84 virtual void collectPageSize(double width, double height, double offsetX, double offsetY) = 0;
85 virtual void collectPolygonTransform(unsigned numAngles, unsigned nextPoint, double rx, double ry, double cx, double cy) = 0;
86 virtual void collectBitmap(unsigned imageId, double x1, double x2, double y1, double y2) = 0;
87 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;
88 virtual void collectBmp(unsigned imageId, const std::vector<unsigned char> &bitmap) = 0;
89 virtual void collectBmpf(unsigned patternId, unsigned width, unsigned height, const std::vector<unsigned char> &pattern) = 0;
90 virtual void collectPpdt(const std::vector<std::pair<double, double> > &points, const std::vector<unsigned> &knotVector) = 0;
91 virtual void collectFillTransform(const CDRTransforms &fillTrafos) = 0;
92 virtual void collectFillOpacity(double opacity) = 0;
93 virtual void collectPolygon() = 0;
94 virtual void collectSpline() = 0;
95 virtual void collectColorProfile(const std::vector<unsigned char> &profile) = 0;
96 virtual void collectBBox(double x0, double y0, double x1, double y1) = 0;
97 virtual void collectSpnd(unsigned spnd) = 0;
98 virtual void collectVectorPattern(unsigned id, const librevenge::RVNGBinaryData &data) = 0;
99 virtual void collectPaletteEntry(unsigned colorId, unsigned userId, const CDRColor &color) = 0;
100 virtual void collectText(unsigned textId, unsigned styleId, const std::vector<unsigned char> &data,
101 const std::vector<unsigned char> &charDescriptions, const std::map<unsigned, CDRStyle> &styleOverrides) = 0;
102 virtual void collectArtisticText(double x, double y) = 0;
103 virtual void collectParagraphText(double x, double y, double width, double height) = 0;
104 virtual void collectStld(unsigned id, const CDRStyle &style) = 0;
105 virtual void collectStyleId(unsigned id) = 0;
106 };
107
108 } // namespace libcdr
109
110 #endif /* __CDRCOLLECTOR_H__ */
111 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
CDRColorProfiles.h
libcdr::CDRParserState::m_lineStyles
std::map< unsigned, CDRLineStyle > m_lineStyles
Definition: CDRCollector.h:45
libcdr::CDRParserState::m_colorTransformRGB2RGB
cmsHTRANSFORM m_colorTransformRGB2RGB
Definition: CDRCollector.h:52
libcdr::CDRPath
Definition: CDRPath.h:34
libcdr::CDRParserState::getBMPColor
unsigned getBMPColor(const CDRColor &color)
Definition: CDRCollector.cpp:87
libcdr::CDRParserState::_getRGBColor
unsigned _getRGBColor(const CDRColor &color)
Definition: CDRCollector.cpp:120
libcdr::CDRParserState::m_colorTransformLab2RGB
cmsHTRANSFORM m_colorTransformLab2RGB
Definition: CDRCollector.h:51
libcdr::CDRParserState::m_colorTransformCMYK2RGB
cmsHTRANSFORM m_colorTransformCMYK2RGB
Definition: CDRCollector.h:50
libcdr::CDRParserState::getRecursedStyle
void getRecursedStyle(CDRStyle &style, unsigned styleId)
Definition: CDRCollector.cpp:580
libcdr::CDRFillStyle
Definition: CDRTypes.h:100
libcdr::CDRCollector::~CDRCollector
virtual ~CDRCollector()
Definition: CDRCollector.h:67
libcdr::CDRParserState::m_bmps
std::map< unsigned, librevenge::RVNGBinaryData > m_bmps
Definition: CDRCollector.h:37
libcdr_utils.h
libcdr::CDRParserState::m_documentPalette
std::map< unsigned, CDRColor > m_documentPalette
Definition: CDRCollector.h:41
libcdr
Definition: CDRCollector.h:29
libcdr::CDRParserState::m_styles
std::map< unsigned, CDRStyle > m_styles
Definition: CDRCollector.h:43
libcdr::CDRParserState::setColorTransform
void setColorTransform(const std::vector< unsigned char > &profile)
Definition: CDRCollector.cpp:42
CDROutputElementList.h
libcdr::CDRCollector::CDRCollector
CDRCollector()
Definition: CDRCollector.h:66
libcdr::CDRParserState::m_fillStyles
std::map< unsigned, CDRFillStyle > m_fillStyles
Definition: CDRCollector.h:44
libcdr::CDRParserState::operator=
CDRParserState & operator=(const CDRParserState &)
libcdr::CDRParserState::m_pages
std::vector< CDRPage > m_pages
Definition: CDRCollector.h:40
libcdr::CDRParserState::~CDRParserState
~CDRParserState()
Definition: CDRCollector.cpp:32
CDRTypes.h
libcdr::CDRLineStyle
Definition: CDRTypes.h:112
libcdr::CDRParserState::CDRParserState
CDRParserState()
Definition: CDRCollector.cpp:16
libcdr::CDRParserState
Definition: CDRCollector.h:32
libcdr::CDRParserState::m_patterns
std::map< unsigned, CDRPattern > m_patterns
Definition: CDRCollector.h:38
libcdr::CDRColor
Definition: CDRTypes.h:52
libcdr::CDRParserState::getRGBColorString
librevenge::RVNGString getRGBColorString(const CDRColor &color)
Definition: CDRCollector.cpp:573
CDRPath.h
libcdr::CDRParserState::m_vects
std::map< unsigned, librevenge::RVNGBinaryData > m_vects
Definition: CDRCollector.h:39
libcdr::CDRStyle
Definition: CDRTypes.h:136
libcdr::CDRTransforms
Definition: CDRTransforms.h:50
libcdr::CDRCollector
Definition: CDRCollector.h:63
libcdr::CDRParserState::m_texts
std::map< unsigned, std::vector< CDRTextLine > > m_texts
Definition: CDRCollector.h:42