[Solved] Bind to key: Coooder

Discussions about using 3rd party extension with OpenOffice.org
Post Reply
User avatar
Agilar
Posts: 85
Joined: Mon Oct 04, 2010 6:51 pm

[Solved] Bind to key: Coooder

Post by Agilar »

Coooder is an extension to color selected text as a given programming language.

When You install it, a small toolbar button appears, when You click that - it asks You which language to color the text.

I want to bind invocation of that diaolog to a hot key. Or even better - to bind "color region in python" automatically.

The problem is - Coooder does not appear in the LibreOffice Basic list. My research suggests that

Code: Select all

service:org.openoffice.coooder.ui.ParseTrigger?execute
command invokes the diaolog. But I don't know how to run such a thing.
Last edited by Agilar on Mon Sep 10, 2012 11:39 am, edited 1 time in total.
LibreOffice 4.1.2.3 on Kubuntu 14.04
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Bind to key: Coooder

Post by hanya »

There are many ways to call it.
- Modify file for key settings by hand or change it using macro.
- Execute the command by macro.
- Create configuration file for the key combination, pack it into extension package and install it.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
User avatar
Agilar
Posts: 85
Joined: Mon Oct 04, 2010 6:51 pm

Re: Bind to key: Coooder

Post by Agilar »

I tried with macro recorder -- but it doesn't work. I can't find a way to 'modify key by hand'.
LibreOffice 4.1.2.3 on Kubuntu 14.04
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Bind to key: Coooder

Post by hanya »

Or even better - to bind "color region in python" automatically.
Hm, it seems I have not read your post well.
Here is an example to highlight selected part of the text in specific language on Writer document. This can not be done without writing the macro, so assign the following macro to your desired key combinations.

Code: Select all

Sub COOoderInPython
  ExecuteCOOoder("python")
End Sub

Sub ExecuteCOOoder(sLanguage As String)
  oLanguage = org.openoffice.coooder.theLanguagesManager.get(GetDefaultContext()).getLanguage(sLanguage)
  If NOT isNull(oLanguage) Then
    oHighlighter = CreateUnoService("org.openoffice.coooder.Highlighter")
    oHighlighter.Language = oLanguage
    oHighlighter.parse(Null)
  End If
End Sub
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
User avatar
Agilar
Posts: 85
Joined: Mon Oct 04, 2010 6:51 pm

Re: Bind to key: Coooder

Post by Agilar »

It works. Thank You so much. I'm now thinking about what key to use. It's sad LibreOffice doesn't have prefix keys the way Emacs has.
LibreOffice 4.1.2.3 on Kubuntu 14.04
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Bind to key: Coooder

Post by hanya »

Agilar wrote:It works. Thank You so much. I'm now thinking about what key to use. It's sad LibreOffice doesn't have prefix keys the way Emacs has.
Some people tried to make the office key settings match with of Emacs and Vim keys. Prefix keys of Emacs and most of movement keys of Vim can not be assigned by normal key configuration.
I have tried to make an extension for Vim key combination using the way to track key operations on Writer document. It worked well but It was disrupted because of the most view function can not be implemented.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
User avatar
Agilar
Posts: 85
Joined: Mon Oct 04, 2010 6:51 pm

Re: [Solved] Bind to key: Coooder

Post by Agilar »

But my problem is easier. I simply don't have enough keys. Not that all my keys are taken - but I want different set of keys for all common functions. For example for COOoder I'd set

C-c b - bash
C-c l - lisp
C-c p - python
C-c t - tex

I've set them to C-M-S-.. instead, but C-M-S- already have non-COOoder keys, which I don't like. This makes things harder to remember.

Thank You again for Your help, and even for Your effort on making LO vim-like keybidings. Actually, I make emacs bindings, resemble LO ones, for example I have C-a for select all. And a number of others.

Actually LO is no good for storing source code. I'm now migrating to Sphinx for that.
LibreOffice 4.1.2.3 on Kubuntu 14.04
Post Reply