20#ifndef __AMIPROPARSER_H
21#define __AMIPROPARSER_H
25#include <tqvaluelist.h>
31 static const float LS_Single, LS_OneAndHalf, LS_Double;
40 bool bold, italic, underline;
41 bool word_underline, double_underline;
42 bool subscript, superscript, strikethrough;
46 enum { Left, Right, Center, Justified } align;
48 AmiProFormat( const AmiProFormat& );
49 AmiProFormat& operator=( const AmiProFormat& );
50 void assign( const AmiProFormat& );
51 void applyStyle( const AmiProStyle& );
54typedef TQValueList<AmiProFormat> AmiProFormatList;
64 bool bold, italic, underline;
65 bool word_underline, double_underline;
66 bool subscript, superscript, strikethrough;
67 TQt::AlignmentFlags align;
69 float spaceBefore, spaceAfter;
71 AmiProLayout( const AmiProLayout& );
72 AmiProLayout& operator=( const AmiProLayout& );
73 void assign( const AmiProLayout& );
74 void applyStyle( const AmiProStyle& );
84 bool bold, italic, underline;
85 bool word_underline, double_underline;
86 bool subscript, superscript, strikethrough;
87 TQt::AlignmentFlags align;
89 float spaceBefore, spaceAfter;
91 AmiProStyle( const AmiProStyle& );
92 AmiProStyle& operator=( const AmiProStyle& );
93 void assign( const AmiProStyle& );
96typedef TQValueList<AmiProStyle> AmiProStyleList;
102 virtual ~AmiProListener();
103 virtual bool doOpenDocument();
104 virtual bool doCloseDocument();
105 virtual bool doDefineStyle( const AmiProStyle& style );
106 virtual bool doParagraph( const TQString& text, AmiProFormatList formatList,
107 AmiProLayout& layout );
115 virtual ~AmiProParser();
117 enum { OK, UnknownError, FileError, InvalidFormat } Error;
119 bool process( const TQString& filename );
120 int result(){ return m_result; }
122 void setListener( AmiProListener * );
128 AmiProFormat m_currentFormat;
129 AmiProFormatList m_formatList;
130 AmiProLayout m_layout;
131 AmiProStyleList m_styleList;
134 AmiProListener *m_listener;
136 TQString m_currentSection;
138 bool setResult( int );
139 bool parseParagraph( const TQStringList& lines );
140 bool parseStyle( const TQStringList& line );
141 AmiProStyle findStyle( const TQString& name );
143 bool handleTag( const TQString& tag );
144 bool processOpenDocument();
145 bool processCloseDocument();
146 bool processParagraph( const TQString& text, AmiProFormatList formatList,
147 AmiProLayout& layout );
|