[api-dev] How to get paragraph from TextRange

2006-09-20 Thread Julien Galand

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] How to get paragraph from TextRange

2006-09-29 Thread Andrew Douglas Pitonyak
If you can create a text cursor from a TextRange, then you can use the 
ParagraphCursor to jump to the start and end of the paragraph.


Julien Galand wrote:

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)


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

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