Hi Denis,

denis escribió:
Hi,

thank you for your answers.

Ariel Constenla-Haile wrote:
denis escribió:
after starting OpenOffice using bootstrap(), how do you get
notified when the connection terminates?
you will have to bootstrap the office not using the simple bootstrap
mechanism, but creating the bridge and adding a listener to it.

The problem I had was that (according to all examples I have
found) the manual way of creating the bridge always requires a
already running instance of OpenOffice.

Now I added a TerminateListener to the XDesktop object as Tobias
said.  This seems to be sufficient.

Notice that this is not what you wanted in first place: there may be
cases where the desktop environment is still alive but not the bridge.

I think you could try, in one thread, to start the office process
listening on a port, and in other thread bootstrap that office (not
using the simple bootstrap mechanism, nor the
css::bridge::XUnoUrlResolver, but
cppu::defaultBootstrap_InitialComponentContext() and manually creating
the bridge).

Take a look at how cppu::bootstrap()
[cppuhelper/inc/cppuhelper/bootstrap.hxx] is implemented
[cppuhelper/source/bootstrap.cxx together with cppuhelper/inc/cppuhelper/findsofficepath.h
cppuhelper/source/findsofficepath.c], you can try the same, but instead
of using a named pipe, start the office process listening in a port.

Although cppuhelper_detail_findSofficePath() has a warning/comment telling client code not to use it, I just copied and paste the code in a client appl. and worked [tested only on Linux]: it could find the installation path, start the office process (osl_executeProcess()) listening on a port (instead of -accept=pipe,name=... as in bootstrap(), pass as arg. -accept=socket,host=localhost,port=8100;... [change localhost for your host name and 8100 for the port number you want]). Then bootstrap with cppu::defaultBootstrap_InitialComponentContext() and manually create the bridge using the UNO URL with the same paramaters as the office was started ("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager").

This way you can get notified from both sides: add a css.lang.XEventListener to the css.bridge.XBridge, and a css.frame.XTerminateListener/2 to the css.frame.Desktop.

Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to