]> git.sven.stormbind.net Git - sven/vym.git/blob - xml-vym.h
771ef679e3ffd58b7caf84c87167ba07f33f2feb
[sven/vym.git] / 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 {TreeContent = 0x0001, SlideContent = 0x0002, XLinkContent = 0x0004};
17
18 class parseVYMHandler  : public parseBaseHandler
19 {
20 public:
21     parseVYMHandler();
22     void setContentFilter (const int &);
23
24 private:
25     int contentFilter;    
26 public:
27     bool startDocument();
28     bool startElement ( const QString&, const QString&,
29                         const QString& eName, const QXmlAttributes& atts ); 
30     bool   endElement ( const QString&, const QString&, const QString& ); 
31     bool characters   ( const QString&);
32     QString errorString();
33     bool readMapAttr     (const QXmlAttributes&);
34     bool readBranchAttr  (const QXmlAttributes&);
35     bool readFrameAttr   (const QXmlAttributes&);
36     bool readOOAttr      (const QXmlAttributes&);
37     bool readNoteAttr    (const QXmlAttributes&);
38     bool readImageAttr   (const QXmlAttributes&);
39     bool readXLinkAttr   (const QXmlAttributes&);
40     bool readLinkNewAttr (const QXmlAttributes&);
41     bool readSettingAttr (const QXmlAttributes&);
42     bool readSlideAttr   (const QXmlAttributes&);
43     bool readTaskAttr    (const QXmlAttributes&);
44
45 private:
46     enum State 
47     {
48         StateInit,
49         StateMap,
50         StateMapSelect,
51         StateMapSetting,
52         StateMapSlide,
53         StateMapCenter,
54         StateBranch,
55         StateBranchXLink,           // Obsolete
56         StateVymNote,
57         StateHtmlNote,              // Obsolete >= 1.13.6
58         StateHtml,
59         StateFrame,
60         StateStandardFlag,
61         StateNote,                  // Obsolete >= 1.4.6
62         StateImage,
63         StateHeading,
64         StateLink,
65         StateAttribute,
66         StateTask
67      };
68
69      int branchesCounter;
70      int branchesTotal;
71
72     State state;             
73     QList <State> stateStack;
74     VymText vymtext;
75
76     BranchItem* lastBranch;
77     ImageItem* lastImage;
78     MapItem* lastMI;
79     SlideItem *lastSlide;
80     Task *lastTask;
81     QString lastSetting;
82
83     bool useProgress;
84 }; 
85 #endif