com.sun.star.bridge.XBridge Java Examples
The following examples show how to use
com.sun.star.bridge.XBridge.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OfficeConnection.java From yarg with Apache License 2.0 | 6 votes |
public void open() throws OpenOfficeException { if (this.closed) { try { XComponentContext localContext = bsc.connect("127.0.0.1", port); String connectionString = "socket,host=127.0.0.1,port=" + port; XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = as(XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); XConnection connection = connector.connect(connectionString); XBridgeFactory bridgeFactory = as(XBridgeFactory.class, localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); String bridgeName = "yarg_" + bridgeIndex.incrementAndGet(); XBridge bridge = bridgeFactory.createBridge(bridgeName, "urp", connection, null); XMultiComponentFactory serviceManager = as(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager")); XPropertySet properties = as(XPropertySet.class, serviceManager); xComponentContext = as(XComponentContext.class, properties.getPropertyValue("DefaultContext")); officeResourceProvider = new OfficeResourceProvider(xComponentContext, officeIntegration); closed = false; } catch (Exception e) { close(); throw new OpenOfficeException("Unable to create Open office components.", e); } } }
Example #2
Source File: OfficeConnection.java From kkFileViewOfficeEdit with Apache License 2.0 | 5 votes |
public void connect() throws ConnectException { logger.fine(String.format("connecting with connectString '%s'", unoUrl)); try { XComponentContext localContext = Bootstrap.createInitialComponentContext(null); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = OfficeUtils.cast(XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); XConnection connection = connector.connect(unoUrl.getConnectString()); XBridgeFactory bridgeFactory = OfficeUtils.cast(XBridgeFactory.class, localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); String bridgeName = "jodconverter_" + bridgeIndex.getAndIncrement(); XBridge bridge = bridgeFactory.createBridge(bridgeName, "urp", connection, null); bridgeComponent = OfficeUtils.cast(XComponent.class, bridge); bridgeComponent.addEventListener(bridgeListener); serviceManager = OfficeUtils.cast(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager")); XPropertySet properties = OfficeUtils.cast(XPropertySet.class, serviceManager); componentContext = OfficeUtils.cast(XComponentContext.class, properties.getPropertyValue("DefaultContext")); connected = true; logger.info(String.format("connected: '%s'", unoUrl)); OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(this); for (OfficeConnectionEventListener listener : connectionEventListeners) { listener.connected(connectionEvent); } } catch (NoConnectException connectException) { throw new ConnectException(String.format("connection failed: '%s'; %s", unoUrl, connectException.getMessage())); } catch (Exception exception) { throw new OfficeException("connection failed: "+ unoUrl, exception); } }
Example #3
Source File: OfficeConnection.java From kkFileView with Apache License 2.0 | 5 votes |
public void connect() throws ConnectException { logger.fine(String.format("connecting with connectString '%s'", unoUrl)); try { XComponentContext localContext = Bootstrap.createInitialComponentContext(null); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = OfficeUtils.cast(XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); XConnection connection = connector.connect(unoUrl.getConnectString()); XBridgeFactory bridgeFactory = OfficeUtils.cast(XBridgeFactory.class, localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); String bridgeName = "jodconverter_" + bridgeIndex.getAndIncrement(); XBridge bridge = bridgeFactory.createBridge(bridgeName, "urp", connection, null); bridgeComponent = OfficeUtils.cast(XComponent.class, bridge); bridgeComponent.addEventListener(bridgeListener); serviceManager = OfficeUtils.cast(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager")); XPropertySet properties = OfficeUtils.cast(XPropertySet.class, serviceManager); componentContext = OfficeUtils.cast(XComponentContext.class, properties.getPropertyValue("DefaultContext")); connected = true; logger.info(String.format("connected: '%s'", unoUrl)); OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(this); for (OfficeConnectionEventListener listener : connectionEventListeners) { listener.connected(connectionEvent); } } catch (NoConnectException connectException) { throw new ConnectException(String.format("connection failed: '%s'; %s", unoUrl, connectException.getMessage())); } catch (Exception exception) { throw new OfficeException("connection failed: "+ unoUrl, exception); } }
Example #4
Source File: OfficeConnection.java From wenku with MIT License | 5 votes |
public void connect() throws ConnectException { logger.fine(String.format("connecting with connectString '%s'", unoUrl)); try { XComponentContext localContext = Bootstrap.createInitialComponentContext(null); XMultiComponentFactory localServiceManager = localContext.getServiceManager(); XConnector connector = OfficeUtils.cast(XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext)); XConnection connection = connector.connect(unoUrl.getConnectString()); XBridgeFactory bridgeFactory = OfficeUtils.cast(XBridgeFactory.class, localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); String bridgeName = "jodconverter_" + bridgeIndex.getAndIncrement(); XBridge bridge = bridgeFactory.createBridge(bridgeName, "urp", connection, null); bridgeComponent = OfficeUtils.cast(XComponent.class, bridge); bridgeComponent.addEventListener(bridgeListener); serviceManager = OfficeUtils.cast(XMultiComponentFactory.class, bridge.getInstance("StarOffice.ServiceManager")); XPropertySet properties = OfficeUtils.cast(XPropertySet.class, serviceManager); componentContext = OfficeUtils.cast(XComponentContext.class, properties.getPropertyValue("DefaultContext")); connected = true; logger.info(String.format("connected: '%s'", unoUrl)); OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(this); for (OfficeConnectionEventListener listener : connectionEventListeners) { listener.connected(connectionEvent); } } catch (NoConnectException connectException) { throw new ConnectException(String.format("connection failed: '%s'; %s", unoUrl, connectException.getMessage())); } catch (Exception exception) { throw new OfficeException("connection failed: "+ unoUrl, exception); } }
Example #5
Source File: OPconnect.java From translationstudio8 with GNU General Public License v2.0 | 2 votes |
/** * Gets the bridge. * @return the bridge */ XBridge getBridge();
Example #6
Source File: OPConnection.java From translationstudio8 with GNU General Public License v2.0 | 2 votes |
/** * (non-Javadoc) * @see net.heartsome.cat.converter.ooconnect.OPconnect#getBridge() * @return */ public XBridge getBridge() { return bridge; }
Example #7
Source File: OPconnect.java From tmxeditor8 with GNU General Public License v2.0 | 2 votes |
/** * Gets the bridge. * @return the bridge */ XBridge getBridge();
Example #8
Source File: OPConnection.java From tmxeditor8 with GNU General Public License v2.0 | 2 votes |
/** * (non-Javadoc) * @see net.heartsome.cat.converter.ooconnect.OPconnect#getBridge() * @return */ public XBridge getBridge() { return bridge; }