VSDXParser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libvisio project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __VSDXPARSER_H__
00011 #define __VSDXPARSER_H__
00012 
00013 #include <librevenge/librevenge.h>
00014 #include "VSDXTheme.h"
00015 #include "VSDXMLParserBase.h"
00016 
00017 namespace libvisio
00018 {
00019 
00020 class VSDCollector;
00021 
00022 class VSDXParser : public VSDXMLParserBase
00023 {
00024   using VSDXMLParserBase::readExtendedColourData;
00025   using VSDXMLParserBase::readDoubleData;
00026   using VSDXMLParserBase::readBoolData;
00027   using VSDXMLParserBase::readLongData;
00028 
00029 public:
00030   explicit VSDXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
00031   virtual ~VSDXParser();
00032   bool parseMain();
00033   bool extractStencils();
00034 
00035 private:
00036   VSDXParser();
00037   VSDXParser(const VSDXParser &);
00038   VSDXParser &operator=(const VSDXParser &);
00039 
00040   // Helper functions
00041 
00042   xmlChar *readStringData(xmlTextReaderPtr reader);
00043 
00044   int getElementToken(xmlTextReaderPtr reader);
00045   int getElementDepth(xmlTextReaderPtr reader);
00046 
00047   int skipSection(xmlTextReaderPtr reader);
00048 
00049   // Functions parsing the Visio 2013 OPC document structure
00050 
00051   bool parseDocument(librevenge::RVNGInputStream *input, const char *name);
00052   bool parseMasters(librevenge::RVNGInputStream *input, const char *name);
00053   bool parseMaster(librevenge::RVNGInputStream *input, const char *name);
00054   bool parsePages(librevenge::RVNGInputStream *input, const char *name);
00055   bool parsePage(librevenge::RVNGInputStream *input, const char *name);
00056   bool parseTheme(librevenge::RVNGInputStream *input, const char *name);
00057   void parseMetaData(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
00058   void processXmlDocument(librevenge::RVNGInputStream *input, VSDXRelationships &rels);
00059   void processXmlNode(xmlTextReaderPtr reader);
00060 
00061   // Functions reading the Visio 2013 OPC document content
00062 
00063   void extractBinaryData(librevenge::RVNGInputStream *input, const char *name);
00064 
00065   void readPageSheetProperties(xmlTextReaderPtr reader);
00066 
00067   void readStyleProperties(xmlTextReaderPtr reader);
00068 
00069   void readShapeProperties(xmlTextReaderPtr reader);
00070 
00071   void getBinaryData(xmlTextReaderPtr reader);
00072 
00073   void readParagraph(xmlTextReaderPtr reader);
00074   void readCharacter(xmlTextReaderPtr reader);
00075   void readFonts(xmlTextReaderPtr reader);
00076 
00077   // Private data
00078 
00079   librevenge::RVNGInputStream *m_input;
00080   librevenge::RVNGDrawingInterface *m_painter;
00081   int m_currentDepth;
00082   VSDXRelationships *m_rels;
00083   VSDXTheme m_currentTheme;
00084 };
00085 
00086 } // namespace libvisio
00087 
00088 #endif // __VSDXPARSER_H__
00089 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */