annotate src/html_common.hh @ 262:bb0694ce4e6b

- html.cc cleanup (in progress). Source split.
author jcid
date Thu, 05 Jun 2008 15:12:04 +0200
parents
children af0161ff58ec
rev   line source
262
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
1 #ifndef __HTML_COMMON_HH__
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
2 #define __HTML_COMMON_HH__
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
3
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
4 #include "url.h"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
5 #include "bw.h"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
6
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
7 #include "lout/misc.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
8 #include "dw/core.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
9 #include "dw/image.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
10
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
11 #include "image.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
12
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
13 #include "form.hh"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
14
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
15 /*
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
16 * Macros
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
17 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
18
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
19 // Dw to Textblock
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
20 #define DW2TB(dw) ((Textblock*)dw)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
21 // "html struct" to "Layout"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
22 #define HT2LT(html) ((Layout*)html->bw->render_layout)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
23 // "Image" to "Dw Widget"
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
24 #define IM2DW(Image) ((Widget*)Image->dw)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
25 // Top of the parsing stack
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
26 #define S_TOP(html) (html->stack->getRef(html->stack->size()-1))
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
27
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
28 // Add a bug-meter message.
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
29 #define BUG_MSG(...) \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
30 D_STMT_START { \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
31 html->bugMessage(__VA_ARGS__); \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
32 } D_STMT_END
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
33
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
34 /*
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
35 * Change one toplevel attribute. var should be an identifier. val is
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
36 * only evaluated once, so you can safely use a function call for it.
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
37 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
38 #define HTML_SET_TOP_ATTR(html, var, val) \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
39 do { \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
40 StyleAttrs style_attrs; \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
41 Style *old_style; \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
42 \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
43 old_style = S_TOP(html)->style; \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
44 style_attrs = *old_style; \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
45 style_attrs.var = (val); \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
46 S_TOP(html)->style = \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
47 Style::create (HT2LT(html), &style_attrs); \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
48 old_style->unref (); \
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
49 } while (FALSE)
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
50
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
51 /*
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
52 * Typedefs
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
53 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
54
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
55 typedef struct _DilloLinkImage DilloLinkImage;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
56 typedef struct _DilloHtmlState DilloHtmlState;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
57
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
58 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
59 DT_NONE,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
60 DT_HTML,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
61 DT_XHTML
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
62 } DilloHtmlDocumentType;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
63
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
64 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
65 DILLO_HTML_PARSE_MODE_INIT = 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
66 DILLO_HTML_PARSE_MODE_STASH,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
67 DILLO_HTML_PARSE_MODE_STASH_AND_BODY,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
68 DILLO_HTML_PARSE_MODE_VERBATIM,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
69 DILLO_HTML_PARSE_MODE_BODY,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
70 DILLO_HTML_PARSE_MODE_PRE
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
71 } DilloHtmlParseMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
72
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
73 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
74 DILLO_HTML_TABLE_MODE_NONE, /* no table at all */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
75 DILLO_HTML_TABLE_MODE_TOP, /* outside of <tr> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
76 DILLO_HTML_TABLE_MODE_TR, /* inside of <tr>, outside of <td> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
77 DILLO_HTML_TABLE_MODE_TD /* inside of <td> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
78 } DilloHtmlTableMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
79
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
80 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
81 HTML_LIST_NONE,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
82 HTML_LIST_UNORDERED,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
83 HTML_LIST_ORDERED
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
84 } DilloHtmlListMode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
85
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
86 typedef enum {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
87 IN_NONE = 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
88 IN_HTML = 1 << 0,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
89 IN_HEAD = 1 << 1,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
90 IN_BODY = 1 << 2,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
91 IN_FORM = 1 << 3,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
92 IN_SELECT = 1 << 4,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
93 IN_OPTION = 1 << 5,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
94 IN_TEXTAREA = 1 << 6,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
95 IN_MAP = 1 << 7,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
96 IN_PRE = 1 << 8,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
97 IN_BUTTON = 1 << 9,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
98 IN_LI = 1 << 10,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
99 } DilloHtmlProcessingState;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
100
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
101 /*
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
102 * Data Structures
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
103 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
104
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
105 struct _DilloLinkImage {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
106 DilloUrl *url;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
107 DilloImage *image;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
108 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
109
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
110 struct _DilloHtmlState {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
111 dw::core::style::Style *style, *table_cell_style;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
112 DilloHtmlParseMode parse_mode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
113 DilloHtmlTableMode table_mode;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
114 bool_t cell_text_align_set;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
115 DilloHtmlListMode list_type;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
116 int list_number;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
117
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
118 /* TagInfo index for the tag that's being processed */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
119 int tag_idx;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
120
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
121 dw::core::Widget *textblock, *table;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
122
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
123 /* This is used to align list items (especially in enumerated lists) */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
124 dw::core::Widget *ref_list_item;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
125
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
126 /* This is used for list items etc; if it is set to TRUE, breaks
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
127 have to be "handed over" (see Html_add_indented and
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
128 Html_eventually_pop_dw). */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
129 bool_t hand_over_break;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
130 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
131
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
132 /*
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
133 * Classes
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
134 */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
135
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
136 class DilloHtml {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
137 private:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
138 class HtmlLinkReceiver: public dw::core::Widget::LinkReceiver {
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
139 public:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
140 DilloHtml *html;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
141
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
142 bool enter (dw::core::Widget *widget, int link, int img, int x, int y);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
143 bool press (dw::core::Widget *widget, int link, int img, int x, int y,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
144 dw::core::EventButton *event);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
145 bool click (dw::core::Widget *widget, int link, int img, int x, int y,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
146 dw::core::EventButton *event);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
147 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
148 HtmlLinkReceiver linkReceiver;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
149
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
150 public: //BUG: for now everything is public
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
151
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
152 BrowserWindow *bw;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
153 DilloUrl *page_url, *base_url;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
154 dw::core::Widget *dw; /* this is duplicated in the stack */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
155
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
156 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
157 /* Variables required at parsing time */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
158 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
159 size_t Buf_Consumed; /* amount of source from cache consumed */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
160 char *Start_Buf;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
161 int Start_Ofs;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
162 char *content_type, *charset;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
163 bool stop_parser;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
164
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
165 size_t CurrTagOfs;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
166 size_t OldTagOfs, OldTagLine;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
167
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
168 DilloHtmlDocumentType DocType; /* as given by DOCTYPE tag */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
169 float DocTypeVersion; /* HTML or XHTML version number */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
170
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
171 lout::misc::SimpleVector<DilloHtmlState> *stack;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
172
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
173 int InFlags; /* tracks which elements we are in */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
174
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
175 Dstr *Stash;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
176 bool_t StashSpace;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
177
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
178 int pre_column; /* current column, used in PRE tags with tabs */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
179 bool_t PreFirstChar; /* used to skip the first CR or CRLF in PRE tags */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
180 bool_t PrevWasCR; /* Flag to help parsing of "\r\n" in PRE tags */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
181 bool_t PrevWasOpenTag; /* Flag to help deferred parsing of white space */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
182 bool_t SPCPending; /* Flag to help deferred parsing of white space */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
183 bool_t PrevWasSPC; /* Flag to help handling collapsing white space */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
184 bool_t InVisitedLink; /* used to 'contrast_visited_colors' */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
185 bool_t ReqTagClose; /* Flag to help handling bad-formed HTML */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
186 bool_t CloseOneTag; /* Flag to help Html_tag_cleanup_at_close() */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
187 bool_t WordAfterLI; /* Flag to help ignoring the 1st <P> after <LI> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
188 bool_t TagSoup; /* Flag to enable the parser's cleanup functions */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
189 char *NameVal; /* used for validation of "NAME" and "ID" in <A> */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
190
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
191 /* element counters: used for validation purposes */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
192 uchar_t Num_HTML, Num_HEAD, Num_BODY, Num_TITLE;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
193
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
194 Dstr *attr_data; /* Buffer for attribute value */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
195
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
196 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
197 /* Variables required after parsing (for page functionality) */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
198 /* -------------------------------------------------------------------*/
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
199 lout::misc::SimpleVector<DilloHtmlForm*> *forms;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
200 lout::misc::SimpleVector<DilloUrl*> *links;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
201 lout::misc::SimpleVector<DilloLinkImage*> *images;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
202 dw::ImageMapsList maps;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
203
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
204 int32_t link_color;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
205 int32_t visited_color;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
206
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
207 private:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
208 bool_t parse_finished;
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
209 void freeParseData();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
210 void initDw(); /* Used by the constructor */
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
211
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
212 public:
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
213 DilloHtml(BrowserWindow *bw, const DilloUrl *url, const char *content_type);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
214 ~DilloHtml();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
215 void bugMessage(const char *format, ... );
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
216 void connectSignals(dw::core::Widget *dw);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
217 void write(char *Buf, int BufSize, int Eof);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
218 int getCurTagLineNumber();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
219 void finishParsing(int ClientKey);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
220 int formNew(DilloHtmlMethod method, const DilloUrl *action,
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
221 DilloHtmlEnc enc, const char *charset);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
222 inline DilloHtmlForm *getCurrentForm ();
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
223 void loadImages (const DilloUrl *pattern);
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
224 };
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
225
bb0694ce4e6b - html.cc cleanup (in progress). Source split.
jcid
parents:
diff changeset
226 #endif /* __HTML_COMMON_HH__ */