VSDXCollector.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 VSDXCOLLECTOR_H
32 #define VSDXCOLLECTOR_H
33 
34 #include <vector>
35 #include "VSDXParser.h"
36 
37 namespace libvisio
38 {
39 
41 {
42 public:
44  virtual ~VSDXCollector() {}
45 
46  virtual void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc) = 0;
47  virtual void collectForeignData(unsigned id, unsigned level, const WPXBinaryData &binaryData) = 0;
48  virtual void collectOLEList(unsigned id, unsigned level) = 0;
49  virtual void collectOLEData(unsigned id, unsigned level, const WPXBinaryData &oleData) = 0;
50  virtual void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop) = 0;
51  virtual void collectLine(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned linePattern, unsigned char startMarker, unsigned char endMarker, unsigned lineCap) = 0;
52  virtual void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG,
53  unsigned fillPattern, unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc,
54  double shadowOffsetX, double shadowOffsetY) = 0;
55  virtual void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern,
56  unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc) = 0;
57  virtual void collectGeometry(unsigned id, unsigned level, unsigned char geomFlags) = 0;
58  virtual void collectMoveTo(unsigned id, unsigned level, double x, double y) = 0;
59  virtual void collectLineTo(unsigned id, unsigned level, double x, double y) = 0;
60  virtual void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow) = 0;
61  virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree,
62  std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
63  virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID) = 0;
64  virtual void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points) = 0;
65  virtual void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID) = 0;
66  virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot,
67  std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights) = 0;
68  virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points) = 0;
69  virtual void collectXFormData(unsigned id, unsigned level, const XForm &xform) = 0;
70  virtual void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform) = 0;
71  virtual void collectShapeId(unsigned id, unsigned level, unsigned shapeId) = 0;
72  virtual void collectForeignDataType(unsigned id, unsigned level, unsigned foreignType, unsigned foreignFormat, double offsetX, double offsetY, double width, double height) = 0;
73  virtual void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale) = 0;
74  virtual void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, unsigned currentPageID) = 0;
75  virtual void collectShape(unsigned id, unsigned level, unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned fillStyle, unsigned textStyle) = 0;
76  virtual void collectSplineStart(unsigned id, unsigned level, double x, double y, double secondKnot, double firstKnot, double lastKnot, unsigned degree) = 0;
77  virtual void collectSplineKnot(unsigned id, unsigned level, double x, double y, double knot) = 0;
78  virtual void collectSplineEnd() = 0;
79  virtual void collectInfiniteLine(unsigned id, unsigned level, double x1, double y1, double x2, double y2) = 0;
80 
81  virtual void collectUnhandledChunk(unsigned id, unsigned level) = 0;
82 
83  virtual void collectColours(const std::vector<Colour> &colours) = 0;
84  virtual void collectFont(unsigned short fontID, const ::WPXBinaryData &textStream, TextFormat format) = 0;
85  virtual void collectText(unsigned id, unsigned level, const ::WPXBinaryData &textStream, TextFormat format) = 0;
86  virtual void collectVSDXCharStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId,
87  double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout,
88  bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace) = 0;
89  virtual void collectVSDXParaStyle(unsigned id , unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight,
90  double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags) = 0;
91  virtual void collectTextBlock(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin,
92  unsigned char verticalAlign, unsigned char bgClrId, const Colour &bgColour, double defaultTabStop,
93  unsigned char textDirection) = 0;
94  virtual void collectNameList(unsigned id, unsigned level) = 0;
95  virtual void collectName(unsigned id, unsigned level, const ::WPXBinaryData &name, TextFormat format) = 0;
96 
97  // Style collectors
98  virtual void collectStyleSheet(unsigned id, unsigned level, unsigned parentLineStyle, unsigned parentFillStyle, unsigned parentTextStyle) = 0;
99  virtual void collectLineStyle(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned char linePattern, unsigned char startMarker, unsigned char endMarker, unsigned char lineCap) = 0;
100  virtual void collectFillStyle(unsigned id, unsigned level, unsigned char colourIndexFG, unsigned char colourIndexBG, unsigned char fillPattern,
101  unsigned char fillFGTransparency, unsigned char fillBGTransparency, unsigned char shadowPattern, Colour shfgc,
102  double shadowOffsetX, double shadowOffsetY) = 0;
103  virtual void collectFillStyle(unsigned id, unsigned level, unsigned char colourIndexFG, unsigned char colourIndexBG, unsigned char fillPattern,
104  unsigned char fillFGTransparency, unsigned char fillBGTransparency, unsigned char shadowPattern, Colour shfgc) = 0;
105  virtual void collectCharIXStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId,
106  double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout,
107  bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace) = 0;
108  virtual void collectParaIXStyle(unsigned id , unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight,
109  double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags) = 0;
110  virtual void collectTextBlockStyle(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin,
111  unsigned char verticalAlign, unsigned char bgClrId, const Colour &bgColour, double defaultTabStop,
112  unsigned char textDirection) = 0;
113 
114  // Field list
115  virtual void collectFieldList(unsigned id, unsigned level) = 0;
116  virtual void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId) = 0;
117  virtual void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId) = 0;
118 
119  // Temporary hack
120  virtual void startPage() = 0;
121  virtual void endPage() = 0;
122  virtual void endPages() = 0;
123 
124 protected:
125  const ::WPXString getColourString(const Colour &c) const
126  {
127  ::WPXString sColour;
128  sColour.sprintf("#%.2x%.2x%.2x", c.r, c.g, c.b);
129  return sColour;
130  }
131 
132 private:
133  VSDXCollector(const VSDXCollector &);
135 };
136 
137 } // namespace libvisio
138 
139 #endif /* VSDXCOLLECTOR_H */
140 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
virtual void collectNameList(unsigned id, unsigned level)=0
virtual void collectUnhandledChunk(unsigned id, unsigned level)=0
virtual void collectLineStyle(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned char linePattern, unsigned char startMarker, unsigned char endMarker, unsigned char lineCap)=0
virtual void collectShapeId(unsigned id, unsigned level, unsigned shapeId)=0
virtual void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, unsigned currentPageID)=0
virtual void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform)=0
virtual void collectXFormData(unsigned id, unsigned level, const XForm &xform)=0
virtual void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern, unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc, double shadowOffsetX, double shadowOffsetY)=0
Definition: VSDXTypes.h:68
virtual void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)=0
unsigned char b
Definition: VSDXTypes.h:75
virtual void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot, std::vector< std::pair< double, double > > controlPoints, std::vector< double > knotVector, std::vector< double > weights)=0
virtual void collectOLEData(unsigned id, unsigned level, const WPXBinaryData &oleData)=0
virtual void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale)=0
virtual void collectLine(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned linePattern, unsigned char startMarker, unsigned char endMarker, unsigned lineCap)=0
virtual void collectGeometry(unsigned id, unsigned level, unsigned char geomFlags)=0
virtual void collectName(unsigned id, unsigned level, const ::WPXBinaryData &name, TextFormat format)=0
const ::WPXString getColourString(const Colour &c) const
Definition: VSDXCollector.h:125
virtual void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop)=0
virtual void collectFillStyle(unsigned id, unsigned level, unsigned char colourIndexFG, unsigned char colourIndexBG, unsigned char fillPattern, unsigned char fillFGTransparency, unsigned char fillBGTransparency, unsigned char shadowPattern, Colour shfgc, double shadowOffsetX, double shadowOffsetY)=0
virtual void collectForeignData(unsigned id, unsigned level, const WPXBinaryData &binaryData)=0
virtual void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc)=0
VSDXCollector & operator=(const VSDXCollector &)
virtual void collectMoveTo(unsigned id, unsigned level, double x, double y)=0
Definition: VSDXCollector.h:40
virtual void collectFont(unsigned short fontID, const ::WPXBinaryData &textStream, TextFormat format)=0
virtual void collectCharIXStyle(unsigned id, unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId, double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout, bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace)=0
virtual void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId)=0
virtual void collectInfiniteLine(unsigned id, unsigned level, double x1, double y1, double x2, double y2)=0
virtual void endPage()=0
virtual void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType, unsigned degree, std::vector< std::pair< double, double > > controlPoints, std::vector< double > knotVector, std::vector< double > weights)=0
virtual void startPage()=0
virtual void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow)=0
virtual void collectSplineKnot(unsigned id, unsigned level, double x, double y, double knot)=0
virtual void collectTextBlock(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin, unsigned char verticalAlign, unsigned char bgClrId, const Colour &bgColour, double defaultTabStop, unsigned char textDirection)=0
unsigned char g
Definition: VSDXTypes.h:74
TextFormat
Definition: VSDXTypes.h:179
virtual void collectTextBlockStyle(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin, unsigned char verticalAlign, unsigned char bgClrId, const Colour &bgColour, double defaultTabStop, unsigned char textDirection)=0
virtual void collectColours(const std::vector< Colour > &colours)=0
virtual void collectOLEList(unsigned id, unsigned level)=0
virtual void collectForeignDataType(unsigned id, unsigned level, unsigned foreignType, unsigned foreignFormat, double offsetX, double offsetY, double width, double height)=0
virtual void collectSplineEnd()=0
virtual void collectVSDXParaStyle(unsigned id, unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight, double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags)=0
virtual void collectLineTo(unsigned id, unsigned level, double x, double y)=0
virtual void collectShape(unsigned id, unsigned level, unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned fillStyle, unsigned textStyle)=0
VSDXCollector()
Definition: VSDXCollector.h:43
virtual void collectText(unsigned id, unsigned level, const ::WPXBinaryData &textStream, TextFormat format)=0
Definition: libvisio_utils.h:78
virtual void collectFieldList(unsigned id, unsigned level)=0
virtual void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector< std::pair< double, double > > &points)=0
virtual ~VSDXCollector()
Definition: VSDXCollector.h:44
virtual void collectParaIXStyle(unsigned id, unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight, double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags)=0
virtual void collectVSDXCharStyle(unsigned id, unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId, double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout, bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace)=0
virtual void collectStyleSheet(unsigned id, unsigned level, unsigned parentLineStyle, unsigned parentFillStyle, unsigned parentTextStyle)=0
Definition: VSDXTypes.h:38
unsigned char r
Definition: VSDXTypes.h:73
virtual void endPages()=0
virtual void collectSplineStart(unsigned id, unsigned level, double x, double y, double secondKnot, double firstKnot, double lastKnot, unsigned degree)=0

Generated for libvisio by doxygen 1.8.13