#ifndef __RTFPARSEHELPERS_H__ #define __RTFPARSEHELPERS_H__ #include "reference.h" #include "sablo.h" #include "rtfformatting.h" #include using std::wstring; using std::string; class RtfParser; class Destination : public Instance { public: // This is called when the Destination is first used virtual void initialize() {}; // Called when data arrives at destination virtual void charData(wstring data) {}; // Called when the Destination goes out of scope virtual void done() {}; protected: RtfParser* m_parser; friend class RtfParser; }; class Analyser : public Instance { public: // This is called when the Analyser is first used virtual void initialize() {}; // Called when a control word is seen virtual void controlWord(const string& cw, int flags, int param) {}; // Called when a group is seen within this scope virtual void groupStart() {}; // Called when a group ends within this scope virtual void groupEnd() {}; // Called when when this analyser goes out of scope virtual void done() {}; protected: RtfParser* m_parser; friend class RtfParser; }; class Level; typedef Reference DestinationPtr; typedef Reference AnalyserPtr; typedef Reference LevelPtr; class Level : public Instance { public: Level(); virtual ~Level(); LevelPtr getPrevious(); LevelPtr pushLevel(); DOM::Element getElement(); void setElement(DOM::Element element, bool deep = false); AnalyserPtr getAnalyser(); void setAnalyser(AnalyserPtr analyser, bool deep = false); DestinationPtr getDestination(); void setDestination(DestinationPtr destination, bool deep = false); RtfFormatting& getFormatting(); void setTextProperties(RtfFormatting& textProperties); protected: Level(const Level& level); LevelPtr m_previous; DOM::Element m_element; RtfFormatting m_text; DestinationPtr m_destination; AnalyserPtr m_analyser; }; #endif //__RTFPARSEHELPERS_H__