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();
}
}
}
Aggregations