~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to fcl/xml/dom_html.pp

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    $Id: dom_html.pp,v 1.1 2002/12/11 21:06:07 sg Exp $
 
3
    This file is part of the Free Component Library
 
4
 
 
5
    Implementation of DOM HTML interfaces
 
6
    Copyright (c) 2002 by
 
7
      Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org
 
8
 
 
9
    See the file COPYING.FPC, included in this distribution,
 
10
    for details about the copyright.
 
11
 
 
12
    This program is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
15
 
 
16
 **********************************************************************}
 
17
 
 
18
{ Please note that this is a very early version, most properties and methods
 
19
  are not implemented yet. }
 
20
 
 
21
 
 
22
unit DOM_HTML;
 
23
 
 
24
interface
 
25
 
 
26
uses DOM;
 
27
 
 
28
type
 
29
 
 
30
  THTMLDocument = class;
 
31
  THTMLFormElement = class;
 
32
  THTMLTableCaptionElement = class;
 
33
  THTMLTableSectionElement = class;
 
34
 
 
35
  THTMLCollection = class
 
36
  public
 
37
    property Length: Cardinal;  // !!!: ro
 
38
    function Item(Index: Cardinal): TDOMNode;
 
39
    function NamedItem(const Index: DOMString): TDOMNode;
 
40
  end;
 
41
 
 
42
  THTMLOptionsCollection = class
 
43
  public
 
44
    property Length: Cardinal;  // !!!: ro
 
45
    function Item(Index: Cardinal): TDOMNode;
 
46
    function NamedItem(const Index: DOMString): TDOMNode;
 
47
  end;
 
48
 
 
49
  THTMLElement = class(TDOMElement)
 
50
  private
 
51
    function GetID: DOMString;
 
52
    procedure SetID(const Value: DOMString);
 
53
    function GetTitle: DOMString;
 
54
    procedure SetTitle(const Value: DOMString);
 
55
    function GetLang: DOMString;
 
56
    procedure SetLang(const Value: DOMString);
 
57
    function GetDir: DOMString;
 
58
    procedure SetDir(const Value: DOMString);
 
59
    function GetClassName: DOMString;
 
60
    procedure SetClassName(const Value: DOMString);
 
61
  protected
 
62
    constructor Create(AOwner: THTMLDocument; const ATagName: DOMString);
 
63
  public
 
64
    property ID: DOMString read GetID write SetID;
 
65
    property Title: DOMString read GetTitle write SetTitle;
 
66
    property Lang: DOMString read GetLang write SetLang;
 
67
    property Dir: DOMString read GetDir write SetDir;
 
68
    property ClassName: DOMString read GetClassName write SetClassName;
 
69
  end;
 
70
 
 
71
  THTMLHtmlElement = class(THTMLElement)
 
72
  private
 
73
    function GetVersion: DOMString;
 
74
    procedure SetVersion(const Value: DOMString);
 
75
  public
 
76
    property Version: DOMString read GetVersion write SetVersion;
 
77
  end;
 
78
 
 
79
  THTMLHeadElement = class(THTMLElement)
 
80
  private
 
81
    function GetProfile: DOMString;
 
82
    procedure SetProfile(const Value: DOMString);
 
83
  public
 
84
    property Profile: DOMString read GetProfile write SetProfile;
 
85
  end;
 
86
 
 
87
  THTMLLinkElement = class(THTMLElement)
 
88
  public
 
89
    property Disabled: Boolean; // !!!: rw
 
90
    property Charset: DOMString;        // !!!: rw
 
91
    property HRef: DOMString;   // !!!: rw
 
92
    property HRefLang: DOMString;       // !!!: rw
 
93
    property Media: DOMString;  // !!!: rw
 
94
    property Rel: DOMString;    // !!!: rw
 
95
    property Rev: DOMString;    // !!!: rw
 
96
    property Target: DOMString; // !!!: rw
 
97
    property HTMLType: DOMString;       // !!!: rw
 
98
  end;
 
99
 
 
100
  THTMLTitleElement = class(THTMLElement)
 
101
  public
 
102
    property Text: DOMString;   // !!!: rw
 
103
  end;
 
104
 
 
105
  THTMLMetaElement = class(THTMLElement)
 
106
  public
 
107
    property Content: DOMString;        // !!!: rw
 
108
    property HTTPEqiv: DOMString;       // !!!: rw
 
109
    property Name: DOMString;   // !!!: rw
 
110
    property Scheme: DOMString; // !!!: rw
 
111
  end;
 
112
 
 
113
  THTMLBaseElement = class(THTMLElement)
 
114
  public
 
115
    property HRef: DOMString;   // !!!: rw
 
116
    property Target: DOMString; // !!!: rw
 
117
  end;
 
118
 
 
119
  THTMLIsIndexElement = class(THTMLElement)
 
120
  public
 
121
    property Form: THTMLFormElement;    // !!!: ro
 
122
    property Prompt: DOMString; // !!!: rw
 
123
  end;
 
124
 
 
125
  THTMLStyleElement = class(THTMLElement)
 
126
  public
 
127
    property Disabled: Boolean; // !!!: rw
 
128
    property Media: DOMString;  // !!!: rw
 
129
    property HTMLType: DOMString;       // !!!: rw
 
130
  end;
 
131
 
 
132
  THTMLBodyElement = class(THTMLElement)
 
133
  public
 
134
    property ALink: DOMString;  // !!!: rw
 
135
    property Background: DOMString;     // !!!: rw
 
136
    property BgColor: DOMString;        // !!!: rw
 
137
    property Link: DOMString;   // !!!: rw
 
138
    property Text: DOMString;   // !!!: rw
 
139
    property VLink: DOMString;  // !!!: rw
 
140
  end;
 
141
 
 
142
  THTMLFormElement = class(THTMLElement)
 
143
  public
 
144
    property Elements: THTMLCollection; // !!!: ro
 
145
    property Length: Integer;   // !!!: ro
 
146
    property Name: DOMString;   // !!!: rw
 
147
    property AcceptCharset: DOMString;  // !!!: rw
 
148
    property Action: DOMString; // !!!: rw
 
149
    property EncType: DOMString;        // !!!: rw
 
150
    property Method: DOMString; // !!!: rw
 
151
    property Target: DOMString; // !!!: rw
 
152
    procedure Submit; virtual; abstract;
 
153
    procedure Reset; virtual; abstract;
 
154
  end;
 
155
 
 
156
  THTMLSelectElement = class(THTMLElement)
 
157
  public
 
158
    property HTMLType: DOMString;       // !!!: ro
 
159
    property SelectedIndex: Integer;    // !!!: rw
 
160
    property Value: DOMString;  // !!!: rw
 
161
    property Length: Cardinal;  // !!!: rw
 
162
    property Form: THTMLFormElement;    // !!!: ro
 
163
    property Options: THTMLOptionsCollection;   // !!!: ro
 
164
    property Disabled: Boolean; // !!!: rw
 
165
    property Multiple: Boolean; // !!!: rw
 
166
    property Name: DOMString;   // !!!: rw
 
167
    property Size: Integer;     // !!!: rw
 
168
    property TabIndex: Integer; // !!!: rw
 
169
    procedure Add(Element, Before: THTMLElement);
 
170
    procedure Remove(Index: Integer);
 
171
    procedure Blur; virtual; abstract;
 
172
    procedure Focus; virtual; abstract;
 
173
  end;
 
174
 
 
175
  THTMLOptGroupElement = class(THTMLElement)
 
176
  public
 
177
    property Disabled: Boolean; // !!!: rw
 
178
    property GroupLabel: DOMString;     // !!!: rw
 
179
  end;
 
180
 
 
181
  THTMLOptionElement = class(THTMLElement)
 
182
  public
 
183
    property Form: THTMLFormElement;    // !!!: ro
 
184
    property DefaultSelected: Boolean;  // !!!: rw
 
185
    property Text: DOMString;   // !!!: ro
 
186
    property Index: Integer;    // !!!: ro
 
187
    property Disabled: Boolean; // !!!: rw
 
188
    property OptionLabel: DOMString;    // !!!: rw
 
189
    property Selected: Boolean; // !!!: rw
 
190
    property Value: DOMString;  // !!!: rw
 
191
  end;
 
192
 
 
193
  THTMLInputElement = class(THTMLElement)
 
194
  public
 
195
    property DefaultValue: DOMString;   // !!!: rw
 
196
    property DefaultChecked: Boolean;   // !!!: rw
 
197
    property Form: THTMLFormElement;    // !!!: ro
 
198
    property Accept: DOMString; // !!!: rw
 
199
    property AccessKey: DOMString;      // !!!: rw
 
200
    property Align: DOMString;  // !!!: rw
 
201
    property Alt: DOMString;    // !!!: rw
 
202
    property Checked: Boolean;  // !!!: rw
 
203
    property Disabled: Boolean; // !!!: rw
 
204
    property MaxLength: Integer;        // !!!: rw
 
205
    property Name: DOMString;   // !!!: rw
 
206
    property ReadOnly: Boolean; // !!!: rw
 
207
    property Size: Cardinal;    // !!!: rw
 
208
    property Src: DOMString;    // !!!: rw
 
209
    property TabIndex: Integer; // !!!: rw
 
210
    property HTMLType: DOMString;       // !!!: rw
 
211
    property UseMap: DOMString; // !!!: rw
 
212
    property Value: DOMString;  // !!!: rw
 
213
    procedure Blur; virtual; abstract;
 
214
    procedure Focus; virtual; abstract;
 
215
    procedure Select; virtual; abstract;
 
216
    procedure Click; virtual; abstract;
 
217
  end;
 
218
 
 
219
  THTMLTextAreaElement = class(THTMLElement)
 
220
  public
 
221
    property DefaultValue: DOMString;   // !!!: rw
 
222
    property Form: THTMLFormElement;    // !!!: ro
 
223
    property AccessKey: DOMString;      // !!!: rw
 
224
    property Cols: Integer;     // !!!: rw
 
225
    property Disabled: Boolean; // !!!: rw
 
226
    property Name: DOMString;   // !!!: rw
 
227
    property ReadOnly: Boolean; // !!!: rw
 
228
    property Rows: Integer;     // !!!: rw
 
229
    property TabIndex: Integer; // !!!: rw
 
230
    property HTMLType: DOMString;       // !!!: rw
 
231
    property Value: DOMString;  // !!!: rw
 
232
    procedure Blur; virtual; abstract;
 
233
    procedure Focus; virtual; abstract;
 
234
    procedure Select; virtual; abstract;
 
235
  end;
 
236
 
 
237
  THTMLButtonElement = class(THTMLElement)
 
238
  public
 
239
    property Form: THTMLFormElement;    // !!!: ro
 
240
    property AccessKey: DOMString;      // !!!: rw
 
241
    property Disabled: Boolean; // !!!: rw
 
242
    property Name: DOMString;   // !!!: rw
 
243
    property TabIndex: Integer; // !!!: rw
 
244
    property HTMLType: DOMString;       // !!!: rw
 
245
    property Value: DOMString;  // !!!: rw
 
246
  end;
 
247
 
 
248
  THTMLLabelElement = class(THTMLElement)
 
249
  public
 
250
    property Form: THTMLFormElement;    // !!!: ro
 
251
    property AccessKey: DOMString;      // !!!: rw
 
252
    property HtmlFor: DOMString;        // !!!: rw
 
253
  end;
 
254
 
 
255
  THTMLFieldSetElement = class(THTMLElement)
 
256
  public
 
257
    property Form: THTMLFormElement;    // !!!: ro
 
258
  end;
 
259
 
 
260
  THTMLLegendElement = class(THTMLElement)
 
261
  public
 
262
    property Form: THTMLFormElement;    // !!!: ro
 
263
    property AccessKey: DOMString;      // !!!: rw
 
264
    property Align: DOMString;  // !!!: rw
 
265
  end;
 
266
 
 
267
  THTMLUListElement = class(THTMLElement)
 
268
  public
 
269
    property Compact: Boolean;  // !!!: rw
 
270
    property HTMLType: DOMString;       // !!!: rw
 
271
  end;
 
272
 
 
273
  THTMLOListElement = class(THTMLElement)
 
274
  public
 
275
    property Compact: Boolean;  // !!!: rw
 
276
    property Start: Integer;    // !!!: rw
 
277
    property HTMLType: DOMString;       // !!!: rw
 
278
  end;
 
279
 
 
280
  THTMLDListElement = class(THTMLElement)
 
281
  public
 
282
    property Compact: Boolean;  // !!!: rw
 
283
  end;
 
284
 
 
285
  THTMLDirectoryElement = class(THTMLElement)
 
286
  public
 
287
    property Compact: Boolean;  // !!!: rw
 
288
  end;
 
289
 
 
290
  THTMLMenuElement = class(THTMLElement)
 
291
  public
 
292
    property Compact: Boolean;  // !!!: rw
 
293
  end;
 
294
 
 
295
  THTMLLIElement = class(THTMLElement)
 
296
  public
 
297
    property HTMLType: DOMString;       // !!!: rw
 
298
    property Value: Integer;    // !!!: rw
 
299
  end;
 
300
 
 
301
  THTMLDivElement = class(THTMLElement)
 
302
  public
 
303
    property Align: DOMString;  // !!!: rw
 
304
  end;
 
305
 
 
306
  THTMLParagraphElement = class(THTMLElement)
 
307
  public
 
308
    property Align: DOMString;  // !!!: rw
 
309
  end;
 
310
 
 
311
  THTMLHeadingElement = class(THTMLElement)
 
312
  public
 
313
    property Align: DOMString;  // !!!: rw
 
314
  end;
 
315
 
 
316
  THTMLQuoteElement = class(THTMLElement)
 
317
  public
 
318
    property Cite: DOMString;   // !!!: rw
 
319
  end;
 
320
 
 
321
  THTMLPreElement = class(THTMLElement)
 
322
  public
 
323
    property Width: Integer;    // !!!: rw
 
324
  end;
 
325
 
 
326
  THTMLBREElement = class(THTMLElement)
 
327
  public
 
328
    property Clear: DOMString;  // !!!: rw
 
329
  end;
 
330
 
 
331
  THTMLBaseFontElement = class(THTMLElement)
 
332
  public
 
333
    property Color: DOMString;  // !!!: rw
 
334
    property Face: DOMString;   // !!!: rw
 
335
    property Size: Integer;     // !!!: rw
 
336
  end;
 
337
 
 
338
  THTMLFontElement = class(THTMLElement)
 
339
  public
 
340
    property Color: DOMString;  // !!!: rw
 
341
    property Face: DOMString;   // !!!: rw
 
342
    property Size: Integer;     // !!!: rw
 
343
  end;
 
344
 
 
345
  THTMLHRElement = class(THTMLElement)
 
346
  public
 
347
    property Align: DOMString;  // !!!: rw
 
348
    property NoShade: Boolean;  // !!!: rw
 
349
    property Size: DOMString;   // !!!: rw
 
350
    property Width: DOMString;  // !!!: rw
 
351
  end;
 
352
 
 
353
  THTMLModElement = class(THTMLElement)
 
354
  public
 
355
    property Cite: DOMString;   // !!!: rw
 
356
    property DateTime: DOMString;       // !!!: rw
 
357
  end;
 
358
 
 
359
  THTMLAnchorElement = class(THTMLElement)
 
360
  public
 
361
    property AccessKey: DOMString;      // !!!: rw
 
362
    property Charset: DOMString;        // !!!: rw
 
363
    property Coords: DOMString; // !!!: rw
 
364
    property HRef: DOMString;   // !!!: rw
 
365
    property HRefLang: DOMString;       // !!!: rw
 
366
    property Name: DOMString;   // !!!: rw
 
367
    property Rel: DOMString;    // !!!: rw
 
368
    property Rev: DOMString;    // !!!: rw
 
369
    property Shape: DOMString;  // !!!: rw
 
370
    property TabIndex: Integer; // !!!: rw
 
371
    property Target: DOMString; // !!!: rw
 
372
    property HTMLType: DOMString;       // !!!: rw
 
373
    procedure Blur; virtual; abstract;
 
374
    procedure Focus; virtual; abstract;
 
375
  end;
 
376
 
 
377
  THTMLImageElement = class(THTMLElement)
 
378
  public
 
379
    property Name: DOMString;   // !!!: rw
 
380
    property Align: DOMString;  // !!!: rw
 
381
    property Alt: DOMString;    // !!!: rw
 
382
    property Border: DOMString; // !!!: rw
 
383
    property Height: Integer;   // !!!: rw
 
384
    property HSpace: Integer;   // !!!: rw
 
385
    property IsMap: Boolean;    // !!!: rw
 
386
    property LongDesc: DOMString;       // !!!: rw
 
387
    property Src: Integer;      // !!!: rw
 
388
    property UseMap: DOMString; // !!!: rw
 
389
    property VSpace: Integer;   // !!!: rw
 
390
    property Width: Integer;    // !!!: rw
 
391
  end;
 
392
 
 
393
  THTMLObjectElement = class(THTMLElement)
 
394
  public
 
395
    property Form: THTMLFormElement;    // !!!: ro
 
396
    property Code: DOMString;   // !!!: rw
 
397
    property Align: DOMString;  // !!!: rw
 
398
    property Archive: DOMString;        // !!!: rw
 
399
    property Border: DOMString; // !!!: rw
 
400
    property CodeBase: DOMString;       // !!!: rw
 
401
    property CodeType: DOMString;       // !!!: rw
 
402
    property Data: DOMString;   // !!!: rw
 
403
    property Declare: Boolean;  // !!!: rw
 
404
    property Height: DOMString; // !!!: rw
 
405
    property HSpace: Integer;   // !!!: rw
 
406
    property Name: DOMString;   // !!!: rw
 
407
    property StandBy: DOMString;        // !!!: rw
 
408
    property TabIndex: Integer; // !!!: rw
 
409
    property HTMLType: DOMString;       // !!!: rw
 
410
    property UseMap: DOMString; // !!!: rw
 
411
    property VSpace: Integer;   // !!!: rw
 
412
    property Width: Integer;    // !!!: rw
 
413
    property ContentDocument: TDOMDocument;     // !!!: ro
 
414
  end;
 
415
 
 
416
  THTMLParamElement = class(THTMLElement)
 
417
  public
 
418
    property Name: DOMString;   // !!!: rw
 
419
    property HTMLType: DOMString;       // !!!: rw
 
420
    property Value: DOMString;  // !!!: rw
 
421
    property ValueType: DOMString;      // !!!: rw
 
422
  end;
 
423
 
 
424
  THTMLAppletElement = class(THTMLElement)
 
425
  public
 
426
    property Align: DOMString;  // !!!: rw
 
427
    property Alt: DOMString;    // !!!: rw
 
428
    property Archive: DOMString;        // !!!: rw
 
429
    property Code: DOMString;   // !!!: rw
 
430
    property CodeBase: DOMString;       // !!!: rw
 
431
    property Height: DOMString; // !!!: rw
 
432
    property HSpace: Integer;   // !!!: rw
 
433
    property Name: DOMString;   // !!!: rw
 
434
    property AppletObject: DOMString;   // !!!: rw
 
435
    property VSpace: Integer;   // !!!: rw
 
436
    property Width: Integer;    // !!!: rw
 
437
  end;
 
438
 
 
439
  THTMLMapElement = class(THTMLElement)
 
440
  public
 
441
    property Areas: THTMLCollection;    // !!!: ro
 
442
    property Name: DOMString;   // !!!: rw
 
443
  end;
 
444
 
 
445
  THTMLAreaElement = class(THTMLElement)
 
446
  public
 
447
    property AccessKey: DOMString;      // !!!: rw
 
448
    property Alt: DOMString;    // !!!: rw
 
449
    property Coords: DOMString; // !!!: rw
 
450
    property HRef: DOMString;   // !!!: rw
 
451
    property NoHRef: Boolean;   // !!!: rw
 
452
    property Shape: DOMString;  // !!!: rw
 
453
    property TabIndex: Integer; // !!!: rw
 
454
    property Target: DOMString; // !!!: rw
 
455
  end;
 
456
 
 
457
  THTMLScriptElement = class(THTMLElement)
 
458
  public
 
459
    property Text: DOMString;   // !!!: rw
 
460
    property HtmlFor: DOMString;        // !!!: rw
 
461
    property Event: DOMString;  // !!!: rw
 
462
    property Charset: DOMString;        // !!!: rw
 
463
    property Defer: Boolean;    // !!!: rw
 
464
    property Src: DOMString;    // !!!: rw
 
465
    property HTMLType: DOMString;       // !!!: rw
 
466
  end;
 
467
 
 
468
  THTMLTableElement = class(THTMLElement)
 
469
  public
 
470
    property Caption: THTMLTableCaptionElement; // !!!: rw
 
471
    property THead: THTMLTableSectionElement;   // !!!: rw
 
472
    property TFoot: THTMLTableSectionElement;   // !!!: rw
 
473
    property Rows: THTMLCollection;     // !!!: ro
 
474
    property TBodies: THTMLCollection;  // !!!: ro
 
475
    property Align: DOMString;  // !!!: rw
 
476
    property BgColor: DOMString;        // !!!: rw
 
477
    property Border: DOMString; // !!!: rw
 
478
    property CellPadding: DOMString;    // !!!: rw
 
479
    property CellSpacing: DOMString;    // !!!: rw
 
480
    property Frame: DOMString;  // !!!: rw
 
481
    property Rules: DOMString;  // !!!: rw
 
482
    property Summary: DOMString;        // !!!: rw
 
483
    property Width: DOMString;  // !!!: rw
 
484
    function CreateTHead: THTMLElement;
 
485
    procedure DeleteTHead;
 
486
    function CreateTFoot: THTMLElement;
 
487
    procedure DeleteTFoot;
 
488
    function CreateCaption: THTMLElement;
 
489
    procedure DeleteCaption;
 
490
    function InsertRow(Index: Integer): THTMLElement;
 
491
    procedure DeleteRow(Index: Integer);
 
492
  end;
 
493
 
 
494
  THTMLTableCaptionElement = class(THTMLElement)
 
495
  public
 
496
    property Align: DOMString;  // !!!: rw
 
497
  end;
 
498
 
 
499
  THTMLTableColElement = class(THTMLElement)
 
500
  public
 
501
    property Align: DOMString;  // !!!: rw
 
502
    property Ch: DOMString;     // !!!: rw
 
503
    property ChOff: DOMString;  // !!!: rw
 
504
    property Span: Integer;     // !!!: rw
 
505
    property VAlign: DOMString; // !!!: rw
 
506
    property Width: DOMString;  // !!!: rw
 
507
  end;
 
508
 
 
509
  THTMLTableSectionElement = class(THTMLElement)
 
510
  public
 
511
    property Align: DOMString;  // !!!: rw
 
512
    property Ch: DOMString;     // !!!: rw
 
513
    property ChOff: DOMString;  // !!!: rw
 
514
    property VAlign: DOMString; // !!!: rw
 
515
    property Rows: THTMLCollection;     // !!!: ro
 
516
    function InsertRow(Index: Integer): THTMLElement;
 
517
    procedure DeleteRow(Index: Integer);
 
518
  end;
 
519
 
 
520
  THTMLTableRowElement = class(THTMLElement)
 
521
  public
 
522
    property RowIndex: Integer; // !!!: ro
 
523
    property SectionRowIndex: Integer;  // !!!: ro
 
524
    property Cells: THTMLCollection;    // !!!: ro
 
525
    property Align: DOMString;  // !!!: rw
 
526
    property BgColor: DOMString;        // !!!: rw
 
527
    property Ch: DOMString;     // !!!: rw
 
528
    property ChOff: DOMString;  // !!!: rw
 
529
    property VAlign: DOMString; // !!!: rw
 
530
    function InsertCell(Index: Integer): THTMLElement;
 
531
    procedure DeleteCell(Index: Integer);
 
532
  end;
 
533
 
 
534
  THTMLTableCellElement = class(THTMLElement)
 
535
  public
 
536
    property CellIndex: Integer;        // !!!: ro
 
537
    property Abbr: DOMString;   // !!!: rw
 
538
    property Align: DOMString;  // !!!: rw
 
539
    property Axis: DOMString;   // !!!: rw
 
540
    property BgColor: DOMString;        // !!!: rw
 
541
    property Ch: DOMString;     // !!!: rw
 
542
    property ChOff: DOMString;  // !!!: rw
 
543
    property ColSpan: Integer;  // !!!: rw
 
544
    property Headers: DOMString;        // !!!: rw
 
545
    property Height: DOMString; // !!!: rw
 
546
    property NoWrap: Boolean;   // !!!: rw
 
547
    property RowSpan: Integer;  // !!!: rw
 
548
    property Scope: DOMString;  // !!!: rw
 
549
    property VAlign: DOMString; // !!!: rw
 
550
    property Width: DOMString;  // !!!: rw
 
551
  end;
 
552
 
 
553
  THTMLFrameSetElement = class(THTMLElement)
 
554
  public
 
555
    property Cols: DOMString;   // !!!: rw
 
556
    property Rows: DOMString;   // !!!: rw
 
557
  end;
 
558
 
 
559
  THTMLFrameElement = class(THTMLElement)
 
560
  public
 
561
    property FrameBorder: DOMString;    // !!!: rw
 
562
    property LongDesc: DOMString;       // !!!: rw
 
563
    property MarginHeight: DOMString;   // !!!: rw
 
564
    property MarginWidth: DOMString;    // !!!: rw
 
565
    property Name: DOMString;   // !!!: rw
 
566
    property NoResize: Boolean; // !!!: rw
 
567
    property Scrolling: DOMString;      // !!!: rw
 
568
    property Src: DOMString;    // !!!: rw
 
569
    property ContentDocument: TDOMDocument;     // !!!: ro
 
570
  end;
 
571
 
 
572
  THTMLIFrameElement = class(THTMLElement)
 
573
  public
 
574
    property Align: DOMString;  // !!!: rw
 
575
    property FrameBorder: DOMString;    // !!!: rw
 
576
    property Height: DOMString; // !!!: rw
 
577
    property LongDesc: DOMString;       // !!!: rw
 
578
    property MarginHeight: DOMString;   // !!!: rw
 
579
    property MarginWidth: DOMString;    // !!!: rw
 
580
    property Name: DOMString;   // !!!: rw
 
581
    property Scrolling: DOMString;      // !!!: rw
 
582
    property Src: DOMString;    // !!!: rw
 
583
    property Width: DOMString;  // !!!: rw
 
584
    property ContentDocument: TDOMDocument;     // !!!: ro
 
585
  end;
 
586
 
 
587
  THTMLDocument = class(TXMLDocument)
 
588
  private
 
589
    function GetTitle: DOMString;
 
590
    procedure SetTitle(const Value: DOMString);
 
591
  public
 
592
    property Title: DOMString read GetTitle write SetTitle;
 
593
    property Referrer: DOMString;       // !!!: ro
 
594
    property Domain: DOMString; // !!!: ro
 
595
    property URL: DOMString;    // !!!: ro
 
596
    property Body: THTMLElement;        // !!!: rw
 
597
    property Images: THTMLCollection;   // !!!: ro
 
598
    property Applets: THTMLCollection;  // !!!: ro
 
599
    property Links: THTMLCollection;    // !!!: ro
 
600
    property Forms: THTMLCollection;    // !!!: ro
 
601
    property Anchors: THTMLCollection;  // !!!: ro
 
602
    property Cookie: DOMString;         // !!!: rw
 
603
 
 
604
    procedure Open; virtual; abstract;
 
605
    procedure Close; virtual; abstract;
 
606
    procedure Write(const AText: DOMString);
 
607
    procedure WriteLn(const AText: DOMString);
 
608
    function GetElementsByName(const ElementName: DOMString): TDOMNodeList;
 
609
 
 
610
    // Helper functions (not in DOM standard):
 
611
    function CreateElement(const tagName: DOMString): THTMLElement;
 
612
    function CreateSubElement: THTMLElement;
 
613
    function CreateSupElement: THTMLElement;
 
614
    function CreateSpanElement: THTMLElement;
 
615
    function CreateBDOElement: THTMLElement;
 
616
    function CreateTTElement: THTMLElement;
 
617
    function CreateIElement: THTMLElement;
 
618
    function CreateBElement: THTMLElement;
 
619
    function CreateUElement: THTMLElement;
 
620
    function CreateSElement: THTMLElement;
 
621
    function CreateStrikeElement: THTMLElement;
 
622
    function CreateBigElement: THTMLElement;
 
623
    function CreateSmallElement: THTMLElement;
 
624
    function CreateEmElement: THTMLElement;
 
625
    function CreateStrongElement: THTMLElement;
 
626
    function CreateDfnElement: THTMLElement;
 
627
    function CreateCodeElement: THTMLElement;
 
628
    function CreateSampElement: THTMLElement;
 
629
    function CreateKbdElement: THTMLElement;
 
630
    function CreateVarElement: THTMLElement;
 
631
    function CreateCiteElement: THTMLElement;
 
632
    function CreateAcronymElement: THTMLElement;
 
633
    function CreateAbbrElement: THTMLElement;
 
634
    function CreateDDElement: THTMLElement;
 
635
    function CreateDTElement: THTMLElement;
 
636
    function CreateNoFramesElement: THTMLElement;
 
637
    function CreateNoScriptElement: THTMLElement;
 
638
    function CreateAddressElement: THTMLElement;
 
639
    function CreateCenterElement: THTMLElement;
 
640
    function CreateHtmlElement: THTMLHtmlElement;
 
641
    function CreateHeadElement: THTMLHeadElement;
 
642
    function CreateLinkElement: THTMLLinkElement;
 
643
{    function CreateTitleElement: THTMLTitleElement;
 
644
    function CreateMetaElement: THTMLMetaElement;
 
645
    function CreateBaseElement: THTMLBaseElement;
 
646
    function CreateIsIndexElement: THTMLIsIndexElement;
 
647
    function CreateStyleElement: THTMLStyleElement;}
 
648
    function CreateBodyElement: THTMLBodyElement;
 
649
{    function CreateFormElement: THTMLFormElement;
 
650
    function CreateSelectElement: THTMLSelectElement;
 
651
    function CreateOptGroupElement: THTMLOptGroupElement;
 
652
    function CreateOptionElement: THTMLOptionElement;
 
653
    function CreateInputElement: THTMLInputElement;
 
654
    function CreateTextAreaElement: THTMLTextAreaElement;
 
655
    function CreateButtonElement: THTMLButtonElement;
 
656
    function CreateLabelElement: THTMLLabelElement;
 
657
    function CreateFieldSetElement: THTMLFieldSetElement;
 
658
    function CreateLegendElement: THTMLLegendElement;}
 
659
    function CreateUListElement: THTMLUListElement;
 
660
    function CreateOListElement: THTMLOListElement;
 
661
    function CreateDListElement: THTMLDListElement;
 
662
{    function CreateDirectoryElement: THTMLDirectoryElement;
 
663
    function CreateMenuElement: THTMLMenuElement;}
 
664
    function CreateLIElement: THTMLLIElement;
 
665
{    function CreateDivElement: THTMLDivElement;}
 
666
    function CreateParagraphElement: THTMLParagraphElement;
 
667
{    function CreateHeadingElement: THTMLHeadingElement;
 
668
    function CreateQuoteElement: THTMLQuoteElement;
 
669
    function CreatePreElement: THTMLPreElement;
 
670
    function CreateBRElement: THTMLBreElement;
 
671
    function CreateBaseFontElement: THTMLBaseFontElement;
 
672
    function CreateFontElement: THTMFontLElement;
 
673
    function CreateHRElement: THTMLHREElement;
 
674
    function CreateModElement: THTMLModElement;
 
675
    function CreateAnchorElement: THTMLAnchorElement;
 
676
    function CreateImageElement: THTMLImageElement;
 
677
    function CreateObjectElement: THTMLObjectElement;
 
678
    function CreateParamElement: THTMLParamElement;
 
679
    function CreateAppletElement: THTMLAppletElement;
 
680
    function CreateMapElement: THTMLMapElement;
 
681
    function CreateAreaElement: THTMLAreaElement;
 
682
    function CreateScriptElement: THTMLScriptElement;
 
683
    function CreateTableElement: THTMLTableElement;
 
684
    function CreateTableCaptionElement: THTMLTableCaptionElement;
 
685
    function CreateTableColElement: THTMLTableColElement;
 
686
    function CreateTableSectionElement: THTMLTableSectionElement;
 
687
    function CreateTableRowElement: THTMLTableRowElement;
 
688
    function CreateTableCellElement: THTMLTableCellElement;
 
689
    function CreateFrameSetElement: THTMLFrameSetElement;
 
690
    function CreateFrameElement: THTMLFrameElement;
 
691
    function CreateIFrameElement: THTMLIFrameElement;}
 
692
  end;
 
693
 
 
694
 
 
695
implementation
 
696
 
 
697
 
 
698
function THTMLCollection.Item(Index: Cardinal): TDOMNode;
 
699
begin
 
700
  Result := nil;
 
701
end;
 
702
 
 
703
function THTMLCollection.NamedItem(const Index: DOMString): TDOMNode;
 
704
begin
 
705
  Result := nil;
 
706
end;
 
707
 
 
708
 
 
709
function THTMLOptionsCollection.Item(Index: Cardinal): TDOMNode;
 
710
begin
 
711
  Result := nil;
 
712
end;
 
713
 
 
714
function THTMLOptionsCollection.NamedItem(const Index: DOMString): TDOMNode;
 
715
begin
 
716
  Result := nil;
 
717
end;
 
718
 
 
719
 
 
720
constructor THTMLElement.Create(AOwner: THTMLDocument; const ATagName: DOMString);
 
721
begin
 
722
  inherited Create(AOwner);
 
723
  FNodeName := ATagName;
 
724
end;
 
725
 
 
726
function THTMLElement.GetID: DOMString; begin Result := GetAttribute('id') end;
 
727
procedure THTMLElement.SetID(const Value: DOMString); begin SetAttribute('id', Value) end;
 
728
function THTMLElement.GetTitle: DOMString; begin Result := GetAttribute('title') end;
 
729
procedure THTMLElement.SetTitle(const Value: DOMString); begin SetAttribute('title', Value) end;
 
730
function THTMLElement.GetLang: DOMString; begin Result := GetAttribute('lang') end;
 
731
procedure THTMLElement.SetLang(const Value: DOMString); begin SetAttribute('lang', Value) end;
 
732
function THTMLElement.GetDir: DOMString; begin Result := GetAttribute('dir') end;
 
733
procedure THTMLElement.SetDir(const Value: DOMString); begin SetAttribute('dir', Value) end;
 
734
function THTMLElement.GetClassName: DOMString; begin  Result := GetAttribute('class') end;
 
735
procedure THTMLElement.SetClassName(const Value: DOMString); begin SetAttribute('class', Value) end;
 
736
 
 
737
 
 
738
function THTMLHtmlElement.GetVersion: DOMString; begin  Result := GetAttribute('version') end;
 
739
procedure THTMLHtmlElement.SetVersion(const Value: DOMString); begin SetAttribute('version', Value) end;
 
740
 
 
741
 
 
742
function THTMLHeadElement.GetProfile: DOMString; begin  Result := GetAttribute('profile') end;
 
743
procedure THTMLHeadElement.SetProfile(const Value: DOMString); begin SetAttribute('profile', Value) end;
 
744
 
 
745
 
 
746
procedure THTMLSelectElement.Add(Element, Before: THTMLElement);
 
747
begin
 
748
end;
 
749
 
 
750
procedure THTMLSelectElement.Remove(Index: Integer);
 
751
begin
 
752
end;
 
753
 
 
754
 
 
755
function THTMLTableElement.CreateTHead: THTMLElement;
 
756
begin
 
757
  Result := nil;
 
758
end;
 
759
 
 
760
procedure THTMLTableElement.DeleteTHead;
 
761
begin
 
762
end;
 
763
 
 
764
function THTMLTableElement.CreateTFoot: THTMLElement;
 
765
begin
 
766
  Result := nil;
 
767
end;
 
768
 
 
769
procedure THTMLTableElement.DeleteTFoot;
 
770
begin
 
771
end;
 
772
 
 
773
function THTMLTableElement.CreateCaption: THTMLElement;
 
774
begin
 
775
  Result := nil;
 
776
end;
 
777
 
 
778
procedure THTMLTableElement.DeleteCaption;
 
779
begin
 
780
end;
 
781
 
 
782
function THTMLTableElement.InsertRow(Index: Integer): THTMLElement;
 
783
begin
 
784
  Result := nil;
 
785
end;
 
786
 
 
787
procedure THTMLTableElement.DeleteRow(Index: Integer);
 
788
begin
 
789
end;
 
790
 
 
791
 
 
792
function THTMLTableSectionElement.InsertRow(Index: Integer): THTMLElement;
 
793
begin
 
794
  Result := nil;
 
795
end;
 
796
 
 
797
procedure THTMLTableSectionElement.DeleteRow(Index: Integer);
 
798
begin
 
799
end;
 
800
 
 
801
 
 
802
function THTMLTableRowElement.InsertCell(Index: Integer): THTMLElement;
 
803
begin
 
804
  Result := nil;
 
805
end;
 
806
 
 
807
procedure THTMLTableRowElement.DeleteCell(Index: Integer);
 
808
begin
 
809
end;
 
810
 
 
811
 
 
812
function THTMLDocument.GetTitle: DOMString;
 
813
var
 
814
  Node: TDOMNode;
 
815
begin
 
816
  Result := '';
 
817
  if not Assigned(DocumentElement) then
 
818
    exit;
 
819
  Node := DocumentElement.FirstChild;
 
820
  while Assigned(Node) and (Node.NodeName <> 'head') do
 
821
    Node := Node.NextSibling;
 
822
  if not Assigned(Node) then
 
823
    exit;
 
824
  Node := Node.FirstChild;
 
825
  while Assigned(Node) and (Node.NodeName <> 'title') do
 
826
    Node := Node.NextSibling;
 
827
  if not Assigned(Node) then
 
828
    exit;
 
829
  Node := Node.FirstChild;
 
830
  if Assigned(Node) and (Node.NodeType = TEXT_NODE) then
 
831
    Result := Node.NodeValue;
 
832
end;
 
833
 
 
834
procedure THTMLDocument.SetTitle(const Value: DOMString);
 
835
var
 
836
  Node: TDOMNode;
 
837
  TitleEl: TDOMElement;
 
838
begin
 
839
  if not Assigned(DocumentElement) then
 
840
    AppendChild(CreateHtmlElement);
 
841
  Node := DocumentElement.FirstChild;
 
842
  while Assigned(Node) and (Node.NodeName <> 'head') do
 
843
    Node := Node.NextSibling;
 
844
  if not Assigned(Node) then
 
845
  begin
 
846
    Node := CreateHeadElement;
 
847
    DocumentElement.InsertBefore(Node, DocumentElement.FirstChild);
 
848
  end;
 
849
  TitleEl := TDOMElement(Node.FirstChild);
 
850
  while Assigned(TitleEl) and (TitleEl.NodeName <> 'title') do
 
851
    TitleEl := TDOMElement(TitleEl.NextSibling);
 
852
  if not Assigned(TitleEl) then
 
853
  begin
 
854
    TitleEl := CreateElement('title');
 
855
    Node.AppendChild(TitleEl);
 
856
  end;
 
857
  while Assigned(TitleEl.FirstChild) do
 
858
    TitleEl.RemoveChild(TitleEl.FirstChild);
 
859
  TitleEl.AppendChild(CreateTextNode(Value));
 
860
end;
 
861
 
 
862
procedure THTMLDocument.Write(const AText: DOMString);
 
863
begin
 
864
end;
 
865
 
 
866
procedure THTMLDocument.WriteLn(const AText: DOMString);
 
867
begin
 
868
end;
 
869
 
 
870
function THTMLDocument.GetElementsByName(const ElementName: DOMString): TDOMNodeList;
 
871
begin
 
872
  Result := nil;
 
873
end;
 
874
 
 
875
function THTMLDocument.CreateElement(const tagName: DOMString): THTMLElement;
 
876
begin
 
877
  Result := THTMLElement.Create(Self, tagName);
 
878
end;
 
879
 
 
880
function THTMLDocument.CreateSubElement: THTMLElement; begin Result := CreateElement('sub') end;
 
881
function THTMLDocument.CreateSupElement: THTMLElement; begin Result := CreateElement('sup') end;
 
882
function THTMLDocument.CreateSpanElement: THTMLElement; begin Result := CreateElement('span') end;
 
883
function THTMLDocument.CreateBDOElement: THTMLElement; begin Result := CreateElement('bdo') end;
 
884
function THTMLDocument.CreateTTElement: THTMLElement; begin Result := CreateElement('tt') end;
 
885
function THTMLDocument.CreateIElement: THTMLElement; begin Result := CreateElement('i') end;
 
886
function THTMLDocument.CreateBElement: THTMLElement; begin Result := CreateElement('b') end;
 
887
function THTMLDocument.CreateUElement: THTMLElement; begin Result := CreateElement('u') end;
 
888
function THTMLDocument.CreateSElement: THTMLElement; begin Result := CreateElement('s') end;
 
889
function THTMLDocument.CreateStrikeElement: THTMLElement; begin Result := CreateElement('strike') end;
 
890
function THTMLDocument.CreateBigElement: THTMLElement; begin Result := CreateElement('big') end;
 
891
function THTMLDocument.CreateSmallElement: THTMLElement; begin Result := CreateElement('small') end;
 
892
function THTMLDocument.CreateEmElement: THTMLElement; begin Result := CreateElement('em') end;
 
893
function THTMLDocument.CreateStrongElement: THTMLElement; begin Result := CreateElement('strong') end;
 
894
function THTMLDocument.CreateDfnElement: THTMLElement; begin Result := CreateElement('dfn') end;
 
895
function THTMLDocument.CreateCodeElement: THTMLElement; begin Result := CreateElement('code') end;
 
896
function THTMLDocument.CreateSampElement: THTMLElement; begin Result := CreateElement('samp') end;
 
897
function THTMLDocument.CreateKbdElement: THTMLElement; begin Result := CreateElement('kbd') end;
 
898
function THTMLDocument.CreateVarElement: THTMLElement; begin Result := CreateElement('var') end;
 
899
function THTMLDocument.CreateCiteElement: THTMLElement; begin Result := CreateElement('cite') end;
 
900
function THTMLDocument.CreateAcronymElement: THTMLElement; begin Result := CreateElement('acronym') end;
 
901
function THTMLDocument.CreateAbbrElement: THTMLElement; begin Result := CreateElement('abbr') end;
 
902
function THTMLDocument.CreateDDElement: THTMLElement; begin Result := CreateElement('dd') end;
 
903
function THTMLDocument.CreateDTElement: THTMLElement; begin Result := CreateElement('dt') end;
 
904
function THTMLDocument.CreateNoFramesElement: THTMLElement; begin Result := CreateElement('noframes') end;
 
905
function THTMLDocument.CreateNoScriptElement: THTMLElement; begin Result := CreateElement('noscript') end;
 
906
function THTMLDocument.CreateAddressElement: THTMLElement; begin Result := CreateElement('address') end;
 
907
function THTMLDocument.CreateCenterElement: THTMLElement; begin Result := CreateElement('center') end;
 
908
function THTMLDocument.CreateHtmlElement: THTMLHtmlElement; begin Result := THTMLHtmlElement.Create(Self, 'html') end;
 
909
function THTMLDocument.CreateHeadElement: THTMLHeadElement; begin Result := THTMLHeadElement.Create(Self, 'head') end;
 
910
function THTMLDocument.CreateLinkElement: THTMLLinkElement; begin Result := THTMLLinkElement.Create(Self, 'a') end;
 
911
//...
 
912
function THTMLDocument.CreateBodyElement: THTMLBodyElement; begin Result := THTMLBodyElement.Create(Self, 'body') end;
 
913
//...
 
914
function THTMLDocument.CreateUListElement: THTMLUListElement; begin Result := THTMLUListElement.Create(Self, 'ul') end;
 
915
function THTMLDocument.CreateOListElement: THTMLOListElement; begin Result := THTMLOListElement.Create(Self, 'ol') end;
 
916
function THTMLDocument.CreateDListElement: THTMLDListElement; begin Result := THTMLDListElement.Create(Self, 'dl') end;
 
917
// ...
 
918
function THTMLDocument.CreateLIElement: THTMLLIElement; begin Result := THTMLLIElement.Create(Self, 'li') end;
 
919
//...
 
920
function THTMLDocument.CreateParagraphElement: THTMLParagraphElement; begin Result := THTMLParagraphElement.Create(Self, 'p') end;
 
921
 
 
922
end.
 
923
 
 
924
 
 
925
{
 
926
  $Log: dom_html.pp,v $
 
927
  Revision 1.1  2002/12/11 21:06:07  sg
 
928
  * Small cleanups
 
929
  * Replaced htmldoc unit with dom_html unit
 
930
  * Added SAX parser framework and SAX HTML parser
 
931
 
 
932
}