|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
DefaultRichDocumentView
. Use
the interface to access the view, instead of using the DefaultRichDocumentView
class directly.
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. |
RichDocumentType |
getDocumentType()
Gets the type of the current document. |
java.lang.String |
getFilePath()
Gets the absolute path of the document loaded 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 |
public void executeOperation(Operation operation) throws java.lang.UnsupportedOperationException
operation
- the operation to be started
java.lang.UnsupportedOperationException
- if an error occurs while running the operation.Operation
public void addOperationListener(OperationListener listener)
OperationListener
into the view. If an operation is invoked,
the listener is notified.
listener
- a listener to be notified when an operation is startedOperationListener
public void removeOperationListener(OperationListener listener)
OperationListener
from the view.
listener
- the listener to be removedOperationListener
public java.lang.Object getUNOModel()
The following code demonstrates how to use the UNO model:
private void createTable( ) throws Exception {
NewOperation operation = ...;
Object obj = operation.getUNOModel();
com.sun.star.lang.XMultiServiceFactory factory = (com.sun.star.lang.XMultiServiceFactory)
UnoRuntime.queryInterface(com.sun.star.lang.XMultiServiceFactory.class, obj);
com.sun.star.text.XTextDocument textDoc = (com.sun.star.text.XTextDocument)
UnoRuntime.queryInterface(com.sun.star.text.XTextDocument.class, obj);
obj = factory.createInstance("com.sun.star.text.TextTable");
com.sun.star.text.XTextTable table = (com.sun.star.text.XTextTable)
UnoRuntime.queryInterface(XTextTable.class, obj);
table.initialize(10, 10);
textDoc.getText().insertTextContent(textDoc.getText().getStart(),
table, false);
}
public java.lang.String getFilePath()
c:\\test.odt
on Windows® operating systems, and /home/test.odt
on
Linux® operating systems.
public RichDocumentType getDocumentType()
RichDocumentType
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |