OfficeConnection Interface

From Apache OpenOffice Wiki
Jump to: navigation, search



The com.sun.star.comp.beans.OfficeConnection interface contains the methods used to configure, initiate,and manage the connection to OpenOffice.org. These methods are:

  public void setUnoUrl(String URL) throws java.net.MalformedURLException
  public com.sun.star.uno.XComponentContext getComponentContext()
  public OfficeWindow createOfficeWindow(Container container)
  public void setContainerFactory(ContainerFactory containerFactory)

The client uses setUnoUrl() to specify to the Office Bean how it connects to the OpenOffice.org process. See the section Configuring the Office Bean for a description of the syntax of the URL. A java.net.MalformedURLException is thrown by the concrete implementation if the client passes a badly formed URL as an argument.

The method getComponentContext() gets an object that implements the com.sun.star.uno.XComponentContext interface from the Office Bean. This object is then used to obtain objects implementing the full OpenOffice.org API from the backend OpenOffice.org process.

A call to createOfficeWindow() requests a new OfficeWindow from the OfficeConnection. The client obtains the java.awt.Component from the OfficeWindow to plug into its UI. See the getAWTComponent() method below on how to obtain the Component from the OfficeWindow. The client provides java.awt.Container that indicates to the implementation what kind of OfficeWindow it is to create.

The method setContainerFactory() specifies to the Office Bean the factory object it uses to create Java AWT windows to display popup windows in the Java environment. This factory object implements the com.sun.star.comp.beans.ContainerFactory interface. See below for a definition of the ContainerFactory interface.

If the client does not implement its own ContainerFactory interface, the Office Bean uses its own default ContainerFactory creating instances of java.awt.Canvas.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools