The ScriptForge Library

To access this command...

Open Tools - Macros - LibreOfficeDev Basic - Edit and select LibreOfficeDev Macros container.


note

This library must be loaded before execution. Execute the following statement before running any macro that uses this library:
GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")


The described modules and classes are invoked from user scripts as "Services". A generic constructor of those services has been designed for that purpose:


      CreateScriptService("servicename"[, arg0, Arg1, ...])
    

Services from external libraries can be registered with the RegisterScriptServices(...) method in order to extend the set of available services.

note

The ScriptForge Basic library is available from LibreOfficeDev 7.1 onwards.


Services provided by the ScriptForge library

Category

Services

LibreOffice Basic

Array
Dictionary
Exception

FileSystem
String
TextStream

Document Content

Calc
Database
Document

User Interface

Dialog
DialogControl
UI

Utilities

Localization
Platform
Services

Session
Timer


ScriptForge.Array service

Provides a collection of methods for manipulating and transforming arrays of one dimension (vectors) and arrays of two dimensions (matrices). This includes set operations, sorting, importing to and exporting from text files.

Arrays with more than two dimensions cannot be used with the methods in this service, the only exception being the CountDims method that accepts Arrays with any number of dimensions.

SFDocuments.Calc service

The SFDocuments library provides a number of methods and properties to facilitate the management and handling of LibreOffice Calc documents.

Some methods are generic for all types of documents and are inherited from the SF_Document service, whereas other methods are specific for the SF_Calc module.

The SF_Calc module is focused on:

Database

SFDialogs.Dialog service

The Dialog service contributes to the management of dialogs created with the Basic Dialog Editor. Each instance of the current class represents a single dialog box displayed to the user.

SFDialogs.DialogControl service

The DialogControl service manages the controls belonging to a dialog defined with the Basic Dialog Editor. Each instance of the current service represents a single control within a dialog box.

The focus is set on getting and setting the values displayed by the controls of the dialog box. Formatting is accessible via the XControlModel and XControlView properties.

Note that DialogControl.Value property content varies according to UNO control types.

ScriptForge.Dictionary service

A dictionary is a collection of key-item pairs

SFDocuments.Document service

The SFDocuments library provides methods and properties to facilitate the management and manipulation of LibreOffice documents.

Methods that are applicable for all types of documents (Text Documents, Sheets, Presentations, etc) are provided by the SFDocuments.Document service. Some examples are:

ScriptForge.Exception service

The Exception service is a collection of methods for Basic code debugging and error handling.

In the advent of a run-time error, the Exception service properties and methods help identify the error context and permit to handle it.

ScriptForge.FileSystem service

The FileSystem service includes routines to handle files and folders. Next are some examples of the features provided by this service:

Localization (L10N)

Platform

ScriptForge.Services service

The ScriptForge library is built upon an extensible collection of so-called "Services".
This collection is implemented as categories of Basic libraries or Python modules:

  1. the standard ScriptForge library shipped with LibreOfficeDev

  2. a number of "associated" libraries shipped with LibreOfficeDev as well

  3. any user/contributor LibreOffice extension wanting to fit into the same framework

ScriptForge.Session service

The Session service gathers various general-purpose methods about:

ScriptForge.String service

The String service provides a collection of methods for string processing. These methods can be used to:

ScriptForge.TextStream service

The TextStream service is used to sequentially read from and write to files opened or created using the ScriptForge.FileSystem service.

The methods OpenTextFile and CreateTextFile from the FileSystem service return an instance of the TextStream service.

ScriptForge.Timer service

The Timer service measures the amount of time it takes to run user scripts.

A Timer measures durations. It can be:

ScriptForge.UI service

The UI (User Interface) service simplifies the identification and the manipulation of the different windows composing the whole LibreOffice application:

Note: Other ScriptForge undescribed modules are reserved for internal use. Their content is subject to change without notice.

warning

All ScriptForge Basic routines or identifiers that are prefixed with an underscore character "_" are reserved for internal use. They are not meant be used in Basic macros.


Please support us!