From 8a4ee0fb39dfabb590fb2b12c87f545da664e449 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Ledure Date: Sat, 24 Aug 2024 15:58:34 +0200 Subject: 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 Tested-by: Jenkins --- wizards/source/sfdocuments/SF_Writer.xba | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'wizards/source/sfdocuments/SF_Writer.xba') diff --git a/wizards/source/sfdocuments/SF_Writer.xba b/wizards/source/sfdocuments/SF_Writer.xba index d71df30135cc..a7fce5fe9840 100644 --- a/wizards/source/sfdocuments/SF_Writer.xba +++ b/wizards/source/sfdocuments/SF_Writer.xba @@ -654,6 +654,13 @@ Public Function CloseDocument(Optional ByVal SaveAsk As Variant) As Boolean CloseDocument = [_Super].CloseDocument(SaveAsk) End Function ' SFDocuments.SF_Writer.CloseDocument +REM ----------------------------------------------------------------------------- +Public Function ContextMenus(Optional ByVal ContextMenuName As Variant _ + , Optional ByVal SubmenuChar As Variant _ + ) As Variant + ContextMenus = [_Super].ContextMenus(ContextMenuName, SubmenuChar) +End Function ' SFDocuments.SF_Writer.ContextMenus + REM ----------------------------------------------------------------------------- Public Function CreateMenu(Optional ByVal MenuHeader As Variant _ , Optional ByVal Before As Variant _ @@ -1166,4 +1173,4 @@ Private Function _Repr() As String End Function ' SFDocuments.SF_Writer._Repr REM ============================================ END OF SFDOCUMENTS.SF_WRITER - + \ No newline at end of file -- cgit