Age | Commit message (Collapse) | Author |
|
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>
|
|
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
|
|
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>
|
|
Many methods will require a "TextRange" as argument.
A textrange is a shortcut describing the scope
on which to apply the method.
Such a textrange corresponds either with a single
insertion point or with a (text) interval between
2 insertion points.
Multiple textranges are not supported in this context.
TextRange = a string containing one of next variants :
(names may be surrounded with single or double quotes)
"~" or "SELECTION" or "SEL" = current selection
(if multiple selections, its 1st component)
"BODY" = the main text of the actual document instance
"FRAME!name" = the text contained in a text frame
"BOOKMARK!name" = the given bookmark,
may be zero or more characters long
"FIELD!name" = a user text field
"SECTION!name" = the text contained in a section
"TABLE!name!cellrange" = a cell (cellrange = "B3")
"WORD+n" = n words after the current selection
"SENTENCE-n" = n sentences before the current selection
"PARAGRAPH" or "§" = the paragraph containing
the current selection (+0 is the default)
optionally combined with next control character:
"|": start or end of string
E.g.
"|~" = the point immediately before the current visible
selection (starting point)
"~|" = the point immediately after the current visible
selection (ending point)
"~", "|~|" = the full visible selection
Implemented properties in this commit:
Bookmarks
CurrentSelection
Fields
Frames
(More will follow)
Example: doc.CurrentSelection = "SECTION!sect01|"
=> the visible cursor is set at the end
of the given section
Change-Id: Ib2a2110e25b0a15cd95c782f6ba8b0db1052bf39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171832
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
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
|
|
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
|
|
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
|
|
Each component has its own set of toolbars, depending
on the component type (Calc, Writer, Basic IDE, ...).
In the context of the actual class, a toolbar
is presumed defined statically:
- either by the application
- or by a customization done by the user.
The definition of a toolbar can be stored
in the application configuration files
or in the current document.
Changes made by scripts to toolbars stored
in the application are persistent. They are valid
for all documents of the same type.
Note that the menubar and the statusbar
are not considered toolbars in this context.
A toolbar consists in a series of graphical
controls to trigger actions.
The "Toolbar" service gives access to the "ToolbarButton" service to manage
the individual buttons belonging to the toolbar.
The "Toolbar" service is triggered from next
services: Document, Calc, Writer, Base, FormDocument
and Datasheet. All those components might host toolbars.
Proposed properties in the Toolbar service:
BuiltIn
Docked
HasGlobalScope
Name
ResourceURL
Visible (r/w)
XUIElement
Proposed method:
ToolbarButtons()
Proposed properties in the ToolbarButton service:
Caption
Height
Index
OnClick (r/w)
Parent
TipText (r/w)
Visible (r/w)
X
Y
(The Height, Width, X, Y properties allow for
easy hook of a popup menu to tye button)
Proposed method:
Execute()
Both services are available both from Basic and Python user scripts.
An update of the dcumentation help is required.
Change-Id: I43cb523b52e3d6362994557d74c4ef9faa220507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147925
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
While a script is executed any display update
resulting from that execution is done immediately.
For performance reasons it might be an advantage
to differ the display updates up to the end of the script.
This is where pairs of Echo() methods to set
and reset the removal of the immediate updates
may be beneficial.
Optionally the actual mouse pointer can be
modified to the image of an hourglass.
Arguments:
EchoOn: when False, the display updates are suspended.
Default = True.
Multiple calls with EchoOn = False are harmless.
Hourglass: when True, the mouse pointer is changed
to an hourglass. Default = False.
The mouse pointer needs to be inside the actual
document's window.
Note that it is very likely that at the least
manual movement of the mouse, the operating system
or the LibreOffice process will take back
the control of the mouse icon and its usual behaviour.
The method may be called from any document, including Calc and
Writer, or form document.
It may be invoked from Basic and Python user scripts.
Echo() should be documented in the sfdocument.xhp help page.
Change-Id: I4d669f5e332131bd1b2efcd33b7a98b304796ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146258
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The SF_FormDocument service is focused on :
- The orchestration of Base form documents
(aka Base Forms, but this is confusing)
and the identification of and the access to their controls.
- Form documents are always contained in a Base document.
A form document may be opened either:
- via code or user interface from the Base file welcome page
- via code only, without having its Base container opened first
In any mode, a form document can be opened only in 1 single copy.
The FormDocument service is triggered either by
base.OpenFormDocument(...)
database.OpenFormDocument(...)
' Base file may be closed
ui.GetDocument(...)
Specific methods:
CloseDocument()
Forms()
GetDatabase()
PrintOut()
Next methods are inherited from the Document superclass:
Activate()
CreateMenu(), RemoveMenu()
ExportAsPdf()
RunCommand()
SaveCopyAs()
SetPrinter()
As a consequence, next methods remain available
but should be declared as deprecated in the help:
base.CloseFormDocument()
base.Forms()
base.PrintOut()
base.SetPrinter()
Above changes have several more minor impacts :
- beside IsCalc, IsWriter, ... , a new IsFormDocument property
- the UI service identifies open form documents
- a new service means a new entry to register
in the Services catalog
- management of form events has been reviewed
- the connection between Base, FormDocument, Form
and Database services is reinforced
- menus were available on components, now also on sub-components
The new service is available for both Basic and Python user scripts.
It requires in the help
- a new sf_formdocument page
- a review of the sf_base, sf_database, sf_form, sf_ui pages
Change-Id: Ib06d1c4565ca093af2f068fa5b8082082641752e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145080
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
The ImportFilters and ExportFilters properties
of the Document, Calc and Writer services
return a zero-based array (Basic) or a list (Python)
of all filters available for the current document
instance.
These properties are NOT applicable to Base documents.
ImportFilter contains the filters flagged for import
or for Import/Export. Idem for ExportFilters.
Both lists overlap each other partially.
The filter selection is done thanks to the
- filter type, to be compared with the Identifier of
the document's component
- filter flags, last 2 bits determine the import or export
orientation
The filter names are potential arguments of the OpenDocument()
and SaveAs() methods (and alike).
Both properties are callable from Basic and Python user scripts.
Change-Id: I8ce5312a58a013bc7e1e68101ff9f50f3233155d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131106
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
To allow object introspection and some help
files automatic generation (see Telegram discussions),
the possibility to make the list of properties
and methods used in Basic available in Python
has been requested.
These changes are for internal use only.
Main changes:
- the SFServices parent class receives new basicproperties()
and basicmethods() methods
- Basic PythonDispatcher() is adapted to provide the lists to
the Python caller
- Methods lists are reviewed in SFDocuments to NOT include
the methods implemented in the parent SF_Document class, to
avoid redundant entries in the list
Change-Id: I80758e225b039426b46f52dd67efe54c50f9f31e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129969
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Next wiki page
https://wiki.documentfoundation.org/Development/DispatchCommands
facilitates the use of commands with the
DispatchHelper service, including with arguments
This commit
- adds the RunCommand() method in the Session service
- extends the scope of existing RunCommand() methods
for the Document, Base, Calc and Writer services
with the addition of command arguments
Syntax by examples:
(Basic)
session.RunCommand("BasicIDEAppear", _
"Document", "LibreOffice Macros & Dialogs", _
"LibName", "ScriptForge", _
"Name", "SF_Session", _
"Line", 100)
(Python) (1)
session.RunCommand("BasicIDEAppear",
"Document", "LibreOffice Macros & Dialogs",
"LibName", "ScriptForge",
"Name", "SF_Session",
"Line", 100)
(Python) (2)
session.RunCommand("BasicIDEAppear",
Document = "LibreOffice Macros & Dialogs",
LibName = "ScriptForge",
Name = "SF_Session",
Line = 100)
Change-Id: I60cd5eb1ed0a057420215ce7aebe92b2aafabd53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129175
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Display a menu in the menubar of a document (form document to be done)
After use, the menu will not be saved neither in the application settings,
nor in the document. The menu setting does not affect the modified status of the
document.
The menu will be displayed, as usual, when its header in the menubar is clicked.
When one of its items is selected, there are 3 alternative options:
- a UNO command (like ".uno:About") is triggered
- a user script is run receiving a standard argument defined in this service
- one of above combined with a toggle of the status of the item
The menu is described from top to bottom.
Each menu item receives a numeric and a string identifier.
Each menu item may be decorated with a tooltip and/or an icon.
The AddItem(), AddCheckBox() and AddRadioButton() methods, when
coompared with their equivalents in the SF_PopupMenu service,
receive 2 additional arguments: Command and Script.
The various document services receive 2 additional methods:
CreateMenu(), returning a Menu service instance
RemoveMenu()
Very short example:
menu = doc.CreateMenu("My menu", Before := "Help")
menu.AddItem("First Item", Command := "About")
menu.AddItem('2nd Item", Script := "... URI notation ...")
menu.Dispose() ' Once set the menu object may ve erased, listeners stay tuned
Later in the lifecycle of the document, one may run:
doc.RemoveMenu("My menu") ' doc.RemoveMenu("File") works as well !!!
All the functionalities are available both in Basic and Python user scripts.
Change-Id: Iabd157573693e9648fcb06d36c90af9a22b17a6c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126309
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Next methods are introduced in SF_Session:
- GetPDFExportOptions to extract a dictionary of the
40+ existing options for PDF export
- SetPDFExportOptions to update the existing options
When applied the options are permanent also for user manual exports
Those methods are not available in Python.
Next method to export a document to PDF:
- ExportAsPDF: it uses the options set above and/or takes
next specific and transitional options:
pages, password, watermark
This method is implemented for use from Basic and Python
Change-Id: Ic5c4190cff579e62137930f422638aad98e61a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120740
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The PrintOut() method launches the printing of a
LO document to a printer previously defined by default,
by the user or by the SetPrinter() method.
It is applicable on any document, on a Calc sheet, a Base form
document. For a Writer document specific arguments may
be provided.
Implemented both for Basic and Python user scripts.
Change-Id: I51ce897b66d3e5624cec97a46e5eb28d9132357a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118786
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The SetPrinter() method is applicable to any document type,
except Base documents.
It is also applicable to Base form documents with an
additional "FormDocument" argument.
Implemented in Basic and in Python.
The method defines next printer settings:
- the printer name
- the orientation
- the paper format
The settings are kept per document or form document
To bypass array management troubles in Basic,
the SF_Utils._SetPropertyValue() Sub is converted to a Function.
(no user scripts impact, only internal use).
Change-Id: I39290d924646ff3b2a65a6d9282f1265ca7543b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118685
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The Forms() method was placed in the SF_Document service
but was applicable only on Writer documents
Now it is placed correctly in the recently created Writer service.
Effective in Basic and Python.
Additionally redundant parentheses have been removed in scriptforge.py
Change-Id: I0d328b40577ddf81a188fdf72611f84751bcb506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118559
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Addition of the skeleton of the new SF_Writer service
as a subclass of SF_Document.
Entry points in CreateScriptService are provided
both for Basic and Python user scripts.
Full compatibility with existing user scripts.
Specific properties and methods will be provided in later
commits.
Change-Id: Ib00a9ea52023707d1429e8ad9dcb4dca2ca63174
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118515
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|