com.sun.star.text.XTextDocument Java Examples

The following examples show how to use com.sun.star.text.XTextDocument. 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: HelloWorld.java    From kkFileViewOfficeEdit with Apache License 2.0 5 votes vote down vote up
public static void printHW(XScriptContext xSc) {

    // getting the text document object
    XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, xSc.getDocument());
    XText xText = xtextdocument.getText();
    XTextRange xTextRange = xText.getEnd();
    xTextRange.setString( "Hello World (in Java)" );

  }
 
Example #2
Source File: HelloWorld.java    From kkFileView with Apache License 2.0 5 votes vote down vote up
public static void printHW(XScriptContext xSc) {

    // getting the text document object
    XTextDocument xtextdocument = (XTextDocument) UnoRuntime.queryInterface(
XTextDocument.class, xSc.getDocument());
    XText xText = xtextdocument.getText();
    XTextRange xTextRange = xText.getEnd();
    xTextRange.setString( "Hello World (in Java)" );

  }
 
Example #3
Source File: DocumentHelper.java    From libreoffice-starter-extension with MIT License 4 votes vote down vote up
/** Returns the current text document (if any) */
public static XTextDocument getCurrentDocument(XComponentContext xContext) {
    return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, getCurrentComponent(xContext));
}
 
Example #4
Source File: WebDocument.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Constructs new OpenOffice.org web document.
 * 
 * @param xTextDocument OpenOffice.org API interface of a web document
 * @param intitialProperties the properties that were used loading the document
 * 
 * @throws IllegalArgumentException if the submitted OpenOffice.org interface is not valid
 * 
 * @author Thomas Renken
 * @author Andreas Bröker
 */
public WebDocument(XTextDocument xtextDocument, PropertyValue[] initialProperties)
    throws IllegalArgumentException {
  super((XComponent) UnoRuntime.queryInterface(XComponent.class, xtextDocument),
      initialProperties);
  this.xTextDocument = xtextDocument;
}
 
Example #5
Source File: TextDocument.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Constructs new OpenOffice.org swriter document.
 * 
 * @param xTextDocument OpenOffice.org XTextDocument interface
 * @param intitialProperties the properties that were used loading the document
 * 
 * @throws IllegalArgumentException if the submitted OpenOffice.org XTextDocument is not valid
 * 
 * @author Andreas Bröker
 */
public TextDocument(XTextDocument xTextDocument, PropertyValue[] initialProperties)
    throws IllegalArgumentException {
  super((XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument),
      initialProperties);
  this.xTextDocument = xTextDocument;
  this.xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
      xTextDocument);
}
 
Example #6
Source File: TextTableCloneService.java    From noa-libre with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * Constructs the TextTableCloneService
 * 
 * @param table the table to be cloned
  * @param textDocument text document to be used
  * 
  * @throws CloneException TODO: add comment
 */
public TextTableCloneService (ITextTable table, XTextDocument textDocument) throws CloneException {
	this.textTable = table;
	this.textDocument = textDocument;
	this.serviceFactory = (XMultiServiceFactory)com.sun.star.uno.UnoRuntime.queryInterface(XMultiServiceFactory.class, textDocument);
	getTableInfo(table);
}
 
Example #7
Source File: DocumentIndexService.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs new DocumentIndexProvider.
 * 
 * @param textDocument XTextDocument interface to be used
 * 
 * @author Andreas Bröker
 * @date 17.08.2006
 */
public DocumentIndexService(XTextDocument textDocument) {
  Assert.isNotNull(textDocument, XTextDocument.class, this);
  this.textDocument = textDocument;
}
 
Example #8
Source File: AnnotationService.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs new AnnotationService.
 * 
 * @param textDocument the text document of the service
 * 
 * @author Markus Krüger
 * @date 13.07.2006
 */
public AnnotationService(ITextDocument textDocument) {
  Assert.isNotNull(textDocument, XTextDocument.class, this);
  this.textDocument = textDocument;
}
 
Example #9
Source File: IWebDocument.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Returns OpenOffice.org public XTextDocument interface.
 * 
 * @return OpenOffice.org XTextDocument interface
 * 
 * @author Thomas Renken
 * @author Andreas Bröker
 */
public XTextDocument getWebDocument();
 
Example #10
Source File: ITextDocument.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Returns OpenOffice.org XTextDocument interface. This method
 * is not intended to be called by clients.
 * 
 * @return OpenOffice.org XTextDocument interface
 * 
 * @author Andreas Bröker 
 */
public XTextDocument getXTextDocument();
 
Example #11
Source File: WebDocument.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Returns OpenOffice.org public XTextDocument interface.
 * 
 * @return OpenOffice.org XTextDocument interface
 * 
 * @author Thomas Renken
 * @author Andreas Bröker
 */
public XTextDocument getWebDocument() {
  return xTextDocument;
}
 
Example #12
Source File: TextDocument.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Returns OpenOffice.org XTextDocument interface. This method
 * is not intended to be called by clients.
 * 
 * @return OpenOffice.org XTextDocument interface
 * 
 * @author Andreas Bröker 
 */
public XTextDocument getXTextDocument() {
  return xTextDocument;
}
 
Example #13
Source File: GlobalTextDocument.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Constructs new GlobalTextDocument.
 * 
 * @param xTextDocument XTextDocument OpenOffice.org interface to be used
 * @param intitialProperties the properties that were used loading the document
 * 
 * @author Andreas Bröker
 * @date 16.03.2006
 */
public GlobalTextDocument(XTextDocument xTextDocument, PropertyValue[] initialProperties) {
  super(xTextDocument, initialProperties);
}