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 <set>
14#include <string>
15#include <librevenge/librevenge.h>
16#include "VSDXTheme.h"
17#include "VSDXMLParserBase.h"
18
19 namespace libvisio
20{
21
22 class VSDCollector;
23
24 class VSDXParser : public VSDXMLParserBase
25{
26 using VSDXMLParserBase::readExtendedColourData;
27 using VSDXMLParserBase::readDoubleData;
28 using VSDXMLParserBase::readBoolData;
29 using VSDXMLParserBase::readLongData;
30 using VSDXMLParserBase::readStringData;
31
32
33 public:
34 explicit VSDXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
35 ~VSDXParser() override;
36 bool parseMain() override;
37 bool extractStencils() override;
38
39 private:
40 VSDXParser();
41 VSDXParser(const VSDXParser &);
42 VSDXParser &operator=(const VSDXParser &);
43
44 // Helper functions
45
46 xmlChar *readStringData(xmlTextReaderPtr reader) override;
47
48 int getElementToken(xmlTextReaderPtr reader) override;
49 int getElementDepth(xmlTextReaderPtr reader) override;
50
51 int skipSection(xmlTextReaderPtr reader);
52
53 // Functions parsing the Visio 2013 OPC document structure
54
55 bool parseDocument(librevenge::RVNGInputStream *input, const char *name);
56 bool parseMasters(librevenge::RVNGInputStream *input, const char *name);
57 bool parseMaster(librevenge::RVNGInputStream *input, const char *name);
58 bool parsePages(librevenge::RVNGInputStream *input, const char *name);
59 bool parsePage(librevenge::RVNGInputStream *input, const char *name);
60 bool parseTheme(librevenge::RVNGInputStream *input, const char *name);
61 void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
62 void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
63 void processXmlNode(xmlTextReaderPtr reader);
64
65 // Functions reading the Visio 2013 OPC document content
66
67 void extractBinaryData(librevenge::RVNGInputStream *input, const char *name);
68
69 void readPageSheetProperties(xmlTextReaderPtr reader);
70
71 void readStyleProperties(xmlTextReaderPtr reader);
72
73 void readShapeProperties(xmlTextReaderPtr reader);
74
75 void getBinaryData(xmlTextReaderPtr reader) override;
76
77 void readLayer(xmlTextReaderPtr reader);
78 void readParagraph(xmlTextReaderPtr reader);
79 void readCharacter(xmlTextReaderPtr reader);
80 void readFonts(xmlTextReaderPtr reader);
81 void readTabs(xmlTextReaderPtr reader);
82 void readTabRow(xmlTextReaderPtr reader);
83
84 // Private data
85
86 librevenge::RVNGInputStream *m_input;
87 librevenge::RVNGDrawingInterface *m_painter;
88 int m_currentDepth;
89 VSDXRelationships *m_rels;
90 VSDXTheme m_currentTheme;
91 // parsePage / parseMaster targets currently on the recursion stack
92 std::set<std::string> m_visitedParts;
93};
94
95} // namespace libvisio
96
97#endif // __VSDXPARSER_H__
98/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
VSDXMLParserBase.h
VSDXTheme.h
libvisio::VSDCollector
Definition VSDCollector.h:21
libvisio::VSDXMLParserBase::readDoubleData
int readDoubleData(std::optional< double > &value, xmlTextReaderPtr reader)
Definition VSDXMLParserBase.cpp:2105
libvisio::VSDXMLParserBase::readStringData
int readStringData(VSDName &text, xmlTextReaderPtr reader)
Definition VSDXMLParserBase.cpp:2089
libvisio::VSDXMLParserBase::readBoolData
int readBoolData(std::optional< bool > &value, xmlTextReaderPtr reader)
Definition VSDXMLParserBase.cpp:2157
libvisio::VSDXMLParserBase::readExtendedColourData
int readExtendedColourData(Colour &value, long &idx, xmlTextReaderPtr reader)
Definition VSDXMLParserBase.cpp:2196
libvisio::VSDXMLParserBase::VSDXMLParserBase
VSDXMLParserBase()
Definition VSDXMLParserBase.cpp:29
libvisio::VSDXMLParserBase::readLongData
int readLongData(std::optional< long > &value, xmlTextReaderPtr reader)
Definition VSDXMLParserBase.cpp:2131
libvisio::VSDXParser::VSDXParser
VSDXParser()
libvisio::VSDXParser::parseDocument
bool parseDocument(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:115
libvisio::VSDXParser::readShapeProperties
void readShapeProperties(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:988
libvisio::VSDXParser::readTabs
void readTabs(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1400
libvisio::VSDXParser::m_rels
VSDXRelationships * m_rels
Definition VSDXParser.h:89
libvisio::VSDXParser::getElementToken
int getElementToken(xmlTextReaderPtr reader) override
Definition VSDXParser.cpp:593
libvisio::VSDXParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition VSDXParser.h:87
libvisio::VSDXParser::readCharacter
void readCharacter(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1485
libvisio::VSDXParser::extractStencils
bool extractStencils() override
Definition VSDXParser.cpp:109
libvisio::VSDXParser::m_currentDepth
int m_currentDepth
Definition VSDXParser.h:88
libvisio::VSDXParser::m_currentTheme
VSDXTheme m_currentTheme
Definition VSDXParser.h:90
libvisio::VSDXParser::operator=
VSDXParser & operator=(const VSDXParser &)
libvisio::VSDXParser::skipSection
int skipSection(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1532
libvisio::VSDXParser::parseMasters
bool parseMasters(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:169
libvisio::VSDXParser::readStringData
xmlChar * readStringData(xmlTextReaderPtr reader) override
Definition VSDXParser.cpp:582
libvisio::VSDXParser::m_visitedParts
std::set< std::string > m_visitedParts
Definition VSDXParser.h:92
libvisio::VSDXParser::processXmlNode
void processXmlNode(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:402
libvisio::VSDXParser::extractBinaryData
void extractBinaryData(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:561
libvisio::VSDXParser::parseMetaData
void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
Definition VSDXParser.cpp:265
libvisio::VSDXParser::VSDXParser
VSDXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
Definition VSDXParser.cpp:51
libvisio::VSDXParser::readStyleProperties
void readStyleProperties(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:746
libvisio::VSDXParser::m_input
librevenge::RVNGInputStream * m_input
Definition VSDXParser.h:86
libvisio::VSDXParser::processXmlDocument
void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels)
Definition VSDXParser.cpp:300
libvisio::VSDXParser::readFonts
void readFonts(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:715
libvisio::VSDXParser::parseMaster
bool parseMaster(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:189
libvisio::VSDXParser::parsePages
bool parsePages(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:209
libvisio::VSDXParser::VSDXParser
VSDXParser(const VSDXParser &)
libvisio::VSDXParser::getBinaryData
void getBinaryData(xmlTextReaderPtr reader) override
Definition VSDXParser.cpp:1506
libvisio::VSDXParser::readPageSheetProperties
void readPageSheetProperties(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:635
libvisio::VSDXParser::parsePage
bool parsePage(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:229
libvisio::VSDXParser::readTabRow
void readTabRow(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1428
libvisio::VSDXParser::getElementDepth
int getElementDepth(xmlTextReaderPtr reader) override
Definition VSDXParser.cpp:983
libvisio::VSDXParser::~VSDXParser
~VSDXParser() override
Definition VSDXParser.cpp:61
libvisio::VSDXParser::readLayer
void readLayer(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1358
libvisio::VSDXParser::parseMain
bool parseMain() override
Definition VSDXParser.cpp:65
libvisio::VSDXParser::parseTheme
bool parseTheme(librevenge::RVNGInputStream *input, const char *name)
Definition VSDXParser.cpp:249
libvisio::VSDXParser::readParagraph
void readParagraph(xmlTextReaderPtr reader)
Definition VSDXParser.cpp:1379
libvisio::VSDXRelationships
Definition VSDXMLHelper.h:57
libvisio::VSDXTheme
Definition VSDXTheme.h:85
libvisio
Definition libvisio_utils.h:47