Biblioteka ScriptForge

Přistup k tutomu přikazej …

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


Biblioteki ScriptForge rozšěrjomnu zběrku skriptowych resursow makrow za LibreOffice tworja, zo bychu so přez makra Basic abo skripty Python wuwołali.

note

• Makra Basic sej wužaduja, zo so biblioteka ScriptForge z pomocu slědowaceho přikaza začituje:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Skripty Python sej import z modula scriptforge wužaduja:
from scriptforge import CreateScriptService


tip

Zo byšće wjace wo tym zhonił, kak móžeće skripty Python z pomocu biblioteki ScriptForge wutworić a wuwjesć, čitajće stronu pomocy Skripty Python ze ScriptForge wutworić.


Słužby ScriptForge wuwołać

Wopisane module a klasy so přez wužiwarske skripty jako „Słužby“ wuwołuja. Powšitkowny konstruktor tutych słužbow je so za tón zaměr z kóždu rěč naćisnył.

Metoda Dispose je we wšěch słužbach k dispoziciji a měła so wołać, zo by resursy po wužiwanju wuswobodźiła:

W Basic

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

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

Słužby, kotrež so přez biblioteku ScriptForge k dispoziciji stajeja

Kategorija

Słužby

LibreOffice Basic

Array
Dictionary

Exception
FileSystem

String
TextStream

Dokumentowy wobsah

Base
Calc
Chart

Database
Dataset
Datasheet

Document
FormDocument
Writer

Wužiwarski powjerch

Dialog
DialogControl
Form

FormControl
Menu
PopupMenu

Toolbar
ToolbarButton
UI

Nastroje

Basic
L10N
Platform

Region
Services
Session

Timer
UnitTest


Słužba ScriptForge.Array

Skići zběrku metodow za manipulaciju a přetworjenje matriksow z jednej dimensiju (wektory) a matriksy z dwěmaj dimensijomaj (matriksy). To operacije set, sortěrowanje, importowanje z a eksportowanje do tekstowych datajow wopřijima.

Matriksy z wjace hač dwěmaj dimensijomaj njedadźa so z metodami w tutej słužbje wužiwać, jeničke wuwzaće je metoda CountDims, kotraž matriksy z někajkejžkuli ličbu dimensijow akceptuje.

Słužba SFDocuments.Base

Słužba Base rjad metodow a kajkosćow skići, kotrež rjadowanje dokumentow LibreOffice Base a wobchadźenje z nimi wosnadnjeja.

Tuta słužba je wusko ze słužbu Document zwjazana, kotraž generiske metody za wobchadźenje z dokumentami LibreOffice skići, inkluziwnje dokumenty Base. Tohodla słužba Base słužbu Document rozšěrja a skićo přidatne metody, kotrež su specifiske za dokumenty Base a wužiwarjam zmóžnjeja:

Słužba ScriptForge.Basic

Słužba ScriptForge.Basic zběrku metodow LibreOffice Basic namjetuje, kotrež so maja w konteksće Python wuwjesć. Metody słužby Basic eksaktnu syntaksu a zadźerženje zatwarjenych funkcijow Basic reprodukuja.

Słužba SFDocuments.Calc

Zhromadnje wužita biblioteka SFDocuments rjad metodow a kajkosćow skići, kotrež rjadowanje dokumentow LibreOffice a wobchadźenje z nimi wosnadnjeja.

Słužba SFDocuments.Calc je podklasa słužby SFDocuments.Document. Ke wšěm metodam a kajkosćam, kotrež so za słužbu Document definuja, maće z pomocu słužboweje instancy Calc přistup.

Słužba Calc koncentruje so na:

Słužba SFDocuments.Chart

Słužba Chart sadźbu kajkosćow a metodow za wobchadźenje z diagramami w dokumentach Calc skići. Z tutej słužbu je móžno:

Słužba SFDatabases.Database

Słužba Database přistup k datowym bankam skići, kotrež su pak zasadźene pak w dokumentach Base wopisane. Tuta słužba metody skići, kotrež:

Słužba SFDatabases.Dataset

Słužba Dataset so wužiwa, zo by tabelariske daty reprezentowała, kotrež su so přez datowu banku wutworili. Z tutej słužbu je móžno:

Słužba SFDatabases.Datasheet

Słužba Datasheet zmóžnja, wobsah tabelow datoweje banki kaž tež wuslědki wotprašowanjow a SQL-přikazy z pomocu datoweho napohlada Base wizualizować. Nimo toho tuta słužba zmóžnja:

Słužba SFDialogs.Dialog

Słužba Dialog k rjadowanju dialogow přinošuje, kotrež su so přez dialogowy editor Basic wutworili abo přez dialogi, kotrež su so nimoducy wutworili. Kóžda instanca aktualneje klasy jednotliwy dialogowe polo reprezentuje, kotrež so wužiwarjej pokazuje.

Słužba SFDialogs.DialogControl

Słužba DialogControl wodźenske elementy rjaduje, kotrež k dialogej słušeja, kotryž so z dialogowym editorom Basic definuje. Kóžda instanca aktualneje słužby jednotliwy wodźenski element w dialogowym polu reprezentuje.

Fokus na wotwołowanje a nastajenje hódnotow leži, kotrež so přez wodźenske elementy dialogoweho pola pokazuja. Formatěrowanje je přistupne přez kajkosći XControlModel a XControlView.

Dźiwajće na to, zo wobsah jónkróćneje kajkosće DialogControl.Value po wobsahowym typje wariěruje.

Wosebita kedźbnosć so na wodźenske elementy typa štom złožuje. Je lochko, štom pjelnić, pak hałuzu po hałuzy pak ze sadźbu hałuzow naraz. Pjelnjenje štomoweho wodźenskeho elementa da so statisce abo dynamisce wuwjesć.

Słužba ScriptForge.Dictionary

Słownik je zběrka porow klučowych zapiskow.

Słužba SFDocuments.Document

Biblioteka SFDocuments metody a kajkosće skići, kotrež rjadowanje a wobdźěłowanje dokumentow LibreOffice wosnadnić.

Metody, kotrež su na wšě typy dokumentow (tekstowe dokumenty, tabelowe dokumenty, prezentacije atd.) nałožujomne, kotrež słužba SFDocuments.Document k dispoziciji staja. Někotre přikłady su:

Słužba ScriptForge.Exception

Słužba Exception je zběrka metodow, kotrež při pytanju za zmylkami w kodźe skriptow Basic a Python a při wobchadźenju ze zmylkami w skriptach Basic pomhaja.

Hdyž w skriptach Basic wuwjedźenskočasowy zmylk nastawa, pomhaja metody a kajkosće słužby Exception zmylkowy kontekst identifikować a dowolić, z nim wobchadźeć.

Słužba ScriptForge.FileSystem

Słužba FileSystem rutiny za wobchadźenje z datajemi a rjadowakami wobsahuje. Potom su někotre přikłady podate, kotrež tuta słužba skići:

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

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:

SFDocuments.FormDocument service

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

In a Base document, existing form documents can be viewed by selecting View - Forms in the user interface. Each form document may be composed of one or more forms, including the main form and other sub-forms.

ScriptForge.L10N service

This service provides a number of methods related to the translation of strings with minimal impact on the program's source code. The methods provided by the L10N service can be used mainly to:

SFWidgets.Menu service

The Menu service can be used to create and remove menus from the menubar of a LibreOffice 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.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

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:

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.

Kedźbu: Druhe njewopisane module ScriptForge su za interne wužiwanje wuměnjene. Jich wobsah da so bjez zdźělenki změnić.

warning

Wšě rutiny Basic ScriptForge abo identifikatory, kotrež so z podsmužku „_“ započinaja, su za interne wužiwanje wuměnjene. Njejsu za to myslene, so w makrach Basic abo skriptach Python wužiwać.


Prošu podpěrajće nas!