I just noticed that the "Start Application"
and "Close Application"
events are not listed anymore in the "Tools:Customize:Events"
tab.
Likewise it appears that some other Application events are also missing ( see screenshot ).
In my previous versions of LibreOffice the “Start Application” and “Close Application” events used to be available, my current version is 5.3.1.2.
- Is this normal for version 5.3.1.2 running on Ubuntu 17.04 ?
- How can i get the “Start Application” and “Close Application” events back into the Event list ?
Thanks in advance, lib.
EDIT 2017-09-14
Further findings:
-
At this moment, the “Start Application” and “Close Application” events are still missing from the list of events on the dialog “Tools : Customize… : Events ( LibreOffice )”.
The event names for these two events are stated here as “OnStartApp” and “OnCloseApp” respectively. -
The same two events ( “OnStartApp” and “OnCloseApp” ) are also missing from the list of events returned by the GlobalEventBroadcaster’s function getEvents().getElementNames().
-
However, when i programmatically assign a script to the “OnStartApp” event using the GlobalEventBroadcaster’s function getEvents().replaceByName(), then
- .getEvents().hasByName( “OnStartApp” ) returns True,
- .getEvents().getByName( “OnStartApp” ) returns a property set containing the correct script uri that i assigned,
- and the assigned script is succesfully called when the application starts.
Yet after assigning the script in this way, it is still not listed in .getElementNames() nor in the GUI.
EDIT 2
i could set the application event using this macro:
set_Application_Event( "OnStartApp", "Standard", "LibreOffice", "Open_Most_Recent_Document" )
Sub set_Application_Event( sEventName as String, sLibrary As String, sModule As String, sFunction As String )
REM Connects the specified Application Event to the specified Basic macro.
REM <sEventName>: The Name of the Application Event to connect a macro to.
REM <sLibrary> : The Name of the Library that contains the module <sModule>.
REM <sModule> : The Name of the Module that contains the method <sFunction>.
REM <sFunction> : The Name of the Method to be connected to the specified Application Event.
Dim aProps(1) As New com.sun.star.beans.PropertyValue
aProps(0).Name = "EventType"
aProps(0).Value = "Script"
aProps(1).Name = "Script"
aProps(1).Value = "vnd.sun.star.script:" & sLibrary & "." & sModule & "." & sFunction & "?language=Basic&location=application"
Dim oGlobalEventBroadcaster As Object
oGlobalEventBroadcaster = GetDefaultContext().getByName( "/singletons/com.sun.star.frame.theGlobalEventBroadcaster" )
oGlobalEventBroadcaster.Events.replaceByName( sEventName, aProps() )
msgbox sEventName & " connected to: " & oGlobalEventBroadcaster.Events.getByName( sEventName )(1).Value, 64, "Set Application Event"
End Sub