I’m using LibreOffice with the OLE interface. Everything works fine.
Only one Problem. I want to send the Print command and after spooling closing the application.
But the close call does cancel the print progress.
I have to wait with the close call until the print progress is completed.
The print progress can take different time amounts so a timer isn’t a solution.
I’m searching for a solution to get the LibreOffice Print Event Listener.
( http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1view_1_1XPrintJobListener.html )
In LibreOfficeBasic the solution to my problem would be:
[code]Sub Register_PrintJobListener
Dim oPrintJobListener as Object
oPrintJobListener = CreateUnoListener( "PrintJobListener_", "com.sun.star.view.XPrintJobListener" )
ThisComponent.addPrintJobListener(oPrintJobListener)
End Sub
Sub PrintJobListener_printJobEvent(oEvent)
End Sub
Sub PrintJobListener_disposing
end sub[/code]
But CreateUnoListener doesn’t exist in XOJO.
I tryed to use the OLEObject.EventTriggered Eventhandler and the createInstance function of the Service Manager, but the Service Manager couldn’t initialize the com.sun.star.view.XPrintJobListener. (com.sun.star.lang.ServiceNotRegisteredException: (Failed on createInstance))
[code]//Event Listener
Dim printEvent as PrintEventListener //Subclass of OLEObject
printEvent = objServiceManager.createInstance(“com.sun.star.view.XPrintJobListener”)
objDocument.addPrintJobListener(printEvent)[/code]
I couldn’t find a solution to get the Event with OLE.
I also tried to Create a Object with two public methods named printJobEvent(oEvent as Variant) and disposing().
After using objDocument.addPrintJobListener(printEvent) on the Object I didn’t get an Error in XOJO but LibreOffice got a fatal error.
Any Ideas or working solutions?