Search in sources :

Example 1 with XCloseable

use of com.sun.star.util.XCloseable in project translationstudio8 by heartsome.

the class OpenOfficeDocumentConverter method storeDocument.

/**
	 * Store document.
	 * @param document
	 *            the document
	 * @param outputUrl
	 *            the output url
	 * @param storeProperties
	 *            the store properties
	 */
@SuppressWarnings("unchecked")
private void storeDocument(XComponent document, String outputUrl, Map storeProperties) throws com.sun.star.io.IOException {
    try {
        XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document);
        storable.storeToURL(outputUrl, toPropertyValues(storeProperties));
    } finally {
        XCloseable closeable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, document);
        if (closeable != null) {
            try {
                closeable.close(true);
            } catch (CloseVetoException closeVetoException) {
                if (Converter.DEBUG_MODE) {
                    closeVetoException.printStackTrace();
                }
            }
        } else {
            document.dispose();
        }
    }
}
Also used : CloseVetoException(com.sun.star.util.CloseVetoException) XStorable(com.sun.star.frame.XStorable) XCloseable(com.sun.star.util.XCloseable)

Aggregations

XStorable (com.sun.star.frame.XStorable)1 CloseVetoException (com.sun.star.util.CloseVetoException)1 XCloseable (com.sun.star.util.XCloseable)1