* @param docLoader A documet loader
* @return A handle to the document
*/
private DocumentHandle loadDocument(XMultiServiceFactory xMSF,
String docLoader) {
DocumentHandle docHandle = null;
try {
// create component loaader
XComponentLoader xCompLoader = (XComponentLoader)
UnoRuntime.queryInterface(
XComponentLoader.class, xMSF.createInstance(
"com.sun.star.frame.Desktop"));
XFramesSupplier xFrameSupp = (XFramesSupplier)UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
// close all existing frames
XFrames xFrames = xFrameSupp.getFrames();
XIndexAccess xAcc = (XIndexAccess)UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
for ( int i=0; i<xAcc.getCount(); i++ ) {
XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
try {
if ( xClose != null ) {
xClose.close(false);
}
else {
failed("Could not query frame for XCloseable!");
}
}
catch( com.sun.star.uno.Exception e ) {
e.printStackTrace((java.io.PrintWriter)log);
failed("Could not query frame for XCloseable!");
}
}
docHandle = new DocumentHandle(xCompLoader);
docHandle.loadDocument(docLoader, false);
}
catch(com.sun.star.uno.Exception e) {
e.printStackTrace();
}
catch(java.lang.Exception e) {