Hi Joan,

XComponent xC = xDesktop.getCurrentComponent();
XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class,xC);

This can be a wee bit tricky since you would always get the document that currently has the focus. Since you are working with Fields you should have the XTextDocument somewhere already, from which you can gain the XModel.

It triggers the XDispatchHelper but always where I left my cursor, what about inserting it where the mark was found? Is there a way to link the
XDispatchHelper with the element I'm in?

Are you sure you need dispatching commands at all ?

Well if you decide that you need them you could just move the visible cursor to the position you need it. From xModel.getCurrentController you should be able to query the XTextViewCursorSupplier. This has the method getViewCursor(). The result of calling this method can be queried on a XTextCursor, which has a method gotoRange(). With the latter you should be able to position the visible cursor to the text range your field is in.

Hope that helps

Regards

Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to