Η βιβλιοθήκη ScriptForge

Για να έχετε πρόσβαση σε αυτήν τη λειτουργία...

Ανοίξτε Εργαλεία - Μακροεντολές - LibreOffice Basic - Επεξεργασία και επιλέξτε τον περιέκτη Μακροεντολές LibreOffice.


Οι βιβλιοθήκες ScriptForge δημιουργούν μια επεκτάσιμη συλλογή πόρων δέσμης ενεργειών μακροεντολών για το LibreOffice που θα κληθεί από μακροεντολές Basic ή σενάρια Python.

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 Creating Python Scripts with ScriptForge help page.


Οι περιγραφόμενες μονάδες και κλάσεις καλούνται από τα σενάρια χρήστη ως "Υπηρεσίες". Ένας γενικός κατασκευαστής αυτών των υπηρεσιών έχει σχεδιαστεί για αυτόν τον σκοπό για κάθε γλώσσα:


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

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

Ηβιβλιοθήκη Basic ScriptForge είναι διαθέσιμη από το LibreOffice 7.1 και μετά. Η λειτουργική μονάδα
Python scriptforge είναι διαθέσιμη από το LibreOffice 7.2 και μετά.


Υπηρεσίες που παρέχονται από τη βιβλιοθήκη ScriptForge

Κατηγορία

Υπηρεσίες

LibreOffice Basic

Array
Dictionary
Exception

FileSystem
String
TextStream

Περιεχόμενο εγγράφου

Base
Calc

Database
Document

Διεπαφή χρήστη

Dialog
DialogControl
UI

Form
FormControl

Βοηθητικά προγράμματα

Basic
L10N
Platform

Services
Session
Timer


ScriptForge.Υπηρεσία Πίνακας

Παρέχει μια συλλογή μεθόδων για το χειρισμό και τον μετασχηματισμό πινάκων μιας διάστασης (διανύσματα) και πινάκων δύο διαστάσεων (μήτρες). Αυτό περιλαμβάνει λειτουργίες συνόλου, ταξινόμηση, εισαγωγή και εξαγωγή από αρχεία κειμένου.

Πίνακες με περισσότερες από δύο διαστάσεις δεν μπορούν να χρησιμοποιηθούν με τις μεθόδους αυτής της υπηρεσίας, η μόνη εξαίρεση είναι η μέθοδος CountDims που δέχεται Πίνακες με οποιονδήποτε αριθμό διαστάσεων.

SFDocuments.Υπηρεσία Base

Η υπηρεσία Base παρέχει έναν αριθμό μεθόδων και ιδιοτήτων για τη διευκόλυνση της διαχείρισης και του χειρισμού των εγγράφων της Base του LibreOffice.

Αυτή η υπηρεσία σχετίζεται στενά με την υπηρεσία Document, η οποία παρέχει γενικές μεθόδους για το χειρισμό εγγράφων του LibreOffice, συμπεριλαμβανομένων των εγγράφων Base. Ως εκ τούτου, η υπηρεσία Base επεκτείνει την υπηρεσία Document και παρέχει πρόσθετες μεθόδους που είναι ειδικές για έγγραφα Base, επιτρέποντας στους χρήστες να:

note

Αυτή η υπηρεσία είναι διαθέσιμη από το LibreOffice 7.2 και μετά.


Υπηρεσία ScriptForge.Basic

Η υπηρεσία ScriptForge.Basic προτείνει μια συλλογή μεθόδων του LibreOffice Basic που θα εκτελεστούν σε περιβάλλον Python. Οι μέθοδοι υπηρεσίας Basic αναπαράγουν την ακριβή σύνταξη και συμπεριφορά των ενσωματωμένων συναρτήσεων Basic.

note

Αυτή η υπηρεσία είναι διαθέσιμη από το LibreOffice 7.2 και μετά.


Υπηρεσία SFDocuments.Calc

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 Document service, whereas other methods are specific for the SF_Calc module.

The SF_Calc module is focused on:

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

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

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:

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:

ScriptForge.Platform service

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

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 LibreOffice

  2. a number of "associated" libraries shipped with LibreOffice 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:

Σημείωση: Άλλες μη περιγραφόμενες λειτουργικές μονάδες ScriptForge προορίζονται για εσωτερική χρήση. Το περιεχόμενό τους υπόκειται σε αλλαγές χωρίς προειδοποίηση.

warning

Όλες οι ScriptForge ρουτίνες Basic ή αναγνωριστικά που έχουν το πρόθεμα χαρακτήρα υπογράμμισης "_" δεσμεύονται για εσωτερική χρήση. Δεν προορίζεται να χρησιμοποιηθούν σε μακροεντολές Basic.