Hi Daniel,

Daniel Naber wrote:

> Hi,
> 
> I posted this on oooforum.org already 
> (http://www.oooforum.org/forum/viewtopic.phtml?t=44933) but it wasn't 
> completly solved, so I need to try here again.
> 
> [...] The next problem is that I need to get the text and check it, then 
> navigate to given positions and select them (this is for my grammar 
> checker, LanguageTool). I can use the following code to navigate to given 
> positions, but it seems to count in a different way than the code above 
> (i.e. using XEnumerationAccess): 
>  
>          XTextCursor cursor = xTextDoc.getText().createTextCursor(); 
>          XParagraphCursor xParagraphCursor = (XParagraphCursor) 
>          UnoRuntime.queryInterface(XParagraphCursor.class, cursor); 
>          boolean hasNextParagraph = true; 
>          while (hasNextParagraph) { 
>            if (paraCount == paragraphNumber) { 
>              xParagraphCursor.gotoStartOfParagraph(false); 
>              xParagraphCursor.goRight(..., false); 
>            } 
>            hasNextParagraph = xParagraphCursor.gotoNextParagraph(false); 
>          }  
>    
> So when I find an error in, say, "paragraph 10, characters 5 to 8", I 
> cannot use this code to navigate there because it seems to count tables 
> differently (namely it ignores them) and I end up in paragraph 11 instead 
> of 10 with the wrong text selected. 
>  
> So how can I combine the first way of iterating over text 
> (XEnumerationAccess) with using the cursor to go right/left/select? In 
> other words, if I have an XEnumeration and XEnumerationAccess, how do I 
> get an XParagraphCursor for that? 

I can't help with your problem, I only wanted to ask wether it is an
option for you to wait for our new Grammar Checking API that will not
require any text iteration from inside the Grammar Checker as it always
gets plain text as a source?

One of the reasons why we want to have a simplified is exactly the point
where you struggled: there is no common paragraph enumeration for *all*
text inside the document. So we will offer one.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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

Reply via email to