Age | Commit message (Collapse) | Author |
|
Only Windows implements the Description
property of the FolderPicker by displaying
it in the dialog's header. Otherwise it
is ignored.
This commit harmonizes the behaviour
among all environments, including Linux.
The previous signature:
fs.PickFolder(defaultdirectory, freetext)
is replaced by:
fs.PickFolder(defaultdirectory, title, freetext)
The 'freetext' parameter is kept for backward
compatibility. It becomes obsolete. When present,
and 'title' is absent, its content is pushed
to the dialog's title.
The change is valid both for Basic and Python scripts.
The documentation should be updated accordingly.
Change-Id: I888ee4afa5046212081bbdedc849147ebda1a3bf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184719
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Idem https://gerrit.libreoffice.org/c/core/+/184662
for the progress bar.
Change-Id: Ife48d115d3e8acb81fe167a27542783f4ca25d25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184665
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
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 Close top-right cross
is done by LO correctly.
When the dialog is created from scratch,
a coded XTopWindowListener should do the job.
So far, the listener was activated for all dialogs.
Additionally the Console is a stored dialog.
When closed and relaunched, the processing
will now handle the window Close and
the built-in Close buttons identically, at
least apparently.
Change-Id: I29e0881989816fbf7e3e8bd12f59517bde4b3047
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184662
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
So far, an exception raised in a user script
and detected by ScriptForge gave next behaviour:
- an error message was displayed to the user (1)
- the same error message was recorded in the
console (2)
- the execution of the script was stopped (3)
The actual commit introduces 4 new properties
in the SF_Exception service.
Next two boolean properties may optionally
change above behaviour:
exception.ReportScriptErrors (default = True)
exception.StopWhenError (default = True)
They may change resp. behaviours (1) and (3).
Note that behaviour (2) is preserved anyway.
Their values are set until they are set
again or until the LO session expires.
When StopWhenError is set to False, next two
properties allow to test the success of the
last call to the ScriptForge API and to
define an appropriate action, including the
continuation of the process:
exception.ReturnCode
exception.ReturnCodeDescription
Example:
exc = CreateScriptService("Exception")
fs = CreateScriptService("FileSystem")
exc.ReportScriptErrors = False
exc.StopWhenError = False
fs.OpenTextFile("/aaa/bbb")
if exc.ReturnCode = "UNKNOWNFILEERROR":
...
The test on the return code must precede any
next call to any ScriptForge API entry.
The list of the available return codes is
listed in the SF_Exception.xba source code.
These changes are applicable both for Basic
and Python user scripts.
The user documentation should be reviewed.
Change-Id: I6d274e54ee37702f244e729ea5c9d1751b69abec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183486
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The latest version of APSO (1.4.4) introduces
a new positional argument in the
def console():
in apso_utile.py, named 'prettyprint'.
The def is used in
SF_Exception.PythonShell()
The absence of the argument caused
an exception/regression.
The actual patch makes above method compatible
with latest and previous versions of APSO.
No impact on user scripts.
No impact on user documentation.
Change-Id: I0a90112d441bba550b330925742e5021665ecee6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183265
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Returns the prefix used to name new documents
(in English = "Untitled ").
Improves the portability of scripts by making
them more language-agnostic.
Available for Basic and Python scripts.
The user documentation should be updated.
Change-Id: Ie3c06e25fdc30fc1c3c775ef6ebbcee1d9cd77cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183134
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The
ImportControl()
method copies a control stored in a dialog
to the actual dialog.
Like in:
dlg1 = CreateScriptService("Dialog", ...)
dlg2 = CreateScriptService("NewDialog", ...)
dlg2.ImportControl(dlg1, "thiscontrol", ...)
The additional arguments contribute to optionally:
- renaming the new control
- storing the new control in a specific page
- repositioning the control (offsetx and offsety args)
- including the OnEventxxx properties
One goal is to help defining individual smaller
dialogs in the IDE and inserting them in a larger
one, keeping them in separate pages.
The function works for Basic and Python user scripts.
The user documentation will have to be updated.
Change-Id: I6155f58d2e8706b73fc5f72c070bb8230cdd17ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182865
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
TabPageContainer-type controls are not supported
by the Basic IDE, while they are visually
attractive.
The current commit proposes the insertion
of such a control by code
dialog.CreateTabPageContainer(..., tabheaders, ...)
where tabheaders is simply an array of strings.
The originality of the approach is here to make
the link with dialog pages very easy:
OnTabSelected: define the script to trigger
when a tab is selected
Value: get or set the actual tab
Additionally, the TabPageContainer control is
associated with the SetPageManager() method.
Example on
https://gitlab.com/LibreOfficiant/scriptforge/-/snippets/4823173
The function is available for Basic and Python user scripts.
The documentation will need to be updated accordingly.
Change-Id: I7a1644344cad5f3739055f7e1eec69310ffa019c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182697
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Listeners programmed in Basic are created with
CreateUnoListener(prefix, listener)
The prefix argument determines the series of
routines run when an event is triggered.
So far, for SF internal listeners, the prefix
was chosen to minimize the risk of naming
collisions with routines present in user scripts.
In fact the prefix argument may be provided as
Library.Module.Prefix
which eliminates the risk of ambiguity or
homonymy.
With the actual change forcing the full
qualification of prefixes, the risk is reduced
from epsilon to zero.
No impact on the user documentation.
Change-Id: I95ef4beec80c89a074c8bec809f416479e64d8cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182384
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Next methods:
AlignRange() => TMBLCR
BorderRange() => LTRBUDHV
DecorateFont() => BUSI
receive a string argument describing
what they have to do.
Those arguments become case-sensitive: only
upper-case characters are considered.
Now:
calc.DecorateFont(range, decoration := "BI")
may be written as:
calc.DecorateFont(range, _
decoration := "Bold+Italic")
which improves the readability of user's scripts.
The functionality is available both in
Basic and Python scripts.
To be considered in the 25.8 documentation.
Change-Id: If241f7aef2e8cbfa5b7dd240e26489790a8cca13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182232
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Change-Id: I4a956e71e54051da58ef75e936106ba21bf501d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181894
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
|
|
Change-Id: Ia88014fd1eb18d3fb828a748aa890479a7a3272a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181893
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
So far only the SetCellStyle() method
provided means to modify cell formats.
The actual patch introduces next methods
to apply simple and common formats. For
other options use the XCellRange
UNO interface.
- calc.AlignRange(targetrange,alignment,...)
- calc.BorderRange(targetrange,borders,...)
- calc.ColorizeRange(targetrange,foreground,background,...)
- calc.DecorateFont(targetrange,fontname,fontsize,
decoration,...)
- calc.FormatRange(targetrange,numberformat,locale,...)
Extra arguments ("...") are:
FilterFormula: a Calc formula to select cells
FilterScope; CELL, ROW or COLUMN
to allow a kind of static conditional formats.
All methods are applicable to Basic and Python
user scripts.
This change will require an update of the
user documentation.
Change-Id: Ic824aebd763f2b55364c2c0bea17430f32512742
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181854
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
When a user script invokes CreateScriptService()
for a not yet used library, ScriptForge loads
the library and searches for the list of
services provided by that library.
The list can be found in a specific method
that the library must contain,
RegisterScriptServices()
in whatever module.
The exploration was done so far through a
ScriptProvider UNO service. This service includes
all programming languages, including Java,
even without Java being used. This caused
an inconvenient error message when Java
is disabled in the advanced options.
This service is now replaced by a
com.sun.star.comp.scripting.ScriptProviderForBasic
service. This gives a direct access to a lower
branch of the scripts tree and skips the Java issue.
All the changes are done in the
ScriptForge.SF_Services._FindModuleFrom Method()
function.
No change required in the user documentation.
Change-Id: I4a6820e5d1a379bf5b61c6077db8a9a382c1757d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181445
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The %enuHeaders property returns,
as an array/tuple of strings the list
of the menus present in the menubar.
This is a helper for the CreateMenu()
method:
- check if the menu exists already to
avoid duplicates
- ease the choice of the Before argument
The property is applicable to next classes:
- Document, and its subclasses
Base, Calc, Writer, FormDocument
- Datasheet
The property is made available to Basic
and Python user scripts.
This new property will require an update
of the user documentation/help
Change-Id: Ia14daf6c58973e06d576b350e416eb178f70feb3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181065
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
1) when in Python the event argument of
CreateScriptService('popupmenu', event)
is set to None, an error was raised
although not justified.
2) when
popupmenu.Execute(False)
is run and the user clicks outside the popup
menu, the doc says a zero-length string
should be returned. It retuned 0.
No impact on user documentation.
Change-Id: I4e1a1372800a728b994813b021f928fcf2b2603c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180960
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The contextmenu service handles the context
menus stored in a document. So far, it
provided only the AddItem() method to add
new items at the bottom of the menu.
The new method allows to forget the preconfigured
menu and to replace it completely.
Example: associate next Sub with the
on-right-click event of sheet 'Sheet1'
=> The custom menu appears when
right-clicking in column C, otherwise
normal behaviour
Sub OnRightClick1(Optional XRange)
' Xrange is a com.sun.star.table.XCellRange
Dim calc, menu, bColumn
Set calc = CreateScriptService("Calc", ThisComponent)
Set menu = calc.ContextMenus("cell")
menu.RemoveAllItems()
bColumn = ( Len(calc.Intersect("Sheet1.$C:$C", _
XRange.AbsoluteName)) > 0 )
If bColumn Then
menu.AddItem("A", Script := "vnd.sun.star.script:...&location=document")
...
End If
menu.Activate(bColumn)
End Sub
The function is available both for Basic and Python user scripts.
The user documentation will have to be reviewed.
Change-Id: I84ee8724bf99c37397a19d729133cc4686a63980
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180520
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The
calc.Intersect(range1, range2) method
computes the common area as a string
which is a sub-range of both input ranges.
It returns an empty string when the
sub-range is empty.
Potential use case: customizing a popup
or context menu depending on the presence
of the selected cell in a given area.
In addition, the A1Style() method returns
the sheetname in the output string only
when it is an explicit argument.
Changes are applicable both for Basic and
Python scripts.
They require an update of the user documentation.
Change-Id: I920fc8bee6dace9ceed263a0570b4c0197bc8cb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180479
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
In addition the VALIDATEREGEX message
is obsolete and removed from next
language files
modified: wizards/source/scriptforge/po/es.po
modified: wizards/source/scriptforge/po/fr.po
modified: wizards/source/scriptforge/po/pt.po
Change-Id: I67c2e5604e548870bf1bdceb9641d4802530e437
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180413
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Replace:
-"supporté" with "pris en charge"
-"tableau" with "matrice" when it's about an array
Change-Id: I7c91bece58da90beb8c9787c1310fcd235698402
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180306
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
modified: wizards/Package_scriptforge.mk
new file: wizards/source/scriptforge/po/es.po
Change-Id: Ia4d51b9dfaa75bf2f50bb5a11f7f8d465b106489
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180285
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: Ibc073d4167e9aa755a52ddcea412039925f4c0df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180187
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
modified: wizards/Package_scriptforge.mk
new file: wizards/source/scriptforge/po/fr.po
Change-Id: I4cb0c93c2c8b335d8319835a383255e02b9b04ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180143
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The
XReetangle(rangename)
property returns a com.sun.star.awt.Rectangle
structure describing the coordinates (in pixels)
on the screen where the given range is
located.
This opens the door to effective interactivity
in calc sheets with the use of popup menus.
Example:
r = calc.XRectangle("B2")
menu = CreateScriptService("PopupMenu", , _
X := r.X + r.Width/2, Y := r.Y + r.Height/2)
initializes a popup menu centered on the given
cell.
The property exists in Basic and Python.
The SF_Calc help page should be updated
according to the actual patch.
Change-Id: I2a97c5c7b5bf84d36a2aab5e4b822e30c9d53d8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180140
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The Methods() method returns the list of methods
present in each class.
It is unused so far (vs. Properties() is used
in the code) => a wrong list has no
consequences. It is however reserved for
future use.
The list was incomplete in Array class.
Change-Id: I3e0522d6669d2732c68e52e4021ffb5c8a3fb108
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180127
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Hard-coded version numbers are modified
from 25.2 to 25.8.
Many changes in po files due to the alphabetical
sequence of keys after the introduction of the
new "case-sensitive" keys feature.
Before this the dict.Keys() method delivered
the keys as an array in the order of creation.
No effect on actual user scripts.
Change-Id: Iee0c48eca22d17ad892278398c9125912b8b2b3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180120
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Change-Id: I0b9be4ea10c3837007158771fde46ad70e5c52a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177785
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The ExecuteCalcFunction() method is a wrapper
of the
com.sun.star.sheet.FunctionAccess::callFunction()
method.
This method accepts a broad variety of arguments
- scalars: numeric and strings only
- data arrays (= arrays os arrays)
- 2D arrays (1D arrays give errors)
- com.sun.star.table.XCellRange objects
depending on the called function and its
execution or not as an "array function".
The actual commit makes that the arguments passed to
session.ExecuteCalcFunction()
are checked as formally correct: scalars are filtered
as numeric or strings, dates and booleans are converted,
arrays are reshaped to 2D where necessary.
The actual change facilitates, as an example,
the use of complex array functions like XLOOKUP,
a powerful search engine on large data sets.
The implemented functionalities are valid in Basic
and Python.
The help documentation might be completed with
additional examples.
Change-Id: I6bba1e21828ef09c5c6f0463cbcfa1f5df695073
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177744
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I7066a328fa54c062d1a12582d4f270e70f466c32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177702
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
A data array is a 1D array of 1D subarrays.
All arrays are presumed zero-based.
Usages:
- the content of a range of Calc cells returned
by the UNO XCellRange.getDataArray() or
XCellRange.getFormulaArray() methods
- the output of SF_Session.ExecuteCalcFunction()
- a tuple of (sub)tuples returned by a Python script
3 methods are added to the Array service:
1) ConvertFromDataArray(DataArray, [IsRange], [FillValue])
Convert a data array to a scalar, a vector or a 2D array.
On request, the individual items are reduced
to strings or doubles only.
2) ConvertToDataArray(Data, [IsRange], [Rows], [Columns)
Create a data array from a scalar, a 1D array or a 2D array.
The returned data array is zero-based and compatible
with the XCellRange.DataArray property when IsRange = True.
3) ConvertToRange(Data, [Direction])
Create a valid cells range content from a scalar,
a 1D array, a 2D array or a data array.
The individual items are always reduced to strings
or doubles. Including booleans or dates.
The returned scalar or array is a valid argument
of the SF_Session.ExecuteCalcFunction() method.
They replace the internal _ConvertFromDataArray()
and _ConvertToDataArray() that were present in
the Calc service, called by SetValue(),
SetFormula() etc. methods.
This change is Basic only and has no effect in Python.
The documentation about the Array service
should be completed with these new 3 methods.
Change-Id: Idc5b6417648e4574b0f9c7c6e2438ff7dfce1829
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177620
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Change-Id: I993e30d3d228c639a69007a846b46f420f9297b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175097
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
1) Error handling in the ExecuteCalcFunction()
function must be conditioned by the global
error handling.
True; display a user-friendly message
False: abort on the erroneous line
So far, an ambiguous error message was displayed
in both cases.
2) Above ambiguous error message was corrupted
by the detour to SF_Array.Prepend() method
in exc.RaiseFatal() and exc.RaiseAbort().
A simple workaround fixes the ambiguity
about the name of the faulty routine.
Change-Id: Iab38b48e6291e1960fc288696a7ebd18ffe8ebae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175020
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Change-Id: I2d58d52d5f331ae9b3f3c4d3dc91d86c075c2a39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174968
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
The
exception.PythonShell()
method opens the APSO console.
It receives 2 additional arguments
background
foreground
which specify the back- and foreground colors
of the window to open as a Python console.
Typical use of the method:
exc.PythonShell({**globals(), **locals()}, \
background = 0x0, foregound = 0xFFFFFF)
opens the shell with all existing variables
loaded and with white characters on a black
background.
The default values are those set in APSO:
background = 0xFDF6E3
foreground = 0x657B83
No impact on existing scripts.
The current change requires to be completed with
the addition of the 2 arguments in the
adequate help page.
Additonal minor changes
- typo in scriptforge.pyi
- 'outsideprocess' replaced by 'remoteprocess'
Change-Id: I9b1be123f049aa39bd0d814b6dd63fcc4f4ea310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174897
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Introduction of a
ScriptForge.outsideprocess
property: when True the actual mode
is via socket or via pipe.
The property is for internal use only.
Once set it cannot be changed anymore.
Previous statements similar to
if ScriptForge.port > 0:
which returned True when socket mode
are replaced by a broader
if ScriptForge.outsideprocess:
No effect on user scripts.
Change-Id: Ice0efd8c2ab9925511fc8c6889cab714fd208ba1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174874
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Reference:
https://bugs.documentfoundation.org/show_bug.cgi?id=163219#c7
Everywhere the With block variable is defined
or redefined inside the With block, the Basic
code has been reviewed.
Found in
SFDatabases/SF_Database.xba/SetTransactionMode()
SFDocuments/SF_Document.xba/Styles()
ScriptForge/SF_Dictionary.xba/ImportFromPropertyValues()
ScriptForge/SF_UI.xba/SetStatusBar()
ScriptForge/SF_UI.xba/ShowProgressBar()
Most changes consist in isolating the With block
variable before the With block itself.
No functional change.
This solution is a workaround for the bug.
IT DOES NOT SOLVE THE ROOT CAUSE.
Change-Id: I48af29d3d9c8b1e36ef5a85c8cfe28f9639ae483
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174560
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Change-Id: Ieff7ec790c457b1f4f67544d3f300fc68723d5aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174393
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
To facilitate the debugging of the
ScriptForge Basic code called by the
python scripts, 2 methods have been
added to the ScriptForge() class:
- initializeRoot(force = False)
Initialize the global scriptforge
data structure.
- When force = False, only when
not yet done.
- When force = True, reinitialize it
whatever its status.
- errorHandling(standard = True)
Determine how errors in the ScriptForge
Basic code are handled. Either
- the standard mode, i.e. display a "crash" message
to the user
- the debugging mode, i.e. the execution stops
on the line causing the error
Example (cfr. tdf#162962)
from scriptforge import CreateScriptService, ScriptForge
sf = ScriptForge()
sf.errorHandling(False)
def testSF():
srv = CreateScriptService("Calc")
g_exportedScripts = (testSF,)
Change-Id: I25d7d8e36e71d95ff8a04191bb8344794886d69e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173458
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Python scripts using ScriptForge start like:
from scriptforge import CreateScriptService, \
ScriptForge
ScriptForge(...) (*)
sv = CreateScriptService(...)
The (*) statement has next syntaxes: either
(1) ScriptForge()
(2) ScriptForge(host: str = ..., port: int = ...)
(3) ScriptForge(pipe: str = ...)
Syntax (1) is implicit at the first invocation of
CreateScriptService() without a former call to
ScriptForge()
Syntax (2) exists in previous versions.
This commit implements syntax (3) to connect a Python
process to a LO process on the same system via a pipe
mechanism.
The change impacts only Python scripts.
The documentation should be upgraded to include
the new functionality.
Change-Id: I50457b6fffc8c9d6a9ad5c5289de1c363c6680e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173252
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I9e50718206fa2f139dca586688eb468667b28172
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173054
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
To enhance the compatibility between
- sf dictionaries
- python dicts
- arrays of PropertyValues
it was necessary to propose the support
of case-sensitive keys, i.e. keys are
different if a case-sensitive comparison
finds them different.
So far only not case-sensitive keys
were supported.
This required a re-visit of the implementation
of the ScriptForge.SF_Dictionary service. So far
it was built upon a Basic Collection class which
differentiates keys not case-sensitively. The
new implementation uses sorted arrays.
The invocation of the service is now:
dict = CreateScriptService("Dictionary", True/False)
True means case-sensitive keys.
Default = False, which preserves the compatibility
with the past.
ScriptForge uses dictionaries internally in
several places. For each of them it has been
assessed if the new attribute was justified
or not. For most of the contexts, it was.
The functionality makes sense only for Basic
user scripts.
The documentation of the Dictionary page
should be revised according to the new invocation
syntax.
Change-Id: If1f695bcbf1673a2b71c1e41487b1781caab71c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173044
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
When a document is closed inadvertently
by the user during a macro run, or between
two macros triggered by events, the actual
behaviour is an error message and a stop
of the execution of the macro.
As this can be counter-productive, the macro
may test at any moment if everything is ok
with the
IsAlive As Boolean (True = OK)
property applied on next service instances:
Document
Base
Calc
FormDocument
Writer
Datasheet
Dialog
The functionality is available both for
Basic and Python user scripts.
The user documentation should be completed
accordingly.
Change-Id: I0b055dacc06c9da70c611dbb4e7bf841160168fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172970
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Python only:
Reset a flag in SF_Database.DMin and DMax methods
to allow dates to be returned.
Review typing hints to accept strings and dates
Integration of remarks from Microsoft/VSCode
about minor syntax issues in scriptforge.pyi
(syntax was accepted by PyCharm).
Now, syntax commonly accepted by both IDE's.
Change-Id: I752d9f1d7a5293222d81748f8fb2e8f46f4317de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172912
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Since
https://gerrit.libreoffice.org/c/core/+/172600
a better categorization of properties
has been done between 4 distinct levels.
The SF_Platform and SF_TextStream services
still needed an update to avoid
redundancy on some of their properties.
A choice had to be made, either:
- put them in the serviceproperties dict
- or define them explicitly with @Property
Not both, for clarity.
Change-Id: I787c7e57235622abf5deb5c7fd42c4c28aa82ec8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172863
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Several minor changes
- comments
- 'cls' used where relevant i.o. class name
- dynamic getting/setting properties reviewed
- SF_Platform properties:
set level = 1 i.o. 0 when returned
by PythonHelper module
Change-Id: I4e9877bc16efd340dc14693833c032c998329b6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172836
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
When considering next python user script:
a = CreateScriptService(...)
a.prop = ...
print(a.prop)
print(a.prop)
so far, the evaluation of a.prop was done
either once or twice depending on
- a parameter of the class a is an instance of
- the read-only status of prop (True/False)
Now the recomputation of the expression
depends on a parameter of prop which can take
one of next values:
0: prop is read-only and not re-evaluated
1: prop is read-only but re-evaluated
f.i. because a user action can change its value
2: prop is editable and not re-evaluated
f.i. because it can be changed only by code
3: prop is editable and always re-evaluated
The change will decrease the number of useless
and more costly recomputations of properties.
Change-Id: I11412a58772147dab2e6b9b06c31477135932603
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172600
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
All arguments passed to ScriptForge methods
are checked for validity.
A.o. a string may be compared with a closed
list of allowed values.
The comparison may now optionally be made
with a
CaseSentitive As Boolean
parameter.
All occurrences where this check makes sense
were identified, inventoried and modified.
A True argument has been inserted where
appropriate.
Change-Id: I1a5cb7fb42618bc83fc8ec57c2727fc2a1bfcdb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172530
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
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
|
|
Comments needed to be made compliant with code
in relation to Calc sheet limits.
Change-Id: I67962540e484ab1d51bc79f8ee7e7a73f9f25a2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171872
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: Ib6cd9cceb41e7b741907cbdc05fe485004568ea7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171903
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
|