com.ibm.productivity.tools.ui.views
Interface RichDocumentView

All Known Implementing Classes:
DefaultRichDocumentView

public interface RichDocumentView

Defines a view to manipulate rich documents. A default implementation is provided as DefaultRichDocumentView. The view is used to start supported rich document operations. It allows adding listeners into the view which are notified when an operation is started.


The default rich document operations are defined in com.ibm.productivity.tools.ui.views.operations package.


The interface is not intended to be implemented by the client. To create a new subclass for this interface, extend the DefaultRichDocumentView. Use the interface to access the view, instead of using the DefaultRichDocumentView class directly.

Since:
8.0.1
See Also:
DefaultRichDocumentView, Operation, OperationListener

Method Summary
 void addOperationListener(OperationListener listener)
          Adds an OperationListener into the view.
 void executeOperation(Operation operation)
          Starts the operation in the view.
 java.lang.Object getUNOModel()
          Returns the com.sun.star.frame.XModel object when the operation is started.
 void removeOperationListener(OperationListener listener)
          Removes a registered OperationListener from the view.
 

Method Detail

executeOperation

public void executeOperation(Operation operation)
                      throws java.lang.UnsupportedOperationException
Starts the operation in the view.

Parameters:
operation - - The operation to be started
Throws:
java.lang.UnsupportedOperationException - - If an error occurs while running the operation.
See Also:
Operation

addOperationListener

public void addOperationListener(OperationListener listener)
Adds an OperationListener into the view. If an operation is invoked, the listener is notified.

Parameters:
listener - - A listener to be notified when an operation is started.
See Also:
OperationListener

removeOperationListener

public void removeOperationListener(OperationListener listener)
Removes a registered OperationListener from the view.

Parameters:
listener - - The listener to be removed
See Also:
OperationListener

getUNOModel

public java.lang.Object getUNOModel()
Returns the com.sun.star.frame.XModel object when the operation is started. The object is available after the operation is started successfully. It is used to access the UNO APIs provided by the UNO service.

The following code demonstrates how to use the UNO model:

 private void createTable( ) throws Exception {
	
	  NewOperation operation = ...;
	  Object obj = operation.getUNOModel();

	  XMultiServiceFactory factory = (XMultiServiceFactory) UnoRuntime
			.queryInterface(XMultiServiceFactory.class, obj);
	  XTextDocument textDoc = (XTextDocument) UnoRuntime.queryInterface(
			XTextDocument.class, obj);
	  obj = factory.createInstance("com.sun.star.text.TextTable");

	  XTextTable table = (XTextTable) UnoRuntime.queryInterface(
			XTextTable.class, obj);
	  table.initialize(10, 10);
	  textDoc.getText().insertTextContent(textDoc.getText().getStart(),
			table, false);
 }
 

Returns:
A com.sun.star.frame.XModel object for the created document