ScroogeXHTML for Object Pascal 8.5
Loading...
Searching...
No Matches
TCustomTranslator Class Reference

Abstract translator class. More...

Inheritance diagram for TCustomTranslator:
ISxTranslator THTMLTranslator TXHTMLTranslator THTML3FlexTranslator THTML401StrictTranslator THTML401TransitionalTranslator THTML50Translator TXHTML10StrictTranslator TXHTML10TransitionalTranslator TXHTMLBasic10Translator TXHTML11Translator TXHTMLMobileProfile10Translator TXHTML50Translator

Public Member Functions

 TCustomTranslator (const IMarginBuilding AMarginBuilder)
 
string BuildLangAttribute (const string Language)
 Returns lang attribute.
 
string Encode (const string S)
 Encode Unicode string using UTF-8.
 
string FormatElement (const string AText, const TCharacterProperties CP)
 Returns text with formatting CSS/HTML/XHTML tags.
 
string GetCharacterStyles (const string AText, const TCharacterProperties CP)
 Returns text with styles applied for the given character properties.
 
string GetCloseEmptyElement ()
 Returns the correct closing bracket for an empty element.
 
string GetDocType ()
 Get the DOCTYPE definition.
 
string GetDocTypeName ()
 Get the name of the doctype.
 
string GetFontSizeStyle (const Integer Pt)
 Returns a CSS style for the given font size.
 
string GetIndentAndDirectionStyle (const TParagraphProperties PP)
 Returns a indent and direction style for the paragraph.
 
string GetMargin ()
 Returns a sequence of spaces (the left margin).
 
string GetParagraph (const string AdditionalStyle, const string AdditionalParams='')
 returns the start tag for a paragraph element
 
string GetParagraphStyle (const TParagraphProperties PP)
 Converts the paragraph properties to a style definition.
 
string GetRootElement (const string Language='')
 Returns the HTML / XHTML document root element.
 
string GetStyleParam (const string AdditionalStyle)
 Get style parameter.
 
Boolean IsDocTypeRequired ()
 Returns True if a DOCTYPE declaration is required (see XHTML 1.1).
 
boolean IsTransitional ()
 Returns True if the document type is a transitional version.
 
Boolean IsXml ()
 Returns True if it is an XML based Translator.
 
 SetFontSizeScale (const TFontSizeScale FSS)
 Setter for the font size scale.
 
 SetParOpen (const string TagAndClass)
 Setter for the 'paragraph open' tag.
 
Boolean SupportsElement (const string ElementName)
 Returns True if the element is supported by the current doctype.
 
Boolean SupportsParameter (const string ElementName, const string ParamName)
 Returns True if the element supports the given parameter.
 

Detailed Description

Abstract translator class.

Constructor & Destructor Documentation

◆ TCustomTranslator()

TCustomTranslator::TCustomTranslator ( const IMarginBuilding AMarginBuilder)

Member Function Documentation

◆ BuildLangAttribute()

string TCustomTranslator::BuildLangAttribute ( const string Language)

Returns lang attribute.

◆ Encode()

string TCustomTranslator::Encode ( const string S)

Encode Unicode string using UTF-8.

Implements ISxTranslator.

◆ FormatElement()

string TCustomTranslator::FormatElement ( const string AText,
const TCharacterProperties CP )

Returns text with formatting CSS/HTML/XHTML tags.

Implements ISxTranslator.

◆ GetCharacterStyles()

string TCustomTranslator::GetCharacterStyles ( const string AText,
const TCharacterProperties CP )

Returns text with styles applied for the given character properties.

◆ GetCloseEmptyElement()

string TCustomTranslator::GetCloseEmptyElement ( )

Returns the correct closing bracket for an empty element.

Example:
  • in HTML, the linebreak element is
    <br> 
  • in XHTML, the linebreak element is
    <br /> 
Note
  • For HTML, the function returns
    ">" 
  • For XHTML, the function returns
    " />" 

Implements ISxTranslator.

◆ GetDocType()

string TCustomTranslator::GetDocType ( )

Get the DOCTYPE definition.

Implements ISxTranslator.

◆ GetDocTypeName()

string TCustomTranslator::GetDocTypeName ( )

Get the name of the doctype.

◆ GetFontSizeStyle()

string TCustomTranslator::GetFontSizeStyle ( const Integer Pt)

Returns a CSS style for the given font size.

Implements ISxTranslator.

◆ GetIndentAndDirectionStyle()

string TCustomTranslator::GetIndentAndDirectionStyle ( const TParagraphProperties PP)

Returns a indent and direction style for the paragraph.

◆ GetMargin()

string TCustomTranslator::GetMargin ( )

Returns a sequence of spaces (the left margin).

◆ GetParagraph()

string TCustomTranslator::GetParagraph ( const string AdditionalStyle,
const string AdditionalParams = '' )

returns the start tag for a paragraph element

Implements ISxTranslator.

◆ GetParagraphStyle()

string TCustomTranslator::GetParagraphStyle ( const TParagraphProperties PP)

Converts the paragraph properties to a style definition.

Implements ISxTranslator.

◆ GetRootElement()

string TCustomTranslator::GetRootElement ( const string Language = '')

Returns the HTML / XHTML document root element.

  • for HTML, this is
    <html> 
  • for XHTML, this is
    <html xmlns="http://www.w3.org/1999/xhtml"> 

Implements ISxTranslator.

◆ GetStyleParam()

string TCustomTranslator::GetStyleParam ( const string AdditionalStyle)

Get style parameter.

Add the given style.

Implements ISxTranslator.

◆ IsDocTypeRequired()

Boolean TCustomTranslator::IsDocTypeRequired ( )

Returns True if a DOCTYPE declaration is required (see XHTML 1.1).

Implements ISxTranslator.

◆ IsTransitional()

boolean TCustomTranslator::IsTransitional ( )

Returns True if the document type is a transitional version.

Implements ISxTranslator.

◆ IsXml()

Boolean TCustomTranslator::IsXml ( )

Returns True if it is an XML based Translator.

Implements ISxTranslator.

◆ SetFontSizeScale()

TCustomTranslator::SetFontSizeScale ( const TFontSizeScale FSS)

Setter for the font size scale.

Implements ISxTranslator.

◆ SetParOpen()

TCustomTranslator::SetParOpen ( const string TagAndClass)

Setter for the 'paragraph open' tag.

Implements ISxTranslator.

◆ SupportsElement()

Boolean TCustomTranslator::SupportsElement ( const string ElementName)

Returns True if the element is supported by the current doctype.

Implements ISxTranslator.

◆ SupportsParameter()

Boolean TCustomTranslator::SupportsParameter ( const string ElementName,
const string ParamName )

Returns True if the element supports the given parameter.

Implements ISxTranslator.