Hi Yu,

> When I tried to query an XTextRange interface from an any-
> type Selection returned by XModel.getCurrentSelection()

mmm ... XModel is no XSelectionSupplier and so won't have a current
Selection. From the XModel you can get the currentController and this
will support a XSelectionSupplier ... pseudo code might be something
like this

XController xC = xModel.getCurrentController();

XSelectionSupplier xSel = (XSelectionSupplier)
UnoRuntime.queryInterface(XSelectionSupplier.class, xC);

Object o = xSel.getSelection();

> via UnoRuntime.queryInterface? And if I can, what 
> interfaces does the Selection support? Thank you in advance!

QueryInterface is always the way to gain the Interface of your choice
from a given UNO-API object.
If you for example marked a "normal" text in your document than the
above code should give you a SwXTextRanges object. So you could continue
with

XIndexAccess xIA = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, o);

XTextRange theFirst = (XTextRange)
UnoRuntime.queryInterface(XTextRange.class, xIA.getByIndex(0));

Hope that helps

Regards

Stephan

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

Reply via email to