Commit Graph
148 Commits
Author SHA1 Message Date
Jean-Pierre Ledure 8a4ee0fb39 ScriptForge (SFWidgets) new ContextMenu service
Complete a predefined context menu with new items
placed at its bottom.

A context menu is obtained by a right-click
on several areas of a document. Each area has
its own context menu.
Each component model has its own set of context menus.

A context menu is usually predefined at
LibreOffice installation. Customization is done
statically with the Tools + Customize dialog.
The actual new service provides a mean
to make temporary additions at the bottom of a
context menu. Those changes are lost when
the document is closed.

The name of a context menu is the last component
of the resource URL:
   "private:resource/popupmenu/the-name-here"

Context menu items are either usual items or
line separators. Checkboxes or radio buttons
are not supported.
Items run a command or a script when clicked.

The service implements 2 methods:
   AddItem() adds an entry in the menu hierarchy
   Activate() shows or hides the added entries

A context menu can be defined from both Basic
and Python user scripts.

An update of the documentation is required.

Change-Id: Id77f1f2565d75e36c09b13972330d0f83b3f1db4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172355
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-08-24 18:29:12 +02:00
Jean-Pierre Ledure e7aa613e75 ScriptForge - Upgrade to version 25.2
Change-Id: Icc7cbdeed7685118408896c52b0415310d7b20fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171590
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-08-07 16:14:59 +02:00
Ilmari Lauhakangas 129e69f005 testtools, wizards, xmlsecurity: fix issues found by Ruff linter
Change-Id: I03edbaa7c9a643ca7503fa0e93c2bf0de3ac4e51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171211
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-07-29 16:56:57 +02:00
Andrea Gelmini 55bf8a21d0 Fix typo
Change-Id: I67c1591af46b530c3cbf46b0871d863a5c0aec24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164907
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:51:03 +01:00
Andrea Gelmini 08750535c5 Fix typo
Change-Id: Ie04b3b3a96b2d4651b6dc477215f29a48c1be4c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164901
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:50:47 +01:00
Andrea Gelmini a0d5d8d165 Fix typo
Change-Id: I1264c4594bbedf7398816552795e33c489ef2863
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164902
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:50:27 +01:00
Andrea Gelmini 3764ae10f8 Fix typo
Change-Id: I8c5c281897c53afb456b63c5f3838059bd1887d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164912
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:49:54 +01:00
Andrea Gelmini 42a01a525b Fix typo
Change-Id: Iac27e35e92ec8f481d0d6ba71c87f72e10a99ffb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164910
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:49:23 +01:00
Andrea Gelmini 5569de72d7 Fix typo
Change-Id: I07c180c9b659950fa0ecc4bf8ca26f2d133a393c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164913
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:48:44 +01:00
Andrea Gelmini d845d151fd Fix typo
Change-Id: I5bece7e286f8ebced0f5f45fff7377037b546a37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164918
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:47:47 +01:00
Andrea Gelmini da7c50f6f7 Fix typo
Change-Id: I0db6ac0b9edfd6953d668dd0949c692630665a2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164915
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:47:34 +01:00
Andrea Gelmini 66567a0bcd Fix typo
Change-Id: I3620d218898a91293d57611d4dcf062f75045892
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164897
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:47:17 +01:00
Andrea Gelmini c1215a2e08 Fix typo
Change-Id: I0a68811af1f5b9d32f453592ec357fa694747d35
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164909
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:46:56 +01:00
Andrea Gelmini b360a2b64f Fix typo
Change-Id: Ibb07cca05ef733932326ceb29aa3fd1cd1e969d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164896
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:46:34 +01:00
Andrea Gelmini 3f9a557813 Fix typo
Change-Id: Id099d4e9471415d572f7eac56e70d20cbae8e577
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164906
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:46:08 +01:00
Andrea Gelmini 7abfe574e2 Fix typo
Change-Id: I42521b965da582e00e4fa9186bb5de3ea3defd4f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164905
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:45:46 +01:00
Andrea Gelmini d7d37ac32c Fix typo
Change-Id: I2e38b46435d927fe4fe8d656c92e7a75a5771ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164911
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:45:20 +01:00
Andrea Gelmini 7e0a186d18 Fix typo
Change-Id: I3f6f98e2781dd6ca37483ca4224b76f7b474a909
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164908
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:44:56 +01:00
Andrea Gelmini 36f6aea73f Fix typo
Change-Id: I5b5182b56259808e7c4c351f24510806bf79c9fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164916
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:44:32 +01:00
Andrea Gelmini 5640b1b0d3 Fix typo
Change-Id: I58ae1ae35bef53a79dfb60ac17b485e7e22a8d87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164900
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:44:11 +01:00
Andrea Gelmini c68303fb07 Fix typo
Change-Id: I6e332fc1366cf6cc20f7d4bbb546996bcfcfc6f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164919
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:43:42 +01:00
Andrea Gelmini 7c42fca202 Fix typo
Change-Id: I5c2075d5c3e87fe5e4f56d884bf7bcfb7371498b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164917
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:42:52 +01:00
Andrea Gelmini 26785eed76 Fix typo
Change-Id: Ib1f5fdc8c44c62619325f6d21d834459905fab44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164921
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 19:42:08 +01:00
Andrea Gelmini 5b7e83ddb0 Fix typo
Change-Id: I54dff81d7dffda684f3e39a5ebf1dda06959b9dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164920
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:41:44 +01:00
Andrea Gelmini 85eb0d1394 Fix typo
Change-Id: I965793a29a92eedb5555b541a22b5be0350c6b98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164923
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:38:12 +01:00
Andrea Gelmini da56c68f5a Fix typo
Change-Id: I493fece1547f15d1e428146928e34807a96636a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164914
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-03-16 19:37:42 +01:00
Andrea Gelmini 5208cc2995 Fix typo
Change-Id: Ic25c4b9fe4fe898de328f1ea98ef69983c66a7c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164904
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 13:00:38 +01:00
Andrea Gelmini 4640cec920 Fix typo
Change-Id: I794f03ec9fe6cc7f1adfe790432a3e252da54b70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164903
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 13:00:24 +01:00
Andrea Gelmini ff7ed8ccca Fix typo
Change-Id: I8c2e3dcfddd27aa7d32feb7a3c7923b411cdafa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164899
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 13:00:11 +01:00
Andrea Gelmini effb43e5ac Fix typo
Change-Id: I26ad4b2cc6738087bb9cbae6eb5e852d7d520c05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164898
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-16 12:59:58 +01:00
Jean-Pierre Ledure c5e0c65bd2 ScriptForge - Python typing hints
Python typing hints may be stored either
- inside the original .py source file
- in a separate .pyi source file (aka. STUB).
Choice is made to create a new scriptforge.pyi file
- to allow hiding the private functions
- to specialize each module: technical doc
  vs. user doc
- to allow potential later translation
- to minimize the impact at run-time:
  stubs are active only during code edition.

The new scriptforge.pyi module
- provides the static type checking of all the public
  interfaces (methods/properties) of the ScriptForge API.
- when the user uses an IDE like PyCharm or VSCode,
  (s)he might benefit from the typing hints provided
  by the signatures and docstrings stored
  in the module.

Visually, while editing a user script:
- hovering an object instance, a method or a property
  displays its detailed description
- a "." after an object instance displays a drop-down
  box listing all available interfaces
- brackets after a method-name start code-completion
  by displaying its arguments.

Limitations: SF supports ProperCase, lowercase and
camelCase naming for methods and properties.
Only ProperCase is described in scriptforge.pyi.
Extending to the other 2 notations would be easy
but would also overload needlessly the drop-down lists.

The effective code (scriptforge.py) is completed
with a series of importable variable types,
corresponding roughly with the available service
instance names in uppercase. Example
       from scriptforge import CALC, RANGE
       def userfct(c: CALC, r: RANGE) -> RANGE:
           r1: RANGE = "A1:K10"
Objective: enrich the signatures in user scripts
and benefit from the same hints when the variable
types cannot be derived from the context.

The help documentation should be complemented
with the actual additional feature.

Change-Id: I6c39939a3cdbed94828e9449cd691fe15c24c923
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164867
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2024-03-15 17:27:00 +01:00
Jean-Pierre Ledure 5fc9908b95 ScriptForge - Upgrade to version 24.8
Copyright years are also reviewed to include 2024.

Change-Id: I1f30443922a6dc3b35c6f05616a5c4e56de1e396
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161277
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-12-25 14:10:36 +01:00
Jean-Pierre Ledure 9b5b313a2f ScriptForge (SF_Database) manage transactions
Transactions are managed by next UNO properties:
   XConnection.AutoCommit
   XConnection.TransactionIsolation
(They seem very easy to use but, in practice,
are not easy at all)

Usually all transactions are in auto-commit mode,
that means, a commit takes place after each
single SQL command.

Switching auto-commit off  means however that
the connection needs to be of type "ISOLATED"
and not of the default type "SHARED".

=> The usual shared connection must be closed.
   As a consequence, all rowsets/resultsets linked
   to the shared connection need to be closed as well.
=> Additionally the buffers must be emptied (flushed)
   to make committed data visible in the Base user
   interface.

All above aspects and constraints are managed in the
   database.SetTransactionMode(transactionmode)
   database.Commit()
   database.Rollback()
methods transparently for the user scripts.

The [transactionmode] argument has as value one of
the TransactionIsolation constants.
Without argument, database.SetTransactionMode()
restores the automatic mode.

The manual transaction mode is available for both
Basic and Python scripts.
Its implementation will require an update of the
documentation about the Database service.

Change-Id: I214bd91a1744d6d24609bc5efc987152c6e946c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159867
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-11-24 09:54:59 +01:00
Jean-Pierre Ledure 5dac0fe157 ScriptForge (SFDatabases) fix dates processing in GetRows
The
   database.GetRows()
   dataset.GetRows()
methods return an array of data collected
in a database table or query.

When a column has the type DATE, the transmission
of their values through the Basic-Python bridge
require them to be converted upfront to UNO
DateTime structures.

The later conversion from UNO DateTime to the python
datetime.datetime structure has been added with
this patch.

No impact on Basic scripts.

The documentation does not need to be changed.

Change-Id: I7a6533aff70d2d1402bfc3f057b65a4940148cc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159348
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-11-12 17:44:55 +01:00
Jean-Pierre Ledure 7b2a6f0444 ScriptForge (SFDatabases) new Dataset service
A dataset represents a set of tabular data
stored/produced by a database.
To use datasets, the database instance must exist
but the Base document may not be open.

A Dataset instance is create either with
- the (new) database.CreateDataset() method
- from an existing dataset with the (new)
  dataset.CreateDataset() method.

The proposed API supports next main purposes:
- browse for- and backward thru the dataset to get its content
- update any record with new values
- create new records or delete some.
In summary, the AKA "CRUD" operations
(create, read, update, delete).

The originality of the proposed API is the use
of a dense syntax to make insertions and updates
easy and readable:
Example:
(BASIC)
  Dim newID As Long
  newID = dataset.Insert("LastName", "Doe", "FirstName", "John")
  '     ... is equivalent to:
  Dim dict As Object, newID As Long
  Set dict = CreateScriptService("ScriptForge.Dictionary")
  dict.Add("LastName", "Doe")
  dict.Add("FirstName", "John")
  newID = dataset.Insert(dict)
(PYTHON) - next statements are equivalent
  newid = dataset.Insert('LastName', 'Doe', 'FirstName', 'John')
  newid = dataset.Insert({'LastName': 'Doe', 'FirstName': 'John'})
  newid = dataset.Insert(dict(LastName = 'Doe', FirstName = 'John'))
  newid = dataset.Insert(LastName = 'Doe', FirstName = 'John')

You will notice that the returned value is the AutoValue primery
key (when it exists) which makes it reuse as a foreign key
immediate.

The API is fully available both in Basic and Python user scripts.

The new service will require its inclusion in the user documentation.

Change-Id: I4f834c4234e5b96ec8fddfffbad791ecf31899df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159325
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-11-11 18:20:15 +01:00
Jean-Pierre Ledure a29841ccbd ScriptForge (SFDocuments) Styles management
Introduction of new properties and methods:

- StyleFamilies
    List of available style families
    All document types except Base
- XStyle(family, stylename)
    UNO representation of given style
    All document types except Base
- Styles(family, [namepattern, used, userdefined,
         parentstyle, category)
    A list of styles matching the given criteria
    All document types except Base
- DeleteStyles(family, styleslist)
    Suppress the user-defined styles in the list
    All document types except Base and FormDocument
- ImportStylesFromFile(filename, families, overwrite)
    Load styles from a closed file
    Calc and Writer only

Example: to delete unused styles:
    a = doc.Styles("ParagraphStyles", used := False)
    doc.DeleteStyles("ParagraphStyles", a)

All functionalities are available from Basic and
Python scripts.

Documentation has to be completed.

Change-Id: I2533c14912257b58feb42bb11ff9d151c7b9531a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157563
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-10-04 18:50:16 +02:00
Jean-Pierre Ledure f9c4973ac6 ScriptForge - Upgrade version number (7.6 => 24.2)
Change-Id: I0e7ceeafcf4c5a802249125e6be44a71adb1456b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156480
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-09-03 14:49:17 +02:00
Jean-Pierre Ledure b3278aa41d ScriptForge (SF_Document) new XDocumentSettings property
The XDocumentSettings property returns a
   com.sun.star.XXX.DocumentSettings
UNO object.

XXX = sheet, text, drawing or presentation

It gives access to a bunch of UNO internal
properties, specific to the document(s type.

The property is available in Basic and Python
user scripts.

An update of the SF_Document service help
page is required.

Change-Id: I9d6db473c91ac5b1814def9cd100e874aa5490cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156475
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-09-03 11:00:26 +02:00
Jean-Pierre Ledure 0bbe5b4f2a ScriptForge - Refactor Python <=> Basic protocol
Incremental changes had made the code in
   SF_PythonHelper.xba
   scriptforge.py
(which manage the protocol between the Python
user scripts and the ScriptForge services
implemented in Basic) less readable and efficient.

Next features have been reviewed:
- dict instances may be passed as arguments
  and returned. Conversions are done on-th-fly.
- dates may be passed as arguments
  and returned. Conversions are done on-th-fly.
  The lists of hardcoded methods have been removed.
- 2D arrays in standard modules may be passed
  as arguments and returned. Conversions are done
  on-th-fly. The lists of hardcoded methods have
  been removed.
- The hardcoded list of methods requiring a post-
  processing has been reduced.
- Methods in standard modules, when not returning
  an array, are also executed with CallByName().
- The unused 'localProperties' attribute in Python
  services has been removed.
- Flags about arrays in standard modules have been
  adapted in
   filesystem.Files()
   filesystem.SubFolders()
   session.UnoMethods()
   session.UnoProperties()
   string.SplitNotQuoted()
   string.Wrap()
   ui.Documents()
- The platform.UserData property became a usual
  property.

Dictionaries are admitted as arguments and return
values. As a consquence next functions are supported
in Python as well:
   session.GetPDFExportOpetions()
   session.SetPDFExportOptions()
   document, calc, writer.CustomProperties
   document, calc, writer.DocumentProperties
These changes require an update of the help pages.

Non-regression tests were run with success. All changes
are transparent for existing scripts.

Change-Id: Iae7a1f5090c590209cd3cb2314c919c44736eba9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155860
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-08-20 10:48:48 +02:00
Jean-Pierre Ledure 0f43960ec8 ScriptForge (SF_Platform) new UserData property
The UserData property lists the content of the
"User Data" oage of the Options dialog.

The content is returned:
- in Basic: in a SF_Dictionary instance
- in Python: in a dict[] instance.

The list of the available keys is:
 city, company, country, email, encryptionkey,
 encrypttoself, fax, firstname, homephone,
 initials, lastname, officephone, position,
 postalcode, signingkey, state, street, title
Many are different from the UNO/priginal values
to make them more user understandable.

This commit will require an update of the SF_Platform
help page.

Both Basic and Python user scripts are supported.

Change-Id: If645579ee9109a1b8180da5a5f3a71979bb5ca59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155024
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-07-29 12:39:34 +02:00
Jean-Pierre Ledure c216a5fc49 ScriptForge (SF_FileSystem) IncludeSubfolders argument
In the FileSystem service, the
   - SubFolders()
   - Files()
methods receive an optional argument
   IncludeSubfolders (Boolean).

That argument determines whether or not only
the given FolderName is explored or also its subfolders
up to the bottom of the folders structure.

The argument must be used with caution as the number
of returned folders or files may increase rapidly.
anThis could consume excessive process time.

This patch will require an update of the
help page about the filesystem service.

The new argument is available both for Basic and Python
user scripts.

Change-Id: Id2a96cd63cb51f8681f20a203a711b47a636fc3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154763
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-07-22 18:03:36 +02:00
Jean-Pierre Ledure 44334328f7 ScriptForge (SF_FileSystem) support document(s internal file structure
1. The SF_Document services (document, base, calc,
   formdocument, writer) receive a new FileSystem
   property that returns the "root" of the
   component's file structure under the format:
      "vnd.sun.star.tdoc:/XXX"
   XXX being the document's identifier.
   The implementation does not use the RuntimeUID
   (UNO property of the OfficeDocument service) which
   is optional and, f.i. not present for Base documents.
   Instead the
    css.frame.TransientDocumentsDocumentContentFactory
   service is used.

2. The SF_FileSystem and SF_TextStream modules have been
   reviewed to support the new context.
   Next restrictions have been met:
   - The FileNaming property is always cnsidered as 'URL'
   - CompareFiles() is not applicable
   - GetFileLen() always returns zero
   - HashFile() is not applicable
   - Normalize() always returns the input string unchanged
   - PickFile() is not applicable
   - PickFolder() is not applicable
   Additionally,
   - CreatetextFile()
   - OpenTextFile() in write or append modes
   copy or initialize the file in a temporary storage
   and write it back in the document when it is being closed.
   The process is transparent for the user.

3. The GetTempName() method accepts an option
      Extension
   argument, for better convenience.

The new functionalities are available in Basic and Python.

Changes require an update of the help documentation.

Change-Id: Ibf8dd9983656923cf6ab43d9f48398dc4d1e6307
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154443
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-07-15 09:54:01 +02:00
Jean-Pierre Ledure a83643dea9 ScriptForge (SF_Dialog) new CloneControl() method
Duplicate an existing control of any type
in the actual dialog.

The duplicated control is left unchanged.
The new control can be relocated.
Args:
  SourceName: the name of the control to duplicate
  ControlName: the name of the new control.
    It must not exist yet.
  Left, Top: the coordinates of the new control
    expressed in "Map AppFont" units.
Returns:
  an instance of the SF_DialogControl class or Nothing

The method is available from Basic and Python user scripts

This change will require an update of the SF_Dialog help page.

Change-Id: I5c2a5404a14ad60b2d4df2ac7eabbf0ddd843170
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152333
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-05-26 19:06:07 +02:00
Jean-Pierre Ledure e7c4a88362 ScripForge (SF_Dialog) new OrderTabs() method
Set the tabulation index f a series of controls.
The sequence of controls are given as an array
of control names from the first to the last.

Next controls will not be accessible (anymore ?)
via the TAB key if >=1 of next conditions is met:
   - if they are not in the given list
   - if their type is FixedLine, GroupBox or ProgressBar
   - if the control is disabled

Args:
   TabsList: an array of valid control names in the order of tabulation.
   Start: the tab index to be assigned to the 1st control in the list. Default = 1.
   Increment: the difference between 2 successive tab indexes. Default = 1.
Returns:
   True when successful.

The method is available from Basic and Python user scripts

This change will require an update of the SF_Dialog help page.

Change-Id: Ie854227691c4e182b49a521b1285deaa4de3d1ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152166
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-05-24 11:20:48 +02:00
Andrea Gelmini 60489faa6c Fix typo
Change-Id: Ic3f79113f09be10f6ff33183b09f80e269f77f93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152122
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-22 20:45:22 +02:00
Jean-Pierre Ledure 0a1022b04c ScriptForge (SFDialogs: create dialogs on-the-fly
A dialog service is returned by next statement

  dialog = CreateScriptService("newdialog", dialogname, place)

All properties and methods applicable to predefined
dialogs are available for such new dialogs.
In particular the series of CreateXXX() methods for the addition
of ne dialog controls.

The functionality is available from Basic and Python user
scripts.

An update of the SFDialogs.SF_Dialog help page is required.

A display rendering unstability (flickerings, delays, ..) has
been observed when (all conditions must be met)
- the user script is run from Python
- from inside the LibreOffice process
- the dialog is non-modal

Change-Id: Id3f311cd04497fd79712ce712bdb2724b5caa861
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152071
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2023-05-22 14:08:20 +02:00
Jean-Pierre Ledure f692b5c5e4 ScriptForge New method dialog.CreateHyperlink()
Method (Dialog service)
  CreateHyperlink(controlname, place, border, multiline,
                  align, verticalalign)

completes the set of available methods for
dynamic DialogControl creation.

Cfr. https://gerrit.libreoffice.org/c/core/+/151896

Change-Id: I162075ea39efdd2e1189fe8b16ac05316e6a13ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151954
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2023-05-20 12:56:41 +02:00
Jean-Pierre Ledure 66a3b09fc3 ScriptForge (SFDialogs) create controls dynamically
The dialog service hosts now a bunch of methods
to create new controls dynamically in an existing
dialog predefined in the Basic IDE.

In other words, a dialog is initialized with controls
in the Basic IDE. New controls can be added at run-time
before or after the Execute() statement.

All the new methods have in common their first 2 arguments:
 ControlName
 Place: an (X, Y, Width, Height) array
        or a com.sun.star.awt.Rectangle

New methods:
 CreateButton(..., toggle, push)
 CreateCheckBox(..., multiline)
 CreateComboBox(..., border, dropdown, linecount)
 CreateCurrencyField(..., border, spinbutton, minvalue,
                     maxvalue, increment, accuracy)
 CreateDateField(..., border, dropdown, mindate, maxdate)
 CreateFileControl(..., border)
 CreateFixedLine(..., orientation)
 CreateFixedText(..., border, multiline, align, verticalalign)
 CreateFormattedField(..., border, spinbutton, minvalue,
                      maxvalue)
 CreateGroupBox(...)
 CreateImageControl(..., border, scale)
 CreateListBox(..., border, dropdown, linecount, multiselect)
 CreateNumericField(..., border, spinbutton, minvalue,
                    maxvalue, increment, accuracy)
 CreatePatternField(..., border, editmask, literalmask)
 CreateProgressBar(..., border, minvalue, maxvalue)
 CreateRadioButton(..., multiline)
 CreateScrollBar(..., orientation, border, minvalue, maxvalue)
 CreateTableControl(..., border, rowheaders, columnheaders,
                    scrollbars, gridlines)
 CreateTextField(..., border, multiline, maximumlength,
                 passwordcharacter)
 CreateTimeField(..., border, mintime, maxtime)
 CreateTreeControl(..., border)

All the methods return a SF_DialogControl instance.

The arguments have bben chosen based on functionality
rather than on layout. After the creatio of the control,
most properties and methods relevant to SF_DialogControl
objects are applicable. Also the XControlModel property
might contribute to layout refinements.

Other changes:
- The SF_DialogControl class receives next updatable
  properties: Border and TabIndex
- The dialogcontrol.SetTableData() receives an
  additional argument: rowheaderwidth
- The dialogcontrol.Resize() method without arguments
  resizes the control to its "preferred size", a size
  adjusted depending on its actual content

All the new functionalities are callable from both
Basic and Python user scripts.

Described changes will require a serios review of the
Dialog and DialogControl help pages.

Change-Id: I654eeae5456527bf14b1f4b43f04d176bbd830b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151896
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-05-18 10:30:45 +02:00
Jean-Pierre Ledure a58017d99c ScriptForge (SFDialogs) support hyperlink control types
Controls designated in english as "Hyperlink controls"
in the Basic IDE are from now on accepted as instances
of the SF_DialogControl service.

All generic properties are accepted.
The supported specific properties are:
   - Caption (the text that appears in the dialog box)
   - URL (the URL to activate when clicked)

The new control type is supported in Basic and Python
user scripts.

The SFDialogs.DialogControl help page needs to be updated.

Change-Id: I4827834ad8ef336c084ee51b5285b85745ceb1b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150824
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-04-23 14:54:49 +02:00
Jean-Pierre Ledure 37a68d6ae3 ScriptForge (SFDialogs) dialogs and controls are sized in APPFONTs
Dimensioning a dialog in the Basic IDE is done
by using "Map AppFont" units.
Map AppFont units are device and resolution independent.
One Map AppFont unit is equal to one eighth of the average
character (Systemfont) height and one quarter of the average
character width.

A dialog or control model also uses AppFont units.
While their views use pixels.

This is confusing. It also complicates size prototyping
with the Basic IDE.

In ScriptForge, sizing and positioning a dialog or a control
is done from now on in AppFont units as well.

Additionally, X and Y positions accept now negative values.

Compatibility with past is ensured: dynamic change or
position and size is a new feature in 7.6.

The change is valid both for Basic and Python user scripts.
It requires a small change in the actual documentation
(pixels => AppFontunits)

Change-Id: Id80b0ccf473eb012b0a8c85d66f5a8ada9b26be5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150704
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
2023-04-21 11:02:01 +02:00