本文整理汇总了Java中com.sun.star.util.CloseVetoException类的典型用法代码示例。如果您正苦于以下问题:Java CloseVetoException类的具体用法?Java CloseVetoException怎么用?Java CloseVetoException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloseVetoException类属于com.sun.star.util包,在下文中一共展示了CloseVetoException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
public void execute(OfficeContext context) throws OfficeException {
XComponent document = null;
try {
document = loadDocument(context, inputFile);
modifyDocument(document);
storeDocument(document, outputFile);
} catch (OfficeException officeException) {
throw officeException;
} catch (Exception exception) {
throw new OfficeException("conversion failed", exception);
} finally {
if (document != null) {
XCloseable closeable = cast(XCloseable.class, document);
if (closeable != null) {
try {
closeable.close(true);
} catch (CloseVetoException closeVetoException) {
// whoever raised the veto should close the document
}
} else {
document.dispose();
}
}
}
}
示例2: storeDocument
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
/**
* 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();
}
}
}
示例3: close
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
public void close() {
try {
XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, doc);
if (xCloseable == null) {
throw new IllegalStateException("XSpreadsheet is not closable");
}
xCloseable.close(false);
} catch (CloseVetoException e) {
throw new LibreOfficeException(e);
}
}
示例4: execute
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
/**
* Execute method.
* @param context OfficeContext
* @throws OfficeException in case of conversion failure
*/
public void execute(OfficeContext context) throws OfficeException {
XComponent document = null;
try {
if (inputFile != null) {
document = loadDocument(context, inputFile);
} else {
document = loadDocument(context, inputFileURL);
}
storeDocument(document, outputFile);
} catch (OfficeException officeException) {
throw officeException;
} catch (Exception exception) {
throw new OfficeException("conversion failed", exception);
} finally {
if (document != null) {
XCloseable closeable = cast(XCloseable.class, document);
if (closeable != null) {
try {
closeable.close(true);
} catch (CloseVetoException closeVetoException) {
// whoever raised the veto should close the document
}
} else {
document.dispose();
}
}
}
}
示例5: terminate
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
private void terminate(int nExitCode)
{
sysCaller.exitProcess(sProcessId);
sysCaller.closeObject(sCrtObjHandle);
XCloseable xcloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xComp);
try {
xcloseable.close(true);
} catch (CloseVetoException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.exit(nExitCode);
}
示例6: queryClosing
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
@Override
public void queryClosing(EventObject arg0, boolean arg1)
throws CloseVetoException
{}
示例7: queryClosing
import com.sun.star.util.CloseVetoException; //导入依赖的package包/类
/**
* Is called when somewhere tries to close listened object.
*
* @param eventObject source event object
* @param getsOwnership information about the ownership
*
* @throws CloseVetoException close veto exception
*
* @author Andreas Bröker
*/
public void queryClosing(EventObject eventObject, boolean getsOwnership)
throws CloseVetoException {
CloseEvent closeEvent = new CloseEvent(eventObject, getServiceProvider());
closeListener.queryClosing(closeEvent, getsOwnership);
if(closeEvent.getVeto())
throw new CloseVetoException();
}