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

How to get paragraph from TextRange
user name
2006-09-30 04:33:05
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.pi
tonyak.org/AndrewMacro.odt
My Book: http://w
ww.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.or
g/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

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

[1-2]

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