Language:

The Free and Open Productivity Suite
Apache OpenOffice 4.1.5 released

Remote communication demo

OpenOffice.org

Contents

Overview
Usage
Description

Overview

This demo shows how to establish an interprocess bridge to a OpenOffice.org 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.org).

  1. Install an OpenOffice.org
  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 command line :
       soffice "-accept=socket,host=localhost,port=2002;urp;StarOffice.NamingService"
    

    You can find a list of command line parameters in the framework project documentation.

  3. After starting the OpenOffice.org, confirm that the port is listening with `netstat -a | fgrep 2002`.
  4. Install the binary output tree of the current build.
  5. Checkout (top-level) 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. (wntmsci3 is dependant on your operating system for LInux use unxlngi4.pro)
  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 your own executable, which is also possible) 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 further on 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.

Author: Jörg Budischewski ($Date: 2004/11/17 11:44:59 $)
Copyright 2001 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.

Apache Software Foundation

Copyright & License | Privacy | Contact Us | Donate | Thanks

Apache and the Apache feather logo are trademarks of The Apache Software Foundation. OpenOffice, OpenOffice.org and the seagull logo are registered trademarks of The Apache Software Foundation. Other names appearing on the site may be trademarks of their respective owners.