Description: Menu created in the Calc application by ScriptForge in Basic module collapsed after insert into document any OLE object (Formula) or Chart Steps to Reproduce: 1. Create menu by ScriptForge 2. Insert chart into document Actual Results: Menu is collapsed Expected Results: Menu should stay Reproducible: Always User Profile Reset: No Additional Info: The menu can be restored by re-running the macro that created it
According to the documentation in [1]: When OLE objects such as Math formulas or Calc charts are edited from within a document, LibreOffice reconfigures the menubar according to the object. When this happens, the menus created with the Menu service are removed and are not be restored after editing the OLE object. [1] https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_menu.html Unfortunately the menu created by the Menu service is not persistent after opening and closing an OLE object. @JPL is there any room for improvement here?
There is no solution, indeed, within ScriptForge. After creation and configuration, a menu is disposed. It is kept nowhere for occasional restores. There is a mean to not create a menu twice: precede each CreateMenu() with a RemoveMenu(). The latter simply returns True (the menu existed) or False (the menu was not found) and does not complain when not found. In the future we can imagine a kind of doc.MenuExists(menuname) method if there is a real pain. In the meantime I recommend the NOTABUG status. I let you the final decision, Rafael.
This can be marked as NAB indeed, since there's nothing broken. Let's just wait and see the OP's opinion.
As a workaround, the OP could try to associate the macro that creates the menu with the OnFocus document event. When the OLE object window is closed, the original document gets back the focus and triggers the OnFocus event.
I made a temporary workaround with no ScriptForge. You can see the details at https://sourceforge.net/projects/criterial/
(In reply to Igor Gaidyshev from comment #5) > I made a temporary workaround with no ScriptForge. You can see the details > at https://sourceforge.net/projects/criterial/ This is great work! I took a look at your code, and you should pack it as an extension. When you do it as an extension, you can define which menu entries to be created, so there's no need for user intervention to install the files and create the menu entries. See the following links to learn more: https://wiki.documentfoundation.org/Development/Create_a_Hello_World_LibreOffice_extension https://wiki.documentfoundation.org/Development/Extension_Development And for a very detailed documentation: https://wiki.documentfoundation.org/Documentation/DevGuide/Extensions I'm closing this as NAB.
Thanks for your advice and attention. To hide the complexity for users, the application now includes scripts for fully automatic installation and removal of the application for Linux/UNUX and Windows, respectively.