VSDXStylesCollector.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 VSDXSTYLESCOLLECTOR_H
32 #define VSDXSTYLESCOLLECTOR_H
33 
34 #include <map>
35 #include <vector>
36 #include <list>
37 #include "VSDXCollector.h"
38 #include "VSDXParser.h"
39 #include "libvisio_utils.h"
40 #include "VSDXStyles.h"
41 
42 namespace libvisio
43 {
44 
46 {
47 public:
49  std::vector<std::map<unsigned, XForm> > &groupXFormsSequence,
50  std::vector<std::map<unsigned, unsigned> > &groupMembershipsSequence,
51  std::vector<std::list<unsigned> > &documentPageShapeOrders
52  );
53  virtual ~VSDXStylesCollector() {};
54 
55  void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc);
56  void collectForeignData(unsigned id, unsigned level, const WPXBinaryData &binaryData);
57  void collectOLEList(unsigned id, unsigned level)
58  {
59  collectUnhandledChunk(id, level);
60  }
61  void collectOLEData(unsigned id, unsigned level, const WPXBinaryData &oleData);
62  void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop);
63  void collectLine(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned linePattern, unsigned char startMarker, unsigned char endMarker, unsigned lineCap);
64  void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern,
65  unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc,
66  double shadowOffsetX, double shadowOffsetY);
67  void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern,
68  unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc);
69  void collectGeometry(unsigned id, unsigned level, unsigned char geomFlags);
70  void collectMoveTo(unsigned id, unsigned level, double x, double y);
71  void collectLineTo(unsigned id, unsigned level, double x, double y);
72  void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow);
73  void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, unsigned char xType, unsigned char yType,
74  unsigned degree, std::vector<std::pair<double, double> > controlPoints,
75  std::vector<double> knotVector, std::vector<double> weights);
76  void collectNURBSTo(unsigned id, unsigned level, double x2, double y2, double knot, double knotPrev, double weight, double weightPrev, unsigned dataID);
77  void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > &points);
78  void collectPolylineTo(unsigned id , unsigned level, double x, double y, unsigned dataID);
79  void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, unsigned degree, double lastKnot,
80  std::vector<std::pair<double, double> > controlPoints, std::vector<double> knotVector, std::vector<double> weights);
81  void collectShapeData(unsigned id, unsigned level, unsigned char xType, unsigned char yType, std::vector<std::pair<double, double> > points);
82  void collectXFormData(unsigned id, unsigned level, const XForm &xform);
83  void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform);
84  void collectShapeId(unsigned id, unsigned level, unsigned shapeId);
85  void collectForeignDataType(unsigned id, unsigned level, unsigned foreignType, unsigned foreignFormat, double offsetX, double offsetY, double width, double height);
86  void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale);
87  void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, unsigned currentPageID);
88  void collectShape(unsigned id, unsigned level, unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned fillStyle, unsigned textStyle);
89  void collectSplineStart(unsigned id, unsigned level, double x, double y, double secondKnot, double firstKnot, double lastKnot, unsigned degree);
90  void collectSplineKnot(unsigned id, unsigned level, double x, double y, double knot);
91  void collectSplineEnd();
92  void collectInfiniteLine(unsigned id, unsigned level, double x1, double y1, double x2, double y2);
93  void collectUnhandledChunk(unsigned id, unsigned level);
94 
95  void collectColours(const std::vector<Colour> &colours);
96  void collectFont(unsigned short fontID, const ::WPXBinaryData &textStream, TextFormat format);
97 
98  void collectText(unsigned id, unsigned level, const ::WPXBinaryData &textStream, TextFormat format);
99  void collectVSDXCharStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId,
100  double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout,
101  bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace);
102  void collectVSDXParaStyle(unsigned id , unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight,
103  double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags);
104  void collectTextBlock(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin, unsigned char verticalAlign,
105  unsigned char bgClrId, const Colour &bgColour, double defaultTabStop, unsigned char textDirection);
106  void collectNameList(unsigned id, unsigned level)
107  {
108  collectUnhandledChunk(id, level);
109  }
110  void collectName(unsigned id, unsigned level, const ::WPXBinaryData &name, TextFormat format);
111 
112  // Style collectors
113  void collectStyleSheet(unsigned id, unsigned level, unsigned parentLineStyle, unsigned parentFillStyle, unsigned parentTextStyle);
114  void collectLineStyle(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned char linePattern, unsigned char startMarker, unsigned char endMarker, unsigned char lineCap);
115  void collectFillStyle(unsigned id, unsigned level, unsigned char colourIndexFG, unsigned char colourIndexBG, unsigned char fillPattern,
116  unsigned char fillFGTransparency, unsigned char fillBGTransparency, unsigned char shadowPattern, Colour shfgc,
117  double shadowOffsetX, double shadowOffsetY);
118  void collectFillStyle(unsigned id, unsigned level, unsigned char colourIndexFG, unsigned char colourIndexBG, unsigned char fillPattern,
119  unsigned char fillFGTransparency, unsigned char fillBGTransparency, unsigned char shadowPattern, Colour shfgc);
120  void collectCharIXStyle(unsigned id , unsigned level, unsigned charCount, unsigned short fontID, Colour fontColour, unsigned langId,
121  double fontSize, bool bold, bool italic, bool underline, bool doubleunderline, bool strikeout, bool doublestrikeout,
122  bool allcaps, bool initcaps, bool smallcaps, bool superscript, bool subscript, WPXString fontFace);
123  void collectParaIXStyle(unsigned id , unsigned level, unsigned charCount, double indFirst, double indLeft, double indRight,
124  double spLine, double spBefore, double spAfter, unsigned char align, unsigned flags);
125  void collectTextBlockStyle(unsigned id, unsigned level, double leftMargin, double rightMargin, double topMargin, double bottomMargin, unsigned char verticalAlign,
126  unsigned char bgClrId, const Colour &bgColour, double defaultTabStop, unsigned char textDirection);
127 
128  // Field list
129  void collectFieldList(unsigned id, unsigned level);
130  void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId);
131  void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId);
132 
133  // Temporary hack
134  void startPage();
135  void endPage();
136  void endPages() {}
137 
139  {
140  return m_styles;
141  }
142 
143 
144 private:
147 
148  void _handleLevelChange(unsigned level);
149  void _flushShapeList();
150 
151  unsigned m_currentLevel;
153 
156 
158  std::map<unsigned, XForm> m_groupXForms;
159  std::map<unsigned, unsigned> m_groupMemberships;
160  std::vector<std::map<unsigned, XForm> > &m_groupXFormsSequence;
161  std::vector<std::map<unsigned, unsigned> > &m_groupMembershipsSequence;
162  std::list<unsigned> m_pageShapeOrder;
163  std::vector<std::list<unsigned> > &m_documentPageShapeOrders;
164  std::map<unsigned, std::list<unsigned> > m_groupShapeOrder;
165  std::list<unsigned> m_shapeList;
166 
174 
179 };
180 
181 }
182 
183 #endif /* VSDXSTYLESCOLLECTOR_H */
184 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
void collectColours(const std::vector< Colour > &colours)
Definition: VSDXStylesCollector.cpp:227
void collectInfiniteLine(unsigned id, unsigned level, double x1, double y1, double x2, double y2)
Definition: VSDXStylesCollector.cpp:159
Definition: VSDXStyles.h:60
VSDXStylesCollector & operator=(const VSDXStylesCollector &)
bool m_isShapeStarted
Definition: VSDXStylesCollector.h:152
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)
Definition: VSDXStylesCollector.cpp:118
void collectNameList(unsigned id, unsigned level)
Definition: VSDXStylesCollector.h:106
Definition: VSDXTypes.h:68
void collectName(unsigned id, unsigned level, const ::WPXBinaryData &name, TextFormat format)
Definition: VSDXStylesCollector.cpp:261
VSDXStylesCollector(std::vector< std::map< unsigned, XForm > > &groupXFormsSequence, std::vector< std::map< unsigned, unsigned > > &groupMembershipsSequence, std::vector< std::list< unsigned > > &documentPageShapeOrders)
Definition: VSDXStylesCollector.cpp:35
Definition: VSDXStyles.h:144
void collectFieldList(unsigned id, unsigned level)
Definition: VSDXStylesCollector.cpp:353
void collectSplineKnot(unsigned id, unsigned level, double x, double y, double knot)
Definition: VSDXStylesCollector.cpp:150
unsigned m_currentStyleSheet
Definition: VSDXStylesCollector.h:167
void collectShape(unsigned id, unsigned level, unsigned masterPage, unsigned masterShape, unsigned lineStyle, unsigned fillStyle, unsigned textStyle)
Definition: VSDXStylesCollector.cpp:214
double m_shadowOffsetY
Definition: VSDXStylesCollector.h:155
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)
Definition: VSDXStylesCollector.cpp:338
VSDXParaStyle * m_paraStyle
Definition: VSDXStylesCollector.h:173
unsigned m_currentLevel
Definition: VSDXStylesCollector.h:151
void collectNumericField(unsigned id, unsigned level, unsigned short format, double number, int formatStringId)
Definition: VSDXStylesCollector.cpp:363
VSDXLineStyle * m_lineStyle
Definition: VSDXStylesCollector.h:169
void collectPolylineTo(unsigned id, unsigned level, double x, double y, unsigned char xType, unsigned char yType, std::vector< std::pair< double, double > > &points)
Definition: VSDXStylesCollector.cpp:132
void collectOLEList(unsigned id, unsigned level)
Definition: VSDXStylesCollector.h:57
void collectUnhandledChunk(unsigned id, unsigned level)
Definition: VSDXStylesCollector.cpp:222
unsigned m_fillStyleMaster
Definition: VSDXStylesCollector.h:176
Definition: VSDXCollector.h:40
std::vector< std::map< unsigned, unsigned > > & m_groupMembershipsSequence
Definition: VSDXStylesCollector.h:161
VSDXFillStyle * m_fillStyle
Definition: VSDXStylesCollector.h:170
std::list< unsigned > m_shapeList
Definition: VSDXStylesCollector.h:165
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)
Definition: VSDXStylesCollector.cpp:240
void collectText(unsigned id, unsigned level, const ::WPXBinaryData &textStream, TextFormat format)
Definition: VSDXStylesCollector.cpp:235
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)
Definition: VSDXStylesCollector.cpp:327
void collectSplineStart(unsigned id, unsigned level, double x, double y, double secondKnot, double firstKnot, double lastKnot, unsigned degree)
Definition: VSDXStylesCollector.cpp:144
void collectPageProps(unsigned id, unsigned level, double pageWidth, double pageHeight, double shadowOffsetX, double shadowOffsetY, double scale)
Definition: VSDXStylesCollector.cpp:203
void collectMoveTo(unsigned id, unsigned level, double x, double y)
Definition: VSDXStylesCollector.cpp:103
void startPage()
Definition: VSDXStylesCollector.cpp:368
Definition: VSDXStyles.h:212
void collectLine(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned linePattern, unsigned char startMarker, unsigned char endMarker, unsigned lineCap)
Definition: VSDXStylesCollector.cpp:78
void _handleLevelChange(unsigned level)
Definition: VSDXStylesCollector.cpp:399
VSDXTextBlockStyle * m_textBlockStyle
Definition: VSDXStylesCollector.h:171
void collectForeignData(unsigned id, unsigned level, const WPXBinaryData &binaryData)
Definition: VSDXStylesCollector.cpp:62
Definition: VSDXStylesCollector.h:45
std::map< unsigned, XForm > m_groupXForms
Definition: VSDXStylesCollector.h:158
void collectForeignDataType(unsigned id, unsigned level, unsigned foreignType, unsigned foreignFormat, double offsetX, double offsetY, double width, double height)
Definition: VSDXStylesCollector.cpp:197
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)
Definition: VSDXStylesCollector.cpp:318
void collectGeometry(unsigned id, unsigned level, unsigned char geomFlags)
Definition: VSDXStylesCollector.cpp:98
void collectLineStyle(unsigned id, unsigned level, double strokeWidth, Colour c, unsigned char linePattern, unsigned char startMarker, unsigned char endMarker, unsigned char lineCap)
Definition: VSDXStylesCollector.cpp:281
void collectFont(unsigned short fontID, const ::WPXBinaryData &textStream, TextFormat format)
Definition: VSDXStylesCollector.cpp:231
TextFormat
Definition: VSDXTypes.h:179
unsigned m_textStyleMaster
Definition: VSDXStylesCollector.h:177
void collectXFormData(unsigned id, unsigned level, const XForm &xform)
Definition: VSDXStylesCollector.cpp:177
std::list< unsigned > m_pageShapeOrder
Definition: VSDXStylesCollector.h:162
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)
Definition: VSDXStylesCollector.cpp:246
void collectArcTo(unsigned id, unsigned level, double x2, double y2, double bow)
Definition: VSDXStylesCollector.cpp:113
VSDXStyles getStyleSheets() const
Definition: VSDXStylesCollector.h:138
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)
Definition: VSDXStylesCollector.cpp:254
void collectTextField(unsigned id, unsigned level, int nameId, int formatStringId)
Definition: VSDXStylesCollector.cpp:358
VSDXStyles m_styles
Definition: VSDXStylesCollector.h:168
void collectPage(unsigned id, unsigned level, unsigned backgroundPageID, unsigned currentPageID)
Definition: VSDXStylesCollector.cpp:209
Definition: libvisio_utils.h:78
Definition: VSDXStyles.h:86
void collectShapeId(unsigned id, unsigned level, unsigned shapeId)
Definition: VSDXStylesCollector.cpp:189
void collectEllipticalArcTo(unsigned id, unsigned level, double x3, double y3, double x2, double y2, double angle, double ecc)
Definition: VSDXStylesCollector.cpp:56
void endPage()
Definition: VSDXStylesCollector.cpp:376
std::map< unsigned, std::list< unsigned > > m_groupShapeOrder
Definition: VSDXStylesCollector.h:164
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)
Definition: VSDXStylesCollector.cpp:164
std::map< unsigned, unsigned > m_groupMemberships
Definition: VSDXStylesCollector.h:159
unsigned m_currentShapeId
Definition: VSDXStylesCollector.h:157
VSDXCharStyle * m_charStyle
Definition: VSDXStylesCollector.h:172
std::vector< std::list< unsigned > > & m_documentPageShapeOrders
Definition: VSDXStylesCollector.h:163
void endPages()
Definition: VSDXStylesCollector.h:136
Definition: VSDXTypes.h:38
unsigned m_lineStyleMaster
Definition: VSDXStylesCollector.h:175
bool m_isStyleStarted
Definition: VSDXStylesCollector.h:178
std::vector< std::map< unsigned, XForm > > & m_groupXFormsSequence
Definition: VSDXStylesCollector.h:160
void collectEllipse(unsigned id, unsigned level, double cx, double cy, double xleft, double yleft, double xtop, double ytop)
Definition: VSDXStylesCollector.cpp:72
void collectFillAndShadow(unsigned id, unsigned level, unsigned colourIndexFG, unsigned colourIndexBG, unsigned fillPattern, unsigned fillFGTransparency, unsigned fillBGTransparency, unsigned shadowPattern, Colour shfgc, double shadowOffsetX, double shadowOffsetY)
Definition: VSDXStylesCollector.cpp:84
virtual ~VSDXStylesCollector()
Definition: VSDXStylesCollector.h:53
double m_shadowOffsetX
Definition: VSDXStylesCollector.h:154
Definition: VSDXStyles.h:178
void collectOLEData(unsigned id, unsigned level, const WPXBinaryData &oleData)
Definition: VSDXStylesCollector.cpp:67
void collectStyleSheet(unsigned id, unsigned level, unsigned parentLineStyle, unsigned parentFillStyle, unsigned parentTextStyle)
Definition: VSDXStylesCollector.cpp:266
void collectSplineEnd()
Definition: VSDXStylesCollector.cpp:155
Definition: VSDXStyles.h:42
void collectLineTo(unsigned id, unsigned level, double x, double y)
Definition: VSDXStylesCollector.cpp:108
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)
Definition: VSDXStylesCollector.cpp:297
void collectTxtXForm(unsigned id, unsigned level, const XForm &txtxform)
Definition: VSDXStylesCollector.cpp:184
void _flushShapeList()
Definition: VSDXStylesCollector.cpp:442

Generated for libvisio by doxygen 1.8.13