On Thu, Apr 3, 2008 at 9:54 PM, Caolan McNamara  wrote:
> Am I right in that it is not possible to simply generically query any
>  given xModel's getCurrentSelection() result to answer the question "is
>  something selected".
>
>  C.

No,  you can ...

- queryInterface the selection object for selection ranges
(com.sun.star.text.TextRanges)
- get the first selected range
- get a cursor over the range
- if the cursor is collapsed (cursor.isCollapsed() ) it means no text
was selected, otherwise it means text was select

What I would really like to see ... but it doesnt seem to be possible
...  is for an XSelectionChangeListener to directly let me know if
text was selected or not without doing this textrange comparison
stuff.... (currently xselectionchange listener is invoked for
everything...even mere movement of the cursor....).

I am trying to build functionality like a context sensitive toolbar
that gets activated only when text is selectd (like the copy, paste
toolbar in openoffice )... anyone know how to go about doing this ?

ashok



ashok

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

Reply via email to