VSDXParser.h Source File documentation

VSDXParser.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 __VSDXPARSER_H__
11 #define __VSDXPARSER_H__
12
13 #include <librevenge/librevenge.h>
14 #include "VSDXTheme.h"
15 #include "VSDXMLParserBase.h"
16
17 namespace libvisio
18 {
19
20 class VSDCollector;
21
22 class VSDXParser : public VSDXMLParserBase
23 {
24 using VSDXMLParserBase::readExtendedColourData;
25 using VSDXMLParserBase::readDoubleData;
26 using VSDXMLParserBase::readBoolData;
27 using VSDXMLParserBase::readLongData;
28 using VSDXMLParserBase::readStringData;
29
30
31 public:
32 explicit VSDXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
33 ~VSDXParser() override;
34 bool parseMain() override;
35 bool extractStencils() override;
36
37 private:
38 VSDXParser();
39 VSDXParser(const VSDXParser &);
40 VSDXParser &operator=(const VSDXParser &);
41
42 // Helper functions
43
44 xmlChar *readStringData(xmlTextReaderPtr reader) override;
45
46 int getElementToken(xmlTextReaderPtr reader) override;
47 int getElementDepth(xmlTextReaderPtr reader) override;
48
49 int skipSection(xmlTextReaderPtr reader);
50
51 // Functions parsing the Visio 2013 OPC document structure
52
53 bool parseDocument(librevenge::RVNGInputStream *input, const char *name);
54 bool parseMasters(librevenge::RVNGInputStream *input, const char *name);
55 bool parseMaster(librevenge::RVNGInputStream *input, const char *name);
56 bool parsePages(librevenge::RVNGInputStream *input, const char *name);
57 bool parsePage(librevenge::RVNGInputStream *input, const char *name);
58 bool parseTheme(librevenge::RVNGInputStream *input, const char *name);
59 void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
60 void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
61 void processXmlNode(xmlTextReaderPtr reader);
62
63 // Functions reading the Visio 2013 OPC document content
64
65 void extractBinaryData(librevenge::RVNGInputStream *input, const char *name);
66
67 void readPageSheetProperties(xmlTextReaderPtr reader);
68
69 void readStyleProperties(xmlTextReaderPtr reader);
70
71 void readShapeProperties(xmlTextReaderPtr reader);
72
73 void getBinaryData(xmlTextReaderPtr reader) override;
74
75 void readLayer(xmlTextReaderPtr reader);
76 void readParagraph(xmlTextReaderPtr reader);
77 void readCharacter(xmlTextReaderPtr reader);
78 void readFonts(xmlTextReaderPtr reader);
79 void readTabs(xmlTextReaderPtr reader);
80 void readTabRow(xmlTextReaderPtr reader);
81
82 // Private data
83
84 librevenge::RVNGInputStream *m_input;
85 librevenge::RVNGDrawingInterface *m_painter;
86 int m_currentDepth;
87 VSDXRelationships *m_rels;
88 VSDXTheme m_currentTheme;
89 };
90
91 } // namespace libvisio
92
93 #endif // __VSDXPARSER_H__
94 /* 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_FILLFOREGND
const int XML_FILLFOREGND
Definition: tokens.h:54
libvisio::xmlReaderForStream
std::unique_ptr< xmlTextReader, void(*)(xmlTextReaderPtr)> xmlReaderForStream(librevenge::RVNGInputStream *input, XMLErrorWatcher *const watcher, bool recover)
Definition: libvisio_xml.cpp:100
libvisio::VSDXParser::parsePage
bool parsePage(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:227
XML_SHAPE
const int XML_SHAPE
Definition: tokens.h:153
libvisio::VSDXRelationship
Definition: VSDXMLHelper.h:29
libvisio::VSDXParser::m_rels
VSDXRelationships * m_rels
Definition: VSDXParser.h:87
libvisio::VSDXParser::readStringData
xmlChar * readStringData(xmlTextReaderPtr reader) override
Definition: VSDXParser.cpp:552
XML_SHDWPATTERN
const int XML_SHDWPATTERN
Definition: tokens.h:161
libvisio::VSDXParser::processXmlDocument
void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
Definition: VSDXParser.cpp:298
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
XML_QUICKSTYLELINEMATRIX
const int XML_QUICKSTYLELINEMATRIX
Definition: tokens.h:136
XML_QUICKSTYLEFILLCOLOR
const int XML_QUICKSTYLEFILLCOLOR
Definition: tokens.h:132
libvisio::VSDXMetaData
Parses docProps/core.xml stream of a VSDX file.
Definition: VSDXMetaData.h:21
XML_BEGINARROW
const int XML_BEGINARROW
Definition: tokens.h:12
libvisio::VSDXParser::readStyleProperties
void readStyleProperties(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:706
libvisio::VSDXParser::readTabRow
void readTabRow(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1371
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_TXTWIDTH
const int XML_TXTWIDTH
Definition: tokens.h:196
libvisio::VSDXParser::operator=
VSDXParser & operator=(const VSDXParser &)
libvisio::VSDXParser::parseDocument
bool parseDocument(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:113
XML_SHDWBKGND
const int XML_SHDWBKGND
Definition: tokens.h:157
libvisio::VSDXParser::parseTheme
bool parseTheme(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:247
XML_LINECOLOR
const int XML_LINECOLOR
Definition: tokens.h:97
VSDStylesCollector.h
XML_IMGWIDTH
const int XML_IMGWIDTH
Definition: tokens.h:81
XML_CHARACTER
const int XML_CHARACTER
Definition: tokens.h:26
XML_QUICKSTYLEFILLMATRIX
const int XML_QUICKSTYLEFILLMATRIX
Definition: tokens.h:133
libvisio::VSDXParser::readPageSheetProperties
void readPageSheetProperties(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:605
libvisio::VSDXParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition: VSDXParser.h:85
VSDContentCollector.h
XML_HIDETEXT
const int XML_HIDETEXT
Definition: tokens.h:75
libvisio::VSDXParser
Definition: VSDXParser.h:23
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
XML_LAYERMEMBER
const int XML_LAYERMEMBER
Definition: tokens.h:92
libvisio::VSDXParser::skipSection
int skipSection(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1475
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
libvisio::VSDXParser::m_input
librevenge::RVNGInputStream * m_input
Definition: VSDXParser.h:84
XML_ROW
const int XML_ROW
Definition: tokens.h:149
libvisio::VSDXParser::readFonts
void readFonts(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:675
libvisio::VSDXParser::parseMasters
bool parseMasters(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:167
XML_SHDWOFFSETY
const int XML_SHDWOFFSETY
Definition: tokens.h:160
libvisio::VSDXParser::readTabs
void readTabs(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1343
XML_PAGEHEIGHT
const int XML_PAGEHEIGHT
Definition: tokens.h:116
VSDXMLHelper.h
libvisio::VSDXParser::parseMain
bool parseMain() override
Definition: VSDXParser.cpp:65
libvisio::VSDXRelationships::getRelationshipByType
const VSDXRelationship * getRelationshipByType(const char *type) const
Definition: VSDXMLHelper.cpp:146
XML_PAGESCALE
const int XML_PAGESCALE
Definition: tokens.h:118
libvisio::VSDXParser::getBinaryData
void getBinaryData(xmlTextReaderPtr reader) override
Definition: VSDXParser.cpp:1449
libvisio::VSDXParser::readLayer
void readLayer(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1301
libvisio::VSDXParser::readCharacter
void readCharacter(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1428
XML_DRAWINGSCALE
const int XML_DRAWINGSCALE
Definition: tokens.h:38
libvisio::VSDXParser::parsePages
bool parsePages(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:207
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
XML_QUICKSTYLESHADOWCOLOR
const int XML_QUICKSTYLESHADOWCOLOR
Definition: tokens.h:137
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::VSDXParser::getElementDepth
int getElementDepth(xmlTextReaderPtr reader) override
Definition: VSDXParser.cpp:931
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_REL
const int XML_REL
Definition: tokens.h:140
XML_FACENAMES
const int XML_FACENAMES
Definition: tokens.h:50
XML_LOCPINY
const int XML_LOCPINY
Definition: tokens.h:102
XML_TXTLOCPINX
const int XML_TXTLOCPINX
Definition: tokens.h:192
libvisio::XMLErrorWatcher
Definition: libvisio_xml.h:25
XML_PARAGRAPH
const int XML_PARAGRAPH
Definition: tokens.h:123
XML_IMGOFFSETX
const int XML_IMGOFFSETX
Definition: tokens.h:79
XML_PAGES
const int XML_PAGES
Definition: tokens.h:121
libvisio::VSDXParser::m_currentTheme
VSDXTheme m_currentTheme
Definition: VSDXParser.h:88
XML_FLIPX
const int XML_FLIPX
Definition: tokens.h:58
libvisio::VSDXParser::VSDXParser
VSDXParser(const VSDXParser &)
XML_ALIGNMENT
const int XML_ALIGNMENT
Definition: tokens.h:6
XML_FILLPATTERN
const int XML_FILLPATTERN
Definition: tokens.h:56
XML_LINECAP
const int XML_LINECAP
Definition: tokens.h:96
XML_RIGHTMARGIN
const int XML_RIGHTMARGIN
Definition: tokens.h:147
VSDXMetaData.h
XML_FILLFOREGNDTRANS
const int XML_FILLFOREGNDTRANS
Definition: tokens.h:55
libvisio::VSDXParser::processXmlNode
void processXmlNode(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:372
libvisio::VSDXMLTokenMap::getTokenId
static int getTokenId(const xmlChar *name)
Definition: VSDXMLTokenMap.cpp:21
XML_HEIGHT
const int XML_HEIGHT
Definition: tokens.h:74
libvisio::VSDXParser::getElementToken
int getElementToken(xmlTextReaderPtr reader) override
Definition: VSDXParser.cpp:563
libvisio::VSDXParser::readParagraph
void readParagraph(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:1322
XML_LAYER
const int XML_LAYER
Definition: tokens.h:90
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
libvisio::VSDXParser::readShapeProperties
void readShapeProperties(xmlTextReaderPtr reader)
Definition: VSDXParser.cpp:936
XML_SHDWOFFSETX
const int XML_SHDWOFFSETX
Definition: tokens.h:159
XML_LINEWEIGHT
const int XML_LINEWEIGHT
Definition: tokens.h:100
libvisio::VSDXParser::m_currentDepth
int m_currentDepth
Definition: VSDXParser.h:86
libvisio::VSDXMetaData::parse
bool parse(librevenge::RVNGInputStream *input)
Definition: VSDXMetaData.cpp:116
libvisio::VSDXMLParserBase
Definition: VSDXMLParserBase.h:31
libvisio::VSDXMetaData::getMetaData
const librevenge::RVNGPropertyList & getMetaData()
Definition: VSDXMetaData.cpp:159
XML_ENDY
const int XML_ENDY
Definition: tokens.h:48
libvisio::VSDXParser::extractBinaryData
void extractBinaryData(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:531
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::VSDXParser::~VSDXParser
~VSDXParser() override
Definition: VSDXParser.cpp:61
libvisio::VSDStyles
Definition: VSDStyles.h:495
XML_QUICKSTYLELINECOLOR
const int XML_QUICKSTYLELINECOLOR
Definition: tokens.h:135
libvisio::VSDXParser::parseMetaData
void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
Definition: VSDXParser.cpp:263
VSDX_DATA_READ_SIZE
#define VSDX_DATA_READ_SIZE
Definition: VSDXParser.cpp:529
XML_WIDTH
const int XML_WIDTH
Definition: tokens.h:203
XML_ANGLE
const int XML_ANGLE
Definition: tokens.h:7
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
VSDXParser.h
XML_BEGINX
const int XML_BEGINX
Definition: tokens.h:13
libvisio::VSDXMLParserBase::readStringData
int readStringData(VSDName &text, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2074
libvisio::VSDXTheme
Definition: VSDXTheme.h:77
XML_COLORS
const int XML_COLORS
Definition: tokens.h:30
XML_TXTHEIGHT
const int XML_TXTHEIGHT
Definition: tokens.h:191
libvisio::VSDXParser::VSDXParser
VSDXParser()
libvisio::VSDXRelationships
Definition: VSDXMLHelper.h:57
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::VSDXMLParserBase::readDoubleData
int readDoubleData(boost::optional< double > &value, xmlTextReaderPtr reader)
Definition: VSDXMLParserBase.cpp:2090
libvisio::XMLErrorWatcher::isError
bool isError() const
Definition: libvisio_xml.cpp:89
libvisio::VSDXRelationship::getTarget
const std::string getTarget() const
Definition: VSDXMLHelper.h:45
XML_MASTER
const int XML_MASTER
Definition: tokens.h:105
libvisio::VSDXParser::parseMaster
bool parseMaster(librevenge::RVNGInputStream *input, const char *name)
Definition: VSDXParser.cpp:187
XML_BEGTRIGGER
const int XML_BEGTRIGGER
Definition: tokens.h:11
libvisio::VSDName
Definition: VSDTypes.h:171
XML_CELL
const int XML_CELL
Definition: tokens.h:24
XML_IMGHEIGHT
const int XML_IMGHEIGHT
Definition: tokens.h:78
libvisio::VSDXParser::extractStencils
bool extractStencils() override
Definition: VSDXParser.cpp:107
XML_TOPMARGIN
const int XML_TOPMARGIN
Definition: tokens.h:189
XML_GEOMETRY
const int XML_GEOMETRY
Definition: tokens.h:69
XML_TOKEN_INVALID
const int XML_TOKEN_INVALID
Definition: tokens.h:306
libvisio::VSDXRelationships::rebaseTargets
void rebaseTargets(const char *baseDir)
Definition: VSDXMLHelper.cpp:137
libvisio_xml.h
XML_FOREIGNDATA
const int XML_FOREIGNDATA
Definition: tokens.h:64
XML_VERTICALALIGN
const int XML_VERTICALALIGN
Definition: tokens.h:201
libvisio::VSDOptionalFillStyle
Definition: VSDStyles.h:104
libvisio_utils.h
VSDXTheme.h
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_TXTPINY
const int XML_TXTPINY
Definition: tokens.h:195
libvisio::RVNGInputStreamPtr_t
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr_t
Definition: libvisio_utils.h:51
libvisio
Definition: libvisio_utils.h:49
libvisio::VSDXRelationships::getRelationshipById
const VSDXRelationship * getRelationshipById(const char *id) const
Definition: VSDXMLHelper.cpp:156
libvisio::VSDXRelationship::getType
const std::string getType() const
Definition: VSDXMLHelper.h:41
XML_PINX
const int XML_PINX
Definition: tokens.h:124
XML_SECTION
const int XML_SECTION
Definition: tokens.h:152
XML_TXTANGLE
const int XML_TXTANGLE
Definition: tokens.h:190
VSDXMLParserBase.h
libvisio::xmlStringToLong
long xmlStringToLong(const xmlChar *s)
Definition: libvisio_xml.cpp:151