summaryrefslogtreecommitdiff
path: root/wizards/source/sfwidgets
AgeCommit message (Collapse)Author
2024-09-08ScriptForge (Dictionary) support case-sensitive keysJean-Pierre Ledure
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>
2024-08-24ScriptForge (SFWidgets) new ContextMenu serviceJean-Pierre Ledure
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
2023-12-25ScriptForge - Upgrade to version 24.8Jean-Pierre Ledure
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-03-14ScriptForge (SFDialogs) make On properties editableJean-Pierre Ledure
A dialog box and its controls may be associated with scripts triggered by events (mouse moved, key pressed, ...). The link is usually preset in the Basic IDE when the dialog is designed. So far, ScriptForge did not offer the setting of a link event-script by code. The actual commit removes this limitation: every On-property related to either a dialog or a dialog control is now editbale. With the important precision that such a property may be updated ONLY IF it was NOT PRESET in the Basic IDE. Static (IDE) and dynamic (by code) definition of a specific On property on a specific dialog or on a specific dialog control are mutually exclusive. The new capacity may be used both in Basic and Python scripts. A short update of the help texts (dialog and dialogcontrol) is needed with mention of above restriction. Change-Id: Ia078aaab317ced7ade7ce69694504013f8e768a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148800 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
2023-03-01Fix typoAndrea Gelmini
Change-Id: I53e2a2f57ca1f00a07c62918e6e34c57a53fdcf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148022 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-01Fix typoAndrea Gelmini
Change-Id: I7a1302f472473171b31a4c2b21c9bfbfe1517904 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148020 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-28ScriptForge (SFWidgets) new Toolbar and ToolbarButton servicesJean-Pierre Ledure
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
2023-01-05ScriptForge - (SFDocuments) new FormDocument serviceJean-Pierre Ledure
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
2022-11-05ScriptForge - (SF_Datasheet) new menu methodsJean-Pierre Ledure
Next 2 methods are added: CreateMenu() RemoveMenu() They allow the addition of a menu entry in the menubar of datasheets in the same way as in documents. The implementation required to make the SFWidgets.SF_Menu SFWidgets.SF_MenuListener SFWidgets.SF_Register classes and modules more generic to be applicable in several contexts. In addition, 2 properties are added: DatabaseFileName ParentDatabase to better identify the database from which the datasheet is derived. New properties and methods are applicable both for Basic and Python user scripts. Change-Id: Iac6318287e89b18810a53ec5928a68e921ea96db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142285 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins
2022-04-13Update remaining DevGuide wiki links.Ilmari Lauhakangas
My Kate editor decided to do some whitespace cleanup, but maybe it's fine as the main changes are not targeting functional bits anyway. Change-Id: I5292e77e43055f94a6256a7f72d49fd59287d194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132928 Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-04-05ScriptForge - (SF_Utils) new _VarTypeObj() methodJean-Pierre Ledure
The method is for internal use by the ScriptForge core only. The only argument is an object with VarType() = V_OBJECT. The purpose is to inspect thoroughly the argument and to return a Type _ObjectDescriptor iVarType As Integer sObjectType As String End Type The iVarType indicates if the object is either - a UNO object => sObjectType contains the UNO type ("com.sun.star. ...") - a ScriptForge class instance => sObjectType contains the class - another Basic object - Nothing (different from Null) Several existing methods benefit from the new method and are part of the commit. No effect on help pages. No effect on Python code. Change-Id: I69565d335b3aeb7c08c48cbccfc13d3d82f11ae1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132525 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-12-06Fix typosAndrea Gelmini
Change-Id: I16d59aa3a3f17764a848428a2e6b206dc57a480a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126325 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-12-03ScriptForge - (SFWidgets) new SF_Menu serviceJean-Pierre Ledure
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>
2021-11-11ScriptForge - (SFWidgets) fix New PopupMenu without eventJean-Pierre Ledure
Invoking the service without an event object was supposed to work. For instance: Dim myPopup As Object Set myPopup = CreateScriptService("PopupMenu", , 300, 300) This would create the PopupMenu in position (300, 300) without an event object... however this does not work. Getting an error saying that "Event is EMPTY" => Add an IsEmpty() test. Change-Id: I86a1baf83264921088facbd35bf8fa299a5aa132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125005 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-11-04ScriptForge - (SF_PopupMenu) Fix com.sun.star.awt.MenuItemStyle.AUTOCHECKJean-Pierre Ledure
To have checkboxes displayed correctly in KDE, it is necessary to use com.sun.star.awt.MenuItemStyle.CHECKABLE instead. No regression in behaviour observed so far in other environments. Change-Id: If15b2ff597f1cdffe2df65fe2352ffef0f770cb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124639 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2021-10-16Fix typoAndrea Gelmini
Change-Id: I66712db3b74e45728e3104c24823a962fd498037 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123677 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-16Fix typoAndrea Gelmini
Change-Id: I101231dc8daa99254a086bd635817e20c23a8ff4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123679 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-15ScriptForge - new SFWidgets library, new PopupMenu serviceJean-Pierre Ledure
The SFWidgets library is intended to host the Toolbar, ToolbarControl (both future) and PopupMenu services. A popup menu is usually triggered by a mouse action (typically a right-click) on a dialog, a form, or one of their controls. In these cases the menu will be displayed below the clicked area. When triggered by other events, including in the normal flow of a user script, the script should provide the coordinates of the topleft edge of the menu versus the actual component. The menu is described from top to bottom with next methods: AddItem() AddCheckBox() AddRadioButton() Example: .AddCheckBox("View>Toolbars>Dialog") .AddCheckBox("View>Toolbars>Find", Status := True) .AddCheckBox("View>Status Bar", Status := True) .AddItem("View>Full Screen", Name := "FULLSCREEN") The SubmenuCharacter (Default = ">") is modifiable. Each menu item receives a numeric and a string identifier. The execute() method returns the item selected by the user. The service is available both from Basic and Python user scripts. The commit includes the review of build files to include the new library and the new modules. Change-Id: I2940be25313cc8fff7b337766edd348b04a20584 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123654 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>