De ScriptForge bibliotheek

Om toegang te krijgen tot deze functie..

Open Extra - Macro's - LibreOfficeDev Basic - Bewerken en selecteer Toepassingsmacro's.


ScriptForge bibliotheken zijn een uitbreidbare collectie van macro-scripts voor LibreOfficeDev die aangeroepen kunnen worden door Basic-macro's en Python-scripts.

note

• Basic macro's kunnen de bibliotheek ScriptForge laden met de instructie:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Python scripts kunnen de module scriptforge importeren met:
from scriptforge import CreateScriptService


tip

Lees, voor een uitleg hoe een Python-script te maken en uit te voeren met gebruik van de ScriptForge bibliotheek, de help-pagina.


ScriptForge services activeren

De beschreven modules en klassen worden geactiveerd door gebruikersscripts als "Services". Voor dit doel is er voor elke taal een algemene "constructor" ontworpen.

In elke service is er een methode Dispose waarmee na het gebruik van de service de gebruikte bronnen vrij gegeven kunnen worden:

In BASIC

    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
    Set oSvc = CreateScriptService("servicename"[, arg0, arg1, ...])
    ' ...
    oSvc.Dispose()
  
In Python

    from scriptforge import CreateScriptService
    svc = CreateScriptService('servicename'[, arg0, arg1, ...])
    # ...
    svc.Dispose()
  

Services beschikbaar in de ScriptForge-bibliotheek

Categorie

Services

LibreOfficeDev BASIC

Array
Dictionary

Exception
FileSystem

String
TextStream

Documentinhoud

Base
Calc

Chart
Database

Document
Writer

Gebruikersinterface

Dialog
DialogControl
Form

FormControl
Menu

PopupMenu
UI

Hulpprogramma's

Basic
L10N

Platform
Services

Session
Timer


ScriptForge.Array service

Geeft methoden voor het manipuleren en omzetten van eendimensionale matrixen (vectoren) en tweedimensionale matrixen. Dit is inclusief het zetten, sorteren, importeren uit en exporteren naar tekstbestanden.

Voor matrixen met meer dan twee dimensies kunnen deze methoden niet worden gebruikt, hierop is één uitzondering, de methode CountDims.

SFDocuments.Base service

De service Base heeft een aantal methoden en eigenschappen voor het ondersteunen van het beheren en werken met LibreOfficeDev Base-documenten.

Deze service is sterk gerelateerd aan de service Document, die generieke methoden bevat door het werken met LibreOfficeDev documenten, inclusief Base-documenten. Deze service Base is dus eigenlijk een uitbreiding op de service Document en geeft aanvullende methoden die specifiek zijn voor Base-documenten, waarmee gebruiken kunnen:

ScriptForge.Basic service

De service ScriptForge.Basic bevat een aantal LibreOfficeDev Basic methoden die vanuit Python uitgevoerd kunnen worden. De methoden in de service Basic gebruiken dezelfde syntaxis en doen hetzelfde als de ingebouwde Basic-functies.

SFDocuments.Calc service

De gedeelde bibliotheek SFDocuments biedt een aantal methoden en eigenschappen om het beheer en de verwerking van LibreOfficeDev-documenten te vergemakkelijken.

De service SFDocuments.Calc is een subklasse van de service SFDocuments.Document. Alle methoden en eigenschappen die gedefinieerd zijn voor de service Document kunnen ook benaderd worden via een instantie van de service Calc.

De service Calc is gericht op:

SFDocuments.Chart service

De service Chart heeft een aantal eigenschappen en methoden voor het werken met diagrammen in Calc.Met deze methode is het mogelijk om:

SFDatabases.Database service

The Database service provides access to databases either embedded or described in Base documents. This service provides methods to:

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 the unique DialogControl.Value property content varies according to the control type.

A special attention is given to controls of type tree control. It is easy to populate a tree, either branch by branch, or with a set of branches at once. Populating a tree control can be performed statically or dynamically.

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 to assist in code debugging in Basic and Python scripts and in error handling in Basic scripts.

In Basic scripts, when a run-time error occurs, the methods and properties of the Exception service help identify the error context and allow to handle it.

ScriptForge.FileSystem service

De service FileSystem bevat routines om met bestanden en mappen te werken. Enkele voorbeelden van de functies in deze service:

SFDocuments.Form service

The Form service provides methods and properties to manage forms in LibreOfficeDev documents. This service supports forms in Base, Calc and Writer documents and allows to:

SFDocuments.FormControl service

The FormControl service provides access to the controls that belong to a form, a subform or a table control of a FormDocument. Each instance of the FormControl service refers to a single control in the form. This service allows users to:

Service ScriptForge.L10N

De service bevat een aantal methoden gerelateerd met de vertaling van teksten van de applicatie en zou geen gevolgen moeten hebben voor de werking van de applicatie. De methoden in de service L10N worden hoofdzakelijk gebruikt voor:

SFWidgets.Menu service

The Menu service can be used to create and remove menus from the menubar of a LibreOfficeDev document window. Each menu entry can be associated with a script or with a UNO command. This service provides the following capabilities:

ScriptForge.Platform service

The Platform service provides a collection of properties about the current execution environment and context, such as:

SFWidgets.PopupMenu service

The PopupMenu service can be used to create popup menus that can be associated with events or executed by scripts. This service provides the following capabilities:

ScriptForge.Services service

The main purpose of the Services module is to provide access to the CreateScriptService method, which can be called in user scripts to instantiate services that are implemented using the ScriptForge 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 LibreOfficeDev application:

SFDocuments.Writer service

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

Some methods are generic for all types of documents and are inherited from the SF_Document module, whereas other methods that are specific for Writer documents are defined in the SF_Writer module.

NB: Overige ScriptForge-modules die hier niet beschreven zijn, dienen voor intern gebruik door ScriptForge. Deze modules kunnen zonder kennisgeving worden gewijzigd.

warning

Alle ScriptForge Basic-routines of variabelen die beginnen met een underscore "_" zijn voor intern gebruik. Gebruik deze niet in een Basic of Python-macro.