com.sun.star.lang.EventObject Java Examples

The following examples show how to use com.sun.star.lang.EventObject. 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: OOPresentation.java    From Quelea with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Connect to an office, if no office is running a new instance is
 * started. A new connection is established and the service manger from
 * the running office is returned.
 *
 * @param path the path to the openoffice install.
 */
private static XComponentContext connect(String path) throws BootstrapException, Exception {
    File progPath = new File(path, "program");
    xOfficeContext = BootstrapSocketConnector.bootstrap(progPath.getAbsolutePath());
    XComponentContext localContext = Bootstrap.createInitialComponentContext(null);
    XMultiComponentFactory localServiceManager = localContext.getServiceManager();
    XConnector connector = UnoRuntime.queryInterface(XConnector.class,
            localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector",
                    localContext));
    connection = connector.connect(RUN_ARGS);
    XBridgeFactory bridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class,
            localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext));
    bridge = bridgeFactory.createBridge("", "urp", connection, null);
    bridgeComponent = UnoRuntime.queryInterface(XComponent.class, bridge);
    bridgeComponent.addEventListener(new com.sun.star.lang.XEventListener() {
        @Override
        public void disposing(EventObject eo) {
        }
    });
    return xOfficeContext;

}
 
Example #2
Source File: OfficeConnection.java    From kkFileView with Apache License 2.0 5 votes vote down vote up
public void disposing(EventObject event) {
    if (connected) {
        connected = false;
        logger.info(String.format("disconnected: '%s'", unoUrl));
        OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(OfficeConnection.this);
        for (OfficeConnectionEventListener listener : connectionEventListeners) {
            listener.disconnected(connectionEvent);
        }
    }
    // else we tried to connect to a server that doesn't speak URP
}
 
Example #3
Source File: OfficeConnection.java    From wenku with MIT License 5 votes vote down vote up
public void disposing(EventObject event) {
    if (connected) {
        connected = false;
        logger.info(String.format("disconnected: '%s'", unoUrl));
        OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(OfficeConnection.this);
        for (OfficeConnectionEventListener listener : connectionEventListeners) {
            listener.disconnected(connectionEvent);
        }
    }
    // else we tried to connect to a server that doesn't speak URP
}
 
Example #4
Source File: OfficeConnection.java    From kkFileViewOfficeEdit with Apache License 2.0 5 votes vote down vote up
public void disposing(EventObject event) {
    if (connected) {
        connected = false;
        logger.info(String.format("disconnected: '%s'", unoUrl));
        OfficeConnectionEvent connectionEvent = new OfficeConnectionEvent(OfficeConnection.this);
        for (OfficeConnectionEventListener listener : connectionEventListeners) {
            listener.disconnected(connectionEvent);
        }
    }
    // else we tried to connect to a server that doesn't speak URP
}
 
Example #5
Source File: HighlightText.java    From kkFileViewOfficeEdit with Apache License 2.0 4 votes vote down vote up
public void disposing(EventObject o)
{
    // do nothing
}
 
Example #6
Source File: OOPresentation.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void disposing(EventObject ev) {
    //Nothing needed here
}
 
Example #7
Source File: OOPresentation.java    From Quelea with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void notifyEvent(com.sun.star.document.EventObject ev) {
    XModel xModel = UnoRuntime.queryInterface(XModel.class, ev.Source);
    XController xController = xModel.getCurrentController();
    xController.getFrame().getContainerWindow().setEnable(false);
}
 
Example #8
Source File: HighlightText.java    From kkFileView with Apache License 2.0 4 votes vote down vote up
public void disposing(EventObject o)
{
    // do nothing
}
 
Example #9
Source File: TerminateListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Is called when the master enviroment is about to terminate.
 * 
 * @param eventObject
 *            source of the event
 * 
 * @throws TerminationVetoException
 *             listener can disagree with this query by throwing a veto
 *             exception
 * 
 * @author Andreas Bröker
 */
public void queryTermination(EventObject eventObject)
		throws TerminationVetoException {
	TerminateEvent terminateEvent = new TerminateEvent(eventObject,
			getServiceProvider());
	terminateListener.queryTermination(terminateEvent);
	if (terminateEvent.getVeto())
		throw new TerminationVetoException();
}
 
Example #10
Source File: Event.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Constructs new Event.
 * 
 * @param eventOject OpenOffice.org EventObject to be used
 * @param serviceProvider the service provider to be used
 * 
 * @throws IllegalArgumentException if the submitted OpenOffice.org EventObject is not valid
 * 
 * @author Andreas Bröker
 */
public Event(EventObject eventOject, IServiceProvider serviceProvider)
    throws IllegalArgumentException {
  if (eventOject == null)
    throw new IllegalArgumentException("The submitted OpenOffice.org EventObject is not valid.");
  this.eventOject = eventOject;
  this.serviceProvider = serviceProvider;
}
 
Example #11
Source File: CloseListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Is called when somewhere tries to close listened object.
 * 
 * @param eventObject source event object
 * @param getsOwnership information about the ownership
 * 
 * @throws CloseVetoException close veto exception
 * 
 * @author Andreas Bröker
 */
public void queryClosing(EventObject eventObject, boolean getsOwnership)
    throws CloseVetoException {
  CloseEvent closeEvent = new CloseEvent(eventObject, getServiceProvider());
  closeListener.queryClosing(closeEvent, getsOwnership);
  if(closeEvent.getVeto())
    throw new CloseVetoException();    
}
 
Example #12
Source File: ElementDisposeListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Gets called when the element beeing holding this listener 
 * gets disposed.
 * 
 * @param event the event beeing fired
 */
public void disposing(EventObject event) {
  elementListener.reactOnDispose();
}
 
Example #13
Source File: DocumentModifyListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Will be called if any change occurs in the document.
 * 
 * @param eventObject event object to be used
 * 
 * @author Sebastian Rösgen
 */
public void modified(EventObject eventObject) {
  documentListener.reactOnUnspecificEvent(new Event(eventObject, getServiceProvider()));
}
 
Example #14
Source File: DocumentModifyListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * This will get called whenever the document is beeing disposed, 
 * or the listener itself gets disposed.
 * 
 * @param eventObject event object to be used
 * 
 * @author Sebastian Rösgen
 */
public void disposing(EventObject eventObject) {
  documentListener.disposing(new Event(eventObject, getServiceProvider()));
}
 
Example #15
Source File: CloseListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Is called when the listened object is closed really.
 * 
 * @param eventObject event object
 * 
 * @author Andreas Bröker
 */
public void notifyClosing(EventObject eventObject) {
  closeListener.notifyClosing(new CloseEvent(eventObject, getServiceProvider()));
}
 
Example #16
Source File: CloseEvent.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs new CloseEvent.
 * 
 * @param eventOject OpenOffice.org EventObject to be used
 * 
 * @throws IllegalArgumentException if the submitted OpenOffice.org EventObject is not valid
 * 
 * @author Andreas Bröker
 */
public CloseEvent(EventObject eventOject, IServiceProvider serviceProvider)
    throws IllegalArgumentException {
  super(eventOject, serviceProvider);
}
 
Example #17
Source File: EventListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
* Gets called when the broadcaster is about to be disposed. 
* 
* @param eventObject source event object
* 
   * @author Andreas Bröker
 */
public void disposing(EventObject eventObject) {
  eventListener.disposing(new Event(eventObject, serviceProvider));
}
 
Example #18
Source File: TerminateEvent.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs new TerminateEvent.
 * 
 * @param eventOject OpenOffice.org EventObject to be used
 * @param serviceProvider the service provider to be used
 * 
 * @throws IllegalArgumentException if the submitted OpenOffice.org EventObject
 * 
 * @author Andreas Bröker
 */
public TerminateEvent(EventObject eventOject, IServiceProvider serviceProvider)
    throws IllegalArgumentException {
  super(eventOject, serviceProvider);
}
 
Example #19
Source File: TerminateListenerWrapper.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Is called when the master enviroment is finally terminated.
 * 
 * @param eventObject
 *            of the event
 * 
 * @author Andreas Bröker
 */
public void notifyTermination(EventObject eventObject) {
	TerminateEvent terminateEvent = new TerminateEvent(eventObject,
			getServiceProvider());
	terminateListener.notifyTermination(terminateEvent);
}