diff options
| author | Jean-Pierre Ledure <jp@ledure.be> | 2026-03-18 15:50:51 +0100 |
|---|---|---|
| committer | Jean-Pierre Ledure <jp@ledure.be> | 2026-03-19 10:12:38 +0100 |
| commit | 710433d5a6cb5b0b7d4639fe6b214bb9c10df01f (patch) | |
| tree | 9408558b45d189327ce9156d97870bd85f8369e6 /icon-themes/oxygen/cmd/sc_fontworksameletterheights.png | |
| parent | c4a26bd04c9d6d1c3075a2a936200e6c27424dda (diff) | |
ScriptForge (Array Map(), Filter(), Reduce()
New methods in the 'array' service:
- Map(module, method, array, Args) -> outarray
Executes the method for each item
in array and accumulates the results
in outarray.
- Filter(module, method, array, Args) -> outarray
outarray contains all the items of
the input array for which the method
has returned True
- Reduce(module, method, array, initialvalue) -> scalar
At each iteration, the partial result
is passed as 1st argument of the next
iteration.
Module = any Basic module, any Basic class instance,
any ScriptForge service instance
Method = given as a string
may be a method or a property
when module is a SF object
Above mzthods allow the programmer to write
simpler, shorter code, without neccessarily
needing to bother about intricacies
like loops, branching and error handling.
Examples:
Let's assume:
ar = CreateScriptService("array")
fs = CreateScriptService("filesystem")
st = CreateScriptService("string")
ui = CreateScriptService("UI")
Open read-only all Calc docs stored in a folder
folder = "C:\MyFolder"
ar.Map(ui, "OpenDocument", fs.Files(folder, filter := "*.ods"), "", True)
Minimize all active Writer docs
ar.Map(ui, "Minimize", ar.Filter(st, "EndsWith", _
ui.Documents(), ".odt"))
Designed for Basic user scripts only.
The user documentation should include those
new functions.
In addition:
- some changes done in Session for more
flexibility in script provider handling
- identification of SF objects modified
in SF_Utils
Change-Id: I16f5fe03d31613c9c777905edd5190f56e460df3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202037
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'icon-themes/oxygen/cmd/sc_fontworksameletterheights.png')
0 files changed, 0 insertions, 0 deletions
