Зміст
Покажчик 🔎︎

# HTML Filters and Forms

You can use all control elements and form events in HTML documents. There have been numerous events to date (for example, focus events), which have not been changed. They will continue to be imported and exported as ONFOCUS, ONBLUR, and so on for JavaScript and as SDONFOCUS, SDONBLUR, and so on for LibreOffice Basic.

Generic names that consist of the Listener interface and the method name of the event are used for all other events: An event registered as XListener::method is exported as

SDEvent-XListener-method = "/* event-code */"

Note that the XListener- and method components of this option are case sensitive.

Event handling of controls is performed using the LibreOffice API. If you assign an event to a control, an object registers itself internally as a "Listener" for a specific control event. To do this, the object must use a specific interface, for example the XFocusListener Interface, so that it can react to focus events. When the event occurs, the control then invokes a special method of the Listener interface when the control receives the focus. The internally registered object then invokes the JavaScript or LibreOffice Basic code, which was assigned to the event.

The HTML filter now uses precisely these listener interfaces and method names so that it can import and export events as desired. You can register a focus event through

<INPUT TYPE=text ONFOCUS="/* code */"

rather than through the

<INPUT TYPE=text SDEvent-XFocusListener-focusGained="/* code */"

register. Events can therefore be registered as desired, including those not offered in the list boxes. To define the script language of events, you can write the following line in the document header:

<META HTTP-EQUIV="content-script-type" CONTENT="...">

As CONTENT you can, for example, use "text/x-StarBasic" for LibreOffice Basic or a "text/JavaScript" for JavaScript. If no entry is made, JavaScript is assumed.

During exporting, the default script language will be defined based on the first module found in macro management. For events, only one language can be used per document.