* @author Andreas Br�ker
* @date 14.06.2006
*/
public IDispatch getDispatch(String commandURL) throws NOAException {
if (commandURL == null)
throw new NOAException("The command URL is not valid.");
try {
XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime
.queryInterface(XDispatchProvider.class, xFrame);
URL[] urls = new URL[1];
urls[0] = new URL();
urls[0].Complete = commandURL;
Object service = null;
if (officeConnection != null)
service = officeConnection
.createService("com.sun.star.util.URLTransformer");
else
service = serviceProvider
.createService("com.sun.star.util.URLTransformer");
XURLTransformer xURLTranformer = (XURLTransformer) UnoRuntime
.queryInterface(XURLTransformer.class, service);
xURLTranformer.parseStrict(urls);
XDispatch xDispatch = xDispatchProvider.queryDispatch(urls[0], "",
FrameSearchFlag.GLOBAL);
if (xDispatch == null)
throw new NOAException("The command URL is not valid");
return new Dispatch(xDispatch, urls[0]);
} catch (Throwable throwable) {
throw new NOAException(throwable);
}
}