VDXParser.h Source File documentation

VDXParser.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 libvisio 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 __VDXPARSER_H__
11 #define __VDXPARSER_H__
12
13 #include <librevenge/librevenge.h>
14 #include "VSDXMLParserBase.h"
15
16 namespace libvisio
17 {
18
19 class VSDCollector;
20
21 class VDXParser : public VSDXMLParserBase
22 {
23 using VSDXMLParserBase::readExtendedColourData;
24 using VSDXMLParserBase::readDoubleData;
25 using VSDXMLParserBase::readBoolData;
26 using VSDXMLParserBase::readLongData;
27 using VSDXMLParserBase::readStringData;
28
29 public:
30 explicit VDXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
31 ~VDXParser() override;
32 bool parseMain() override;
33 bool extractStencils() override;
34
35 private:
36 VDXParser();
37 VDXParser(const VDXParser &);
38 VDXParser &operator=(const VDXParser &);
39
40 // Helper functions
41
42 xmlChar *readStringData(xmlTextReaderPtr reader) override;
43
44 int getElementToken(xmlTextReaderPtr reader) override;
45 int getElementDepth(xmlTextReaderPtr reader) override;
46
47 // Functions to read the DatadiagramML document structure
48
49 bool processXmlDocument(librevenge::RVNGInputStream *input);
50 void processXmlNode(xmlTextReaderPtr reader);
51
52 // Functions reading the DiagramML document content
53
54 void readLine(xmlTextReaderPtr reader);
55 void readFillAndShadow(xmlTextReaderPtr reader);
56 void readXFormData(xmlTextReaderPtr reader);
57 void readMisc(xmlTextReaderPtr reader);
58 void readTxtXForm(xmlTextReaderPtr reader);
59 void readXForm1D(xmlTextReaderPtr reader);
60 void readPageProps(xmlTextReaderPtr reader);
61 void readFonts(xmlTextReaderPtr reader);
62 void readTextBlock(xmlTextReaderPtr reader);
63 void readForeignInfo(xmlTextReaderPtr reader);
64 void readLayerMem(xmlTextReaderPtr reader);
65 void readTabs(xmlTextReaderPtr reader);
66 void readTab(xmlTextReaderPtr reader);
67
68 void getBinaryData(xmlTextReaderPtr reader) override;
69
70 // Private data
71
72 librevenge::RVNGInputStream *m_input;
73 librevenge::RVNGDrawingInterface *m_painter;
74 };
75
76 } // namespace libvisio
77
78 #endif // __VDXPARSER_H__
79 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
XML_POSITION
const int XML_POSITION
Definition: tokens.h:128
XML_ROUNDING
const int XML_ROUNDING
Definition: tokens.h:148
XML_PARA
const int XML_PARA
Definition: tokens.h:122
XML_FILLFOREGND
const int XML_FILLFOREGND
Definition: tokens.h:54
XML_LEADER
const int XML_LEADER
Definition: tokens.h:93
libvisio::xmlReaderForStream
std::unique_ptr< xmlTextReader, void(*)(xmlTextReaderPtr)> xmlReaderForStream(librevenge::RVNGInputStream *input, XMLErrorWatcher *const watcher, bool recover)
Definition: libvisio_xml.cpp:100
libvisio::VDXParser::readPageProps
void readPageProps(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:729
XML_SHAPE
const int XML_SHAPE
Definition: tokens.h:153
XML_SHDWPATTERN
const int XML_SHDWPATTERN
Definition: tokens.h:161
libvisio::VDXParser::processXmlNode
void processXmlNode(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:92
XML_PINY
const int XML_PINY
Definition: tokens.h:125
XML_STYLESHEET
const int XML_STYLESHEET
Definition: tokens.h:171
libvisio::VSDStylesCollector
Definition: VSDStylesCollector.h:25
libvisio::VDXParser::readXForm1D
void readXForm1D(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:674
libvisio::VDXParser::readTab
void readTab(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:1035
XML_BEGINARROW
const int XML_BEGINARROW
Definition: tokens.h:12
libvisio::VDXParser::operator=
VDXParser & operator=(const VDXParser &)
XML_SHDWFOREGND
const int XML_SHDWFOREGND
Definition: tokens.h:158
libvisio::VSDXMLParserBase::readExtendedColourData
int readExtendedColourData(Colour &value, long &idx, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2181
XML_SOLUTIONXML
const int XML_SOLUTIONXML
Definition: tokens.h:163
XML_TXTWIDTH
const int XML_TXTWIDTH
Definition: tokens.h:196
libvisio::VDXParser::readForeignInfo
void readForeignInfo(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:949
XML_SHDWBKGND
const int XML_SHDWBKGND
Definition: tokens.h:157
XML_LINECOLOR
const int XML_LINECOLOR
Definition: tokens.h:97
libvisio::VDXParser::getElementDepth
int getElementDepth(xmlTextReaderPtr reader) override
Definition: VDXParser.cpp:928
VSDStylesCollector.h
XML_IMGWIDTH
const int XML_IMGWIDTH
Definition: tokens.h:81
XML_TAB
const int XML_TAB
Definition: tokens.h:178
XML_LINE
const int XML_LINE
Definition: tokens.h:95
VSDContentCollector.h
XML_HIDETEXT
const int XML_HIDETEXT
Definition: tokens.h:75
XML_FILLBKGNDTRANS
const int XML_FILLBKGNDTRANS
Definition: tokens.h:53
XML_GEOM
const int XML_GEOM
Definition: tokens.h:68
VSD_DEBUG_MSG
#define VSD_DEBUG_MSG(M)
Definition: libvisio_utils.h:42
libvisio::VDXParser::readMisc
void readMisc(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:466
XML_LAYERMEMBER
const int XML_LAYERMEMBER
Definition: tokens.h:92
libvisio::VSDXMLParserBase::readLongData
int readLongData(boost::optional< long > &value, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2116
XML_TEXT
const int XML_TEXT
Definition: tokens.h:181
XML_SHDWOFFSETY
const int XML_SHDWOFFSETY
Definition: tokens.h:160
XML_PAGEHEIGHT
const int XML_PAGEHEIGHT
Definition: tokens.h:116
VSDXMLHelper.h
XML_XFORM1D
const int XML_XFORM1D
Definition: tokens.h:206
XML_PAGESCALE
const int XML_PAGESCALE
Definition: tokens.h:118
xmltoken::tokenId
int tokenId
Definition: tokenhash.h:36
XML_DRAWINGSCALE
const int XML_DRAWINGSCALE
Definition: tokens.h:38
XML_TXTLOCPINY
const int XML_TXTLOCPINY
Definition: tokens.h:193
XML_PAGE
const int XML_PAGE
Definition: tokens.h:115
VSDXMLTokenMap.h
XML_TEXTBKGND
const int XML_TEXTBKGND
Definition: tokens.h:182
libvisio::VDXParser::readFonts
void readFonts(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:795
XML_TEXTDIRECTION
const int XML_TEXTDIRECTION
Definition: tokens.h:185
XML_TABS
const int XML_TABS
Definition: tokens.h:179
libvisio::Colour
Definition: VSDTypes.h:71
XML_ENDARROW
const int XML_ENDARROW
Definition: tokens.h:45
libvisio::VDXParser::readStringData
xmlChar * readStringData(xmlTextReaderPtr reader) override
Definition: VDXParser.cpp:907
XML_FACENAME
const int XML_FACENAME
Definition: tokens.h:49
XML_PAGESHEET
const int XML_PAGESHEET
Definition: tokens.h:119
XML_FILLBKGND
const int XML_FILLBKGND
Definition: tokens.h:52
XML_FACENAMES
const int XML_FACENAMES
Definition: tokens.h:50
XML_LOCPINY
const int XML_LOCPINY
Definition: tokens.h:102
libvisio::VDXParser::readTxtXForm
void readTxtXForm(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:595
XML_TXTLOCPINX
const int XML_TXTLOCPINX
Definition: tokens.h:192
XML_IMGOFFSETX
const int XML_IMGOFFSETX
Definition: tokens.h:79
libvisio::VDXParser::getBinaryData
void getBinaryData(xmlTextReaderPtr reader) override
Definition: VDXParser.cpp:933
XML_PAGES
const int XML_PAGES
Definition: tokens.h:121
libvisio::VDXParser::getElementToken
int getElementToken(xmlTextReaderPtr reader) override
Definition: VDXParser.cpp:923
libvisio::VDXParser::readTabs
void readTabs(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:1004
XML_FLIPX
const int XML_FLIPX
Definition: tokens.h:58
libvisio::VDXParser::readTextBlock
void readTextBlock(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:825
XML_ALIGNMENT
const int XML_ALIGNMENT
Definition: tokens.h:6
XML_FILLPATTERN
const int XML_FILLPATTERN
Definition: tokens.h:56
XML_FILL
const int XML_FILL
Definition: tokens.h:51
XML_LINECAP
const int XML_LINECAP
Definition: tokens.h:96
XML_RIGHTMARGIN
const int XML_RIGHTMARGIN
Definition: tokens.h:147
XML_FILLFOREGNDTRANS
const int XML_FILLFOREGNDTRANS
Definition: tokens.h:55
libvisio::VSDXMLTokenMap::getTokenId
static int getTokenId(const xmlChar *name)
Definition: VSDXMLTokenMap.cpp:21
XML_HEIGHT
const int XML_HEIGHT
Definition: tokens.h:74
libvisio::VDXParser::extractStencils
bool extractStencils() override
Definition: VDXParser.cpp:67
XML_LAYER
const int XML_LAYER
Definition: tokens.h:90
XML_XFORM
const int XML_XFORM
Definition: tokens.h:205
libvisio::VSD_TEXT_UTF8
@ VSD_TEXT_UTF8
Definition: VSDTypes.h:166
XML_SHAPES
const int XML_SHAPES
Definition: tokens.h:156
XML_DEFAULTTABSTOP
const int XML_DEFAULTTABSTOP
Definition: tokens.h:36
XML_LOCPINX
const int XML_LOCPINX
Definition: tokens.h:101
XML_ENDX
const int XML_ENDX
Definition: tokens.h:47
XML_BOTTOMMARGIN
const int XML_BOTTOMMARGIN
Definition: tokens.h:15
libvisio::VSDOptionalLineStyle
Definition: VSDStyles.h:24
XML_BEGINY
const int XML_BEGINY
Definition: tokens.h:14
XML_SHAPESHDWOFFSETX
const int XML_SHAPESHDWOFFSETX
Definition: tokens.h:154
XML_PAGEWIDTH
const int XML_PAGEWIDTH
Definition: tokens.h:120
XML_SHDWOFFSETX
const int XML_SHDWOFFSETX
Definition: tokens.h:159
XML_PAGEPROPS
const int XML_PAGEPROPS
Definition: tokens.h:117
libvisio::VDXParser::~VDXParser
~VDXParser() override
Definition: VDXParser.cpp:30
XML_LINEWEIGHT
const int XML_LINEWEIGHT
Definition: tokens.h:100
libvisio::VSDXMLParserBase
Definition: VSDXMLParserBase.h:31
XML_ENDY
const int XML_ENDY
Definition: tokens.h:48
XML_CHAR
const int XML_CHAR
Definition: tokens.h:25
libvisio::VSDContentCollector
Definition: VSDContentCollector.h:32
libvisio::VSDXMLParserBase::readBoolData
int readBoolData(boost::optional< bool > &value, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2142
XML_SHAPESHDWOFFSETY
const int XML_SHAPESHDWOFFSETY
Definition: tokens.h:155
libvisio::VDXParser::readXFormData
void readXFormData(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:509
libvisio::VSDStyles
Definition: VSDStyles.h:495
XML_TEXTBLOCK
const int XML_TEXTBLOCK
Definition: tokens.h:184
XML_WIDTH
const int XML_WIDTH
Definition: tokens.h:203
XML_ANGLE
const int XML_ANGLE
Definition: tokens.h:7
libvisio::VDXParser::readLayerMem
void readLayerMem(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:568
XML_FLIPY
const int XML_FLIPY
Definition: tokens.h:59
XML_STYLESHEETS
const int XML_STYLESHEETS
Definition: tokens.h:172
XML_IMGOFFSETY
const int XML_IMGOFFSETY
Definition: tokens.h:80
XML_BEGINX
const int XML_BEGINX
Definition: tokens.h:13
libvisio::VSDXMLParserBase::readStringData
int readStringData(VSDName &text, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2074
XML_COLORS
const int XML_COLORS
Definition: tokens.h:30
XML_TXTHEIGHT
const int XML_TXTHEIGHT
Definition: tokens.h:191
XML_FOREIGN
const int XML_FOREIGN
Definition: tokens.h:63
XML_MASTERS
const int XML_MASTERS
Definition: tokens.h:106
XML_LEFTMARGIN
const int XML_LEFTMARGIN
Definition: tokens.h:94
XML_TXTPINX
const int XML_TXTPINX
Definition: tokens.h:194
libvisio::VDXParser::parseMain
bool parseMain() override
Definition: VDXParser.cpp:34
libvisio::VDXParser::m_input
librevenge::RVNGInputStream * m_input
Definition: VDXParser.h:72
libvisio::VSDXMLParserBase::readDoubleData
int readDoubleData(boost::optional< double > &value, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2090
VDXParser.h
XML_MASTER
const int XML_MASTER
Definition: tokens.h:105
XML_LAYERMEM
const int XML_LAYERMEM
Definition: tokens.h:91
XML_BEGTRIGGER
const int XML_BEGTRIGGER
Definition: tokens.h:11
libvisio::VSDName
Definition: VSDTypes.h:171
libvisio::VDXParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: VDXParser.h:73
libvisio::VDXParser::readLine
void readLine(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:313
XML_IMGHEIGHT
const int XML_IMGHEIGHT
Definition: tokens.h:78
libvisio::VDXParser::VDXParser
VDXParser(const VDXParser &)
libvisio::VDXParser::VDXParser
VDXParser()
XML_MISC
const int XML_MISC
Definition: tokens.h:107
XML_TOPMARGIN
const int XML_TOPMARGIN
Definition: tokens.h:189
XML_TOKEN_INVALID
const int XML_TOKEN_INVALID
Definition: tokens.h:306
libvisio_xml.h
XML_FOREIGNDATA
const int XML_FOREIGNDATA
Definition: tokens.h:64
libvisio::VDXParser::processXmlDocument
bool processXmlDocument(librevenge::RVNGInputStream *input)
Definition: VDXParser.cpp:73
XML_TEXTBKGNDTRANS
const int XML_TEXTBKGNDTRANS
Definition: tokens.h:183
XML_VERTICALALIGN
const int XML_VERTICALALIGN
Definition: tokens.h:201
libvisio::VDXParser
Definition: VDXParser.h:22
libvisio::VSDOptionalFillStyle
Definition: VSDStyles.h:104
libvisio_utils.h
xmltoken::name
const char * name
Definition: tokenhash.h:35
XML_LINEPATTERN
const int XML_LINEPATTERN
Definition: tokens.h:98
libvisio::VSDStylesCollector::getStyleSheets
const VSDStyles & getStyleSheets() const
Definition: VSDStylesCollector.h:175
libvisio::VSDOptionalTextBlockStyle
Definition: VSDStyles.h:420
XML_ENDTRIGGER
const int XML_ENDTRIGGER
Definition: tokens.h:46
XML_TEXTXFORM
const int XML_TEXTXFORM
Definition: tokens.h:187
XML_TXTPINY
const int XML_TXTPINY
Definition: tokens.h:195
libvisio
Definition: libvisio_utils.h:49
libvisio::VDXParser::readFillAndShadow
void readFillAndShadow(xmlTextReaderPtr reader)
Definition: VDXParser.cpp:378
XML_PINX
const int XML_PINX
Definition: tokens.h:124
XML_TXTANGLE
const int XML_TXTANGLE
Definition: tokens.h:190
VSDXMLParserBase.h
libvisio::xmlStringToLong
long xmlStringToLong(const xmlChar *s)
Definition: libvisio_xml.cpp:151