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

List:       koffice-devel
Subject:    kspell2
From:       Zack Rusin <zack () kde ! org>
Date:       2004-05-02 6:30:23
Message-ID: 200405020230.23378.zack () kde ! org
[Download RAW message or body]

Ave,

KSpell2 is in kdelibs. If you've got it installed I'd appreciate some 
help/testers. The koText patch pretty much comes down to :
- kospell - implements KSpell2::BackgroundChecker class. It's the 
"engine" used by both the dialog and the highlighter in kspell2. Thanks 
to which no additional code is necessary for for example checking just 
the selected text - you just pass the right kotextiterator or parag to 
it.
- kobgspellcheck.h - which uses kospell to actually highlight the 
misspelled word. 

In order to get background spellchecking for your application you need 
to implement 
KoTextIterator *KoBgSpellCheck::createWholeDocIterator() const;
method which of course create a KoTextIterator for your whole document. 
Besides doing that you need to remember to call 
KoBgSpellCheck::registerNewTextObject( KoTextObject *object ) function 
which registers new text object with the background checker. 

The createWholeDocIterator is called on startup and the background 
checker goes into action and starts checking. It also goes into 
interactive mode. Interactive mode means that it listens for 
paragraphCreated/Modified/Deleted signals from the registered text 
objects and acts as follows:
a) if paragraph created is catch, the paragraph is added to the queue of 
the ones which need to be checked,
b) if modified is catched and the length of the modified text is less 
than 3 (it's 1 of course as you're typing) then background checker 
fetches just the modifed word and checks just it. If the length is 
greater or equal to 3 then it acts just during the catch of 
paragraphCreated signal. This makes it _very_ _very_ fast. It also 
takes very little cpu. 
c) if paragraphDeleted is cought then the list of paras about to be 
checked is searched and if that para is in it, it's removed.

So yeah, I'm sending the kotext patch which is done and the kword patch 
which is missing the configuration page in the config dialog (it's just 
a matter of adding KSpell2::ConfigWidget there) and for some reason 
crashes randomly when checking with the dialog. While background 
checking is virtually perfect, the dialog is acting up and I need to 
figure out what's wrong there. Either way, it's ok to try it out 
(assuming you have kdelibs HEAD compiled).

Zack


-- 
As long as there are tests, there will be prayer in public schools.

["kspell2.tar.bz2" (application/x-tbz)]

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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