Class LocalOfficeConnection

  • All Implemented Interfaces:
    OfficeConnection, com.sun.star.lang.XComponent, com.sun.star.uno.XInterface

    public class LocalOfficeConnection
    extends java.lang.Object
    implements OfficeConnection
    This class represents a connection to the local office application.
    Since:
    OOo 2.0.0
    • Constructor Detail

      • LocalOfficeConnection

        public LocalOfficeConnection()
        Constructor. Sets up paths to the office application and native libraries if values are available in OFFICE_PROP_FILE in the user home directory.
        "com.sun.star.beans.path" - the office application directory;
        "com.sun.star.beans.libpath" - native libraries directory.
      • LocalOfficeConnection

        protected LocalOfficeConnection​(com.sun.star.uno.XComponentContext xContext)
        protected Constructor Initialise a LocalOfficeConnection with an already running office. This C'Tor is only used in complex tests at the moment.
        Parameters:
        xContext -
    • Method Detail

      • setUnoUrl

        public void setUnoUrl​(java.lang.String url)
                       throws java.net.MalformedURLException
        Sets a connection URL. This implementation accepts a UNO URL with following format:
         url    := uno:localoffice[,<params>];urp;StarOffice.ServiceManager
         params := <path>[,<pipe>]
         path   := path=<pathv>
         pipe   := pipe=<pipev>
         pathv  := platform_specific_path_to_the_local_office_distribution
         pipev  := local_office_connection_pipe_name
         
        Specified by:
        setUnoUrl in interface OfficeConnection
        Parameters:
        url - This is UNO URL which describes the type of a connection.
        Throws:
        java.net.MalformedURLException
      • setContainerFactory

        @Deprecated
        public void setContainerFactory​(ContainerFactory containerFactory)
        Deprecated.
        Sets an AWT container factory.
        Specified by:
        setContainerFactory in interface OfficeConnection
        Parameters:
        containerFactory - This is an application provided AWT container factory.
      • getComponentContext

        public com.sun.star.uno.XComponentContext getComponentContext()
        Retrieves the UNO component context. Establishes a connection if necessary and initialises the UNO service manager if it has not already been initialised. This method can return null if it fails to connect to the office application.
        Specified by:
        getComponentContext in interface OfficeConnection
        Returns:
        The office UNO component context.
      • createOfficeWindow

        @Deprecated
        public OfficeWindow createOfficeWindow​(java.awt.Container container)
        Deprecated.
        Creates an office java.awt.Canvas based window.
        Specified by:
        createOfficeWindow in interface OfficeConnection
        Parameters:
        container - This is an AWT container.
        Returns:
        The office window instance.
      • dispose

        public void dispose()
        Closes the connection.
        Specified by:
        dispose in interface com.sun.star.lang.XComponent
      • addEventListener

        public void addEventListener​(com.sun.star.lang.XEventListener listener)
        Adds an event listener to the object.
        Specified by:
        addEventListener in interface com.sun.star.lang.XComponent
        Parameters:
        listener - is a listener object.
      • removeEventListener

        public void removeEventListener​(com.sun.star.lang.XEventListener listener)
        Removes an event listener from the listener list.
        Specified by:
        removeEventListener in interface com.sun.star.lang.XComponent
        Parameters:
        listener - is a listener object.