Common: Missing Application Events in "Tools:Customize:Events" tab for LibreOffice

asked 2017-08-24 01:18:42 +0200

librebel gravatar image

updated 2017-09-15 00:03:10 +0200

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 ).

image description

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.

  1. Is this normal for version 5.3.1.2 running on Ubuntu 17.04 ?
  2. 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
edit retag flag offensive close merge delete

Comments

@librebel You're only missing the start & close application. Sorry, using 5.3.4.2 here on Mint 18.2 & all OK. Checked my Ubuntu 16.04 but turns out I got rid of distro version.

Ratslinger gravatar imageRatslinger ( 2017-08-24 02:20:35 +0200 )edit

Thank you for this info @Ratslinger

i was comparing from this list by mr. Pitonyak, it seems he had more events available back in 2011 besides OnStartApp and OnCloseApp also OnPageCountChangeOnMailMergeOnMailMergeFinishedOnFieldMergeOnFieldMergeFinished and OnLayoutFinished...

librebel gravatar imagelibrebel ( 2017-08-24 03:34:14 +0200 )edit

@librebel I was comparing your list to one in Calc. In writer there are more. They are: Printing of form letters started, Printing of form letters finished, Merging of form fields started, Merging of form fields finished, & Changing the page count.

Ratslinger gravatar imageRatslinger ( 2017-08-24 13:59:42 +0200 )edit

@librebel Trying, but so far no luck. Ubuntu 16.04 & Unity for this. Removed LO from LibreOffice. Installed Writer & Calc through Ubuntu software. This gave me v5.1.6.2 & no problems with events listed. Then updated PPA sudo add-apt-repository ppa:libreoffice/ppa & got updated version. This brought me to v5.4.1.2 and still no missing items in events. At this point I'd have to say it's something with 17.04 and/or where your version is coming from. Lost unless you think of something.

Ratslinger gravatar imageRatslinger ( 2017-09-14 20:10:51 +0200 )edit

Thank you for your efforts @Ratslinger. I think i'll wait it out till the next version, now that i found a way to set the event by macro, it's good enough for me.

librebel gravatar imagelibrebel ( 2017-09-15 00:08:21 +0200 )edit

And thank you right back for the code. Even with all the events present I can see some use for this. +1!

Ratslinger gravatar imageRatslinger ( 2017-09-15 00:33:36 +0200 )edit