diff --git a/source/text/sbasic/shared/03/sf_services.xhp b/source/text/sbasic/shared/03/sf_services.xhp
new file mode 100644
index 0000000000..3dc040187c
--- /dev/null
+++ b/source/text/sbasic/shared/03/sf_services.xhp
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+ ScriptForge.Services service
+ /text/sbasic/shared/03/sf_services.xhp
+
+
+
+
+
+ Services service
+
+
+
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:
+
+
+
+ the standard ScriptForge library shipped with %PRODUCTNAME
+
+
+ a number of "associated" libraries shipped with %PRODUCTNAME as well
+
+
+ any user/contributor LibreOffice extension wanting to fit into the same framework
+
+
+
+
+A service is a collection of properties or methods which implement the service.
+For the author of a user script, a service may be either a module within a library, or an instance of a class module.
+An event manager is a script contained in a library which binds an event triggering a macro - usually defined by the menu - to the concerned service instance.
+As an example, if several documents trigger the same macro when they are loaded, it might be useful to know which document triggered the macro this time. That's where an event manager plays its role.
+
+The following methods make up the kernel of the ScriptForge framework:
+
+
+ RegisterScriptServices
+ Called internally by ScriptForge to register for a library the list of services it implements.
+ Each library associated to Scriptforge or extending it must implement its own RegisterScriptServices method.
+
+
+ RegisterService
+ Called - as many times as there are services to register in the library - by RegisterScriptServices.
+
+
+ RegisterEventManager
+ Called to register a library event manager by RegisterScriptServices.
+
+
+ CreateScriptService
+ Called by user scripts to get an object giving access to the service given as argument.
+ All services should be invoked thru the CreateScriptService method.
+
+
+Conventionally, the String, Array and Exception services may be invoked directly respectively as SF_String, SF_Array and SF_Exception.
+
+
+
+ List of Methods in the Services Service
+
+
+
+
+ CreateScriptService
+
+
+
+
+ RegisterScriptServices
+ RegisterService
+
+
+
+
+ RegisterEventManager
+
+
+
+
+
+ Gain access to one of the services of a library for the benefit of a user script.
+ The returned value is a Basic object or Nothing if an error occurred.
+
+
+ A service can be understood as either:
+
+
+
+ as a set of methods gathered in a Basic standard module
+
+
+ or a set of methods and properties gathered in a Basic class module.
+
+
+
+
+ CreateScriptService(Service As String, [arg0, ...] As Variant) As Variant
+
+
+ Service: The name of the service identified as "library.service".
+ The library is a Basic library that must exist in the GlobalScope. The default value is "ScriptForge".
+ The service is one of the services registered by the library via the RegisterScriptServices() method.
+ arg0, ...: A list of arguments required by the invoked service.
+ If the first argument refers to an event manager, then arg0 is mandatory and must be the UNO object representing the event provided as argument to the user macro.
+
+
+ GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
+ ' To be done once
+ Dim svc As Object
+ Set svc = CreateScriptService("Array")
+ ' Refers to the "ScriptForge.Array" service or SF_Array
+ Set svc = CreateScriptService("ScriptForge.Dictionary")
+ ' Returns a new empty dictionary class instance; "ScriptForge." is optional
+ Set svc = CreateScriptService("SFDocuments.Calc")
+ ' Refers to the Calc service, implemented in the associated SFDocuments library
+ Set svc = CreateScriptService("Timer", True)
+ ' Returns a Timer class instance starting immediately
+ Set svc = CreateScriptService("SFDocuments.DocumentEvent", oEvent)
+ ' Refers to the DocumentEvent service implemented in the associated SFDocuments library
+ ' Returns the instance of the Document class that fired the event
+
+
+
+
+ RegisterScriptServices ------------------------------------------------------------------------------------------------------------------------
+
+ Services service;RegisterScriptServices
+
+
RegisterScriptServices
+
+ By executing a series of invocations of RegisterService() and RegisterEventManager(), the RegisterScriptServices() method incorporates a library into the ScriptForge framework.
+ Each library pertaining to the framework must implement its own version of this method.
+
+ The method has to be stored in a standard Basic module as opposed to a class module.
+ A service is either:
+
+
+
+ a Basic standard module passed as a Basic object.
+
+
+ or a string designating the function to execute to get an instance of the service. It is in fact the function containing the New keyword of a Set statement creating the instance.
+
+
+
+ GlobalScope.LibraryName.ModuleName ' Object
+ "LibraryName.ModuleName.FunctionName" ' String
+
+
+
+
+ Public Sub RegisterScriptServices()
+ ' To be stored in library = myLibrary
+ With GlobalScope.ScriptForge.SF_Services
+ .RegisterService("myService1", GlobalScope.myLibrary.myModule)
+ ' Refer to a Basic standard module implementing the service as a set of methods
+ .RegisterService("myService2", "myLibrary.someModule.someFunction")
+ ' The function should return an instance of a Basic object class implementing the service
+ ' ...
+ End With
+ End Sub
+
+ When a user script contains a statement such as:
+ Set myServ = CreateScriptService("myLibrary.myService1")
+ ScriptForge performs these tasks:
+
+
+ load the library myLibrary when necessary
+
+
+ invoke the RegisterScriptServices method to load the list of services of myLibrary in memory
+
+
+ initialize the variable myServ with the given service
+
+
+
+
+
+ RegisterService ------------------------------------------------------------------------------------------------------------------------
+
+ Services service;RegisterService
+
+
RegisterService
+
+ The method returns True if the name-value pair given as argument could be registered successfully.
+
+
+
+ GlobalScope.ScriptForge.SF_Services.RegisterService(ServiceName As String, ServiceReference As Variant) As Boolean
+
+
+ ServiceName: The name of the service as a case-insensitive string. The name must be unique.
+ ServiceReference: A service reference is either:
+
+
+
+ With GlobalScope.ScriptForge.SF_Services
+ .RegisterService("myService1", GlobalScope.myLibrary.myModule)
+ ' Refer to a Basic standard module implementing the service as a set of methods
+ .RegisterService("myService2", "myLibrary.someModule.someFunction")
+ ' The function should return an instance of a Basic object class implementing the service
+ ' ...
+ End With
+
+
+
+
+ RegisterEventManager ------------------------------------------------------------------------------------------------------------------------
+
+ Services service;RegisterEventManager
+
+
RegisterEventManager
+
+ The method returns True if the name-value pair given as argument could be registered successfully.
+
+
+
+ GlobalScope.ScriptForge.SF_Services.RegisterEventManager(ServiceName As String, ServiceReference As String) As Boolean
+
+
+ ServiceName: The name of the service as a case-insensitive string. The name must be unique.
+ ServiceReference: A string designating the function to execute to get an instance of the service. It is in fact the function containing the New keyword of a Set statement creating the instance.:
+ "LibraryName.ModuleName.FunctionName" ' String
+
+
+ With GlobalScope.ScriptForge.SF_Services
+ .RegisterEventManager("myEventMgr", "myLibrary.someModule.someFunction")
+ ' The function should return an instance of a Basic object class implementing the service
+ ' ...
+ End With
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/text/sbasic/shared/03/sf_session.xhp b/source/text/sbasic/shared/03/sf_session.xhp
index 8c9aae2f03..e9a32de584 100644
--- a/source/text/sbasic/shared/03/sf_session.xhp
+++ b/source/text/sbasic/shared/03/sf_session.xhp
@@ -227,7 +227,7 @@
' Xray returns no value
-
+
ExecuteCalcFunction --------------------------------------------------------------------------------------------------------------------------
@@ -235,13 +235,13 @@
ExecuteCalcFunction
Execute a Calc function using its English name and based on the given arguments.
- If the arguments are arrays, the function is executed as an array function.
+ If the arguments are arrays, the function is executed as an array formula.
session.ExecuteCalcFunction(CalcFunction As String, arg0, ...) As Variant
- CalcFunction: The english name of the function to execute.
+ CalcFunction: The English name of the function to execute.arg0, ...: The arguments to provide to the called Calc function. Each argument must be either a string, a numeric value or an array of arrays combining those types.
- Dim a As Variant
- a = CreateUnoService("com.sun.star.sheet.FunctionAccess")
- MsgBox session.HasUnoProperty(a, "Wildcards")
+ Dim svc As Variant
+ svc = CreateUnoService("com.sun.star.sheet.FunctionAccess")
+ MsgBox session.HasUnoProperty(svc, "Wildcards")
-
+
OpenURLInBrowser --------------------------------------------------------------------------------------------------------------------------
@@ -343,7 +343,7 @@
session.OpenURLInBrowser("https://docs.python.org/3/library/webbrowser.html")
-
+
RunApplication --------------------------------------------------------------------------------------------------------------------------
@@ -365,7 +365,7 @@
session.RunApplication("kate", "/home/me/install.txt") ' GNU/Linux
-
+
SendMail --------------------------------------------------------------------------------------------------------------------------
@@ -393,7 +393,7 @@
)
-
+
UnoMethods --------------------------------------------------------------------------------------------------------------------------
@@ -414,7 +414,7 @@
MsgBox SF_Array.Contains(session.UnoMethods(a), "callFunction")
-
+
UnoProperties --------------------------------------------------------------------------------------------------------------------------
@@ -430,12 +430,12 @@
UnoObject: The object to inspect.
- Dim a As Variant
- a = CreateUnoService("com.sun.star.sheet.FunctionAccess")
- MsgBox SF_Array.Contains(session.UnoProperties(a), "Wildcards")
+ Dim svc As Variant
+ svc = CreateUnoService("com.sun.star.sheet.FunctionAccess")
+ MsgBox SF_Array.Contains(session.UnoProperties(svc), "Wildcards")
-
+
UnoObjectType --------------------------------------------------------------------------------------------------------------------------
@@ -451,11 +451,11 @@
UnoObject: The object to identify.
- Dim a As Variant, s As String
- a = CreateUnoService("com.sun.star.system.SystemShellExecute")
- s = session.UnoObjectType(a) ' "com.sun.star.comp.system.SystemShellExecute"
- a = CreateUnoStruct("com.sun.star.beans.Property")
- s = session.UnoObjectType(a) ' "com.sun.star.beans.Property"
+ Dim svc As Variant, txt As String
+ svc = CreateUnoService("com.sun.star.system.SystemShellExecute")
+ txt = session.UnoObjectType(svc) ' "com.sun.star.comp.system.SystemShellExecute"
+ svc = CreateUnoStruct("com.sun.star.beans.Property")
+ txt = session.UnoObjectType(svc) ' "com.sun.star.beans.Property"
@@ -482,8 +482,10 @@
-
+
+
+