* @author Andreas Br�ker
*/
public IDesktopService getDesktopService() throws OfficeApplicationException {
try {
if (officeConnection == null)
throw new OfficeApplicationException("Application is not active.");
if (desktopService == null) {
Object service = officeConnection.createService("com.sun.star.frame.Desktop");
XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, service);
desktopService = new DesktopService(desktop, officeConnection);
}
return desktopService;
}
catch (Exception exception) {
OfficeApplicationException officeApplicationException = new OfficeApplicationException(exception.getMessage());
officeApplicationException.initCause(exception);
throw officeApplicationException;
}
}