VSDCollector.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* libvisio
3  * Version: MPL 1.1 / GPLv2+ / LGPLv2+
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License or as specified alternatively below. You may obtain a copy of
8  * the License at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * Major Contributor(s):
16  * Copyright (C) 2011 Fridrich Strba <fridrich.strba@bluewin.ch>
17  * Copyright (C) 2011 Eilidh McAdam <tibbylickle@gmail.com>
18  *
19  *
20  * All Rights Reserved.
21  *
22  * For minor contributions see the git repository.
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
26  * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
27  * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
28  * instead of those above.
29  */
30 
31 #ifndef VSDCOLLECTOR_H
32 #define VSDCOLLECTOR_H
33 
34 #include <vector>
35 #include <boost/optional.hpp>
36 #include "VSDParser.h"
37 
38 namespace libvisio
39 {
40 
42 {
43 public:
45  virtual ~VSDCollector() {}
46 
47  virtual void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc) = 0;
48  virtual void collectForeignData(unsigned level, const WPXBinaryData &binaryData) = 0;
49  virtual void collectOLEList(unsigned id, unsigned level) = 0;
50  virtual void collectOLEData(unsigned id, unsigned level, const WPXBinaryData &oleData) = 0;
51  virtual void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop) = 0;
52  virtual void collectLine(unsigned level, const boost::optional<double> &strokeWidth, const boost::optional<Colour> &c, const boost::optional<unsigned char> &linePattern,
53  const boost::optional<unsigned char> &startMarker, const boost::optional<unsigned char> &endMarker,
54  const boost::optional<unsigned char> &lineCap) = 0;
55  virtual void collectFillAndShadow(unsigned level, const boost::optional<Colour> &colourFG, const boost::optional<Colour> &colourBG,
56  const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
57  const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
58  const boost::optional<Colour> &shfgc, const boost::optional<double> &shadowOffsetX, const boost::optional<double> &shadowOffsetY) = 0;
59  virtual void collectFillAndShadow(unsigned level, const boost::optional<Colour> &colourFG, const boost::optional<Colour> &colourBG,
60  const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
61  const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
62  const boost::optional<Colour> &shfgc) = 0;
63  virtual void collectGeometry(unsigned id, unsigned level, bool noFill, bool noLine, bool noShow) = 0;
64  virtual void collectMoveTo(unsigned id, unsigned level, double x, double y) = 0;
65  virtual void collectLineTo(unsigned id, unsigned level, double x, double y) = 0;
66  virtual void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow) = 0;
67  virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree,
68  std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
69  virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID) = 0;
70  virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, const NURBSData &data) = 0;
71  virtual void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType, const std::vector<std::pair<double, double> > &points) = 0;
72  virtual void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned dataID) = 0;
73  virtual void collectPolylineTo(unsigned id, unsigned level, double x, double y, const PolylineData &data) = 0;
74  virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot,
75  std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
76  virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points) = 0;
77  virtual void collectXFormData(unsigned level, const XForm &xform) = 0;
78  virtual void collectTxtXForm(unsigned level, const XForm &txtxform) = 0;
79  virtual void collectShapesOrder(unsigned id, unsigned level, const std::vector<unsigned> &shapeIds) = 0;
80  virtual void collectForeignDataType(unsigned level, unsigned foreignType, unsigned foreignFormat, double offsetX, double offsetY, double width, double height) = 0;
81  virtual void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale) = 0;
82  virtual void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, bool isBackgroundPage, const VSDName &pageName) = 0;
83  virtual void collectShape(unsigned id, unsigned level, unsigned parent, unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned fillStyle, unsigned textStyle) = 0;
84  virtual void collectSplineStart(unsigned id, unsigned level, double x, double y, double secondKnot, double firstKnot, double lastKnot, unsigned degree) = 0;
85  virtual void collectSplineKnot(unsigned id, unsigned level, double x, double y, double knot) = 0;
86  virtual void collectSplineEnd() = 0;
87  virtual void collectInfiniteLine(unsigned id, unsigned level, double x1, double y1, double x2, double y2) = 0;
88  virtual void collectRelCubBezTo(unsigned id, unsigned level, double x, double y, double a, double b, double c, double d) = 0;
89  virtual void collectRelEllipticalArcTo(unsigned id, unsigned level, double x, double y, double a, double b, double c, double d) = 0;
90  virtual void collectRelLineTo(unsigned id, unsigned level, double x, double y) = 0;
91  virtual void collectRelMoveTo(unsigned id, unsigned level, double x, double y) = 0;
92  virtual void collectRelQuadBezTo(unsigned id, unsigned level, double x, double y, double a, double b) = 0;
93 
94  virtual void collectUnhandledChunk(unsigned id, unsigned level) = 0;
95 
96  virtual void collectText(unsigned level, const ::WPXBinaryData &textStream, TextFormat format) = 0;
97  virtual void collectCharIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<VSDName> &font,
98  const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize, const boost::optional<bool> &bold,
99  const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
100  const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
101  const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
102  const boost::optional<bool> &subscript) = 0;
103  virtual void collectDefaultCharStyle(unsigned charCount, const boost::optional<VSDName> &font, const boost::optional<Colour> &fontColour,
104  const boost::optional<double> &fontSize, const boost::optional<bool> &bold, const boost::optional<bool> &italic,
105  const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline, const boost::optional<bool> &strikeout,
106  const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps, const boost::optional<bool> &initcaps,
107  const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript, const boost::optional<bool> &subscript) = 0;
108  virtual void collectParaIX(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
109  const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
110  const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
111  const boost::optional<unsigned> &flags) = 0;
112  virtual void collectDefaultParaStyle(unsigned charCount, const boost::optional<double> &indFirst, const boost::optional<double> &indLeft,
113  const boost::optional<double> &indRight, const boost::optional<double> &spLine, const boost::optional<double> &spBefore,
114  const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align, const boost::optional<unsigned> &flags) = 0;
115  virtual void collectTextBlock(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
116  const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
117  const boost::optional<unsigned char> &verticalAlign, const boost::optional<bool> &isBgFilled,
118  const boost::optional<Colour> &bgColour, const boost::optional<double> &defaultTabStop,
119  const boost::optional<unsigned char> &textDirection) = 0;
120  virtual void collectNameList(unsigned id, unsigned level) = 0;
121  virtual void collectName(unsigned id, unsigned level, const ::WPXBinaryData &name, TextFormat format) = 0;
122  virtual void collectPageSheet(unsigned id, unsigned level) = 0;
123 
124  // Style collectors
125  virtual void collectStyleSheet(unsigned id, unsigned level,unsigned parentLineStyle, unsigned parentFillStyle, unsigned parentTextStyle) = 0;
126  virtual void collectLineStyle(unsigned level, const boost::optional<double> &strokeWidth, const boost::optional<Colour> &c, const boost::optional<unsigned char> &linePattern,
127  const boost::optional<unsigned char> &startMarker, const boost::optional<unsigned char> &endMarker,
128  const boost::optional<unsigned char> &lineCap) = 0;
129  virtual void collectFillStyle(unsigned level, const boost::optional<Colour> &colourFG, const boost::optional<Colour> &colourBG,
130  const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
131  const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
132  const boost::optional<Colour> &shfgc, const boost::optional<double> &shadowOffsetX, const boost::optional<double> &shadowOffsetY) = 0;
133  virtual void collectFillStyle(unsigned level, const boost::optional<Colour> &colourFG, const boost::optional<Colour> &colourBG,
134  const boost::optional<unsigned char> &fillPattern, const boost::optional<double> &fillFGTransparency,
135  const boost::optional<double> &fillBGTransparency, const boost::optional<unsigned char> &shadowPattern,
136  const boost::optional<Colour> &shfgc) = 0;
137  virtual void collectCharIXStyle(unsigned id, unsigned level, unsigned charCount, const boost::optional<VSDName> &font,
138  const boost::optional<Colour> &fontColour, const boost::optional<double> &fontSize, const boost::optional<bool> &bold,
139  const boost::optional<bool> &italic, const boost::optional<bool> &underline, const boost::optional<bool> &doubleunderline,
140  const boost::optional<bool> &strikeout, const boost::optional<bool> &doublestrikeout, const boost::optional<bool> &allcaps,
141  const boost::optional<bool> &initcaps, const boost::optional<bool> &smallcaps, const boost::optional<bool> &superscript,
142  const boost::optional<bool> &subscript) = 0;
143  virtual void collectParaIXStyle(unsigned id, unsigned level, unsigned charCount, const boost::optional<double> &indFirst,
144  const boost::optional<double> &indLeft, const boost::optional<double> &indRight, const boost::optional<double> &spLine,
145  const boost::optional<double> &spBefore, const boost::optional<double> &spAfter, const boost::optional<unsigned char> &align,
146  const boost::optional<unsigned> &flags) = 0;
147  virtual void collectTextBlockStyle(unsigned level, const boost::optional<double> &leftMargin, const boost::optional<double> &rightMargin,
148  const boost::optional<double> &topMargin, const boost::optional<double> &bottomMargin,
149  const boost::optional<unsigned char> &verticalAlign, const boost::optional<bool> &isBgFilled,
150  const boost::optional<Colour> &bgColour, const boost::optional<double> &defaultTabStop,
151  const boost::optional<unsigned char> &textDirection) = 0;
152  // Field list
153  virtual void collectFieldList(unsigned id, unsigned level) = 0;
154  virtual void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId) = 0;
155  virtual void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId) = 0;
156 
157  // Temporary hack
158  virtual void startPage(unsigned pageId) = 0;
159  virtual void endPage() = 0;
160  virtual void endPages() = 0;
161 
162 private:
163  VSDCollector(const VSDCollector &);
165 };
166 
167 } // namespace libvisio
168 
169 #endif /* VSDCOLLECTOR_H */
170 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Generated for libvisio by doxygen 1.8.3.1