[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    Re: spell check as you go
From:       David Faure <david () mandrakesoft ! com>
Date:       2001-09-09 19:02:11
[Download RAW message or body]

On Samedi 1 Septembre 2001 23:37, Thomas Zander wrote:
> On Sat, Sep 01, 2001 at 05:20:23PM -0700, Evan Moore wrote:
> > This is what I propose:
> > In kwview.cc I want to modify the spell checking code to work interactivly (ie \
> > with the KSpell dialog) or non-interactivly (without the KSpell dialog)
> 
> Just a quick note about what kwcanvas and kwview here.
> when you click view->split view, you have 2 views of the same document in one \
> window. This means you have one instance of KWView, and 2 instances of KWCanvas. 
No no, you have two KWViews in that case !
Each view has exactly one canvas, always.
You have only one KWDocument, though.

> Click on view->new view you open a new view of the document, in a new window. This
> means you just created a new KWView and a new KWCanvas object.
> 
> Because of this I think you want to consider storing your misspelled 
> ord-boolean and the checked-word boolean with the text (a QTRichText 
> object in a KWTextFrameset) and do the drawing in the kwcanvas.cc file.

The support for "this word is misspelled" is already available in QTextFormat
(see the enum). A format is the thing that each character has (bold, italic, fontsize \
etc.). Formats are shared (via the format collection), so all the characters with the \
same formats in fact simply store a pointer to the same format object.

Anyway, to set a word to mispelled, create a Temp selection with this word
(setSelectionStart/setSelectionEnd), create a format with the misspelled flag
to true, then call setFormat( QTextDocument::Temp, theFormat, QTextFormat::Misspelled \
) so that the misspelled flag gets set in all the letters of the word.

> Also, because the event filters (incoming keystrokes etc) are implemented 
> in kwcanvas, you might want to use the space to spell-check the last word 
> or something like that.
The file autoformat.cc already has the hooks for this. Please have a look in there.

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://perso.mandrakesoft.com/~david/ , http://www.konqueror.org/
KDE, Making The Future of Computing Available Today


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic