Hello Marcin,

> Marcin Miłkowski wrote:
> 
>> Hi all,
>> 
>> I'm trying to understand the new API from the point of view of the 
>> grammar checker developer (unfortunately, the docs are written from the 
>> opposite point of view).
>> 
>> So far I got this (I'm using Java, so Java API names follow):
>> 
>> The checker should implement the XGrammarChecker interface, and define 
>> its abilities this way. OK. The checking process would be started with 
>> doGrammarChecking() method. OK. But here goes what I don't understand. 
>> Suppose I found some errors with my code, and I built the structures 
>> that describe errors (as far as I understand, I should use 
>> GrammarCheckingResult that contains a collection of 
>> SingleGrammarErrors). But what should I do with this structure? In other 
>> words, how do I make a wavy green line to appear, or supply data for a 
>> grammar checker dialog box / context menu? I haven't found any APIs that 
>> allow doing that but maybe they're generic and not for grammar-checking 
>> only.
> 
> You don't need to do that - OOo will do that for you, based on the
> information you return.
> 
>> It's not clear to me if doGrammarChecking() would be triggered 
>> automatically or not - if not, whether I should build a class that uses 
>> XFlatParagraph to iterate the document? Also I cannot see any use for 
>> document IDs in the API - what are they for? And what endDocument method 
>> should do?
> 
> OOo will call doGrammarChecking() in the idle processing. Thomas Lange
> currently is implementing this. For the moment you can write a Basic
> macro that calls doGrammarChecking() and so start your checking with
> this macro.

Or to be more precisely you don't even start the grammar checking by
calling doGrammarChecking()!
That function is called by the grammar checking iterator (see file
gciterator in linguistic). That iterator is a listener to the results of
the grammar checker and when processing them will call a function to
draw the green lines.

The application (or user) is just supposed to call
startGrammarChecking(...) at that iterator whenever it thinks sth needs
to be done. The grammar checking iterator will then take care of the rest.

Please note that currently the iterator is hardcoded to call the dummy
grammar checker. (That is currently being changed.)
For the time being you need to change that part in gciterator.cxx to
create your grammar checker by using the multi service factory.

Drop me a note and I can provide you with the necessary changes in
gciterator.cxx if you need a helping hand that is if you want them quickly.


Regards,
Thomas






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

Reply via email to