You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by Jörg Schmidt <jo...@j-m-schmidt.de> on 2015/06/17 09:43:47 UTC

need some help to Accelerators.xcu

Hello,

On the following page I find information on Accelerators.xcu:
https://wiki.openoffice.org/wiki/Framework/Article/Accelerators_Configuration

This works well so far, but I've noticed the changes of Keys in the area of a module (for example: <node oor: name = "com.sun.star.text.TextDocument">) only active if you are restarting openoffice.

Is there any way to avoid the need for the restart?

(In the specific case I a macro would suffice instead of using Accelerators.xcu.)


Greetings,
Jörg





---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: need some help to Accelerators.xcu

Posted by Amenel VOGLOZIN <wa...@yahoo.fr>.
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 <Ol...@gmx.de>
 À : 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-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org



  

Re: need some help to Accelerators.xcu

Posted by Jörg Schmidt <jo...@j-m-schmidt.de>.
> From: Oliver Brinzing [mailto:Oliver.Brinzing@gmx.de] 

> just found, that there is a service 
> "com.sun.star.ui.GlobalAcceleratorConfiguration"
> maybe this will work:

Thank you for the moment. I give feedback in a few days when I tried it.


Greetings,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: need some help to Accelerators.xcu

Posted by Oliver Brinzing <Ol...@gmx.de>.
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-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org


Re: need some help to Accelerators.xcu

Posted by Oliver Brinzing <Ol...@gmx.de>.
Hi Jörg,

 > Is there any way to avoid the need for the restart?

i am pretty sure (but maybe i am wrong) it will not work without restarting aoo.

you can try creating shortcuts via api, for example see attached document:
https://bz.apache.org/ooo/show_bug.cgi?id=71154

before you start, change "sMyCommand" to:

sMyCommand = "macro://./Standard.Module1.Test()"

and it should work.
	
Regards
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org