com.sun.star.beans.PropertyValue Java Examples
The following examples show how to use
com.sun.star.beans.PropertyValue.
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 |
/** * 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: PrintService.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Returns the active printer. * * @return the active printer * * @throws NOAException if printer could not be retrieved * * @author Markus Krüger * @date 16.08.2007 */ public IPrinter getActivePrinter() throws NOAException { try { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerProps = xPrintable.getPrinter(); String name = null; for(int i = 0; i < printerProps.length; i++) { if(printerProps[i].Name.equals("Name")) name = (String)printerProps[i].Value; } return new Printer(name); } catch(Throwable throwable) { throw new NOAException(throwable); } }
Example #3
Source File: PrintService.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Returns if the active printer is busy. * * @return if the active printer is busy * * @throws NOAException if the busy state could not be retrieved * * @author Markus Krüger * @date 16.08.2007 */ public boolean isActivePrinterBusy() throws NOAException { try { XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerProps = xPrintable.getPrinter(); Boolean busy = new Boolean(false); for(int i = 0; i < printerProps.length; i++) { if(printerProps[i].Name.equals("IsBusy")) busy = (Boolean)printerProps[i].Value; } return busy.booleanValue(); } catch(Throwable throwable) { throw new NOAException(throwable); } }
Example #4
Source File: DocumentService.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Loads document on the basis of the submitted URL. * * @param url URL of the document * @param documentDescriptor document descriptor to be used * * @return loaded document * * @throws NOAException if the document can not be loaded or the URL does * not locate an OpenOffice.org document * * @author Andreas Bröker * @date 02.07.2006 */ public IDocument loadDocument(String url, IDocumentDescriptor documentDescriptor) throws NOAException { try { PropertyValue[] propertyValues = DocumentDescriptorTransformer.documentDescriptor2PropertyValues(documentDescriptor); url = URLAdapter.adaptURL(url); IDocument document = DocumentLoader.loadDocument(serviceProvider, url, propertyValues); if (document != null) return document; else throw new NOAException(Messages.getString("DocumentService_exception_url_invalid")); //$NON-NLS-1$ } catch (Throwable throwable) { throw new NOAException(throwable); } }
Example #5
Source File: PrintService.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Sets the active printer. * * @param printer the printer to be set to be active * * @throws NOAException if printer could not be set * * @author Markus Krüger * @date 16.08.2007 */ public void setActivePrinter(IPrinter printer) throws NOAException { try { if(printer == null) throw new NullPointerException("Invalid printer to be set"); XPrintable xPrintable = (XPrintable)UnoRuntime.queryInterface(XPrintable.class, document.getXComponent()); PropertyValue[] printerDesc = new PropertyValue[1]; printerDesc[0] = new PropertyValue(); printerDesc[0].Name = "Name"; printerDesc[0].Value = printer.getName(); xPrintable.setPrinter(printerDesc); } catch(Throwable throwable) { throw new NOAException(throwable); } }
Example #6
Source File: DocumentLoader.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Loads document from the submitted URL into the OpenOffice.org frame. * * @param serviceProvider the service provider to be used * @param xFrame frame to used for document * @param URL URL of the document * @param searchFlags search flags for the target frame * @param properties properties for OpenOffice.org * * @return loaded document * * @throws Exception if an OpenOffice.org communication error occurs * @throws IOException if document can not be found */ public static IDocument loadDocument(IServiceProvider serviceProvider, XFrame xFrame, String URL, int searchFlags, PropertyValue[] properties) throws Exception, IOException { if (xFrame != null) { if (properties == null) { properties = new PropertyValue[0]; } XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xFrame); return loadDocument(serviceProvider, xComponentLoader, URL, xFrame.getName(), searchFlags, properties); } return null; }
Example #7
Source File: DocumentExporter.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Exports document on the basis of the submitted filter and URL. * * @param document document to be exported * @param URL URL to be used * @param filter OpenOffice.org filter to be used * @param properties properties properties for OpenOffice.org * * @throws IOException if any error occurs */ public static void exportDocument(IDocument document, String URL, IFilter filter, 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 = "FilterName"; newProperties[properties.length].Value = filter.getFilterDefinition(document); XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, document.getXComponent()); try { xStorable.storeToURL(URL, newProperties); } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.getMessage()); } }
Example #8
Source File: ApplicationInfo.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * This method can be used to get any info from the application that is available. * (Possible paths and keys can be retrieved with the dumpInfo method). * Returns the object described by the path and key, or <code>null</code> if not available. * * @param path the path to the key information * @param key the key to get the value for * * @return the object described by the path and key, or <code>null</code> if not available * * @throws Exception if retreiving the value fails * * @author Markus Krüger * @date 18.11.2008 */ public Object getInfo(String path, String key) throws Exception { Object configProviderObject = serviceProvider.createService("com.sun.star.comp.configuration.ConfigurationProvider"); XMultiServiceFactory xConfigServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, configProviderObject); String readConfAccess = "com.sun.star.configuration.ConfigurationAccess"; PropertyValue[] properties = new PropertyValue[1]; properties[0] = new PropertyValue(); properties[0].Name = "nodepath"; properties[0].Value = path; Object configReadAccessObject = xConfigServiceFactory.createInstanceWithArguments(readConfAccess, properties); XNameAccess xConfigNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, configReadAccessObject); return xConfigNameAccess.getByName(key); }
Example #9
Source File: DocumentWriter.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Stores document to the submitted URL. * * @param document document to be stored * @param URL URL to be used * @param properties properties for OpenOffice.org * * @throws IOException if any error occurs */ public static void storeDocument(IDocument document, String URL, PropertyValue[] properties) throws IOException { if(URL == null) { URL = ""; } if(properties == null && URL.length() == 0) { properties = new PropertyValue[0]; } XStorable xStorable = (XStorable)UnoRuntime.queryInterface(XStorable.class, document.getXComponent()); try { if(URL.length() != 0) { xStorable.storeToURL(URL, properties); } else { xStorable.store(); } } catch(com.sun.star.io.IOException ioException) { throw new IOException(ioException.getMessage()); } }
Example #10
Source File: MemoryUsage.java From kkFileView with Apache License 2.0 | 6 votes |
private XSpreadsheet createSpreadsheet(XScriptContext ctxt) throws Exception { XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, ctxt.getDesktop()); XComponent comp = loader.loadComponentFromURL( "private:factory/scalc", "_blank", 4, new PropertyValue[0]); XSpreadsheetDocument doc = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, comp); XIndexAccess index = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, doc.getSheets()); XSpreadsheet sheet = (XSpreadsheet) AnyConverter.toObject( new Type(com.sun.star.sheet.XSpreadsheet.class), index.getByIndex(0)); return sheet; }
Example #11
Source File: AbstractOpenOfficeDocumentConverter.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * To property values. * @param properties * the properties * @return the property value[] */ @SuppressWarnings("unchecked") protected static PropertyValue[] toPropertyValues(Map/* <String,Object> */properties) { PropertyValue[] propertyValues = new PropertyValue[properties.size()]; int i = 0; for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Object value = entry.getValue(); if (value instanceof Map) { // recursively convert nested Map to PropertyValue[] Map subProperties = (Map) value; value = toPropertyValues(subProperties); } propertyValues[i++] = property((String) entry.getKey(), value); } return propertyValues; }
Example #12
Source File: AbstractOpenOfficeDocumentConverter.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * To property values. * @param properties * the properties * @return the property value[] */ @SuppressWarnings("unchecked") protected static PropertyValue[] toPropertyValues(Map/* <String,Object> */properties) { PropertyValue[] propertyValues = new PropertyValue[properties.size()]; int i = 0; for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Object value = entry.getValue(); if (value instanceof Map) { // recursively convert nested Map to PropertyValue[] Map subProperties = (Map) value; value = toPropertyValues(subProperties); } propertyValues[i++] = property((String) entry.getKey(), value); } return propertyValues; }
Example #13
Source File: AbstractInliner.java From yarg with Apache License 2.0 | 6 votes |
protected XPropertySet buildImageProperties(XGraphicProvider xGraphicProvider, Object oImage, byte[] imageContent) throws Exception { XPropertySet imageProperties = as(XPropertySet.class, oImage); PropertyValue[] propValues = new PropertyValue[]{new PropertyValue()}; propValues[0].Name = "InputStream"; propValues[0].Value = new ByteArrayToXInputStreamAdapter(imageContent); XGraphic graphic = xGraphicProvider.queryGraphic(propValues); if (graphic != null) { imageProperties.setPropertyValue("Graphic", graphic); imageProperties.setPropertyValue("HoriOrient", HoriOrientation.NONE); imageProperties.setPropertyValue("VertOrient", HoriOrientation.NONE); imageProperties.setPropertyValue("HoriOrientPosition", 0); imageProperties.setPropertyValue("VertOrientPosition", 0); } return imageProperties; }
Example #14
Source File: HtmlContentInliner.java From yarg with Apache License 2.0 | 6 votes |
private void insertHTML(XText destination, XTextRange textRange, String htmlContent) throws Exception { File tempFile = null; try { tempFile = File.createTempFile(UUID.randomUUID().toString(), ".htm"); StringBuilder contentBuilder = new StringBuilder(); contentBuilder.append(ENCODING_HEADER); contentBuilder.append(OPEN_HTML_TAGS); contentBuilder.append(htmlContent); contentBuilder.append(CLOSE_HTML_TAGS); FileUtils.writeByteArrayToFile(tempFile, contentBuilder.toString().getBytes()); String fileUrl = "file:///" + tempFile.getCanonicalPath().replace("\\", "/"); XTextCursor textCursor = destination.createTextCursorByRange(textRange); XDocumentInsertable insertable = as(XDocumentInsertable.class, textCursor); insertable.insertDocumentFromURL(fileUrl, new PropertyValue[0]); } finally { FileUtils.deleteQuietly(tempFile); } }
Example #15
Source File: Frame.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Aktivates the print preview for the frame with the given columns and rows. * * @param columns the number of columns to display * @param rows the number of rows to display * * @throws NOAException if there is an error showing the preview * * @author Markus Krüger * @date 09.07.2007 */ public void showPreview(int columns, int rows) throws NOAException { IDispatch dispatch = getDispatch(GlobalCommands.PRINT_PREVIEW); dispatch.dispatch(); if(columns < 1) columns = 1; if(rows < 1) rows = 1; dispatch = getDispatch(GlobalCommands.PRINT_PREVIEW_SHOW_MULTIPLE_PAGES); PropertyValue[] properties = new PropertyValue[2]; properties[0] = new PropertyValue(); properties[0].Name = "Columns"; properties[0].Value = new Integer(columns); properties[1] = new PropertyValue(); properties[1].Name = "Rows"; properties[1].Value = new Integer(rows); dispatch.dispatch(properties); }
Example #16
Source File: MemoryUsage.java From kkFileViewOfficeEdit with Apache License 2.0 | 6 votes |
private XSpreadsheet createSpreadsheet(XScriptContext ctxt) throws Exception { XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, ctxt.getDesktop()); XComponent comp = loader.loadComponentFromURL( "private:factory/scalc", "_blank", 4, new PropertyValue[0]); XSpreadsheetDocument doc = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, comp); XIndexAccess index = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, doc.getSheets()); XSpreadsheet sheet = (XSpreadsheet) AnyConverter.toObject( new Type(com.sun.star.sheet.XSpreadsheet.class), index.getByIndex(0)); return sheet; }
Example #17
Source File: DocumentLoader.java From noa-libre with GNU Lesser General Public License v2.1 | 6 votes |
/** * Loads document on the basis of the submitted XInputStream implementation. * * @param serviceProvider the service provider to be used * @param xInputStream OpenOffice.org XInputStream inplementation * @param properties properties for OpenOffice.org * * @return loaded Document * * @throws Exception if an OpenOffice.org communication error occurs * @throws IOException if document can not be found */ public static IDocument loadDocument(IServiceProvider serviceProvider, XInputStream xInputStream, PropertyValue[] properties) throws Exception, 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 = "InputStream"; newProperties[properties.length].Value = xInputStream; Object oDesktop = serviceProvider.createServiceWithContext("com.sun.star.frame.Desktop"); XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, oDesktop); return loadDocument(serviceProvider, xComponentLoader, "private:stream", "_blank", 0, newProperties); }
Example #18
Source File: PropertyDescriptor.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Activates the "Hidden" property. * */ public void activatePropertyHidden () { PropertyValue tempPValue []= new PropertyValue [1]; tempPValue[0] = new PropertyValue (); tempPValue[0].Name = "Hidden"; tempPValue[0].Value = new Boolean (true); arrayList.add(tempPValue[0]); }
Example #19
Source File: PersistenceService.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Stores document to the submitted URL. * * @param url URL to be used as location * * @throws DocumentException if the document can not be stored * * @author Andreas Bröker */ public void store(String url) throws DocumentException { if (url == null) throw new DocumentException(Messages.getString("PersistenceService.error_url_invalid_message")); //$NON-NLS-1$ try { url = URLAdapter.adaptURL(url); PropertyValue[] initialPropertyValues = document.getInitialProperties(); String filterDefinition = null; for (int i = 0; i < initialPropertyValues.length; i++) { if (initialPropertyValues[i].Name.equalsIgnoreCase("FilterName")) filterDefinition = initialPropertyValues[i].Value.toString(); } boolean useFilter = filterDefinition != null && filterDefinition.length() > 0; if (useFilter) { PropertyValue[] propertyValues = new PropertyValue[1]; propertyValues[0] = new PropertyValue(); propertyValues[0].Name = "FilterName"; //$NON-NLS-1$ propertyValues[0].Value = filterDefinition; xStorable.storeAsURL(url, propertyValues); } else { xStorable.storeAsURL(url, new PropertyValue[0]); } document.setModified(false); } catch (Throwable throwable) { String message = throwable.getMessage(); if (throwable instanceof ErrorCodeIOException) { if (message == null || message.length() == 0) message = Messages.getString("PersistenceService.error_io_message", String.valueOf(((ErrorCodeIOException) throwable).ErrCode)); //$NON-NLS-1$ } else if (message == null || message.length() == 0) message = ERROR_MESSAGE; throw new DocumentException(message, throwable); } }
Example #20
Source File: PropertyDescriptor.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Activates the "AsTemplate" property. */ public void activatePropertyAsTemplate () { PropertyValue tempPValue []= new PropertyValue [1]; tempPValue[0] = new PropertyValue (); tempPValue[0].Name = "AsTemplate"; tempPValue[0].Value = new Boolean (true); arrayList.add(tempPValue[0]); }
Example #21
Source File: PropertyDescriptor.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Sets property value. * * @param name the property name attribute. * @param object the property value attribute. */ public void setProperty(String name, Object object) { PropertyValue tempPValue []= new PropertyValue [1]; tempPValue[0] = new PropertyValue (); tempPValue[0].Name = name; tempPValue[0].Value = object; arrayList.add(tempPValue[0]); }
Example #22
Source File: TextCursor.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Inserts a text document at the current cursor location. * * @param url URL of the document (must look like file:///c:/test.odt) * * @throws NOAException if the text document can not be inserted * * @author Andreas Bröker * @date 27.10.2006 */ public void insertDocument(String url) throws NOAException { if(url == null) return; try { XDocumentInsertable xDocumentInsertable = (XDocumentInsertable)UnoRuntime.queryInterface(XDocumentInsertable.class, xTextCursor); if(xDocumentInsertable != null) xDocumentInsertable.insertDocumentFromURL(URLAdapter.adaptURL(url), new PropertyValue[0]); } catch(Throwable throwable) { throw new NOAException(throwable); } }
Example #23
Source File: Dispatch.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Dispatches the related command with the submitted property values. * * @param propertyValues property values to be used * * @throws NOAException if the command can not be executed * * @author Andreas Bröker * @date 06.11.2006 */ public void dispatch(PropertyValue[] propertyValues) throws NOAException { if(propertyValues == null) dispatch(); else { try { xDispatch.dispatch(url, propertyValues); } catch(Throwable throwable) { throw new NOAException(throwable); } } }
Example #24
Source File: PropertyDescriptor.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Method to return the array of PropertyValues comprised in the object. * * @return propertyValue Array of property Values */ public PropertyValue[] getProperties() { PropertyValue propertyValue[] = new PropertyValue[ arrayList.size() ]; for (int i = 0; i<arrayList.size();i++) { propertyValue[i] = (PropertyValue) arrayList.get(i); } return propertyValue; }
Example #25
Source File: OfficeUtils.java From kkFileViewOfficeEdit with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public static PropertyValue[] toUnoProperties(Map<String,?> properties) { PropertyValue[] propertyValues = new PropertyValue[properties.size()]; int i = 0; for (Map.Entry<String,?> entry : properties.entrySet()) { Object value = entry.getValue(); if (value instanceof Map) { Map<String,Object> subProperties = (Map<String,Object>) value; value = toUnoProperties(subProperties); } propertyValues[i++] = property((String) entry.getKey(), value); } return propertyValues; }
Example #26
Source File: PersistenceService.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * Stored document in the submitted output stream. * * @param outputStream output stream to be used * * @throws Throwable if the document can not be stored * @author Alessandro Conte * @date 07.09.2006 */ private void storeInternal(OutputStream outputStream) throws Throwable { if (outputStream == null) return; OutputStreamToXOutputStreamAdapter stream = new OutputStreamToXOutputStreamAdapter(outputStream); PropertyValue[] initialPropertyValues = document.getInitialProperties(); String filterDefinition = null; for (int i = 0; i < initialPropertyValues.length; i++) { if (initialPropertyValues[i].Name.equalsIgnoreCase("FilterName")) filterDefinition = initialPropertyValues[i].Value.toString(); } boolean useFilter = filterDefinition != null && filterDefinition.length() > 0; int propCount = 2; if (useFilter) propCount = 3; PropertyValue[] propertyValues = new PropertyValue[propCount]; propertyValues[0] = new PropertyValue("OutputStream", -1, stream, PropertyState.DIRECT_VALUE); //$NON-NLS-1$ propertyValues[1] = new PropertyValue(); propertyValues[1].Name = "Hidden"; //$NON-NLS-1$ propertyValues[1].Value = new Boolean(true); if (useFilter) { propertyValues[2] = new PropertyValue(); propertyValues[2].Name = "FilterName"; //$NON-NLS-1$ propertyValues[2].Value = filterDefinition; } xStorable.storeToURL("private:stream", propertyValues); //$NON-NLS-1$ document.setModified(false); }
Example #27
Source File: DocumentExporter.java From noa-libre with GNU Lesser General Public License v2.1 | 5 votes |
/** * 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 #28
Source File: OfficeResourceProvider.java From yarg with Apache License 2.0 | 5 votes |
public XComponent loadXComponent(byte[] bytes) throws com.sun.star.lang.IllegalArgumentException, IOException { XComponentLoader xComponentLoader = getXComponentLoader(); PropertyValue[] props = new PropertyValue[1]; props[0] = new PropertyValue(); props[0].Name = "Hidden"; props[0].Value = Boolean.TRUE; File tempFile = createTempFile(bytes); return xComponentLoader.loadComponentFromURL(toURL(tempFile), "_blank", 0, props); }
Example #29
Source File: OfficeResourceProvider.java From yarg with Apache License 2.0 | 5 votes |
public XComponent loadXComponent(XInputStream inputStream) throws com.sun.star.lang.IllegalArgumentException, IOException { XComponentLoader xComponentLoader = getXComponentLoader(); PropertyValue[] props = new PropertyValue[2]; props[0] = new PropertyValue(); props[1] = new PropertyValue(); props[0].Name = "InputStream"; props[0].Value = inputStream; props[1].Name = "Hidden"; props[1].Value = true; return xComponentLoader.loadComponentFromURL("private:stream", "_blank", 0, props); }
Example #30
Source File: OfficeResourceProvider.java From yarg with Apache License 2.0 | 5 votes |
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); }