OpenOfficeRemote communication demo


Contents

Overview
Usage
Description

Overview

This demo shows how to establish an interprocess bridge to a openoffice and creates four new office documents. ( see also the interprocess-bridge documentation ). The source code of the example can be found in udk/remotebridges/examples .

Usage

The demo consists of a UNO-component, that supports the com.sun.star.lang.XMain interface. The component can be started using the uno.exe tool, which can be found in the binary output tree ( it is not installed with OpenOffice ).

  1. Install an openoffice.
  2. Before program start, please open the share/config/registry/instance/org/openoffice/Setup.xml file. You need to modify the tag ooSetupConnectionURL. Here's an example:
       <ooSetupConnectionURL cfg:type="string" >socket,host=localhost,port=2002;urp;StarOffice.NamingService</ooSetupConnectionURL>
    
    Alternatively you can start the office with the following commandline :
       soffice "-accept=socket,host=localhost,port=2002;urp;StarOffice.NamingService"
    
  3. Start the office ( after starting the office, netstat -a | fgrep 2002 should signal, that the port is being listened to ).
  4. Install the binary output tree of the current build.
  5. Checkout (toplevel) the api/odk module from openoffice.org.
  6. Build the api/odk/examples/cpp/officeclient directory (formerly api/odk/examples/officeclient).
  7. Make the api/odk/wntmsci3/bin (on unix api/odk/unxsols3/lib) your current directory.
  8. Copy from the binary output tree the file wntmsci3/bin/applicat.rdb to the current directory.
  9. Now execute the following :
    Windows :
    uno -l officeclientsample.dll -c com.sun.star.comp.odk.example.OfficeClientSample -r applicat.rdb -- uno:socket,host=localhost,port=2002;urp;StarOffice.NamingService
    Unix :
    uno -l libofficeclientsample.so -c com.sun.star.comp.odk.example.OfficeClientSample -r applicat.rdb -- 'uno:socket,host=localhost,port=2002;urp;StarOffice.NamingService'
    The component now is instantiated by the uno.exe tool and connects to the office. Please press any key when asked to do so. You should get the following output on the shell :
    OStorePageBIOS::verify(): close pending.
    Connecting ....
    Creating Socket. Family: 2 Type: 1 Protocol: 0
    got the remote NamingService
    press any key to open a new writer document ...
    
    
    pasting some text into the writer document
    press any key to close the document
    
    press any key to open a new draw document ...
    
    
    press any key to close the document
    
    press any key to open a new schedule document ...
    
    
    press any key to close the document
    
    press any key to open a new calc document ...
    
    
    press any key to close the document
    

Description

The demo is implemented as component to show the usage of uno-exe. The advantage (compared to writing an own executable, which would have been possible also) is, that you do not have to care about the UNO bootstrapping.

The component first takes care, that all necessary shared libraries are registered (registerServices) method. Afterwards it uses the com.sun.star.bridge.UnoUrlResolver service to establish an interprocess-bridge to the office.

Then it retrieves the remote servicemanager and furtheron the com.sun.star.frame.Desktop service (which is a oneinstance service).

Now it queries for the XComponentLoader interface and opens the four empty documents on demand.


Auhor: Jörg Budischewski ($Date: 2001/08/28 16:36:01 $)
Copyright 2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.