4023 Commits
Author SHA1 Message Date
Jean-Pierre Ledure 2821d29a87 ScriptForge (FileSystem) Manage ZIP archives
The FileSystem service provides simple
methods to manage compressed zip archives.

As an example, .odf and .oxt files being
formatted as such archives, massive or
punctual changes of file contents
with smart scripts can be facilitated.

New methods:
- IsZipFile(filename)
    returns True when filename is a valid
    zip file
- FilesInZip(filename, pattern)
    returns a list of archive members,
    optionally filtered with a Like pattern,
    stored in filename
- ExtractFromZip(filename, destination, source)
    stores the source file(s) found in the
    given ZIP file into a destination folder
- CompressToZip(filename, foldername, rootfolder)
    stores the content of folder, including
    its subfolders, into a zip archive,
    optionally under a root folder

The implementation is based on the python
zipfile standard library.

The methods area available both for Basic and
Python user scripts. For Python scripts, the
user is also free to use the native zipfile
library instead.

The user documentation shouid be updated
according to this commit.

Change-Id: I506a8583dc3fa38c7e05094562ade33f84a24747
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211891
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-10-07 14:26:54 +02:00
Jean-Pierre Ledure 750f2e2fc7 ScriptForge fix tdf#173117 array.AppendColumn/Row
ncorrect examples in comment lines
and reproduced in help files.

Change-Id: Id87f8375d77f908757b1d1742bb2cc047c620ca4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211414
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-09-24 12:00:58 +02:00
Jean-Pierre Ledure 1b3d801b14 ScriptForge ui.EnterValue() enhance password input
Addition of a button that makes the
password field readable and back.

A "password" input field is set by the
  EchoChar
property in the field model.
It cannot be changed dynamically during
the dialog's life.

To circumvene this limitation, a new readable
'= EchoChar = 0) usual text field is added
with the same dimensions and position
as the password field.
Only 1 of them is visible at the same time.

The button implements
- a swap between readable and non-readable fields
- a copy of the actual content of the last used field
- the repositioning of the caret
This maximizes the illusion of the use
of a single field while, in fact, 2 alternate
fields are used.

No effect on existing user scripts.
The functionality is valid for both Basic and
Python user scripts.

Change-Id: I8e84b2b0a8e25087f203a2efa58ff208526e2591
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211228
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-09-20 09:27:03 +02:00
Andrea Gelmini 1406e27b4c Fix typos
Change-Id: Ife5bb699c12cc02575ab9313b2a70d85c75e61b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210577
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 20:37:30 +02:00
Jean-Pierre Ledure 3181946eaf ScriptForge Fix typos (a.o.) in po files
Read
 https://gerrit.libreoffice.org/c/core/+/210371/comments/0ed12361_0bc1e0bc

Change-Id: I300c022ddd2453e23b902f6cf5af05f1da98b831
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210436
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-09-03 12:47:19 +02:00
Jean-Pierre Ledure acb597ce0a ScriptForge Fix tdf#173228 Python SyntaxWarning
As from Python 3.14, a 'return' statement
inside a 'finally clause' raises a
   SyntaxWarning
warning, however without execution stop.

Occurrence in ScriptForgeHelper.py is
now fixed.

The 'finally' clause had the intent to never
interrupt the execution flow in the preceding
'try' clause.
It is replaced by
   except Exception:
      pass
which does the same job without warning.

No effect on existing user scripts.
No effect on user documentation.

Change-Id: I79aaea4a87726f297c856cfd40c9f7063c6c7abd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210244
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-08-29 10:18:16 +02:00
Jean-Pierre Ledure 03762554ad ScriptForge Upgrade to version 27.2
Version number is modified from 26.8 to 27.2.
No effect on actual user scripts.

Change-Id: I239d19d379915766eab41c20dbf6793c75d4ee77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210022
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-08-27 16:17:00 +02:00
Andrea Gelmini cf0a1268e3 Fix typos
Change-Id: Ib8964b0b98005da480826cfdd2c64bd68c88575c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209460
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-22 10:15:11 +02:00
Andrea Gelmini 6d10a8e47b Fix typo
Change-Id: I2411ddcf7bb5751755b4375addc30e5c5a0d284a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208276
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-07-20 14:29:08 +02:00
Jean-Pierre Ledure bf69ea294e ScriptForge upgrade README.md
ChangeLog: add 26.8 commits
Change-Id: Ied994368ac6a8432a3ade86975a6ea7d22146994
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208243
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-07-19 10:41:14 +02:00
Andrea Gelmini cdca7e34ce Fix typo
Change-Id: Iee29feb8d794f4deadcf2b3d2afd0c8f2334f42b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205264
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-05-17 19:26:13 +02:00
Jean-Pierre Ledure d8f94b5a26 SctiptForge Python scripts and default pipe
Python scripts may run either
(1) inside the LO process, the usual mode
(2) as a client of a LO server
    using a pipe or a socket.
    The LO command is started with
    an "--accept" argument.

The benefit of (2) is the freedom to
choose his/her preferred IDE to edit
and debug the script. The drawback is the
reference to the pipe/socket in the
script source code.

APSO is the best (only ?) choice for debugging (1).

With this commit, when no reference is given
to a pipe or a socket in the user script,
ScriptForge tries a connection through the
default pipe 'PIPE2LIBREOFFICE'.
If the connection fails, mode (1) is assumed.

The benefit is that the same source code
can run without change in both (1) and (2)
modes.
The command to run LO must refer explicitly
to the default pipe when (2) is wanted.

The change has no effect on existing Python
scripts.

Change-Id: I3176f4744ffea5b387280e9364b3563483fd14f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205228
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-05-16 11:12:33 +02:00
Jean-Pierre Ledure d6b4eb14c3 ScriptForge Session.GetUnoProperty/GetPropertyByName()
Several changes:

- 2 new methods in the Session service:
    session.GetPropertyByName(basicobject,
        propertyname, [arg])
      for read access to properties of ScriptForge
      object instances.
      Argument is required for some Calc properties.
    session.GetUnoProperty(unoobject,
        propertyname)
      for read access to properties of UNO
      object instances.
  Those methods complement nicely the
  array.Map(), Filter() and Reduce() methods.

- The wording of trapped errors when
    session.ExecutePythonScript()
  fails has been reviewed to be distinct
  to that of
    session.ExecuteBasicScript()

- The source code of
    session.GetPDFExportOptions() was missplaced.

- A more accurate identification of ScriptForge
  object instances has been implemented in
    SF_Utils._VarTypeObj()
  (internal use only).

- Some fixed typos

The changes are applicable to Basic and Python
user scripts.

The new methods require an update of the user
documentation.

Change-Id: Ibbc0eecfe52a190eece66edadc14710a7fd6a106
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205033
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-05-11 10:12:10 +02:00
Jean-Pierre Ledure 0b6494b0ed ScriptForge fix non-modal dialogs closure
In previous releases the cross present in the
top-right corner of a window was inoperant
in LibreOffice for non-modal dialogs (bug).

As a workaround, ScriptForge introduced a
  com.sun.star.awt.XTopWindowListener
that intercepted theClosing event
to effectively close the dialog.

Above bug gas been fixed now (fix #??).
The listener may now safely been removed
together with its event routines.

Change-Id: I43cd382c842ccd6eb90d32eecac0eb148c62e6df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204877
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-05-08 17:38:23 +02:00
Julien Nabet 5fdf0a21d5 Related tdf#171816: fix link in wizards module files
Change-Id: I6968a34dc22fd999a44409d43876f40970d2fb60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204355
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-04-27 21:57:34 +02:00
Andrea Gelmini 67961532c2 Fix typo
Change-Id: Ie83cc5a2ac47f7439a27460efed2ecb0c160ea24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202187
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-03-19 15:38:10 +01:00
Jean-Pierre Ledure 710433d5a6 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>
2026-03-19 10:12:38 +01:00
Jean-Pierre Ledure c428b24381 ScriptForge - ui.Activate() Fix maximize
ui.Activate(...)
sets the focus on the window in argument.

Before the actual patch, when the window
in background was maximized, it appeared
in foreground simply "restored".

Now "restored" or "maximized" depends on
the previous status.

Limited impact on existing scripts.
Improvement valid for Python and Basic
user scripts.

No impact on help documentation.

Change-Id: Ie3d30967948d114a422345afa9d13d54e587b79e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201175
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-03-08 11:04:02 +01:00
Jean-Pierre Ledure 485d6db955 ScriptForge CallByName manages arrays
The bug "CallByName() does not work when the returned value
is an array"
   https://bugs.documentfoundation.org/show_bug.cgi?id=138155
is now fixed thanks to tdf#187145

This is a major improvement for the protocol
designed to make ScriptForge run smoothly
in Python as well as in Basic.

Indeed, CallByName() is a cornerstone of that protocol.
The implementation of this protocol is now
greatly simplified: the previous use of
hardcoded calls to workaround the limitation
to scalars of CallByName() has been suppressed.

The actual commit has no effect on existing scripts.
The documentation is not impacted.

Change-Id: Id01bb2d2d8be587d9c6aed227d172d10ddd85d4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199740
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-02-20 08:54:43 +01:00
Jean-Pierre Ledure a6e4216153 ScriptForge (UI) fix no active frame in StarDesktop
Sometimes,
- headless mode
- client/server mode from python scripts
  via pipe or socket
- ...
the StarDesktop object has punctually
no active frame set.

This caused inopportune aborts in the
ScriptForge code: "Object variable not set",
when maximizing/minimizing the frame.
The request should simply be ignored.

Change-Id: Ifd38207cdeb4c5c4f40c58cca561f8131e8aed51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199466
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-02-16 14:35:15 +01:00
Jean-Pierre Ledure 6f5a59a79b ScriptForge (UI) new EnterValue() method
The
   ui.EnterValue(...)
method displays a typed input box to the user
and returns the entered value as a scalar
of the requested type, or Empty/None
when the user cancels the box.

=> A single statement to interact with
   the user through a complex dialog box
   e.g. a listbox field of allowed values.

The box is centered on the active window.

The arguments (all are optional) :
   prompt: the message appearing above the input field
      Escape chars (\n \t) are interpreted correctly
   valuetype: determines the type of the input field
      and of the returned value, either
         STRING, PASSWORD -> str
         BOOL, INTEGER, FLOAT -> bool, int, float
         DATE, TIME, DATETIME -> datetime
         COMBO, LIST, RADIO -> str
   default: the initial value
   title: the header of the dialog
   choices: the list of valid values
      (COMBO, LIST and RADIO only)
   format: the format of numeric and date values

Example (Python):
   destination = ui.EnterValue(("What is your next destination ?", "LIST",
                      choices = ("Belgium", "Brazil", "France", "Mexico"),
                      default = "France",
                      title = "This text is in the titlebar")

The box is sized based on the arguments.

The function is available both in Basic
and Python user scripts.

The user documentation should be adapted accordingly.

Change-Id: I7c3f02f597ba5990c5f5a8548fb4f07699cda358
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199194
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-02-12 10:01:37 +01:00
Jean-Pierre Ledure 1952c85f9c ScriptForge fix tdf#169176 comma in file names
Per
  https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#file-and-directory-names
the comma and the semicolon are not
reserved characters in folder or file
names.

Not in Windows, and also not in Linux.

The regular expressions used to filter
valid file names have been reviewed
accordingly in the
  ScriptForge.SF_String
module.

No impact on user scripts, except a better
tolerance.
No impact on user documentation.

Change-Id: I4970c6d8334d717e5642782d3b5385731aa98717
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198545
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-02-02 15:09:31 +01:00
Andrea Gelmini 50159dbedc Harmonize "an URL" -> "a URL"
Change-Id: I17ae188e1dfca3a0d3b9b666a8407b1b7c862a9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198367
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-01-29 17:23:22 +01:00
Andrea Gelmini 1fbdc78398 Fix typo
Change-Id: Ic2f962595d93f79e798a5d77a5f90b8c4ea3595a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197348
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-01-22 17:18:14 +01:00
Jean-Pierre Ledure 69a816910d ScriptForge Fix dialog.Center() for dynamic dialogs
This patch is for dynamic (= built by code,
not in the Basic IDE) dialogs only.

At creation, such dialogs are incomplete:
their view contains default widths and heights.
In addition, conversions from MAP APPFONTs
(unit for position and size in the model)
to pixels and back were not available.

This made the computations for centering such a dialog
in the middle of a parent window, known in pixels,
erroneous.

The data is transferred from model to view
when the dialog is explicitly made visible:
   view.setVisible(True)

The computations are made correct by forcing
the visibility of the dialog as soon as a
   dialog.Center(...)
is issued, while, before, it was done immediately
before the
   dialog.Execute(...)

No impact on help documentation.
No impact on existing user scripts.

Change-Id: Ie867239300c5d61424c408efec40fecc9b06bca8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197257
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2026-01-15 10:15:27 +01:00
Jean-Pierre Ledure 38bc68ba4b ScriptForge (Calc) FormatRange() fix new formats
New formats should not be deleted after
use. Anyway they are stored in the
document, not at install level.

+

A few typos in comments.

No change in user documentation.

Change-Id: I839fa0d86abdaf521a12b0d97978cf225cc8088e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197090
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2026-01-12 17:23:01 +01:00
Jean-Pierre Ledure 2a149fcc6a ScriptForge upgrade to versin 26.8
Version number is modified from 26.2 to 26.8.
No effect on actual user scripts.

Change-Id: I3010985552fc90b5374ca7fa571dfacfbdc8af37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196202
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-12-24 16:58:53 +01:00
Jean-Pierre Ledure a9e9c3b2e2 ScriptForge Fix Watch close button of all dialogs
Cfr. patch
   https://gerrit.libreoffice.org/c/core/+/184662

Dialogs can either be stored in a library
or created from scratch.

When run in non-modal mode, the closing of
a stored dialog with the window Close
top-right cross was done by LO correctly
in LO <= release 25.2.

Since 25.8, both dialog created from scratch
or stored in a library need a coded
XTopWindowListener to have the job done.

Since above-mentioned patch, SF activated
a listener for on-the-fly dialogs only.

Change-Id: I6fca927d2a2cea321eba5303d4ff3037f15b5841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194949
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-12-03 12:02:29 +01:00
Jean-Pierre Ledure e856738f5f ScriptForge (SF_Exception) fix console error
In the scenario where
- the console is opened in modal mode,
- the console is closed immediately,
- the exception.ConsoleClear() is run,
an abort occurs:
   Object variable not set

Fixed now.

Change-Id: Ib7de836457e77786b0e29a68eaf64e8bd6aa8a0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194846
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-11-30 18:18:58 +01:00
Jean-Pierre Ledure be98d8c3f5 ScriptForge review README.md file
Content upgraded to 26.2 news

Change-Id: I617fc62db831d6731d1f6b0ee2e2f74929259319
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194390
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-11-24 12:27:21 +01:00
Mike Kaganski b0390a4d1b Drop unohelper.absolutize, and use uno.absolutize to avoid duplication
Change-Id: I9e3b10c5c9b0a0ef1af66c99732bb217d37c3851
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194073
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-11-16 19:10:57 +01:00
Jean-Pierre Ledure 61c6321c76 ScriptForge Timer uses Basic Now function
The durations in the Timer service
are measured with a precision of
the millisecond.

Thanks to tdf#161469 the Basic Now()
function provides sub-seconds precision
since LO 25.2.

Hence the use of the Calc NOW() function
is replaced in the Basic code by the
more immediately available Basic Now()
equivalent.

No impact on existing user scripts.
Documentation is unchanged.

Change-Id: Ia3b0f07918d9b9a9e96f62aaa5ce3862a2b48579
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194070
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-11-16 17:14:07 +01:00
Andrea Gelmini 6d12de282e Fix typo
Change-Id: Id4b0055134855081de7cc38274d1a792d4579849
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193981
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-11-14 14:08:24 +01:00
Andrea Gelmini 3846a3b02c Fix typo
Change-Id: I0faf22d000d08806662cf7e958896b967961ed0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193980
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2025-11-14 13:09:33 +01:00
Jean-Pierre Ledure 2a3eb41c03 ScriptForge (SFDocuments) new Shape service
The new "Shape" service is focused on
the description of shapes/images/drawing
objects stored in documents.
In the actual release only shapes
in Calc sheets are considered.

A Shape instance is created from either:
-  calc.CreateShapeFromFile(shapename, imagefile,
                            range, aslink)
   => the shape is loaded in the sheet and
      anchored to the given range.
      The shape may or not be embedded in the
      document.
-  calc.Shapes(sheetname, shapename)

Next methods are available:
-  shape.Anchor(anchortype, cell)
   => define the anchor type and the cell
      to which the shape has to be anchored.
-  shape.ExportToFile(filename, imagetype, overwrite)
   => save the shape as an image file
      to a specified location.
-  shape.Pick()
   => select the shape (NB "Select" is a reserved
      word in Basic, hence "Pick")
-  shape.Resize(xpos, ypos, width, height)
   => change position and/or size.
-  shape.Rotate(angle, pivot)
   => rotate the shape using a given
      pivot point (x, y) with a given angle.

The shape.XShape property gives a direct
access to its com.sun.star.drawing.XShape
UNO representation.

The pre-existing SF_Chart service is
functionally unchanged. However it is
now implemented as a subclass of the
new SF_Shape service.
Compatibility with previous releases
is preserved.

The implementation required a few changes
in the error messages. Hence also in
their translations.

All the functions are available for both
Basic and Python user scripts.

The documentation should include:
- a revision of the Calc and Chart help pages
- the creation of an additional Shape page

Change-Id: Ib67f5e755e3112961aadeffc3188b2cdf9aca613
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193906
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-11-13 10:04:58 +01:00
Jean-Pierre Ledure f6b4cee785 ScriptForge (Calc) ColorizeRange() clean colors
The ColorizeRange() method accepts next
arguments:

- TargetRange : the cell or the range as a string
    in which cells should be re-colorizeed
- Foreground: the foreground color as the output
    of the RGB() function
- Background: the background color as the output
    of the RGB() function
- FilterFormula: a Calc formula to select
    among the given TargetRange which cells,
    rows or columns should affected
- FilterScope: "CELL", "ROW" or "COLUMN"

So far, negative values for Foreground and
Background were ignored.
Now, they reset the colors to their default
values.

This is valid for Basic and Python user scripts.
The documentation should be updated
accordingly.

Change-Id: Ie7722365bcacb1ebe82dc1fc226ed047483143dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191969
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-10-06 18:01:21 +02:00
Jean-Pierre Ledure 50ef4d5256 ScriptForge (Calc) more accurate XRectangle
The
  calc.XRectangle(range)
property returns a com.sun.star.awt.Rectangle
structure describing the position and size
of the range given as a string.
The function opens the opportunity to
design popup menus in user scripts.

The actual implementation has next improvements:

1) When the zoom in the sheet was different from
   100%, there was a distorsion of the Height
   and Width values. Fixed now.

2) When some toolbars were visible, the
   computation of the Y dimension was
   under-evaluated. Fixed now.

3) The implementation does not use the
   deprecated XAccessibleXontext API
   anymore.

The computations have been verified
- the worksheet is not maximized
- with varying row heights and column widths
- with or without a formula bar
- with or without toolbars
- with different user interfaces

The documentation does not need a revision.

Change-Id: I06c9ec40d6cdaed74e5935950aaec9dec382b7fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191906
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-10-06 10:57:54 +02:00
Jean-Pierre Ledure 7420eb7b55 ScriptForge fix tdf#168409 AccessibleContext
Extract from above bug report:
 The accessibility UNO API is unpublished and
 for LibreOffice-internal use only and
 subject to change by design.

The com.sub.star.accessibility.AccessibleContext
service is used in ScriptForge to determine
the location on the screen, in pixels, of
next window subsets:
(1) a Calc cell or cellrange
    => calc.XRectangle(range) property
(2) a toolbarbutton in a docked toolbar
    => toolbar.ToolbarButtons(buttonname) method
In both situations, SF offers a facility
to display a well-positioned popup menu
triggered by a mouse left-  or right-click.

The situation of the API is as follows:
- fully available in 25.2
- partially available in 25.8
  (1) is not broken
  (2) is broken
- fully vanished in 26.2

The gradual phase-out of the API requires,
to fix the bug, a tiered adaptation of
the code.
The choice is made to incorporate, where
appropriate, a switch to the right code
snippet based on the run LibreOffice version:
25.2, 25.8 or 26.2.

Now the behaviours in 25.2 and 25.8 are
identical. In 26.2, a different location
is returned for undocked toolbars.

The solution used for 26.2 must be considered
as still subject to change.
The emergency is to fix the issue in 25.8,
which is currently broken.

With the actual patch, the compatibility
between releases is restored, both in
Basic and Pythonuser scripts, and does
not need any documentation revision.

Change-Id: I29b4ccca3f11eca39e5a1841d3cfd744d5eb1fe3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191670
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-10-01 10:00:23 +02:00
Jean-Pierre Ledure cf57cf042a ScriptForge fix tdf#168433 array.ImportFromCSVFile
The import of a CSV-formatted file
into an array fails when specific
combinations of double quotes and
commas (= delimiter) are present.

The
  array.ImportFromCSVFile()
method uses internally the
  string.SplitNotQuoted()
method for parsing the input
records.

The latter method skips the delimiters
located inside quoted strings.
It was buggy and needed a revision.

Documentation unchanged.

Change-Id: Ie156455b99749c6a8e4f43f4d3c258772904848f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191227
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-09-20 16:20:31 +02:00
Jean-Pierre Ledure 58336d587e Access2Base fix float Value setting
The Field class has a generic Value property
   field.Value = ...
for setting the content of a database field
whatever its datatype.

The property checks the validity of the
given value before running the real
database update.

The check for FLOAT datatype was erroneous
and prevented to enter the value zero into
the field.

See Mike kaganski's remark in
  https://gerrit.libreoffice.org/c/core/+/155507

Change-Id: I0651586c5c51ddf3273fef5fcc1e57355b7af2f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191128
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-09-19 17:01:36 +02:00
Jean-Pierre Ledure d8c75e9bda ScriptForge (Sharedmemory) review StoreValue() signature
Thanks to commit
  https://gerrit.libreoffice.org/c/core/+/190931
  (Extend Python-Basic gateway for objects)
a signature with an object instance as argument
is allowed in any position, i.o. the 1st only.

This is applicable to
  sharedmemory.StoreValue(value, variablename)
Indeed, 'value' may be such an object instance.

The signature becomes now
  sharedmemory.StoreValue(variablename, value)
which is more intuitive.

No impact on user scripts <= 25.8

Documentation should take both commits
into account.

Change-Id: I1a07cd740fc9dcba1077932bba0f69735a7bc647
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190979
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-09-17 16:44:26 +02:00
Jean-Pierre Ledure 8bc9ddf832 ScriptForge Extend Python-Basic gateway for objects
A Python ScriptForge object may be passed to
Basic functions, so far only when it is
positioned as the first argument in the
method signature.

Like in:
   dialogB.Center(dialogA)

The actual commit extends the protocol
between Python and Basic to allow passing
Python objects from another position
in the method signature.

However this possibility is limited to
maximum 1 such argument.
(Note that removing this limitation,
if ever needed, would not require
a big change.)

No impact on user existing scripts.
No documentation update.

Change-Id: I191b7bb7c32b158b7274815577349ddfa1406b93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190931
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-09-15 07:35:37 +02:00
Andrea Gelmini ef4d044ee1 Fix typo
Change-Id: I77c1c2bce39f2a96d52b2ac594682682163bd976
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190450
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2025-09-01 04:47:24 +02:00
Jean-Pierre Ledure 3f34264bc6 ScriptForge - Upgrade python stub file
Concerned file:
  scriptforge.pyi
(python stub having no impact on script
execution, only on script edition with
advanced IDE's like PyCharm and VSCode).

Guided by
  https://typing.python.org/en/latest/guides/modernizing.html#generics-in-the-typing-module
Older typing features are superseded
by more modern alternatives,
which are recommended to use.

Applicable changes:
>= Python 3.9
  typing.Dict => dict
  typing.List => list - replaced by tuple
  typing.Tuple => tuple
  typing.Sequence => collections.abc.Sequence
                     replaced by tuple
>= Python 3.10
  typing.Optional => | None
  typing.Union => | (pipe operator)

This makes the source more readable
and, also, a bit shorter.

No impact on user scripts.
Documentation unchanged.

Change-Id: I856d01660c5c3e1c3f0a0c2cca756fa0cbfd9a4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190362
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-08-29 15:54:45 +02:00
Jean-Pierre Ledure e79a47409f ScriptForge - new SharedMemory service
Singleton class implementing the
  "ScriptForge.SharedMemory"
service. Implemented as a usual Basic module.

Contains the mechanisms to manage persistent memory storage
across Basic and/or Python scripts.

When a script stops running, all the variables it uses vanish,
except Basic Global variables, which stay in memory until
the end of the LibreOffice session.

However event-driven scripting can often benefit from having
variables still being available when the next script is
triggered, probably due to a user action.

The SharedMemory service implements interfaces allowing
to store both BASIC and PYTHON variables in persistent storage,
and to retrieve them later from either BASIC or PYTHON scripts
interchangeably.

The use of the Basic Global statement is more efficient
than the actual service and should be preferred when the variables
are created and retrieved in basic scripts only.

The supported variable types are:
 * Scalar or tuple combining:
  - int, within the bounds of the Basic Long type
  - float, within the bounds of the Basic Double type
  - str
  - bool
  - None
 * datetime.datetime
 * UNO object
 * ScriptForge class instance

Example:
  Sub CreateDoc()
    ui = CreateScriptService("UI")
    doc = ui.CreateDocument("Calc")
    store = CreateScriptService("SharedMemory")
    store.StoreValue(doc, "actualdocument")
  ...

  def UpdateDoc():
    store = CreateScriptService("SharedMemory")
    doc = store.ReadValue("actualdocument")
    ...

The service is available both for Basic and Python scripts.
The actual commit requires the creation of an additional
Help page.

Change-Id: Id53994be5105206c16659f769338261b3dde2d3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190174
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-08-25 16:24:31 +02:00
Jean-Pierre Ledure 6e15cf7286 ScriptForge Fix case-sensitive Dictionary
Incomplete implementation of the
case-sensitivity of Basic dictionaries
in
   CreateScriptService()

Change-Id: Id12b50fb7b62322909622a19fa191d3110447dae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189792
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-08-16 14:03:28 +02:00
prrvchr 3324db4d03 tdf#167495 Base need to close ResultSet after using it.
Change-Id: I02622911370b9929cbca66228a879fcdcb0f866e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189332
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-08-11 15:08:53 +02:00
Jean-Pierre Ledure 490bab1bac ScriptForge - new README.md file
File is purely for info.
No effect on LO build process.

Change-Id: I76c8732c770df891788dc4c48c67aa4809f48ede
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189064
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2025-08-07 15:04:00 +02:00
Andrea Gelmini b0e0ce33a0 Fix typo
Change-Id: I8fd866a1ac73cb925f95c2730051b8c493b02309
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189010
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2025-08-06 16:31:00 +02:00
Jean-Pierre Ledure e72f7d6dd3 ScriptForge new session.GetRangeFromCalc method
The
   GetRangeFromCalc(filename: str, range: str)
method (stored in the Session service)
reads the values contained in the given
range located in the given Calc file.

The file does not need to be open. This
makes this shortcut particularly useful.

The content of the range is returned either
- as a scalar for a single cell
- as a 1D-array or a tuple when the range
  is contained in a single row or column
- as a 2D-array or a tuple of tuples for
  a rectangular range of adjacent cells.

Clean error management is included in the code.

The method is available for Basic and Python
user scripts.

The user documentation needs to be updated.

Change-Id: I39cd218f0bf3a6a21e3ada42826069eeee451c6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189000
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2025-08-06 14:34:55 +02:00