]> git.sven.stormbind.net Git - sven/vym.git/blob - src/xml-vym.h
New upstream version 2.9.22
[sven/vym.git] / src / xml-vym.h
1 #ifndef XML_H
2 #define XML_H
3
4 #include "xml-base.h"
5
6 #include "vymnote.h"
7
8 class BranchItem;
9 class ImageItem;
10 class MapItem;
11 class SlideItem;
12 class Task;
13
14 /*! \brief Parsing VYM maps from XML documents */
15
16 enum Content {
17     TreeContent = 0x0001,
18     SlideContent = 0x0002,
19     XLinkContent = 0x0004
20 };
21
22 class parseVYMHandler : public parseBaseHandler {
23   public:
24     parseVYMHandler();
25     void setContentFilter(const int &);
26
27   private:
28     int contentFilter;
29
30   public:
31     bool startDocument();
32     bool startElement(const QString &, const QString &, const QString &eName,
33                       const QXmlAttributes &atts);
34     bool endElement(const QString &, const QString &, const QString &);
35     bool characters(const QString &);
36     QString errorString();
37     bool readMapAttr(const QXmlAttributes &);
38     bool readMapDesignCompatibleAttr(const QXmlAttributes &);
39     bool readBranchAttr(const QXmlAttributes &);
40     bool readFrameAttr(const QXmlAttributes &);
41     bool readOOAttr(const QXmlAttributes &);
42     bool readNoteAttr(const QXmlAttributes &);
43     bool readImageAttr(const QXmlAttributes &);
44     bool readXLinkAttr(const QXmlAttributes &);
45     bool readLinkNewAttr(const QXmlAttributes &);
46     bool readSettingAttr(const QXmlAttributes &);
47     bool readSlideAttr(const QXmlAttributes &);
48     bool readTaskAttr(const QXmlAttributes &);
49     bool readUserFlagDefAttr(const QXmlAttributes &);
50     bool readUserFlagAttr(const QXmlAttributes &);
51
52   private:
53     enum State {
54         StateInit,
55         StateMap,
56         StateMapDesign,  // Introduced 2.9.514
57         StateMD,         // Introduced 2.9.514
58         StateMapSelect,
59         StateMapSetting,
60         StateMapSlide,
61         StateMapCenter,
62         StateBranch,
63         StateBranchXLink, // Obsolete
64         StateVymNote,
65         StateHtmlNote, // Obsolete >= 1.13.6
66         StateHtml,
67         StateFrame,
68         StateStandardFlag, // New in 2.7.509
69         StateUserFlagDef,  // New in 2.7.509
70         StateUserFlag,
71         StateNote, // Obsolete >= 1.4.6
72         StateImage,
73         StateHeading,
74         StateLink,
75         StateAttribute,
76         StateTask
77     };
78
79     int branchesCounter;
80     int branchesTotal;
81
82     State state;
83     QList<State> stateStack;
84     VymText vymtext;
85
86     BranchItem *lastBranch;
87     ImageItem *lastImage;
88     MapItem *lastMI;
89     SlideItem *lastSlide;
90     Task *lastTask;
91     QString lastSetting;
92
93     bool useProgress;
94 };
95 #endif