com.sun.star.io.XOutputStream Java Examples

The following examples show how to use com.sun.star.io.XOutputStream. 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: DocumentWriter.java    From noa-libre with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Stores document on the basis of the submitted xOutputStream implementation.
 * 
 * @param document document to be stored
 * @param xOutputStream OpenOffice.org XOutputStream inplementation
 * @param properties properties for OpenOffice.org
 * 
 * @throws IOException if any error occurs
 */
public static void storeDocument(IDocument document, XOutputStream xOutputStream, PropertyValue[] properties) 
throws IOException {
  if(properties == null) {
    properties = new PropertyValue[0];
  }
  
  PropertyValue[] newProperties = new PropertyValue[properties.length + 1];
  for(int i=0; i<properties.length; i++) {
    newProperties[i] = properties[i];
  }
  newProperties[properties.length] = new PropertyValue(); 
  newProperties[properties.length].Name = "OutputStream"; 
  newProperties[properties.length].Value = xOutputStream;
  
  XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, document.getXComponent());
  try {
    xStorable.storeToURL("private:stream", newProperties);
  }
  catch(com.sun.star.io.IOException ioException) {
    throw new IOException(ioException.getMessage());
  }    
}
 
Example #2
Source File: DocumentExporter.java    From noa-libre with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Exports document on the basis of the submitted filter and XOutputStream implementation.
 * 
 * @param document document to be stored
 * @param xOutputStream OpenOffice.org XOutputStream inplementation
 * @param filter filter to be used
 * @param properties properties properties for OpenOffice.org
 * 
 * @throws IOException if any error occurs
 */
public static void exportDocument(IDocument document, XOutputStream xOutputStream, IFilter filter, PropertyValue[] properties) 
throws IOException {
  if(properties == null) {
    properties = new PropertyValue[0];
  }
  
  PropertyValue[] newProperties = new PropertyValue[properties.length + 2];
  for(int i=0; i<properties.length; i++) {
    newProperties[i] = properties[i];
  }
  newProperties[properties.length] = new PropertyValue(); 
  newProperties[properties.length].Name = "OutputStream"; 
  newProperties[properties.length].Value = xOutputStream;
  
  newProperties[properties.length + 1] = new PropertyValue(); 
  newProperties[properties.length + 1].Name = "FilterName"; 
  newProperties[properties.length + 1].Value = filter.getFilterDefinition(document);
  
  XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, document.getXComponent());
  try {
    xStorable.storeToURL("private:stream", newProperties);
  }
  catch(com.sun.star.io.IOException ioException) {
    throw new IOException(ioException.getMessage());
  }    
}
 
Example #3
Source File: OfficeResourceProvider.java    From yarg with Apache License 2.0 5 votes vote down vote up
public void saveXComponent(XComponent xComponent, XOutputStream xOutputStream, String filterName) throws IOException {
    PropertyValue[] props = new PropertyValue[2];
    props[0] = new PropertyValue();
    props[1] = new PropertyValue();
    props[0].Name = "OutputStream";
    props[0].Value = xOutputStream;
    props[1].Name = "FilterName";
    props[1].Value = filterName;
    XStorable xStorable = as(XStorable.class, xComponent);
    xStorable.storeToURL("private:stream", props);
}
 
Example #4
Source File: DocumentExporter.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Exports document on the basis of the submitted filter and XOutputStream implementation.
 * 
 * @param document document to be stored
 * @param xOutputStream OpenOffice.org XOutputStream inplementation
 * @param filter filter to be used
 * 
 * @throws IOException if any error occurs
 */
public static void exportDocument(IDocument document, XOutputStream xOutputStream, IFilter filter) 
throws IOException {
  exportDocument(document, xOutputStream, filter, null);
}
 
Example #5
Source File: DocumentWriter.java    From noa-libre with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Stores document on the basis of the submitted xOutputStream implementation.
 * 
 * @param document document to be stored
 * @param xOutputStream OpenOffice.org XOutputStream inplementation
 * 
 * @throws IOException if any error occurs
 */
public static void storeDocument(IDocument document, XOutputStream xOutputStream) throws IOException {
  storeDocument(document, xOutputStream, null);
}