A ScriptForge programkönyvtár

Ennek a parancsnak az eléréséhez...

Open Tools - Macros - LibreOffice Basic - Edit and select Application Macros container.


A ScriptForge könyvtárak a Basic makrókból vagy Python parancsfájlokból meghívható LibreOffice makro parancsfájlok bővíthető gyűjteményét alkotják.

note

• Basic macros require to load ScriptForge library using the following statement:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Python scripts require an import from scriptforge module:
from scriptforge import CreateScriptService


tip

To learn more about how to create and execute Python scripts using the ScriptForge library, read the help page Creating Python Scripts with ScriptForge.


Invoking ScriptForge services

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

The Dispose method is available in all services and should be called to free up resources after usage:

A Basic nyelvben

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

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

Services provided by the ScriptForge library

Kategória

Szolgáltatások

LibreOffice Basic

Array
Dictionary

Exception
FileSystem

String
TextStream

Dokumentumtartalom

Base
Calc
Chart

Database
Dataset
Datasheet

Document
FormDocument
Writer

Felhasználói felület

Dialog
DialogControl
Form

FormControl
Menu
PopupMenu

Toolbar
ToolbarButton
UI

Utilities

Basic
L10N
Platform

Region
Services
Session

Timer
UnitTest


ScriptForge.Array service

Egydimenziós (vektorok) és kétdimenziós (mátrixok) tömbök manipulálására és transzformálására szolgáló módszerek gyűjteménye. Ez magában foglalja a halmazműveleteket, a rendezést, a szöveges fájlokból való importálást és a szöveges fájlba való exportálást.

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.Base service

The Base service provides a number of methods and properties to facilitate the management and handling of LibreOffice Base documents.

Ez a szolgáltatás szorosan kapcsolódik a Document szolgáltatáshoz, amely általános módszereket biztosít a LibreOffice dokumentumok kezeléséhez, beleértve a Base dokumentumokat is. Ezért a Base szolgáltatás kibővíti a Document szolgáltatást, és további, a Base dokumentumokra jellemző metódusokat biztosít, lehetővé téve a felhasználók számára, hogy:

ScriptForge.Basic service

The ScriptForge.Basic service proposes a collection of LibreOffice Basic methods to be executed in a Python context. Basic service methods reproduce the exact syntax and behaviour of Basic builtin functions.

SFDocuments.Calc service

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

The SFDocuments.Calc service is a subclass of the SFDocuments.Document service. All methods and properties defined for the Document service can also be accessed using a Calc service instance.

The Calc service is focused on:

SFDocuments.Chart service

The Chart service provides a set of properties and methods to handle charts in Calc documents. With this service it is possible to:

SFDatabases.Database service

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

SFDatabases.Dataset service

The Dataset service is used to represent tabular data produced by a database. With this service it is possible to:

SFDatabases.Datasheet service

The Datasheet service allows to visualize the contents of database tables as well as the results of queries and SQL statements using Base's Data View. Additionally, this service allows to:

SFDialogs.Dialog service

The Dialog service contributes to the management of dialogs created with the Basic Dialog Editor or dialogs created on-the-fly. 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.

Különös figyelmet fordítunk a fa vezérlőelemekre. Egy fát könnyen fel lehet tölteni, akár áganként, akár egyszerre több ággal. A fa vezérlőelem feltöltése történhet statikusan vagy dinamikusan.

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

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

SFDocuments.Form service

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

SFDocuments.FormControl service

A FormControl szolgáltatás hozzáférést biztosít egy űrlaphoz, alűrlaphoz vagy a FormDocument táblázatvezérlőhöz tartozó vezérlőkhöz. A FormControl szolgáltatás minden egyes példánya az űrlap egyetlen vezérlőelemére utal. Ez a szolgáltatás lehetővé teszi a felhasználók számára, hogy:

SFDocuments.FormDocument service

The FormDocument service allows to access form documents stored in LibreOffice Base documents.

Egy Base dokumentumban a meglévő űrlapdokumentumok a felhasználói felületen a Nézet - Űrlapok menüpont kiválasztásával tekinthetők meg. Minden űrlapdokumentum egy vagy több űrlapból állhat, beleértve a fő űrlapot és más alűrlapokat.

ScriptForge.L10N service

Ez a szolgáltatás számos módszert kínál a karakterláncok fordításához kapcsolódóan, a program forráskódját minimálisan befolyásolva. A L10N szolgáltatás által biztosított módszerek elsősorban a következőkre használhatók:

SFWidgets.Menu service

A Menu szolgáltatással menük hozhatók létre és távolíthatók el a LibreOffice dokumentumablak menüsorából. Minden egyes menübejegyzés egy parancsfájlhoz vagy egy UNO-parancshoz társítható. Ez a szolgáltatás a következő képességeket biztosítja:

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.Region service

The Region service provides a collection of properties and methods to handle locale and region-related aspects of programming, such as:

ScriptForge.Services service

A Services modul fő célja, hogy hozzáférést biztosítson a CreateScriptService metódushoz, amely a felhasználói parancsfájlokban meghívható a ScriptForge keretrendszerrel megvalósított szolgáltatáspéldányok létrehozására.

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:

SFWidgets.Toolbar service

The Toolbar service allows to retrieve information related to the toolbars available for a specific document window. With this service it is possible to:

SFWidgets.ToolbarButton service

The ToolbarButton service allows to retrieve information related to the toolbar buttons available in a given toolbar. With this service it is possible to:

ScriptForge.UI service

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

SFUnitTests.UnitTest service

The UnitTest service provides a framework for automating unit tests using the Basic language, including the ability to:

SFDocuments.Writer service

The SFDocuments shared library provides a number of methods and properties to facilitate the management and handling of LibreOffice 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.

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 or Python scripts.


Támogasson minket!