Den 23/03/2006 kl. 19.25 skrev Mathias Bauer:
We have an API for cursor travelling, but I don't understand how asingle integer value can describe a cursor position. Can you explain?What is the "reference point" for your position?OK. ^ is cursor ^hello <-- pos == 0 h^ello <-- pos == 1Yes, sure, but this doesn't help. Consider a complex document with 100 pages of text. Your current view might be on page 17. On this page you have a text table on the tab, followed by normal text, the text cursor is in the last paragraph of it. So which character should be the one with position 0? The first character of the document? The first character in the table? The character that the cursor points to?
Honestly that doesn't really matter, as long as the mapping is reliable, and as long as I can get the entire text of the document.
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.
This sounds possible from your description...
void ChangeRange(const HWND w, char *NewString, const int start, const int length);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 inthe 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.
BTW: I thought that the best list would be [email protected] but[email protected] should be OK here also. One move is enough. :-)OK, I have tried a few times, but it has not shown up in the archives. Not Iexperiment with a new method (joining, then mailing to thwe list).I didn't want to suggest a move to api-dev, but now you arrived here, solet's go on. :-)
Nobody was replying in the other list, so... A --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
