ScroogeXHTML for Object Pascal 9.3
Loading...
Searching...
No Matches
TSxBase Class Reference

The base class for ScroogeXHTML. More...

Inheritance diagram for TSxBase:
ISxWriterOptions TSxMain TCustomScrooge TBTScroogeXHTML

Public Member Functions

 TSxBase ()
 Creates a new instance of TSxBase.
 TSxBase (TComponent AOwner)
 Creates a new instance of TSxBase with a specified owner.
 ~TSxBase ()
 Destroys the TSxBase instance and releases all allocated resources.
string GetCloseEmptyElement ()
 Returns the closing tag for an empty HTML element.
string GetEmptyParagraph ()
 Returns an empty paragraph element.
string GetLineBreakTag ()
 Returns the line break element.
string GetOrderedListTag ()
 Returns the opening tag for an ordered list.
string GetParOpen ()
 Returns the opening tag for a paragraph without the closing angle bracket.
string GetUnorderedListTag ()
 Returns the opening tag for an unordered list.
 Log (const TLogLevel ALogLevel, const string ALogText)
 Logs a message with the specified log level.
 ReplaceFont (string &FontName)
 Replaces a font name with a predefined substitution.
string TextElementToXHTML (const ISimpleDomTextNode TextElement, TParagraphProperties ParProps)
 convert a text element to HTML / XHTML.
 VerifySettings ()
 Verifies the current settings of the component.

Public Attributes

Boolean ConvertAnchors
 Activates support for anchor conversion.
Boolean ConvertEmptyParagraphs
 Replaces empty paragraphs with a line break tag (<br />).
Boolean ConvertHyperlinks
 Enables hyperlink support.
Boolean ConvertIndent
 Enables support for left and right paragraph indentation.
Boolean ConvertLanguage
 Activates support for language conversion.
Boolean ConvertPictures
 Enables picture conversion.
Boolean ConvertSpaces
 Converts consecutive spaces into non-breaking spaces (&nbsp;).
Boolean ConvertToPlainText
 Converts the document content to plain text.
Boolean ConvertToPreviewText
 Enables preview text conversion.
string DefaultLanguage
 Sets the default language of the document.
TDocumentType DocumentType
 Specifies the document type.
TFontConversionOptions FontConversionOptions
 Configure which character properties are converted.
TFontSizeScale FontSizeScale
 Set the font size scale.
ISxFormatter Formatter
 Provides access to the formatter used for generating the output.
IHyperlinkURIBuilder HyperlinkURIBuilder
 Provides access to the hyperlink URI builder.
Boolean IncludeDocType
 Include the DOCTYPE declaration at the beginning of the document.
Boolean IncludeXMLDeclaration
 Include the XML declaration line at the beginning of the document.
TLogLevel LogLevel
 Control the detail level of the logging procedure.
IMarginBuilding MarginBuilder
 Provides access to the margin builder.
TMarginConversionFlags MarginConversionFlags
 Configure flags for paragraph margin conversion.
TNoRTFHeaderAction NoRTFHeaderAction
 Define the action to take for missing or invalid RTF headers.
TSxOptionsHead OptionsHead
 Configure HTML HEAD options.
TSxOptionsOptimize OptionsOptimize
 Configure optimization options for the document.
string ParagraphElementAttributes
 Specify optional attributes for the.
IPictureAdapter PictureAdapter
 Provides access to the picture adapter.
TPostProcessEventListeners PostProcessEventListeners
 A list of TPostProcessEventListener instances.
TStrings ReplaceFonts
 Define font names to be replaced.
Boolean RtfEnd
 Indicates whether the end of the document has been reached.
string TabString
 Define the HTML representation of a TAB character.
ISxTranslator Translator
 Provides access to the HTML/XHTML translator.
string Version
 Retrieve the ScroogeXHTML version.
TSxBase events
TEncodingEvent OnAfterEncode
 Event handler which will be called after the encoding.
TEncodingEvent OnBeforeEncode
 Event handler which will be called before the encoding.
TLogEvent OnLog
 Event handler for log messages.
TReplaceFontEvent OnReplaceFont
 This event handler can be used to define a font substition.

Protected Member Functions

 DoPostProcessing (const ISimpleDomDocument ADocument)
Boolean GetConvertToPreviewText ()

Detailed Description

The base class for ScroogeXHTML.

Constructor & Destructor Documentation

◆ TSxBase() [1/2]

TSxBase::TSxBase ( )

Creates a new instance of TSxBase.

This constructor initializes the component with default settings.

◆ TSxBase() [2/2]

TSxBase::TSxBase ( TComponent AOwner)

Creates a new instance of TSxBase with a specified owner.

Parameters
AOwnerThe owner component.

◆ ~TSxBase()

TSxBase::~TSxBase ( )

Destroys the TSxBase instance and releases all allocated resources.

Member Function Documentation

◆ DoPostProcessing()

TSxBase::DoPostProcessing ( const ISimpleDomDocument ADocument)
protected

◆ GetCloseEmptyElement()

string TSxBase::GetCloseEmptyElement ( )

Returns the closing tag for an empty HTML element.

The result depends on the document type (e.g., XHTML or HTML).

Returns
A string containing either " /&gt;" (XHTML) or "&gt;" (HTML).

◆ GetConvertToPreviewText()

Boolean TSxBase::GetConvertToPreviewText ( )
protected

Implements ISxWriterOptions.

◆ GetEmptyParagraph()

string TSxBase::GetEmptyParagraph ( )

Returns an empty paragraph element.

The result includes the opening and closing tags for a paragraph.

Returns
A string representing an empty paragraph, including any required margins.

◆ GetLineBreakTag()

string TSxBase::GetLineBreakTag ( )

Returns the line break element.

The result depends on whether plain text conversion is enabled.

Returns
A string containing either a line break tag (<br>) or a plain text line break.

◆ GetOrderedListTag()

string TSxBase::GetOrderedListTag ( )

Returns the opening tag for an ordered list.

Returns
A string containing the opening tag for an ordered list (<ol>).

◆ GetParOpen()

string TSxBase::GetParOpen ( )

Returns the opening tag for a paragraph without the closing angle bracket.

Additional attributes can be included based on the ParagraphElementAttributes property.

Returns
A string containing the opening tag for a paragraph, optionally including attributes.

◆ GetUnorderedListTag()

string TSxBase::GetUnorderedListTag ( )

Returns the opening tag for an unordered list.

Returns
A string containing the opening tag for an unordered list (<ul>).

◆ Log()

TSxBase::Log ( const TLogLevel ALogLevel,
const string ALogText )

Logs a message with the specified log level.

If a log event handler is assigned, it will be called with the provided message.

Parameters
ALogLevelThe severity level of the log message (e.g., debug, info, warning, error).
ALogTextThe text of the log message to be logged or displayed.

◆ ReplaceFont()

TSxBase::ReplaceFont ( string & FontName)

Replaces a font name with a predefined substitution.

If a font replacement event handler is assigned, it will be used instead.

Parameters
FontNameThe name of the font to be replaced. This parameter is modified in place.

◆ TextElementToXHTML()

string TSxBase::TextElementToXHTML ( const ISimpleDomTextNode TextElement,
TParagraphProperties ParProps )

convert a text element to HTML / XHTML.

This function receives a block of text and its attributes, packaged in a ISimpleDomTextNode object. It will then

◆ VerifySettings()

TSxBase::VerifySettings ( )

Verifies the current settings of the component.

Throws an exception if any property is set to an invalid value.

Exceptions
ExceptionRaised when invalid settings are detected.

Member Data Documentation

◆ ConvertAnchors

Boolean TSxBase::ConvertAnchors

Activates support for anchor conversion.

When enabled, anchors in the document will be processed and converted.

See also
FConvertAnchors For reading
FConvertAnchors For writing

◆ ConvertEmptyParagraphs

Boolean TSxBase::ConvertEmptyParagraphs

Replaces empty paragraphs with a line break tag (<br />).

Set this property to True to replace paragraphs where the opening <p> tag is immediately followed by the closing </p> tag. Default: False.

See also
FConvertEmptyParagraphs For reading
FConvertEmptyParagraphs For writing

◆ ConvertHyperlinks

Boolean TSxBase::ConvertHyperlinks

Enables hyperlink support.

Set this property to True to detect and process hyperlinks in the document. Default: True.

Note
Hyperlinks are detected if the text contains a HYPERLINK field expression.
See also
FConvertHyperlinks For reading
FConvertHyperlinks For writing

◆ ConvertIndent

Boolean TSxBase::ConvertIndent

Enables support for left and right paragraph indentation.

Set this property to True to activate indentation support. Default: False.

Note
The right indent in the output document is relative to the browser window. If the browser window size changes, the text area will adjust accordingly.
See also
FConvertIndent For reading
FConvertIndent For writing

◆ ConvertLanguage

Boolean TSxBase::ConvertLanguage

Activates support for language conversion.

When enabled, language attributes in the document will be processed and converted.

See also
GetConvertLanguage For reading
FConvertLanguage For writing

◆ ConvertPictures

Boolean TSxBase::ConvertPictures

Enables picture conversion.

Set this property to True to process and convert pictures in the document.

See also
FConvertPictures For reading
FConvertPictures For writing

◆ ConvertSpaces

Boolean TSxBase::ConvertSpaces

Converts consecutive spaces into non-breaking spaces (&nbsp;).

If two or more spaces are found in sequence, they will be replaced with &nbsp;. Default: True.

See also
FConvertSpaces For reading
FConvertSpaces For writing

◆ ConvertToPlainText

Boolean TSxBase::ConvertToPlainText

Converts the document content to plain text.

When enabled, the output will be plain text instead of HTML or XHTML.

See also
FConvertToPlainText For reading
FConvertToPlainText For writing

◆ ConvertToPreviewText

Boolean TSxBase::ConvertToPreviewText

Enables preview text conversion.

Set this property to True to convert only the first paragraph. Default: False.

See also
FConvertToPreviewText For reading
FConvertToPreviewText For writing

◆ DefaultLanguage

string TSxBase::DefaultLanguage

Sets the default language of the document.

Use this property to specify the language attribute for the document.

See also
GetDefaultLanguage For reading
FDefaultLanguage For writing

◆ DocumentType

TDocumentType TSxBase::DocumentType

Specifies the document type.

The document type determines the supported HTML/XHTML elements and parameters.

Note
Depending on the document type, some elements or parameters may not be supported.
See also
FDocumentType For reading
SetDocumentType For writing

◆ FontConversionOptions

TFontConversionOptions TSxBase::FontConversionOptions

Configure which character properties are converted.

  • opFontSize: Enables conversion of font sizes. Default: enabled.
  • opFontName: Enables conversion of font names. See also TCustomScrooge::ReplaceFonts. Default: enabled.
  • opFontStyle: Enables conversion of font styles (bold, italic, underlined, strikeout). Default: enabled.
  • opFontColor: Enables conversion of font colors. Default: enabled.
  • opFontBGColor: Enables conversion of background font colors. Default: enabled.
  • opFontHLColor: Enables conversion of highlight font colors. Default: enabled.
    See also
    GetFontConversionOptions For reading
    FFontConversionOptions For writing

◆ FontSizeScale

TFontSizeScale TSxBase::FontSizeScale

Set the font size scale.

Supported units:

  • point (pt): Absolute size scale.
  • em: Relative size scale.
  • ex: Relative size scale.
  • percent: Relative size scale.
    See also
    FFontSizeScale For reading
    FFontSizeScale For writing

◆ Formatter

ISxFormatter TSxBase::Formatter

Provides access to the formatter used for generating the output.

See also
FFormatter For reading

The formatter is responsible for formatting the document structure.

◆ HyperlinkURIBuilder

IHyperlinkURIBuilder TSxBase::HyperlinkURIBuilder

Provides access to the hyperlink URI builder.

See also
FHyperlinkURIBuilder For reading
SetHyperlinkURIBuilder For writing

This builder is used to construct hyperlink elements in the output.

◆ IncludeDocType

Boolean TSxBase::IncludeDocType

Include the DOCTYPE declaration at the beginning of the document.

Default: True.

Note
Some HTML browsers use this declaration to validate the document.
XHTML 1.1 always includes a DOCTYPE declaration.
See also
FIncludeDocType For reading
FIncludeDocType For writing

◆ IncludeXMLDeclaration

Boolean TSxBase::IncludeXMLDeclaration

Include the XML declaration line at the beginning of the document.

Default: False. Example:

* <?xml version="1.0"?>
* 
Note
The default encoding for documents with this declaration is UTF-8.
See also
FIncludeXMLDeclaration For reading
FIncludeXMLDeclaration For writing

◆ LogLevel

TLogLevel TSxBase::LogLevel

Control the detail level of the logging procedure.

Default: logInfo.

See also
FLogLevel For reading
FLogLevel For writing

◆ MarginBuilder

IMarginBuilding TSxBase::MarginBuilder

Provides access to the margin builder.

See also
FMarginBuilder For reading

The margin builder is used to calculate and apply margins to the document.

◆ MarginConversionFlags

TMarginConversionFlags TSxBase::MarginConversionFlags

Configure flags for paragraph margin conversion.

See also
FMarginConversionFlags For reading
FMarginConversionFlags For writing

◆ NoRTFHeaderAction

TNoRTFHeaderAction TSxBase::NoRTFHeaderAction

Define the action to take for missing or invalid RTF headers.

See also
FNoRTFHeaderAction For reading
FNoRTFHeaderAction For writing

◆ OnAfterEncode

TEncodingEvent TSxBase::OnAfterEncode

Event handler which will be called after the encoding.

See also
FOnAfterEncode For reading
FOnAfterEncode For writing

◆ OnBeforeEncode

TEncodingEvent TSxBase::OnBeforeEncode

Event handler which will be called before the encoding.

See also
FOnBeforeEncode For reading
FOnBeforeEncode For writing

◆ OnLog

TLogEvent TSxBase::OnLog

Event handler for log messages.

See also
LogLevel
FOnLog For reading
FOnLog For writing

◆ OnReplaceFont

TReplaceFontEvent TSxBase::OnReplaceFont

This event handler can be used to define a font substition.

See also
FOnReplaceFont For reading
FOnReplaceFont For writing

◆ OptionsHead

TSxOptionsHead TSxBase::OptionsHead

Configure HTML HEAD options.

See also
FOptionsHead For reading
SetOptionsHead For writing

◆ OptionsOptimize

TSxOptionsOptimize TSxBase::OptionsOptimize

Configure optimization options for the document.

See also
GetOptionsOptimize For reading
SetOptionsOptimize For writing

◆ ParagraphElementAttributes

string TSxBase::ParagraphElementAttributes

Specify optional attributes for the.

element. Example: ParagraphAttributes := 'class="myclass"'.

See also
FParagraphElementAttributes For reading
FParagraphElementAttributes For writing

◆ PictureAdapter

IPictureAdapter TSxBase::PictureAdapter

Provides access to the picture adapter.

See also
GetPictureAdapter For reading
FPictureAdapter For writing

The picture adapter is responsible for handling image conversions and embedding.

◆ PostProcessEventListeners

TPostProcessEventListeners TSxBase::PostProcessEventListeners

A list of TPostProcessEventListener instances.

The converter will TPostProcessEventListener instance PostProcess methods, passing a internal DOM representation of the document, which may be modified before it is written to the actual result HTML.

See also
FPostProcessEventListeners For reading

◆ ReplaceFonts

TStrings TSxBase::ReplaceFonts

Define font names to be replaced.

Example: ReplaceFonts.Add('Arial=Arial,sans-serif').

See also
FReplaceFonts For reading
SetReplaceFonts For writing

◆ RtfEnd

Boolean TSxBase::RtfEnd

Indicates whether the end of the document has been reached.

See also
FRtfEnd For reading
FRtfEnd For writing

True if the document has ended, otherwise False.

◆ TabString

string TSxBase::TabString

Define the HTML representation of a TAB character.

See also
GetTabString For reading
FTabString For writing

◆ Translator

ISxTranslator TSxBase::Translator

Provides access to the HTML/XHTML translator.

See also
FTranslator For reading

The translator is responsible for converting the document content into the desired format.

Note
To change the translator, use the DocumentType property.

◆ Version

string TSxBase::Version

Retrieve the ScroogeXHTML version.

See also
False For reading