[Solved] Packaging right-click context menus in an extension
[Solved] Packaging right-click context menus in an extension
I am developing a programming tool extension on the Windows 10 version of Libre Office 6.3 and have run into a difficulty packaging the macros and related menu/toolbar/context menu components into an extension. While I have been able to add menu and tool bar changes using ADDON.XCU xml, specifications, I have been unable to find a method of packaging my context menu changes.
Below is an example of the type of context menu change I would like to package, highlighted and circled:
Ideally, I would like to include these changes as something similar to the specification used for adding and merging menus and toolbars in the extension package.
Alternatively, I would be open to building these menus dynamically, using a basic macro, if someone can point me to appropriate documentation and/or examples.
Does anyone know of documentation, posts or examples explaining how to accomplish this using either of these techniques, or can suggest another method of modifying context menus from an extension.
Thanks in advance – david.
Below is an example of the type of context menu change I would like to package, highlighted and circled:
Ideally, I would like to include these changes as something similar to the specification used for adding and merging menus and toolbars in the extension package.
Alternatively, I would be open to building these menus dynamically, using a basic macro, if someone can point me to appropriate documentation and/or examples.
Does anyone know of documentation, posts or examples explaining how to accomplish this using either of these techniques, or can suggest another method of modifying context menus from an extension.
Thanks in advance – david.
Last edited by Hagar Delest on Fri Feb 07, 2020 11:00 pm, edited 1 time in total.
Reason: tagged solved
Reason: tagged solved
Libreoffice 6.3 on Windows 10
Re: Packaging right-click context menus in an extension
Don't know about extensions but for information on intercepting context menus:
https://wiki.openoffice.org/wiki/User:A ... ementation
viewtopic.php?f=45&t=81436
An alternative to modifying the context menu might be to use a mouse handler and have a menu that pops up when you right click with a modifier key (eg shift + right click).
Edit: Or a keyboard shortcut of course.
https://wiki.openoffice.org/wiki/User:A ... ementation
viewtopic.php?f=45&t=81436
An alternative to modifying the context menu might be to use a mouse handler and have a menu that pops up when you right click with a modifier key (eg shift + right click).
Edit: Or a keyboard shortcut of course.
Last edited by JeJe on Tue Feb 04, 2020 12:26 am, edited 1 time in total.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Packaging right-click context menus in an extension
I would think that LibreOffice can do that because LibreOffice lets you customize context menus just like main menues and toolbars.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Packaging right-click context menus in an extension
Another advance from LibreOffice! Someone asked a similar question about a year ago but got no answer
https://ask.libreoffice.org/en/question ... extension/
LibreOffice 6.2 API Documentation would be the place to look maybe:
https://api.libreoffice.org/
Edit:
Java ContextMenuInterceptor example:
https://api.libreoffice.org/examples/De ... mples.html
https://ask.libreoffice.org/en/question ... extension/
LibreOffice 6.2 API Documentation would be the place to look maybe:
https://api.libreoffice.org/
Edit:
Java ContextMenuInterceptor example:
https://api.libreoffice.org/examples/De ... mples.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Packaging right-click context menus in an extension
Thanks for the responses.
I will investigate the context menu strategy.
It does not appear that anyone answered the similar question posed last year, but given the ability to package tool bars and menus, one would think that the ability to package context menus would be offered as well. Does anyone have any information indicating that this can not be done with the current release of the software?
I will investigate the context menu strategy.
It does not appear that anyone answered the similar question posed last year, but given the ability to package tool bars and menus, one would think that the ability to package context menus would be offered as well. Does anyone have any information indicating that this can not be done with the current release of the software?
Libreoffice 6.3 on Windows 10
Re: Packaging right-click context menus in an extension
https://libreoffice.org/ is the successor to OpenOffice. SInce many years OpenOffice is no longer under active development.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Packaging right-click context menus in an extension
I did find an acceptable solution for this issue and while it works in my case, it may not be universally applicable.
In LibreOffice 6.3.4.2, I was able to package all of the menu, toolbar and context menu customizations in a template which I then load when initializing the code for my extension. The only issue that I encountered was, what I think is a bug in the toolbar customization where icons are corrupted when scoping the toolbar customs at the document level. It is possible to replace the corrupted icon file with a sound file and repack the template though it adds a bunch of steps to the packaging process. Alternatively, tool changes and menu changes could be packaged using the traditional methods while just packaging the context menus in a template.
While this works in my case, I do not expect that this solution will work for everyone - it would be nice to have a documented way of packaging context menu changes and also notebook bar changes.
In LibreOffice 6.3.4.2, I was able to package all of the menu, toolbar and context menu customizations in a template which I then load when initializing the code for my extension. The only issue that I encountered was, what I think is a bug in the toolbar customization where icons are corrupted when scoping the toolbar customs at the document level. It is possible to replace the corrupted icon file with a sound file and repack the template though it adds a bunch of steps to the packaging process. Alternatively, tool changes and menu changes could be packaged using the traditional methods while just packaging the context menus in a template.
While this works in my case, I do not expect that this solution will work for everyone - it would be nice to have a documented way of packaging context menu changes and also notebook bar changes.
Libreoffice 6.3 on Windows 10
Re: [Solved] Packaging right-click context menus in an exten
LibreOffice has three different icon sizes for toolbars so to be compatible with all options your customization should provide icons for each... just mentioning that in case it might have something to do with your icon problems.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: [Solved] Packaging right-click context menus in an exten
Great you have solved it, but I don't understand how you did it.
How could you design a context menu entry? shown in your picture.
Next what do mean by template? What kind of file are you working with?
How could you design a context menu entry? shown in your picture.
Next what do mean by template? What kind of file are you working with?
Apache Open Office 4.1.9 Windows 10
Re: [Solved] Packaging right-click context menus in an exten
If you don't know what a template is, you never used any office suite of the past 30 years.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Packaging right-click context menus in an exten
I don't understand how menus are related to templates unless we are talking about special templates used for extensions.
Another possibility is that he has added the menu entries through the tool-> customize functionality.
I have not seen how you can add a right click context menu in an addons.xcu. So if he has done that I would like to know.
Another possibility is that he has added the menu entries through the tool-> customize functionality.
I have not seen how you can add a right click context menu in an addons.xcu. So if he has done that I would like to know.
Apache Open Office 4.1.9 Windows 10
Re: [Solved] Packaging right-click context menus in an exten
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: [Solved] Packaging right-click context menus in an exten
Like MS Office, OpenOffice allows you to customize toolbars and menu entries specific to a document class (template). Just declare that you want to save the customization in the current document instead of the global settings.DavidBo wrote:I don't understand how menus are related to templates unless we are talking about special templates used for extensions.
Another possibility is that he has added the menu entries through the tool-> customize functionality.
I have not seen how you can add a right click context menu in an addons.xcu. So if he has done that I would like to know.
Keyboard shortcuts would be too confusing, therefore you can't define shortcuts for specific documents. LibreOffice added the ability to customize context menues. This way you create a template with or without macro code that serves a special purpose (reporting, data entry, form letters etc.) with menues and toolbars adjusted to the specific task. This is sooo 90ies but 1% of office users may be still able to utilize stuff like this.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice