Thanks Stephan, that was really helpful!

The problem is that I don't really get (maybe because of my English)
what is every class... What's a model, a controller, a component, a
frame, etc

Joan

-----Mensaje original-----
De: Stephan Wunderlich [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 17 de noviembre de 2006 11:13
Para: [email protected]
Asunto: Re: [api-dev] XDispatchHelper / XModel in XEnumeration

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]


This e-mail may contain confidential or privileged information. Any unauthorised
copying, use or distribution of this information is strictly prohibited.

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

Reply via email to