Re: Registration of an accelerator at extension installation
Hi Amenel, you can use an Accelerators.xcu file in you extension, for example: [...] service:my.extension.Service?myParam1 and register it during extension installation, for example add to the manifest.xml of your extension. your service has to implement the "com.sun.star.task.XJobExecutor" Interface with the trigger(string Event ) method. if you want your extension being instantiated during aoo startup, implement the "com.sun.star.task.XJob Interface" with it's execute(NamedValue[] args) method. add a Jobs.xcu, for example: https://wiki.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Configuration xmlns:oor="http://openoffice.org/2001/registry"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> my.extension.Service and register in "manifest.xml" manifest:media-type="application/vnd.sun.star.configuration-data" /> Regards Oliver - To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org
Re: need some help to Accelerators.xcu
Oliver, I have followed your Basic code below and adapted it to Java and I can confirm that it works for the intended purpose of binding a shortcut key to an extension command. Thank you. De : Oliver Brinzing À : api@openoffice.apache.org Envoyé le : Mercredi 17 juin 2015 20h36 Objet : Re: need some help to Accelerators.xcu just found, that there is a service "com.sun.star.ui.GlobalAcceleratorConfiguration" maybe this will work: Sub Main oGlobalAccelCfg = createUnoService("com.sun.star.ui.GlobalAcceleratorConfiguration") Dim aKeyEvent as new com.sun.star.awt.KeyEvent aKeyEvent.KeyCode = com.sun.star.awt.Key.F11 aKeyEvent.Modifiers = com.sun.star.awt.KeyModifier.MOD1 oGlobalAccelCfg.setKeyEvent(aKeyEvent, "vnd.sun.star.script:Standard.Module1.ShowMsgBox?language=Basic&location=application" ) oGlobalAccelCfg.store() End Sub Sub ShowMsgBox MsgBox("Hello World!!!") End Sub - To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org
Registration of an accelerator at extension installation
Hi, Thanks to a recent post to this mailing list, I have been able to bind a shortcut key, a.k.a accelerator, to a command of my extension. However, I am facing the problem that the accelerator becomes active only when the main window of the extension is opened or put differently, when the extension is instantiated. Since the role of the accelerator is to open that very window, something feels missing here. I'm wondering whether there is a post-installation hook for extensions that I could exploit and in which I would register the accelerator to the global configuration? Note that this is different from what Jörg Schmidt wrote on 2015-06-17 because unless the extension has been opened by the user, the accelerator won't be registered: restarting AOO several times is useless in this context if the extension hasn't been launched. Thank you.