Anders Johansen wrote:

> The ONLY things that matter are, that
> * I can get the entire text (for spell checking)
> * I can convert a position in the entire text to a position in a part  
> of the editable text of an OO document (so I can replace a word  
> during spell check)
> * I can get the current position (expressed as an int), and the  
> current text, and hence parse out the current partially written word  
> (if any)
> * I can replace the current word with another one (word prediction)
>
> For example in Word I do it by requesting all text (WholeStory I  
> think it's called), and then calculating the difference in one-letter- 
> movements to the current selection.
> 
> Assuming that the document consists of 3 chuncks of text, one could  
> do like this:
> 
> Context = text from part 1 + text from part 2 + text from part 3
> 
> if (cursor is in part 1) {
>    Position = position in part 1;
> } else if (cursor is in part 2) {
>    Position = length of text in part 1 + position in part 2;
> } else <...>
> 
> This would leave the problem of handling highlights that span  
> boundaries of text blocks.
> 
> You see, from my point of view the ORDER of the text blocks does not  
> matter. I do not have to parse the text in the order it is written or  
> read, really, although it would be nice if the order was somewhat sane.

OK, so the tricky part will be to have a reliable algorithm that
"serializes" every possible arrangement of text on a single Writer page.
Or the whole text of a document? Should be doable but needs some
thinking. After this coding will not be the biggest problem. :-)

>> I forgot to mention: if you want to use char* to address strings there
>> is another problem because OOo strings are 16Bit UniCode strings, so a
>> suitable data type should be used. You could workaround this by
>> converting all strings received by our API to UTF-8 encoded strings in
>> the DLL with C-API but then you can't rely on the usual pointer  
>> arithmetics.
> 
> Don't need pointer calcs. Just need to replace a chunk of text with  
> something else for spell checking or word prediction.

So you would be fine with getting the text as UTF-8 encoded byte strings?

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