{******************************************************************************} { } { Library: Fundamentals 5.00 - HTML Parser } { File name: flcHTMLDocElements.pas } { File version: 5.07 } { Description: HTML DOM elements } { } { Copyright: Copyright (c) 2000-2020, David J Butler } { All rights reserved. } { Redistribution and use in source and binary forms, with } { or without modification, are permitted provided that } { the following conditions are met: } { Redistributions of source code must retain the above } { copyright notice, this list of conditions and the } { following disclaimer. } { THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND } { CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED } { WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED } { WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A } { PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL } { THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, } { INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR } { CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, } { PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF } { USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) } { HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER } { IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING } { NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE } { USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE } { POSSIBILITY OF SUCH DAMAGE. } { } { Github: https://github.com/fundamentalslib } { E-mail: fundamentals.library at gmail.com } { } { Revision history: } { } { 2002/10/21 1.00 Initial version in cHTMLObjects } { 2002/10/27 1.01 Classes for all HTML 4 element objects. } { 2002/11/22 1.02 Style sheet support. } { 2002/12/03 1.03 Style sheet changes. } { 2002/12/07 1.04 Small additions. } { 2002/12/08 1.05 Created unit cHTMLDocElements. } { 2015/04/11 1.06 UnicodeString changes. } { 2019/02/22 5.07 Revise for Fundamentals 5. } { } {******************************************************************************} {$INCLUDE flcHTML.inc} unit flcHTMLDocElements; interface uses { System } UITypes, { Fundamentals } flcStdTypes, { HTML } flcHTMLElements, flcHTMLProperties, flcHTMLStyleTypes, flcHTMLStyleProperties, flcHTMLStyleSheet, flcHTMLDocBase; { } { Global element factory } { } function htmlElementClass(const TagID: ThtmlTagID): ThtmlElementClass; overload; function htmlElementClass(const Name: String): ThtmlElementClass; overload; function htmlCreateElement(const TagID: ThtmlTagID; const Name: String): AhtmlElement; { } { } { } { } type ThtmlPhraseElement = (peEmphasise, peStrong, peDefiningInstance, peCode, peSample, peKeyboard, peVariable, peCitation, peAbbreviation, peAcronym); AhtmlPhraseElement = class(AhtmlElementInclAttrs) protected FPhraseElement: ThtmlPhraseElement; public constructor Create(const TagID: ThtmlTagID; const PhraseElement: ThtmlPhraseElement); overload; property PhraseElement: ThtmlPhraseElement read FPhraseElement; end; ThtmlEM = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlSTRONG = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlDFN = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlCODE = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlSAMP = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlKBD = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlVAR = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlCITE = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlABBR = class(AhtmlPhraseElement) public constructor Create; override; end; ThtmlACRONYM = class(AhtmlPhraseElement) public constructor Create; override; end; { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } { } type ThtmlTITLE = class(AhtmlElementIncli18n) public constructor Create; override; end; { } { } type ThtmlISINDEX = class(AhtmlElementInclCoreAttrs) private function GetPrompt: String; procedure SetPrompt(const Value: String); public constructor Create; override; property Prompt: String read GetPrompt write SetPrompt; end; { } { } { } { } { } { ]]> } { } { } { '' then StyleInfo.FontFamily := htmlDecodeFontFamilyList(S); Size := GetSizeValue; if Size.SizeType <> fsizeDefault then begin htmlResolveRelativeFontSize(Size, ParentStyle.FontSize); StyleInfo.FontSize := Size; end; S := GetColor; if S <> '' then StyleInfo.FontColor := htmlDecodeColor(S); end; { ThtmlBR } constructor ThtmlBR.Create; begin inherited Create(HTML_TAG_BR, ttStartTag); end; function ThtmlBR.GetClear: ThtmlClearType; begin Result := htmlDecodeClearType(AttributeText['CLEAR']); end; procedure ThtmlBR.SetClear(const Value: ThtmlClearType); begin AttributeText['CLEAR'] := htmlEncodeBRClearType(Value); end; function ThtmlBR.GetHTMLText: String; begin Result := '
'; end; { ============================================================================ } { DOCUMENT BODY } { ============================================================================ } { ThtmlBODY } constructor ThtmlBODY.Create; begin inherited Create(HTML_TAG_BODY, ttContentTags); end; function ThtmlBODY.GetOnLoad: String; begin Result := AttributeText['ONLOAD']; end; procedure ThtmlBODY.SetOnLoad(const Value: String); begin AttributeText['ONLOAD'] := Value; end; function ThtmlBODY.GetOnUnload: String; begin Result := AttributeText['ONUNLOAD']; end; procedure ThtmlBODY.SetOnUnload(const Value: String); begin AttributeText['ONUNLOAD'] := Value; end; function ThtmlBODY.GetBackground: String; begin Result := AttributeText['BACKGROUND']; end; procedure ThtmlBODY.SetBackground(const Value: String); begin AttributeText['BACKGROUND'] := Value; end; function ThtmlBODY.GetBackColor: String; begin Result := AttributeText['BGCOLOR']; end; procedure ThtmlBODY.SetBackColor(const Value: String); begin AttributeText['BGCOLOR'] := Value; end; function ThtmlBODY.GetBackColorDelphi: TColor; begin Result := htmlResolveColor(GetBackColor).Color; end; function ThtmlBODY.GetTextColor: String; begin Result := AttributeText['TEXT']; end; procedure ThtmlBODY.SetTextColor(const Value: String); begin AttributeText['TEXT'] := Value; end; function ThtmlBODY.GetLinkColor: String; begin Result := AttributeText['LINK']; end; procedure ThtmlBODY.SetLinkColor(const Value: String); begin AttributeText['LINK'] := Value; end; function ThtmlBODY.GetVisitedLinkColor: String; begin Result := AttributeText['VLINK']; end; procedure ThtmlBODY.SetVisitedLinkColor(const Value: String); begin AttributeText['VLINK'] := Value; end; function ThtmlBODY.GetSelectedLinkColor: String; begin Result := AttributeText['ALINK']; end; procedure ThtmlBODY.SetSelectedLinkColor(const Value: String); begin AttributeText['ALINK'] := Value; end; procedure ThtmlBODY.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin inherited; S := GetBackColor; if S <> '' then StyleInfo.BackColor := htmlDecodeColor(S); end; procedure ThtmlBODY.PrepareStructure; begin end; function ThtmlBODY.StyleRefs: StringArray; var L : ThtmlLINK; begin Result := nil; L := ThtmlLINK(FindNext(nil, ThtmlLINK)); while Assigned(L) do begin if StrEqualNoAsciiCaseU(L.Rel, 'stylesheet') then DynArrayAppend(Result, L.GetHRef); L := ThtmlLINK(FindNext(L, ThtmlLINK)); end; end; { ThtmlADDRESS } constructor ThtmlADDRESS.Create; begin inherited Create(HTML_TAG_ADDRESS, ttContentTags); end; { AhtmlElementInclAttrsAndAlign } function AhtmlElementInclAttrsAndAlign.GetAlign: ThtmlTextAlignType; begin Result := htmlDecodeTextAlignType(AttributeText['ALIGN']); end; procedure AhtmlElementInclAttrsAndAlign.SetAlign(const Value: ThtmlTextAlignType); begin AttributeText['ALIGN'] := htmlEncodeTextAlignType(Value); end; { ThtmlDIV } constructor ThtmlDIV.Create; begin inherited Create(HTML_TAG_DIV, ttContentTags); end; { ThtmlCENTER } constructor ThtmlCENTER.Create; begin inherited Create(HTML_TAG_CENTER, ttContentTags); end; { ============================================================================ } { ANCHOR ELEMENT } { ============================================================================ } { ThtmlA } constructor ThtmlA.Create; begin inherited Create(HTML_TAG_A, ttContentTags); end; function ThtmlA.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlA.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlA.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlA.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlA.GetHRef: String; begin Result := AttributeText['HREF']; end; procedure ThtmlA.SetHRef(const Value: String); begin AttributeText['HREF'] := Value; end; function ThtmlA.GetTarget: String; begin Result := AttributeText['TARGET']; end; procedure ThtmlA.SetTarget(const Value: String); begin AttributeText['TARGET'] := Value; end; function ThtmlA.GetRel: String; begin Result := AttributeText['REL']; end; procedure ThtmlA.SetRel(const Value: String); begin AttributeText['REL'] := Value; end; function ThtmlA.GetRev: String; begin Result := AttributeText['REV']; end; procedure ThtmlA.SetRev(const Value: String); begin AttributeText['REV'] := Value; end; function ThtmlA.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure ThtmlA.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function ThtmlA.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure ThtmlA.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function ThtmlA.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure ThtmlA.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; procedure ThtmlA.InitStyleElementInfo(const StyleSheet: ThtmlCSS; const ParentInfo: PhtmlcssElementInfo); begin FIsLink := GetHRef <> ''; inherited; end; procedure ThtmlA.InitStyleInfo(const StyleSheet: ThtmlCSS; const StyleInfo: ThtmlcssStyleProperties); var State: ThtmlcssAnchorPseudoPropertyState; begin if not FIsLink then begin // init style with no pseudo properties FStyleInfo.PseudoIDs := []; inherited InitStyleInfo(StyleSheet, StyleInfo); exit; end; // init state styles for State := Low(State) to High(State) do begin FStyleInfo.PseudoIDs := HTML_CSS_PP_Properties_AnchorState[State]; FStateStyles[State] := StyleInfo; InitElementStyleInfo(StyleSheet, FStateStyles[State], StyleInfo); end; // init style with Link state FStyleInfo.PseudoIDs := HTML_CSS_PP_Properties_AnchorState[anchorLink]; FStyle := FStateStyles[anchorLink]; InitChildrenStyleInfo(StyleSheet, FStyle); end; { ============================================================================ } { CLIENT-SIDE IMAGE MAPS } { ============================================================================ } { ThtmlMAP } constructor ThtmlMAP.Create; begin inherited Create(HTML_TAG_MAP, ttContentTags); end; function ThtmlMAP.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlMAP.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; { ThtmlAREA } constructor ThtmlAREA.Create; begin inherited Create(HTML_TAG_AREA, ttStartTag); end; function ThtmlAREA.GetShape: String; begin Result := AttributeText['SHAPE']; end; procedure ThtmlAREA.SetShape(const Value: String); begin AttributeText['SHAPE'] := Value; end; function ThtmlAREA.GetCoords: String; begin Result := AttributeText['COORDS']; end; procedure ThtmlAREA.SetCoords(const Value: String); begin AttributeText['COORDS'] := Value; end; function ThtmlAREA.GetHRef: String; begin Result := AttributeText['HREF']; end; procedure ThtmlAREA.SetHRef(const Value: String); begin AttributeText['HREF'] := Value; end; function ThtmlAREA.GetTarget: String; begin Result := AttributeText['TARGET']; end; procedure ThtmlAREA.SetTarget(const Value: String); begin AttributeText['TARGET'] := Value; end; function ThtmlAREA.GetNoHRef: Boolean; begin Result := AttributeFlag['NOHREF']; end; procedure ThtmlAREA.SetNoHRef(const Value: Boolean); begin AttributeFlag['NOHREF'] := Value; end; function ThtmlAREA.GetAlt: String; begin Result := AttributeText['ALT']; end; procedure ThtmlAREA.SetAlt(const Value: String); begin AttributeText['ALT'] := Value; end; function ThtmlAREA.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure ThtmlAREA.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function ThtmlAREA.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure ThtmlAREA.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function ThtmlAREA.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure ThtmlAREA.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; { ============================================================================ } { LINK ELEMENT } { ============================================================================ } { ThtmlLINK } constructor ThtmlLINK.Create; begin inherited Create(HTML_TAG_LINK, ttStartTag); end; function ThtmlLINK.GetHRef: String; begin Result := AttributeText['HREF']; end; procedure ThtmlLINK.SetHRef(const Value: String); begin AttributeText['HREF'] := Value; end; function ThtmlLINK.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlLINK.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlLINK.GetRel: String; begin Result := AttributeText['REL']; end; procedure ThtmlLINK.SetRel(const Value: String); begin AttributeText['REL'] := Value; end; function ThtmlLINK.GetRev: String; begin Result := AttributeText['REV']; end; procedure ThtmlLINK.SetRev(const Value: String); begin AttributeText['REV'] := Value; end; function ThtmlLINK.GetMedia: String; begin Result := AttributeText['MEDIA']; end; procedure ThtmlLINK.SetMedia(const Value: String); begin AttributeText['MEDIA'] := Value; end; function ThtmlLINK.GetTarget: String; begin Result := AttributeText['TARGET']; end; procedure ThtmlLINK.SetTarget(const Value: String); begin AttributeText['TARGET'] := Value; end; { ============================================================================ } { IMAGES } { ============================================================================ } { AhtmlImageElement } function AhtmlImageElement.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure AhtmlImageElement.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function AhtmlImageElement.GetAlign: ThtmlIAlignType; begin Result := htmlDecodeIAlignType(AttributeText['ALIGN']); end; procedure AhtmlImageElement.SetAlign(const Value: ThtmlIAlignType); begin AttributeText['ALIGN'] := htmlEncodeIAlignType(Value); end; function AhtmlImageElement.GetWidthStr: String; begin Result := AttributeText['WIDTH']; end; procedure AhtmlImageElement.SetWidthStr(const Value: String); begin AttributeText['WIDTH'] := Value; end; function AhtmlImageElement.GetHeightStr: String; begin Result := AttributeText['HEIGHT']; end; procedure AhtmlImageElement.SetHeightStr(const Value: String); begin AttributeText['HEIGHT'] := Value; end; function AhtmlImageElement.GetWidth: ThtmlLength; begin Result := htmlDecodeLength(GetWidthStr); end; function AhtmlImageElement.GetHeight: ThtmlLength; begin Result := htmlDecodeLength(GetHeightStr); end; function AhtmlImageElement.GetHSpace: Integer; begin Result := htmlDecodeInteger(AttributeText['HSPACE'], 0); end; procedure AhtmlImageElement.SetHSpace(const Value: Integer); begin AttributeText['HSPACE'] := htmlEncodeInteger(Value); end; function AhtmlImageElement.GetVSpace: Integer; begin Result := htmlDecodeInteger(AttributeText['VSPACE'], 0); end; procedure AhtmlImageElement.SetVSpace(const Value: Integer); begin AttributeText['VSPACE'] := htmlEncodeInteger(Value); end; function AhtmlImageElement.GetUseMap: String; begin Result := AttributeText['USEMAP']; end; procedure AhtmlImageElement.SetUseMap(const Value: String); begin AttributeText['USEMAP'] := Value; end; procedure AhtmlImageElement.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin S := GetWidthStr; if S <> '' then StyleInfo.Width := htmlDecodeLength(S); S := GetHeightStr; if S <> '' then StyleInfo.Height := htmlDecodeLength(S); end; { ThtmlIMG } constructor ThtmlIMG.Create; begin inherited Create(HTML_TAG_IMG, ttStartTag); end; function ThtmlIMG.GetSrc: String; begin Result := AttributeText['SRC']; end; procedure ThtmlIMG.SetSrc(const Value: String); begin AttributeText['SRC'] := Value; end; function ThtmlIMG.GetAlt: String; begin Result := AttributeText['ALT']; end; procedure ThtmlIMG.SetAlt(const Value: String); begin AttributeText['ALT'] := Value; end; function ThtmlIMG.GetLongDesc: String; begin Result := AttributeText['LONGDESC']; end; procedure ThtmlIMG.SetLongDesc(const Value: String); begin AttributeText['LONGDESC'] := Value; end; function ThtmlIMG.GetIsMap: Boolean; begin Result := AttributeFlag['ISMAP']; end; procedure ThtmlIMG.SetIsMap(const Value: Boolean); begin AttributeFlag['ISMAP'] := Value; end; function ThtmlIMG.GetBorder: String; begin Result := AttributeText['BORDER']; end; procedure ThtmlIMG.SetBorder(const Value: String); begin AttributeText['BORDER'] := Value; end; { ============================================================================ } { EMBEDDED OBJECT } { ============================================================================ } { ThtmlEmbeddedOBJECT } constructor ThtmlEmbeddedOBJECT.Create; begin inherited Create(HTML_TAG_OBJECT, ttContentTags); end; function ThtmlEmbeddedOBJECT.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_PARAM then Result := ThtmlEmbeddedObjectPARAM.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlEmbeddedOBJECT.GetDeclare: Boolean; begin Result := AttributeFlag['DECLARE']; end; procedure ThtmlEmbeddedOBJECT.SetDeclare(const Value: Boolean); begin AttributeFlag['DECLARE'] := Value; end; function ThtmlEmbeddedOBJECT.GetClassID: String; begin Result := AttributeText['CLASSID']; end; procedure ThtmlEmbeddedOBJECT.SetClassID(const Value: String); begin AttributeText['CLASSID'] := Value; end; function ThtmlEmbeddedOBJECT.GetCodeBase: String; begin Result := AttributeText['CODEBASE']; end; procedure ThtmlEmbeddedOBJECT.SetCodeBase(const Value: String); begin AttributeText['CODEBASE'] := Value; end; function ThtmlEmbeddedOBJECT.GetData: String; begin Result := AttributeText['DATA']; end; procedure ThtmlEmbeddedOBJECT.SetData(const Value: String); begin AttributeText['DATA'] := Value; end; function ThtmlEmbeddedOBJECT.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlEmbeddedOBJECT.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlEmbeddedOBJECT.GetCodeType: String; begin Result := AttributeText['CODETYPE']; end; procedure ThtmlEmbeddedOBJECT.SetCodeType(const Value: String); begin AttributeText['CODETYPE'] := Value; end; function ThtmlEmbeddedOBJECT.GetStandBy: String; begin Result := AttributeText['STANDBY']; end; procedure ThtmlEmbeddedOBJECT.SetStandBy(const Value: String); begin AttributeText['STANDBY'] := Value; end; function ThtmlEmbeddedOBJECT.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure ThtmlEmbeddedOBJECT.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function ThtmlEmbeddedOBJECT.GetBorder: Integer; begin Result := htmlDecodeInteger(AttributeText['BORDER'], 0); end; procedure ThtmlEmbeddedOBJECT.SetBorder(const Value: Integer); begin AttributeText['BORDER'] := htmlEncodeInteger(Value); end; { ThtmlEmbeddedObjectPARAM } constructor ThtmlEmbeddedObjectPARAM.Create; begin inherited Create(HTML_TAG_PARAM, ttStartTag); end; function ThtmlEmbeddedObjectPARAM.GetID: String; begin Result := AttributeText['ID']; end; procedure ThtmlEmbeddedObjectPARAM.SetID(const Value: String); begin AttributeText['ID'] := Value; end; function ThtmlEmbeddedObjectPARAM.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlEmbeddedObjectPARAM.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlEmbeddedObjectPARAM.GetValue: String; begin Result := AttributeText['VALUE']; end; procedure ThtmlEmbeddedObjectPARAM.SetValue(const Value: String); begin AttributeText['VALUE'] := Value; end; function ThtmlEmbeddedObjectPARAM.GetValueType: String; begin Result := AttributeText['VALUETYPE']; end; procedure ThtmlEmbeddedObjectPARAM.SetValueType(const Value: String); begin AttributeText['VALUETYPE'] := Value; end; function ThtmlEmbeddedObjectPARAM.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlEmbeddedObjectPARAM.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; { ============================================================================ } { APPLET } { ============================================================================ } { ThtmlAPPLET } constructor ThtmlAPPLET.Create; begin inherited Create(HTML_TAG_APPLET, ttContentTags); end; function ThtmlAPPLET.GetAlt: String; begin Result := AttributeText['ALT']; end; procedure ThtmlAPPLET.SetAlt(const Value: String); begin AttributeText['ALT'] := Value; end; function ThtmlAPPLET.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlAPPLET.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlAPPLET.GetCode: String; begin Result := AttributeText['CODE']; end; procedure ThtmlAPPLET.SetCode(const Value: String); begin AttributeText['CODE'] := Value; end; function ThtmlAPPLET.GetSerObject: String; begin Result := AttributeText['OBJECT']; end; procedure ThtmlAPPLET.SetSerObject(const Value: String); begin AttributeText['OBJECT'] := Value; end; function ThtmlAPPLET.GetCodeBase: String; begin Result := AttributeText['CODEBASE']; end; procedure ThtmlAPPLET.SetCodeBase(const Value: String); begin AttributeText['CODEBASE'] := Value; end; function ThtmlAPPLET.GetAlign: ThtmlIAlignType; begin Result := htmlDecodeIAlignType(AttributeText['ALIGN']); end; procedure ThtmlAPPLET.SetAlign(const Value: ThtmlIAlignType); begin AttributeText['ALIGN'] := htmlEncodeIAlignType(Value); end; function ThtmlAPPLET.GetWidth: String; begin Result := AttributeText['WIDTH']; end; procedure ThtmlAPPLET.SetWidth(const Value: String); begin AttributeText['WIDTH'] := Value; end; function ThtmlAPPLET.GetHeight: String; begin Result := AttributeText['HEIGHT']; end; procedure ThtmlAPPLET.SetHeight(const Value: String); begin AttributeText['HEIGHT'] := Value; end; function ThtmlAPPLET.GetHSpace: Integer; begin Result := htmlDecodeInteger(AttributeText['HSPACE'], 0); end; procedure ThtmlAPPLET.SetHSpace(const Value: Integer); begin AttributeText['HSPACE'] := htmlEncodeInteger(Value); end; function ThtmlAPPLET.GetVSpace: Integer; begin Result := htmlDecodeInteger(AttributeText['VSPACE'], 0); end; procedure ThtmlAPPLET.SetVSpace(const Value: Integer); begin AttributeText['VSPACE'] := htmlEncodeInteger(Value); end; { ============================================================================ } { HORISONTAL RULE } { ============================================================================ } { ThtmlHR } constructor ThtmlHR.Create; begin inherited Create(HTML_TAG_HR, ttStartTag); end; function ThtmlHR.GetAlign: String; begin Result := AttributeText['ALIGN']; end; procedure ThtmlHR.SetAlign(const Value: String); begin AttributeText['ALIGN'] := Value; end; function ThtmlHR.GetSize: Integer; begin Result := htmlDecodeInteger(AttributeText['SIZE'], -1); end; procedure ThtmlHR.SetSize(const Value: Integer); begin AttributeText['SIZE'] := htmlEncodeInteger(Value); end; function ThtmlHR.GetWidth: String; begin Result := AttributeText['WIDTH']; end; procedure ThtmlHR.SetWidth(const Value: String); begin AttributeText['WIDTH'] := Value; end; function ThtmlHR.GetNoShade: Boolean; begin Result := AttributeFlag['NOSHADE']; end; procedure ThtmlHR.SetNoShade(const Value: Boolean); begin AttributeFlag['NOSHADE'] := Value; end; { ============================================================================ } { PARAGRAPHS } { ============================================================================ } { ThtmlP } constructor ThtmlP.Create; begin inherited Create(HTML_TAG_P, ttContentTags); end; { ============================================================================ } { HEADINGS } { ============================================================================ } { AhtmlHeadingTag } constructor AhtmlHeadingTag.Create(const TagID: ThtmlTagID); begin inherited Create(TagID, ttContentTags); end; { ThtmlH1 } constructor ThtmlH1.Create; begin inherited Create(HTML_TAG_H1); end; { ThtmlH2 } constructor ThtmlH2.Create; begin inherited Create(HTML_TAG_H2); end; { ThtmlH3 } constructor ThtmlH3.Create; begin inherited Create(HTML_TAG_H3); end; { ThtmlH4 } constructor ThtmlH4.Create; begin inherited Create(HTML_TAG_H4); end; { ThtmlH5 } constructor ThtmlH5.Create; begin inherited Create(HTML_TAG_H5); end; { ThtmlH6 } constructor ThtmlH6.Create; begin inherited Create(HTML_TAG_H6); end; { ============================================================================ } { PREFORMATTED TEXT } { ============================================================================ } { ThtmlPRE } constructor ThtmlPRE.Create; begin inherited Create(HTML_TAG_PRE, ttContentTags); end; function ThtmlPRE.GetWidth: Integer; begin Result := htmlDecodeInteger(AttributeText['WIDTH'], -1); end; procedure ThtmlPRE.SetWidth(const Value: Integer); begin AttributeText['WIDTH'] := htmlEncodeInteger(Value); end; procedure ThtmlPRE.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); begin StyleInfo.WhiteSpace := wsPre; end; { ============================================================================ } { QUOTES } { ============================================================================ } { ThtmlQ } constructor ThtmlQ.Create; begin inherited Create(HTML_TAG_Q, ttContentTags); end; function ThtmlQ.GetCite: String; begin Result := AttributeText['CITE']; end; procedure ThtmlQ.SetCite(const Value: String); begin AttributeText['CITE'] := Value; end; { ThtmlBLOCKQUOTE } constructor ThtmlBLOCKQUOTE.Create; begin inherited Create(HTML_TAG_BLOCKQUOTE, ttContentTags); end; function ThtmlBLOCKQUOTE.GetCite: String; begin Result := AttributeText['CITE']; end; procedure ThtmlBLOCKQUOTE.SetCite(const Value: String); begin AttributeText['CITE'] := Value; end; { ============================================================================ } { INSERTED/DELETED TEXT } { ============================================================================ } { AhtmlVersionElement } function AhtmlVersionElement.GetCite: String; begin Result := AttributeText['CITE']; end; procedure AhtmlVersionElement.SetCite(const Value: String); begin AttributeText['CITE'] := Value; end; function AhtmlVersionElement.GetDateTime: String; begin Result := AttributeText['DATETIME']; end; procedure AhtmlVersionElement.SetDateTime(const Value: String); begin AttributeText['DATETIME'] := Value; end; { ThtmlINS } constructor ThtmlINS.Create; begin inherited Create(HTML_TAG_INS, ttContentTags); end; { ThtmlDEL } constructor ThtmlDEL.Create; begin inherited Create(HTML_TAG_DEL, ttContentTags); end; { ============================================================================ } { LISTS } { ============================================================================ } { ThtmlDL } constructor ThtmlDL.Create; begin inherited Create(HTML_TAG_DL, ttContentTags); end; function ThtmlDL.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_DT then Result := ThtmlDT.Create else if ThtmlTagID(ID) = HTML_TAG_DD then Result := ThtmlDD.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlDL.GetCompact: Boolean; begin Result := AttributeFlag['COMPACT']; end; procedure ThtmlDL.SetCompact(const Value: Boolean); begin AttributeFlag['COMPACT'] := Value; end; { ThtmlDT } constructor ThtmlDT.Create; begin inherited Create(HTML_TAG_DT, ttContentTags); end; { ThtmlDD } constructor ThtmlDD.Create; begin inherited Create(HTML_TAG_DD, ttContentTags); end; { AhtmlListItemContainer } constructor AhtmlListItemContainer.Create(const TagID: ThtmlTagID); begin inherited Create(TagID, ttContentTags); end; function AhtmlListItemContainer.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_LI then Result := ThtmlLI.Create else Result := inherited CreateItem(ID, Name); end; function AhtmlListItemContainer.GetCompact: Boolean; begin Result := AttributeFlag['COMPACT']; end; procedure AhtmlListItemContainer.SetCompact(const Value: Boolean); begin AttributeFlag['COMPACT'] := Value; end; { ThtmlOL } constructor ThtmlOL.Create; begin inherited Create(HTML_TAG_OL); end; function ThtmlOL.GetListType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlOL.SetListType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlOL.GetStart: Integer; begin Result := htmlDecodeInteger(AttributeText['START'], -1); end; procedure ThtmlOL.SetStart(const Value: Integer); begin AttributeText['START'] := htmlEncodeInteger(Value); end; { ThtmlUL } constructor ThtmlUL.Create; begin inherited Create(HTML_TAG_UL); end; function ThtmlUL.GetListType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlUL.SetListType(const Value: String); begin AttributeText['TYPE'] := Value; end; { ThtmlDIR } constructor ThtmlDIR.Create; begin inherited Create(HTML_TAG_DIR); end; { ThtmlMENU } constructor ThtmlMENU.Create; begin inherited Create(HTML_TAG_MENU); end; { ThtmlLI } constructor ThtmlLI.Create; begin inherited Create(HTML_TAG_LI, ttStartTag); end; function ThtmlLI.GetItemType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlLI.SetItemType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlLI.GetValue: Integer; begin Result := htmlDecodeInteger(AttributeText['VALUE'], -1); end; procedure ThtmlLI.SetValue(const Value: Integer); begin AttributeText['VALUE'] := htmlEncodeInteger(Value); end; { ============================================================================ } { FORMS } { ============================================================================ } { ThtmlFORM } constructor ThtmlFORM.Create; begin inherited Create(HTML_TAG_FORM, ttContentTags); end; function ThtmlFORM.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_LABEL then Result := ThtmlLABEL.Create else if ThtmlTagID(ID) = HTML_TAG_INPUT then Result := ThtmlINPUT.Create else if ThtmlTagID(ID) = HTML_TAG_SELECT then Result := ThtmlSELECT.Create else if ThtmlTagID(ID) = HTML_TAG_TEXTAREA then Result := ThtmlTEXTAREA.Create else if ThtmlTagID(ID) = HTML_TAG_FIELDSET then Result := ThtmlFIELDSET.Create else if ThtmlTagID(ID) = HTML_TAG_LEGEND then Result := ThtmlLEGEND.Create else if ThtmlTagID(ID) = HTML_TAG_BUTTON then Result := ThtmlBUTTON.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlFORM.GetAction: String; begin Result := AttributeText['ACTION']; end; procedure ThtmlFORM.SetAction(const Value: String); begin AttributeText['ACTION'] := Value; end; function ThtmlFORM.GetMethod: String; begin Result := AttributeText['METHOD']; end; procedure ThtmlFORM.SetMethod(const Value: String); begin AttributeText['METHOD'] := Value; end; function ThtmlFORM.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlFORM.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlFORM.GetOnSubmit: String; begin Result := AttributeText['ONSUBMIT']; end; procedure ThtmlFORM.SetOnSubmit(const Value: String); begin AttributeText['ONSUBMIT'] := Value; end; function ThtmlFORM.GetOnReset: String; begin Result := AttributeText['ONRESET']; end; procedure ThtmlFORM.SetOnReset(const Value: String); begin AttributeText['ONRESET'] := Value; end; function ThtmlFORM.GetTarget: String; begin Result := AttributeText['TARGET']; end; procedure ThtmlFORM.SetTarget(const Value: String); begin AttributeText['TARGET'] := Value; end; { ThtmlLABEL } constructor ThtmlLABEL.Create; begin inherited Create(HTML_TAG_LABEL, ttContentTags); end; function ThtmlLABEL.GetForID: String; begin Result := AttributeText['FOR']; end; procedure ThtmlLABEL.SetForID(const Value: String); begin AttributeText['FOR'] := Value; end; function ThtmlLABEL.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure ThtmlLABEL.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function ThtmlLABEL.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure ThtmlLABEL.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; { AhtmlTextInputElement } function AhtmlTextInputElement.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure AhtmlTextInputElement.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function AhtmlTextInputElement.GetDisabled: Boolean; begin Result := AttributeFlag['DISABLED']; end; procedure AhtmlTextInputElement.SetDisabled(const Value: Boolean); begin AttributeFlag['DISABLED'] := Value; end; function AhtmlTextInputElement.GetReadOnly: Boolean; begin Result := AttributeFlag['READONLY']; end; procedure AhtmlTextInputElement.SetReadOnly(const Value: Boolean); begin AttributeFlag['READONLY'] := Value; end; function AhtmlTextInputElement.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure AhtmlTextInputElement.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function AhtmlTextInputElement.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure AhtmlTextInputElement.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function AhtmlTextInputElement.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure AhtmlTextInputElement.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; function AhtmlTextInputElement.GetOnSelect: String; begin Result := AttributeText['ONSELECT']; end; procedure AhtmlTextInputElement.SetOnSelect(const Value: String); begin AttributeText['ONSELECT'] := Value; end; function AhtmlTextInputElement.GetOnChange: String; begin Result := AttributeText['ONCHANGE']; end; procedure AhtmlTextInputElement.SetOnChange(const Value: String); begin AttributeText['ONCHANGE'] := Value; end; { ThtmlINPUT } constructor ThtmlINPUT.Create; begin inherited Create(HTML_TAG_INPUT, ttStartTag); end; function ThtmlINPUT.GetInputType: ThtmlInputType; begin Result := htmlDecodeInputType(AttributeText['TYPE']); end; procedure ThtmlINPUT.SetInputType(const Value: ThtmlInputType); begin AttributeText['TYPE'] := htmlEncodeInputType(Value); end; function ThtmlINPUT.GetValue: String; begin Result := AttributeText['VALUE']; end; procedure ThtmlINPUT.SetValue(const Value: String); begin AttributeText['VALUE'] := Value; end; function ThtmlINPUT.GetChecked: Boolean; begin Result := AttributeFlag['CHECKED']; end; procedure ThtmlINPUT.SetChecked(const Value: Boolean); begin AttributeFlag['CHECKED'] := Value; end; function ThtmlINPUT.GetSize: String; begin Result := AttributeText['SIZE']; end; procedure ThtmlINPUT.SetSize(const Value: String); begin AttributeText['SIZE'] := Value; end; function ThtmlINPUT.GetMaxLength: Integer; begin Result := htmlDecodeInteger(AttributeText['MAXLENGTH'], -1); end; procedure ThtmlINPUT.SetMaxLength(const Value: Integer); begin AttributeText['MAXLENGTH'] := htmlEncodeInteger(Value); end; function ThtmlINPUT.GetSrc: String; begin Result := AttributeText['SRC']; end; procedure ThtmlINPUT.SetSrc(const Value: String); begin AttributeText['SRC'] := Value; end; function ThtmlINPUT.GetAlt: String; begin Result := AttributeText['ALT']; end; procedure ThtmlINPUT.SetAlt(const Value: String); begin AttributeText['ALT'] := Value; end; function ThtmlINPUT.GetAlign: ThtmlIAlignType; begin Result := htmlDecodeIAlignType(AttributeText['ALIGN']); end; procedure ThtmlINPUT.SetAlign(const Value: ThtmlIAlignType); begin AttributeText['ALIGN'] := htmlEncodeIAlignType(Value); end; function ThtmlINPUT.GetSizeInt: Integer; begin Result := StringToIntDefU(GetSize, 0); end; { ThtmlSELECT } constructor ThtmlSELECT.Create; begin inherited Create(HTML_TAG_SELECT, ttContentTags); end; function ThtmlSELECT.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_OPTGROUP then Result := ThtmlOPTGROUP.Create else if ThtmlTagID(ID) = HTML_TAG_OPTION then Result := ThtmlOPTION.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlSELECT.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlSELECT.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlSELECT.GetSize: Integer; begin Result := htmlDecodeInteger(AttributeText['SIZE'], -1); end; procedure ThtmlSELECT.SetSize(const Value: Integer); begin AttributeText['SIZE'] := htmlEncodeInteger(Value); end; function ThtmlSELECT.GetMultiple: Boolean; begin Result := AttributeFlag['MULTIPLE']; end; procedure ThtmlSELECT.SetMultiple(const Value: Boolean); begin AttributeFlag['MULTIPLE'] := Value; end; function ThtmlSELECT.GetDisabled: Boolean; begin Result := AttributeFlag['DISABLED']; end; procedure ThtmlSELECT.SetDisabled(const Value: Boolean); begin AttributeFlag['DISABLED'] := Value; end; function ThtmlSELECT.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure ThtmlSELECT.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function ThtmlSELECT.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure ThtmlSELECT.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function ThtmlSELECT.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure ThtmlSELECT.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; function ThtmlSELECT.GetOnChange: String; begin Result := AttributeText['ONCHANGE']; end; procedure ThtmlSELECT.SetOnChange(const Value: String); begin AttributeText['ONCHANGE'] := Value; end; { ThtmlOPTGROUP } constructor ThtmlOPTGROUP.Create; begin inherited Create(HTML_TAG_OPTGROUP, ttContentTags); end; function ThtmlOPTGROUP.GetDisabled: Boolean; begin Result := AttributeFlag['DISABLED']; end; procedure ThtmlOPTGROUP.SetDisabled(const Value: Boolean); begin AttributeFlag['DISABLED'] := Value; end; function ThtmlOPTGROUP.GetLabelText: String; begin Result := AttributeText['LABEL']; end; procedure ThtmlOPTGROUP.SetLabelText(const Value: String); begin AttributeText['LABEL'] := Value; end; { ThtmlOPTION } constructor ThtmlOPTION.Create; begin inherited Create(HTML_TAG_OPTION, ttContentTags); end; function ThtmlOPTION.GetDisabled: Boolean; begin Result := AttributeFlag['DISABLED']; end; procedure ThtmlOPTION.SetDisabled(const Value: Boolean); begin AttributeFlag['DISABLED'] := Value; end; function ThtmlOPTION.GetSelected: Boolean; begin Result := AttributeFlag['SELECTED']; end; procedure ThtmlOPTION.SetSelected(const Value: Boolean); begin AttributeFlag['SELECTED'] := Value; end; function ThtmlOPTION.GetLabelText: String; begin Result := AttributeText['LABEL']; end; procedure ThtmlOPTION.SetLabelText(const Value: String); begin AttributeText['LABEL'] := Value; end; function ThtmlOPTION.GetValue: String; begin Result := AttributeText['VALUE']; end; procedure ThtmlOPTION.SetValue(const Value: String); begin AttributeText['VALUE'] := Value; end; { ThtmlTEXTAREA } constructor ThtmlTEXTAREA.Create; begin inherited Create(HTML_TAG_TEXTAREA, ttContentTags); end; function ThtmlTEXTAREA.GetRows: Integer; begin Result := htmlDecodeInteger(AttributeText['ROWS'], 0); end; procedure ThtmlTEXTAREA.SetRows(const Value: Integer); begin AttributeText['ROWS'] := htmlEncodeInteger(Value); end; function ThtmlTEXTAREA.GetCols: Integer; begin Result := htmlDecodeInteger(AttributeText['COLS'], 0); end; procedure ThtmlTEXTAREA.SetCols(const Value: Integer); begin AttributeText['COLS'] := htmlEncodeInteger(Value); end; { ThtmlFIELDSET } constructor ThtmlFIELDSET.Create; begin inherited Create(HTML_TAG_FIELDSET, ttContentTags); end; { ThtmlLEGEND } constructor ThtmlLEGEND.Create; begin inherited Create(HTML_TAG_LEGEND, ttContentTags); end; function ThtmlLEGEND.GetAlign: String; begin Result := AttributeText['ALIGN']; end; procedure ThtmlLEGEND.SetAlign(const Value: String); begin AttributeText['ALIGN'] := Value; end; { ThtmlBUTTON } constructor ThtmlBUTTON.Create; begin inherited Create(HTML_TAG_BUTTON, ttContentTags); end; function ThtmlBUTTON.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlBUTTON.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlBUTTON.GetValue: String; begin Result := AttributeText['VALUE']; end; procedure ThtmlBUTTON.SetValue(const Value: String); begin AttributeText['VALUE'] := Value; end; function ThtmlBUTTON.GetButtonType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlBUTTON.SetButtonType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlBUTTON.GetDisabled: Boolean; begin Result := AttributeFlag['DISABLED']; end; procedure ThtmlBUTTON.SetDisabled(const Value: Boolean); begin AttributeFlag['DISABLED'] := Value; end; function ThtmlBUTTON.GetTabIndex: String; begin Result := AttributeText['TABINDEX']; end; procedure ThtmlBUTTON.SetTabIndex(const Value: String); begin AttributeText['TABINDEX'] := Value; end; function ThtmlBUTTON.GetOnFocus: String; begin Result := AttributeText['ONFOCUS']; end; procedure ThtmlBUTTON.SetOnFocus(const Value: String); begin AttributeText['ONFOCUS'] := Value; end; function ThtmlBUTTON.GetOnBlur: String; begin Result := AttributeText['ONBLUR']; end; procedure ThtmlBUTTON.SetOnBlur(const Value: String); begin AttributeText['ONBLUR'] := Value; end; { ============================================================================ } { TABLES } { ============================================================================ } { ThtmlTABLE } constructor ThtmlTABLE.Create; begin inherited Create(HTML_TAG_TABLE, ttContentTags); end; function ThtmlTABLE.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_TD then Result := ThtmlTD.Create else if ThtmlTagID(ID) = HTML_TAG_TR then Result := ThtmlTR.Create else if ThtmlTagID(ID) = HTML_TAG_TH then Result := ThtmlTH.Create else if ThtmlTagID(ID) = HTML_TAG_CAPTION then Result := ThtmlCAPTION.Create else if ThtmlTagID(ID) = HTML_TAG_COL then Result := ThtmlCOL.Create else if ThtmlTagID(ID) = HTML_TAG_COLGROUP then Result := ThtmlCOLGROUP.Create else if ThtmlTagID(ID) = HTML_TAG_THEAD then Result := ThtmlTHEAD.Create else if ThtmlTagID(ID) = HTML_TAG_TBODY then Result := ThtmlTBODY.Create else if ThtmlTagID(ID) = HTML_TAG_TFOOT then Result := ThtmlTFOOT.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlTABLE.GetSummary: String; begin Result := AttributeText['SUMMARY']; end; procedure ThtmlTABLE.SetSummary(const Value: String); begin AttributeText['SUMMARY'] := Value; end; function ThtmlTABLE.GetWidthStr: String; begin Result := AttributeText['WIDTH']; end; procedure ThtmlTABLE.SetWidthStr(const Value: String); begin AttributeText['WIDTH'] := Value; end; function ThtmlTABLE.GetWidth: ThtmlLength; begin Result := htmlDecodeLength(GetWidthStr); end; function ThtmlTABLE.GetBorder: Integer; begin Result := htmlDecodeInteger(AttributeText['BORDER'], 0); end; procedure ThtmlTABLE.SetBorder(const Value: Integer); begin AttributeText['BORDER'] := htmlEncodeInteger(Value); end; function ThtmlTABLE.GetCellSpacing: String; begin Result := AttributeText['CELLSPACING']; end; procedure ThtmlTABLE.SetCellSpacing(const Value: String); begin AttributeText['CELLSPACING'] := Value; end; function ThtmlTABLE.GetCellSpacingInt: Integer; begin Result := StringToIntDefU(GetCellSpacing, 1); end; function ThtmlTABLE.GetCellPadding: String; begin Result := AttributeText['CELLPADDING']; end; procedure ThtmlTABLE.SetCellPadding(const Value: String); begin AttributeText['CELLPADDING'] := Value; end; function ThtmlTABLE.GetCellPaddingInt: Integer; begin Result := StringToIntDefU(GetCellPadding, 1); end; function ThtmlTABLE.GetAlign: ThtmlTAlignType; begin Result := htmlDecodeTAlignType(AttributeText['ALIGN']); end; procedure ThtmlTABLE.SetAlign(const Value: ThtmlTAlignType); begin AttributeText['ALIGN'] := htmlEncodeTAlignType(Value); end; function ThtmlTABLE.GetBgColor: String; begin Result := AttributeText['BGCOLOR']; end; procedure ThtmlTABLE.SetBgColor(const Value: String); begin AttributeText['BGCOLOR'] := Value; end; function ThtmlTABLE.GetBgColorRGB: LongWord; begin Result := htmlResolveColor(GetBgColor).RGB; end; procedure ThtmlTABLE.SetBgColorRGB(const Value: LongWord); begin SetBgColor(htmlEncodeRGBColor(htmlRGBColor(Value))); end; function ThtmlTABLE.GetBgColorDelphi: TColor; begin Result := htmlResolveColor(GetBgColor).Color; end; function ThtmlTABLE.GetColGroupsSpanResolved: Integer; var ColGroup: ThtmlCOLGROUP; begin Result := 0; ColGroup := nil; repeat ColGroup := ThtmlCOLGROUP(FindNext(ColGroup, ThtmlCOLGROUP)); if not Assigned(ColGroup) then break; Inc(Result, ColGroup.GetSpanResolved); until False; end; function ThtmlTABLE.GetColGroupsWidthsPixels(const StyleSheet: ThtmlCSS; const AbsWidth: Integer): IntegerArray; var ColGroup: ThtmlCOLGROUP; W: IntegerArray; begin W := nil; Result := nil; ColGroup := nil; repeat ColGroup := ThtmlCOLGROUP(FindNext(ColGroup, ThtmlCOLGROUP)); if not Assigned(ColGroup) then break; W := ColGroup.GetColWidthsPixels(StyleSheet, AbsWidth); DynArrayAppendIntegerArray(Result, W); until False; end; procedure ThtmlTABLE.GetColGroupsAlign(var HorAlign: ThtmlTextAlignArray; var VerAlign: ThtmlVerticalAlignArray); var ColGroup: ThtmlCOLGROUP; H: ThtmlTextAlignArray; V: ThtmlVerticalAlignArray; I, L, M: Integer; begin H := nil; V := nil; L := GetColGroupsSpanResolved; SetLength(HorAlign, L); SetLength(VerAlign, L); ColGroup := nil; L := 0; repeat ColGroup := ThtmlCOLGROUP(FindNext(ColGroup, ThtmlCOLGROUP)); if not Assigned(ColGroup) then break; ColGroup.GetGroupAlign(H, V); M := Length(H); if M > 0 then begin Assert(Length(V) = Length(H), 'Length(V) = Length(H)'); for I := 0 to M - 1 do begin HorAlign[L + I] := H[I]; VerAlign[L + I] := V[I]; end; Inc(L, M); end; until False; end; procedure ThtmlTABLE.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin inherited; S := GetBgColor; if S <> '' then StyleInfo.BackColor := htmlDecodeColor(S); S := GetWidthStr; if S <> '' then StyleInfo.Width := htmlDecodeLength(S); end; { ThtmlCAPTION } constructor ThtmlCAPTION.Create; begin inherited Create(HTML_TAG_CAPTION, ttContentTags); end; function ThtmlCAPTION.GetAlign: String; begin Result := AttributeText['ALIGN']; end; procedure ThtmlCAPTION.SetAlign(const Value: String); begin AttributeText['ALIGN'] := Value; end; { AhtmlElementInclCellAlign } function AhtmlElementInclCellAlign.GetAlign: String; begin Result := AttributeText['ALIGN']; end; procedure AhtmlElementInclCellAlign.SetAlign(const Value: String); begin AttributeText['ALIGN'] := Value; end; function AhtmlElementInclCellAlign.GetAlignChar: String; begin Result := AttributeText['CHAR']; end; procedure AhtmlElementInclCellAlign.SetAlignChar(const Value: String); begin AttributeText['CHAR'] := Value; end; function AhtmlElementInclCellAlign.GetCharOff: String; begin Result := AttributeText['CHAROFF']; end; procedure AhtmlElementInclCellAlign.SetCharOff(const Value: String); begin AttributeText['CHAROFF'] := Value; end; function AhtmlElementInclCellAlign.GetVAlign: String; begin Result := AttributeText['VALIGN']; end; procedure AhtmlElementInclCellAlign.SetVAlign(const Value: String); begin AttributeText['VALIGN'] := Value; end; function AhtmlElementInclCellAlign.GetHorAlign: ThtmlTextAlignType; begin Result := htmlDecodeTextAlignType(GetAlign); end; function AhtmlElementInclCellAlign.GetVerAlign: ThtmlVerticalAlign; begin Result := htmlcssDecodeVerticalAlign(GetVAlign); end; { AhtmlTableColumnDefinitionElement } function AhtmlTableColumnDefinitionElement.GetSpan: Integer; begin Result := htmlDecodeInteger(AttributeText['SPAN'], 1); end; procedure AhtmlTableColumnDefinitionElement.SetSpan(const Value: Integer); begin AttributeText['SPAN'] := htmlEncodeInteger(Value); end; function AhtmlTableColumnDefinitionElement.GetWidthStr: String; begin Result := AttributeText['WIDTH']; end; procedure AhtmlTableColumnDefinitionElement.SetWidthStr(const Value: String); begin AttributeText['WIDTH'] := Value; end; function AhtmlTableColumnDefinitionElement.GetWidth: ThtmlLength; begin Result := htmlDecodeLength(GetWidthStr); end; procedure AhtmlTableColumnDefinitionElement.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin inherited; S := GetWidthStr; if S <> '' then StyleInfo.Width := htmlDecodeLength(S); end; { ThtmlCOLGROUP } constructor ThtmlCOLGROUP.Create; begin inherited Create(HTML_TAG_COLGROUP, ttContentTags); end; function ThtmlCOLGROUP.GetSpanResolved: Integer; var Col: ThtmlCOL; ColCount, SpanTot: Integer; begin // Count span from COL elements ColCount := 0; SpanTot := 0; Col := nil; repeat Col := ThtmlCOL(FindNext(Col, ThtmlCOL)); if not Assigned(Col) then break; Inc(SpanTot, Col.Span); Inc(ColCount); until False; // Calculate span if ColCount = 0 then Result := GetSpan // use Span attribute else Result := SpanTot; end; function ThtmlCOLGROUP.GetColWidthsPixels(const StyleSheet: ThtmlCSS; const AbsWidth: Integer): IntegerArray; var I, J, L, S, V, W: Integer; Col: ThtmlCOL; begin // get span L := GetSpanResolved; SetLength(Result, L); if L = 0 then exit; // initialize result from COLGROUP width W := MaxInt(0, htmlResolveLengthPixels(FStyle.Width, AbsWidth)); for I := 0 to L - 1 do Result[I] := W; // set result from COL widths I := 0; Col := nil; repeat Col := ThtmlCOL(FindNext(Col, ThtmlCOL)); if not Assigned(Col) then break; V := htmlResolveLengthPixels(Col.FStyle.Width, AbsWidth); S := Col.Span; for J := I to I + S - 1 do Result[J] := V; Inc(I, S); until I >= L; end; procedure ThtmlCOLGROUP.GetGroupAlign(var HorAlign: ThtmlTextAlignArray; var VerAlign: ThtmlVerticalAlignArray); var I, J, L, S: Integer; V: ThtmlVerticalAlign; H: ThtmlTextAlignType; Col: ThtmlCOL; begin // get span L := GetSpanResolved; SetLength(HorAlign, L); SetLength(VerAlign, L); if L = 0 then exit; // initialize result for I := 0 to L - 1 do begin HorAlign[I] := talignDefault; VerAlign[I].AlignType := valignDefault; end; // set result from COLs I := 0; Col := nil; repeat Col := ThtmlCOL(FindNext(Col, ThtmlCOL)); if not Assigned(Col) then break; V := Col.VerAlign; H := Col.HorAlign; S := Col.Span; for J := I to I + S - 1 do begin HorAlign[J] := H; VerAlign[J] := V; end; Inc(I, S); until I >= L; end; { ThtmlCOL } constructor ThtmlCOL.Create; begin inherited Create(HTML_TAG_COL, ttContentTags); end; { ThtmlTHEAD } constructor ThtmlTHEAD.Create; begin inherited Create(HTML_TAG_THEAD, ttContentTags); end; { ThtmlTBODY } constructor ThtmlTBODY.Create; begin inherited Create(HTML_TAG_TBODY, ttContentTags); end; { ThtmlTFOOT } constructor ThtmlTFOOT.Create; begin inherited Create(HTML_TAG_TFOOT, ttContentTags); end; { ThtmlTR } constructor ThtmlTR.Create; begin inherited Create(HTML_TAG_TR, ttContentTags); end; function ThtmlTR.GetBgColor: String; begin Result := AttributeText['BGCOLOR']; end; procedure ThtmlTR.SetBgColor(const Value: String); begin AttributeText['BGCOLOR'] := value; end; function ThtmlTR.GetBgColorDelphi: TColor; begin Result := htmlResolveColor(GetBgColor).Color; end; procedure ThtmlTR.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin inherited; S := GetBgColor; if S <> '' then StyleInfo.BackColor := htmlDecodeColor(S); end; { AhtmlTableDataCell } constructor AhtmlTableDataCell.Create(const TagID: ThtmlTagID); begin inherited Create(TagID, ttContentTags); end; function AhtmlTableDataCell.GetAbbr: String; begin Result := AttributeText['ABBR']; end; procedure AhtmlTableDataCell.SetAbbr(const Value: String); begin AttributeText['ABBR'] := Value; end; function AhtmlTableDataCell.GetRowSpan: Integer; begin Result := htmlDecodeInteger(AttributeText['ROWSPAN'], 1); end; procedure AhtmlTableDataCell.SetRowSpan(const Value: Integer); begin AttributeText['ROWSPAN'] := htmlEncodeInteger(Value); end; function AhtmlTableDataCell.GetColSpan: Integer; begin Result := htmlDecodeInteger(AttributeText['COLSPAN'], 1); end; procedure AhtmlTableDataCell.SetColSpan(const Value: Integer); begin AttributeText['COLSPAN'] := htmlEncodeInteger(Value); end; function AhtmlTableDataCell.GetNoWrap: Boolean; begin Result := AttributeFlag['NOWRAP']; end; procedure AhtmlTableDataCell.SetNoWrap(const Value: Boolean); begin AttributeFlag['NOWRAP'] := Value; end; function AhtmlTableDataCell.GetBgColor: String; begin Result := AttributeText['BGCOLOR']; end; procedure AhtmlTableDataCell.SetBgColor(const Value: String); begin AttributeText['BGCOLOR'] := Value; end; function AhtmlTableDataCell.GetBgColorDelphi: TColor; begin Result := htmlResolveColor(GetBgColor).Color; end; function AhtmlTableDataCell.GetWidthStr: String; begin Result := AttributeText['WIDTH']; end; procedure AhtmlTableDataCell.SetWidthStr(const Value: String); begin AttributeText['WIDTH'] := Value; end; function AhtmlTableDataCell.GetHeightStr: String; begin Result := AttributeText['HEIGHT']; end; procedure AhtmlTableDataCell.SetHeightStr(const Value: String); begin AttributeText['HEIGHT'] := Value; end; function AhtmlTableDataCell.GetWidth: ThtmlLength; begin Result := htmlDecodeLength(GetWidthStr); end; function AhtmlTableDataCell.GetHeight: ThtmlLength; begin Result := htmlDecodeLength(GetHeightStr); end; procedure AhtmlTableDataCell.ApplyHTMLStyleInfo(var StyleInfo: ThtmlcssStyleProperties; const ParentStyle: ThtmlcssStyleProperties); var S: String; begin inherited; S := GetBgColor; if S <> '' then StyleInfo.BackColor := htmlDecodeColor(S); S := GetWidthStr; if S <> '' then StyleInfo.Width := htmlDecodeLength(S); S := GetHeightStr; if S <> '' then StyleInfo.Height := htmlDecodeLength(S); end; { ThtmlTD } constructor ThtmlTD.Create; begin inherited Create(HTML_TAG_TD); FTagType := ttContentTags; end; { ThtmlTH } constructor ThtmlTH.Create; begin inherited Create(HTML_TAG_TH); FTagType := ttContentTags; end; { ============================================================================ } { FRAMES } { ============================================================================ } { ThtmlFRAMESET } constructor ThtmlFRAMESET.Create; begin inherited Create(HTML_TAG_FRAMESET, ttContentTags); end; function ThtmlFRAMESET.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_FRAME then Result := ThtmlFRAME.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlFRAMESET.GetRows: String; begin Result := AttributeText['ROWS']; end; procedure ThtmlFRAMESET.SetRows(const Value: String); begin AttributeText['ROWS'] := Value; end; function ThtmlFRAMESET.GetCols: String; begin Result := AttributeText['COLS']; end; procedure ThtmlFRAMESET.SetCols(const Value: String); begin AttributeText['COLS'] := Value; end; function ThtmlFRAMESET.GetOnLoad: String; begin Result := AttributeText['ONLOAD']; end; procedure ThtmlFRAMESET.SetOnLoad(const Value: String); begin AttributeText['ONLOAD'] := Value; end; function ThtmlFRAMESET.GetOnUnload: String; begin Result := AttributeText['ONUNLOAD']; end; procedure ThtmlFRAMESET.SetOnUnload(const Value: String); begin AttributeText['ONUNLOAD'] := Value; end; { AhtmlFrameElement } function AhtmlFrameElement.GetLongDesc: String; begin Result := AttributeText['LONGDESC']; end; procedure AhtmlFrameElement.SetLongDesc(const Value: String); begin AttributeText['LONGDESC'] := Value; end; function AhtmlFrameElement.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure AhtmlFrameElement.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function AhtmlFrameElement.GetSrc: String; begin Result := AttributeText['SRC']; end; procedure AhtmlFrameElement.SetSrc(const Value: String); begin AttributeText['SRC'] := Value; end; function AhtmlFrameElement.GetFrameBorder: Boolean; begin Result := htmlDecodeInteger(AttributeText['FRAMEBORDER'], 1) <> 0; end; procedure AhtmlFrameElement.SetFrameBorder(const Value: Boolean); begin AttributeText['FRAMEBORDER'] := iifU(Value, '1', '0'); end; function AhtmlFrameElement.GetMarginWidth: Integer; begin Result := htmlDecodeInteger(AttributeText['MARGINWIDTH'], 0); end; procedure AhtmlFrameElement.SetMarginWidth(const Value: Integer); begin AttributeText['MARGINWIDTH'] := htmlEncodeInteger(Value); end; function AhtmlFrameElement.GetMarginHeight: Integer; begin Result := htmlDecodeInteger(AttributeText['MARGINHEIGHT'], 0); end; procedure AhtmlFrameElement.SetMarginHeight(const Value: Integer); begin AttributeText['MARGINHEIGHT'] := htmlEncodeInteger(Value); end; function AhtmlFrameElement.GetScrolling: String; begin Result := AttributeText['SCROLLING']; end; procedure AhtmlFrameElement.SetScrolling(const Value: String); begin AttributeText['SCROLLING'] := Value; end; { ThtmlFRAME } constructor ThtmlFRAME.Create; begin inherited Create(HTML_TAG_FRAME, ttStartTag); end; function ThtmlFRAME.GetNoResize: Boolean; begin Result := AttributeFlag['NORESIZE']; end; procedure ThtmlFRAME.SetNoResize(const Value: Boolean); begin AttributeFlag['NORESIZE'] := Value; end; { ThtmlIFRAME } constructor ThtmlIFRAME.Create; begin inherited Create(HTML_TAG_IFRAME, ttContentTags); end; function ThtmlIFRAME.GetAlign: ThtmlIAlignType; begin Result := htmlDecodeIAlignType(AttributeText['ALIGN']); end; procedure ThtmlIFRAME.SetAlign(const Value: ThtmlIAlignType); begin AttributeText['ALIGN'] := htmlEncodeIAlignType(Value); end; function ThtmlIFRAME.GetHeight: String; begin Result := AttributeText['HEIGHT']; end; procedure ThtmlIFRAME.SetHeight(const Value: String); begin AttributeText['HEIGHT'] := Value; end; function ThtmlIFRAME.GetWidth: String; begin Result := AttributeText['WIDTH']; end; procedure ThtmlIFRAME.SetWidth(const Value: String); begin AttributeText['WIDTH'] := Value; end; { ThtmlNOFRAMES } constructor ThtmlNOFRAMES.Create; begin inherited Create(HTML_TAG_NOFRAMES, ttContentTags); end; { ============================================================================ } { DOCUMENT HEAD } { ============================================================================ } { ThtmlHEAD } constructor ThtmlHEAD.Create; begin inherited Create(HTML_TAG_HEAD, ttContentTags); end; function ThtmlHEAD.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_TITLE then Result := ThtmlTITLE.Create else if ThtmlTagID(ID) = HTML_TAG_ISINDEX then Result := ThtmlISINDEX.Create else if ThtmlTagID(ID) = HTML_TAG_BASE then Result := ThtmlBASE.Create else if ThtmlTagID(ID) = HTML_TAG_SCRIPT then Result := ThtmlSCRIPT.Create else if ThtmlTagID(ID) = HTML_TAG_STYLE then Result := ThtmlSTYLE.Create else if ThtmlTagID(ID) = HTML_TAG_META then Result := ThtmlMETA.Create else if ThtmlTagID(ID) = HTML_TAG_LINK then Result := ThtmlLINK.Create else if ThtmlTagID(ID) = HTML_TAG_OBJECT then Result := ThtmlLINK.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlHEAD.GetProfile: String; begin Result := AttributeText['PROFILE']; end; procedure ThtmlHEAD.SetProfile(const Value: String); begin AttributeText['PROFILE'] := Value; end; function ThtmlHEAD.FindMetaHttpField(const Name: String): AhtmlElement; var T: AhtmlObject; begin T := nil; repeat T := FindNextName(T, 'META'); if not Assigned(T) then break; if (T is AhtmlElement) and StrEqualNoAsciiCaseU(Name, AhtmlElement(T).AttributeText['http-equiv']) then begin Result := AhtmlElement(T); exit; end; until False; Result := nil; end; function ThtmlHEAD.GetMetaHttpField(const Name: String): String; var T: AhtmlElement; begin T := FindMetaHttpField(Name); if Assigned(T) then Result := T.AttributeText['CONTENT'] else Result := ''; end; procedure ThtmlHEAD.SetMetaHttpField(const Name, Value: String); var T: AhtmlElement; begin T := FindMetaHttpField(Name); if Assigned(T) then T.AttributeText['CONTENT'] := Value else AddItem(ThtmlMETA.CreateField(Name, Value)); end; function ThtmlHEAD.GetTitle: String; var T: AhtmlObject; begin Result := ItemText['TITLE']; if Result = '' then Result := MetaHttpField['title']; if Result = '' then begin T := FindNextName(nil, 'STYLE'); if Assigned(T) and (T is AhtmlElement) then Result := AhtmlElement(T).AttributeText['TITLE']; end; end; procedure ThtmlHEAD.SetTitle(const Value: String); begin ItemText['TITLE'] := Value; MetaHttpField['title'] := Value; end; function ThtmlHEAD.GetContentType: String; begin Result := MetaHttpField['content-type']; end; procedure ThtmlHEAD.SetContentType(const Value: String); begin MetaHttpField['content-type'] := Value; end; function ThtmlHEAD.GetDescription: String; begin Result := MetaHttpField['description']; end; procedure ThtmlHEAD.SetDescription(const Value: String); begin MetaHttpField['description'] := Value; end; function ThtmlHEAD.GetKeywords: String; begin Result := MetaHttpField['keywords']; end; procedure ThtmlHEAD.SetKeywords(const Value: String); begin MetaHttpField['keywords'] := Value; end; function ThtmlHEAD.GetAutoRefresh: Boolean; begin Result := Assigned(FindMetaHttpField('refresh')); end; procedure ThtmlHEAD.SetAutoRefresh(const Value: Boolean); begin if Value = GetAutoRefresh then exit; if Value then MetaHttpField['refresh'] := ''; end; function ThtmlHEAD.GetAutoRefreshInterval: Integer; begin Result := StringToIntDefU(StrBeforeU(MetaHttpField['refresh'], ';', True), 0); end; procedure ThtmlHEAD.SetAutoRefreshInterval(const Value: Integer); var S, T: String; begin S := MetaHttpField['refresh']; T := StrAfterU(S, ';'); MetaHttpField['refresh'] := IntToStringU(Value) + iifU(T <> '', ';', '') + T; end; function ThtmlHEAD.GetAutoRefreshURL: String; begin Result := StrBetweenU(MetaHttpField['refresh'], ';URL=', [';'], False, True, False); end; procedure ThtmlHEAD.SetAutoRefreshURL(const Value: String); var S, T: String; begin S := MetaHttpField['refresh']; T := StrBeforeU(S, ';URL=', True, False); MetaHttpField['refresh'] := T + ';URL=' + Value; end; function ThtmlHEAD.GetStyleText: String; var Style: ThtmlSTYLE; begin Result := ''; Style := nil; repeat Style := ThtmlSTYLE(FindNext(Style, ThtmlSTYLE)); if not Assigned(Style) then exit; if Result <> '' then Result := Result + #13#10; Result := Result + Style.StyleText; until False; end; function ThtmlHEAD.GetStyleRefs: StringArray; var Link : ThtmlLINK; S : String; begin Result := nil; Link := nil; repeat Link := ThtmlLINK(FindNext(Link, ThtmlLINK)); if not Assigned(Link) then exit; if StrEqualNoAsciiCaseU(Link.Rel, 'STYLESHEET') and ((Link.Media = '') or (PosStrU('screen', Link.Media, 1, False) > 0)) then begin S := Link.HRef; StrTrimInPlaceU(S); if S <> '' then DynArrayAppend(Result, S); end; until False; end; procedure ThtmlHEAD.PrepareStructure; begin end; { ThtmlTITLE } constructor ThtmlTITLE.Create; begin inherited Create(HTML_TAG_TITLE, ttContentTags); end; { ThtmlISINDEX } constructor ThtmlISINDEX.Create; begin inherited Create(HTML_TAG_ISINDEX, ttStartTag); end; function ThtmlISINDEX.GetPrompt: String; begin Result := AttributeText['PROMPT']; end; procedure ThtmlISINDEX.SetPrompt(const Value: String); begin AttributeText['PROMPT'] := Value; end; { ThtmlBASE } constructor ThtmlBASE.Create; begin inherited Create(HTML_TAG_BASE, ttStartTag); end; function ThtmlBASE.GetHRef: String; begin Result := AttributeText['HREF']; end; procedure ThtmlBASE.SetHRef(const Value: String); begin AttributeText['HREF'] := Value; end; function ThtmlBASE.GetTarget: String; begin Result := AttributeText['TARGET']; end; procedure ThtmlBASE.SetTarget(const Value: String); begin AttributeText['TARGET'] := Value; end; { ThtmlMETA } constructor ThtmlMETA.Create; begin inherited Create(HTML_TAG_META, ttStartTag); end; constructor ThtmlMETA.CreateField(const HttpEquiv, Value: String); begin inherited Create; SetHttpEquiv(HttpEquiv); SetFieldContent(Value); end; function ThtmlMETA.GetHttpEquiv: String; begin Result := AttributeText['HTTP-EQUIV']; end; procedure ThtmlMETA.SetHttpEquiv(const Value: String); begin AttributeText['HTTP-EQUIV'] := Value; end; function ThtmlMETA.GetFieldContent: String; begin Result := AttributeText['CONTENT']; end; procedure ThtmlMETA.SetFieldContent(const Value: String); begin AttributeText['CONTENT'] := Value; end; function ThtmlMETA.GetNameAttr: String; begin Result := AttributeText['NAME']; end; procedure ThtmlMETA.SetNameAttr(const Value: String); begin AttributeText['NAME'] := Value; end; function ThtmlMETA.GetScheme: String; begin Result := AttributeText['SCHEME']; end; procedure ThtmlMETA.SetScheme(const Value: String); begin AttributeText['SCHEME'] := Value; end; { ThtmlSTYLE } constructor ThtmlSTYLE.Create; begin inherited Create(HTML_TAG_STYLE, ttContentTags); end; function ThtmlSTYLE.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlSTYLE.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlSTYLE.GetMedia: String; begin Result := AttributeText['MEDIA']; end; procedure ThtmlSTYLE.SetMedia(const Value: String); begin AttributeText['MEDIA'] := Value; end; function ThtmlSTYLE.GetTitle: String; begin Result := AttributeText['TITLE']; end; procedure ThtmlSTYLE.SetTitle(const Value: String); begin AttributeText['TITLE'] := Value; end; function ThtmlSTYLE.GetStyleText: String; var C: AhtmlObject; I: Integer; begin Result := ''; // Get style sheet text from content. Text may be in comments. C := nil; repeat C := FindNext(C, AhtmlObject); if not Assigned(C) then break; if C is ThtmlComment then for I := 0 to Length(ThtmlComment(C).Comments) - 1 do Result := Result + ThtmlComment(C).Comments[I] + ' ' else if C is AhtmlTextContentObject then Result := Result + C.ContentText; until False; end; { ThtmlSCRIPT } constructor ThtmlSCRIPT.Create; begin inherited Create(HTML_TAG_SCRIPT, ttContentTags); end; function ThtmlSCRIPT.GetContentType: String; begin Result := AttributeText['TYPE']; end; procedure ThtmlSCRIPT.SetContentType(const Value: String); begin AttributeText['TYPE'] := Value; end; function ThtmlSCRIPT.GetLanguage: String; begin Result := AttributeText['LANGUAGE']; end; procedure ThtmlSCRIPT.SetLangauge(const Value: String); begin AttributeText['LANGUAGE'] := Value; end; function ThtmlSCRIPT.GetSrc: String; begin Result := AttributeText['SRC']; end; procedure ThtmlSCRIPT.SetSrc(const Value: String); begin AttributeText['SRC'] := Value; end; function ThtmlSCRIPT.GetDefer: Boolean; begin Result := AttributeFlag['DEFER']; end; procedure ThtmlSCRIPT.SetDefer(const Value: Boolean); begin AttributeFlag['DEFER'] := Value; end; { ThtmlNOSCRIPT } constructor ThtmlNOSCRIPT.Create; begin inherited Create(HTML_TAG_NOSCRIPT, ttContentTags); end; { ============================================================================ } { DOCUMENT STRUCTURE } { ============================================================================ } { ThtmlVersionTag } constructor ThtmlVersionTag.Create(const Version: String); begin inherited Create; FVersion := Version; end; function ThtmlVersionTag.DuplicateObject: AhtmlObject; begin Result := inherited DuplicateObject; ThtmlVersionTag(Result).FVersion := FVersion; end; function ThtmlVersionTag.GetHTMLText: String; begin Result := ''; end; { ThtmlHTML } constructor ThtmlHTML.Create; begin inherited Create(HTML_TAG_HTML, ttContentTags); end; function ThtmlHTML.CreateItem(const ID: Integer; const Name: String): AhtmlObject; begin if ThtmlTagID(ID) = HTML_TAG_HEAD then Result := ThtmlHEAD.Create else if ThtmlTagID(ID) = HTML_TAG_BODY then Result := ThtmlBODY.Create else if ThtmlTagID(ID) = HTML_TAG_FRAMESET then Result := ThtmlFRAMESET.Create else if ThtmlTagID(ID) = HTML_TAG_NOFRAMES then Result := ThtmlNOFRAMES.Create else Result := inherited CreateItem(ID, Name); end; function ThtmlHTML.GetVersion: String; var T: AhtmlObject; begin T := FindNext(nil, ThtmlVersionTag); if Assigned(T) then Result := ThtmlVersionTag(T).Version else Result := ''; end; procedure ThtmlHTML.SetVersion(const Value: String); var T: AhtmlObject; begin T := FindNext(nil, ThtmlVersionTag); if Assigned(T) then ThtmlVersionTag(T).Version := Value else AddItem(ThtmlVersionTag.Create(Value)); end; function ThtmlHTML.GetHead: ThtmlHEAD; begin Result := ThtmlHEAD(RequireItemByClass(ThtmlHEAD)); end; function ThtmlHTML.GetBody: ThtmlBODY; begin Result := ThtmlBODY(RequireItemByClass(ThtmlBODY)); end; function ThtmlHTML.GetFrameSet: ThtmlFRAMESET; begin Result := ThtmlFRAMESET(RequireItemByClass(ThtmlFRAMESET)); end; procedure ThtmlHTML.SetContentText(const ContentText: String); begin Body.ContentText := ContentText; end; procedure ThtmlHTML.PrepareStructure; begin Head.PrepareStructure; Body.PrepareStructure; end; end.