List Info

Thread: How to get paragraph from TextRange




How to get paragraph from TextRange
user name
2006-09-20 09:24:05
Hi to all,

Does someone know a reliable way to get the paragraph
containing a 
TextRange (let's say it's collapsed), beside of course
enumerating all 
paragraphs from the start of the text ? (which has linear
complexity 
proportional to the number of paragraphs)

I have read in a mail of this list that the TextRange
service implements 
XEnumerationAccess, apparently in the same way as the Text
service does.
I have tried, and it seems to give some result, but :
- XEnumerationAccess on TextRange seems undocumented (at
least in the 
SDK 2.0 I have); will this interface be maintained or
published in the 
future ?
- Can I be sure that it is the TextRange service itself that
implements 
XEnumerationAccess, and not only some services including
TextRange, such 
as TextCursor, TextPortion, etc. ? (I have tried on both
TextCursor and 
TextPortion, it works)

For instance, is the following navigation in the text model
valid :

Text -> by XEnumerationAccess, enumerate all Paragraph
Paragraph -> by XEnumerationAccess, enumerate all
TextPortion
TextPortion -> since it includes TextRange, by
XEnumerationAccess, 
enumerate again the (only) paragraph "contained"
in the range of the portion

etc. ad infinitum ? It seems to work !

Thank you if you have any hint or confirmation of this
surprising use of 
interfaces,

Julien Galand


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )