Page 1 of 1
[Solved] Macro to switch "mouse as pen" in Impress
Posted: Sat Mar 23, 2013 12:15 am
by Deemar
I'm looking for some sort of way to be able to turn the mouse as pen feature on or off in the middle of an Impress presentation. The method of using right click and selecting from the menu is undesirable, I'd prefer to do it another way. Does this macro exist somewhere already? Should I write it instead?
If I do have to write it I have a couple of questions. Do I need to write it in the macro generator or would I write it in a separate program and then run that program externally? Do I do this by importing the UNO API into Eclipse? I'm totally confused how this works, thanks.
Re: Looking for a macro to switch "mouse as pen" in Impress
Posted: Sat Mar 23, 2013 5:38 am
by hanya
Hi,
Code: Select all
Sub SwitchToUsePen
oController = ThisComponent.getPresentation().getController()
If NOT IsNull( oController ) Then
b = NOT oController.UsePen
oController.UsePen = b
If b Then
oController.PenColor = RGB(0, 255, 0)
End If
End If
End Sub
Store this code into Basic library and assign it to key combination.
I wonder is there any way to change line width of pen through API.
| Edit: Unused line was removed. No API is there, simply the attribute PenWidth is not exported through the API. |
Re: Looking for a macro to switch "mouse as pen" in Impress
Posted: Mon Mar 25, 2013 10:27 pm
by Deemar
Thank you, that code worked great except in order to use it, I need to right click and select 'mouse as pen' to get the pen out. Then my keyboard shortcut (CTRL+h) for the macro works perfect. It switches the pen on and off with ease. However I do have to right click and select that option before it works. Is there another line of code to add in order to switch it on without having to do that?
Re: Looking for a macro to switch "mouse as pen" in Impress
Posted: Mon Mar 25, 2013 11:09 pm
by Deemar
I got it, I just needed to click the slideshow to select the window. For some reason the slideshow isn't the focused window when it starts, you need to click it first. Weird.
From searching around the internet before this, I suspect there will be quite a few people finding this thread in a search and benefiting from your code. Thanks!