log.println( "get custom presentation" );
XCustomPresentationSupplier oCPS = (XCustomPresentationSupplier)
UnoRuntime.queryInterface(
XCustomPresentationSupplier.class, xImpressDoc);
XNameContainer xCP = oCPS.getCustomPresentations();
XInterface oInstance = null;
XInterface oInstance2 = null;
XSingleServiceFactory oSingleMSF = (XSingleServiceFactory)
UnoRuntime.queryInterface(XSingleServiceFactory.class, xCP);
try{
oInstance = (XInterface) oSingleMSF.createInstance();
oInstance2 = (XInterface) oSingleMSF.createInstance();
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create instance", e);
}
try {
xCP.insertByName("FirstPresentation",oInstance);
xCP.insertByName("SecondPresentation", oInstance2);
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException("Could't insert Instance", e);
} catch (com.sun.star.container.ElementExistException e) {
e.printStackTrace(log);