Top Description Inners Fields Constructors Methods
com.sun.star.comp.beans

public Class LocalOfficeConnection

extends Object
implements OfficeConnection
Class Inheritance
All Implemented Interfaces
com.sun.star.comp.beans.OfficeConnection
Imports
java.awt.Container, java.io.File, .UnsupportedEncodingException, java.util.ArrayList, .Arrays, .Iterator, .List, java.util.concurrent.atomic.AtomicLong, com.sun.star.beans.XPropertySet, com.sun.star.bridge.XBridge, com.sun.star.bridge.XBridgeFactory, com.sun.star.connection.XConnection, com.sun.star.connection.XConnector, com.sun.star.lang.XComponent, com.sun.star.lang.XEventListener, com.sun.star.lang.XMultiComponentFactory, com.sun.star.lib.uno.helper.UnoUrl, com.sun.star.lib.util.NativeLibraryLoader, com.sun.star.uno.UnoRuntime, com.sun.star.uno.XComponentContext

References Deprecated

OfficeConnection is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

This class represents a connection to the local office application.
Since
OOo 2.0.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
LocalOfficeConnection.OfficeService

References Deprecated NativeService is deprecated or references (maybe indirectly) at least one deprecated element.
private static class

Field Summary

Modifier and TypeField and Description
private static final AtomicLong
private com.sun.star.bridge.XBridge
private final List<com.sun.star.lang.XEventListener>
private String
private com.sun.star.uno.XComponentContext
private String
private String
private String
private Process
private String
private String
public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public
LocalOfficeConnection()

Constructor.

protected
LocalOfficeConnection(com.sun.star.uno.XComponentContext xContext)

protected Constructor Initialise a LocalOfficeConnection with an already running office.

Method Summary

Modifier and TypeMethod and Description
public void
addEventListener(com.sun.star.lang.XEventListener
is a listener object.
listener
)

Adds an event listener to the object.

private com.sun.star.uno.XComponentContext
connect()

Establishes the connection to the office.

public OfficeWindow

Returns:

The office window instance.
createOfficeWindow
(Container
This is an AWT container.
container
)

Implements com.sun.star.comp.beans.OfficeConnection.createOfficeWindow.

Deprecated

Creates an office java.awt.Canvas based window.

public void
dispose()

Closes the connection.

public synchronized com.sun.star.uno.XComponentContext

Returns:

The office UNO component context.
getComponentContext
()

Implements com.sun.star.comp.beans.OfficeConnection.getComponentContext.

Retrieves the UNO component context.

private static String
getPipeName()

creates a unique pipe name.

private void
parseUnoUrlWithOfficePath(String
This is UNO URL which describes the type of a connection.
url
,
String prefix)

Parses a connection URL.

public void
removeEventListener(com.sun.star.lang.XEventListener
is a listener object.
listener
)

Removes an event listener from the listener list.

private Object
resolve(com.sun.star.uno.XComponentContext xLocalContext, String dcp)

public void
setContainerFactory(ContainerFactory
This is an application provided AWT container factory.
containerFactory
)

Implements com.sun.star.comp.beans.OfficeConnection.setContainerFactory.

Deprecated

Sets an AWT container factory.

public void
setUnoUrl(String
This is UNO URL which describes the type of a connection.
url
)

Implements com.sun.star.comp.beans.OfficeConnection.setUnoUrl.

Sets a connection URL.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_nBridgeCounterback to summary
private static final AtomicLong m_nBridgeCounter
mBridgeback to summary
private com.sun.star.bridge.XBridge mBridge
mComponentsback to summary
private final List<com.sun.star.lang.XEventListener> mComponents
mConnTypeback to summary
private String mConnType
mContextback to summary
private com.sun.star.uno.XComponentContext mContext
mInitialObjectback to summary
private String mInitialObject
mPipeback to summary
private String mPipe
mPortback to summary
private String mPort
mProcessback to summary
private Process mProcess
mProtocolback to summary
private String mProtocol
mURLback to summary
private String mURL
OFFICE_APP_NAMEback to summary
public static final String OFFICE_APP_NAME
OFFICE_ID_SUFFIXback to summary
public static final String OFFICE_ID_SUFFIX
OFFICE_LIB_NAMEback to summary
public static final String OFFICE_LIB_NAME

Constructor Detail

LocalOfficeConnectionback to summary
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.

LocalOfficeConnectionback to summary
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.

Method Detail

addEventListenerback to summary
public void addEventListener(com.sun.star.lang.XEventListener listener)

Adds an event listener to the object.

Parameters
listener:com.sun.star.lang.XEventListener

is a listener object.

connectback to summary
private com.sun.star.uno.XComponentContext connect()

Establishes the connection to the office.

createOfficeWindowback to summary
public OfficeWindow createOfficeWindow(Container container)

Implements com.sun.star.comp.beans.OfficeConnection.createOfficeWindow.

Deprecated

Creates an office java.awt.Canvas based window.

Parameters
container:Container

This is an AWT container.

Returns:OfficeWindow

The office window instance.

Annotations
@Deprecated
disposeback to summary
public void dispose()

Closes the connection.

getComponentContextback to summary
public synchronized com.sun.star.uno.XComponentContext getComponentContext()

Implements com.sun.star.comp.beans.OfficeConnection.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.

Returns:com.sun.star.uno.XComponentContext

The office UNO component context.

getPipeNameback to summary
private static String getPipeName() throws UnsupportedEncodingException

creates a unique pipe name.

parseUnoUrlWithOfficePathback to summary
private void parseUnoUrlWithOfficePath(String url, String prefix) throws MalformedURLException

Parses a connection URL. This method accepts a UNO URL with following format:

url    := uno:localoffice[,<params>];urp;StarOffice.NamingService
params := <path>[,<pipe>]
path   := path=<pathv>
pipe   := pipe=<pipev>
pathv  := platform_specific_path_to_the_local_office_distribution
pipev  := local_office_connection_pipe_name

Examples

  • "uno:localoffice,pipe=xyz_Office,path=/opt/openoffice11/program;urp;StarOffice.ServiceManager";
  • "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager";
Parameters
url:String

This is UNO URL which describes the type of a connection.

Exceptions
MalformedURLException:
when inappropriate URL was provided.
removeEventListenerback to summary
public void removeEventListener(com.sun.star.lang.XEventListener listener)

Removes an event listener from the listener list.

Parameters
listener:com.sun.star.lang.XEventListener

is a listener object.

resolveback to summary
private Object resolve(com.sun.star.uno.XComponentContext xLocalContext, String dcp) throws com.sun.star.connection.NoConnectException, com.sun.star.connection.ConnectionSetupException, com.sun.star.lang.IllegalArgumentException
setContainerFactoryback to summary
public void setContainerFactory(ContainerFactory containerFactory)

Implements com.sun.star.comp.beans.OfficeConnection.setContainerFactory.

Deprecated

Sets an AWT container factory.

Parameters
containerFactory:ContainerFactory

This is an application provided AWT container factory.

Annotations
@Deprecated
setUnoUrlback to summary
public void setUnoUrl(String url) throws MalformedURLException

Implements com.sun.star.comp.beans.OfficeConnection.setUnoUrl.

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
Parameters
url:String

This is UNO URL which describes the type of a connection.

com.sun.star.comp.beans back to summary

private Class LocalOfficeConnection.OfficeService

extends Object
implements NativeService
Class Inheritance
All Implemented Interfaces
com.sun.star.comp.beans.NativeService

References Deprecated

NativeService is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

The identifier of the office service.
getIdentifier
()

Implements com.sun.star.comp.beans.NativeService.getIdentifier.

Retrieve the office service identifier.

public int

Returns:

The amount of time to wait in seconds(?).
getStartupTime
()

Implements com.sun.star.comp.beans.NativeService.getStartupTime.

Retrieves the amount of time to wait for the startup.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

OfficeServiceback to summary
private OfficeService()

Method Detail

getIdentifierback to summary
public String getIdentifier()

Implements com.sun.star.comp.beans.NativeService.getIdentifier.

Retrieve the office service identifier.

Returns:String

The identifier of the office service.

getStartupTimeback to summary
public int getStartupTime()

Implements com.sun.star.comp.beans.NativeService.getStartupTime.

Retrieves the amount of time to wait for the startup.

Returns:int

The amount of time to wait in seconds(?).

startupServiceback to summary
public void startupService() throws IOException

Implements com.sun.star.comp.beans.NativeService.startupService.

Starts the office process.

com.sun.star.comp.beans back to summary

private Class LocalOfficeConnection.StreamProcessor

extends Thread
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final InputStream
private final PrintStream
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopthreadIdtoStringyield

Field Detail

m_inback to summary
private final InputStream m_in
m_printback to summary
private final PrintStream m_print

Constructor Detail

StreamProcessorback to summary
public StreamProcessor(final InputStream in, final PrintStream out)

Method Detail

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

Annotations
@Override