Third-Party Tools | HunSpell

<< Click to display table of contents >>

Third-Party Tools | HunSpell

HunSpell is a spell checker.

Hunspell is free software, distributed under the terms of a GPL, LGPL and MPL tri-license.

Visit http://hunspell.github.io/ for additional information.

Installing

HunSpell support does not require additional components, all necessary components are installed by the TRichView installer.

However, the components works only if HunSpell DLLs and dictionaries are available.

For example, you can download DLLs from our web site:

32 bit

64 bit

Dictionaries (*.aff and *.dic files) can be downloaded, for example, here: https://cgit.freedesktop.org/libreoffice/dictionaries/tree/.

Using

Create TRVAHunSpellInterface component, assign it to SpellInterface property of TRVAControlPanel component.

Create TRVHunSpell component, assign it to HunSpell property of this TRVAHunSpellInterface component. Assign its DictDir, DllDir, DllName properties, if necessary. Load dictionaries (for example, by calling LoadAllDictionaries).

Assign TrvActionSpellingCheck to a menu item or a toolbar button.

Live spelling check

To enable a live spelling check, assign OnSpellingCheck event of TCustomRichViewEdit component:

procedure TForm1.RichViewEdit1SpellingCheck(Sender: TCustomRichView;

  const AWord: String; StyleNo: Integer; var Misspelled: Boolean);

begin

  Misspelled := not RVAHunSpellInterface1.IsWordValid(AWord, 

    RichViewEdit1, StyleNo);

end;

If you want to start a live spelling check when the user starts editing, assign rvlspOnChange to LiveSpellingMode property of TCustomRichViewEdit component.

If you want to start a live spelling check when the user loaded a document, use OnOpenFile event of TrvActionOpen action:

procedure TForm1.RvActionOpen1OpenFile(Sender: TObject;

  Editor: TCustomRichViewEdit; const FileName: String

  FileFormat: TrvFileOpenFilter; CustomFilterIndex: Integer);

begin

  Editor.StartLiveSpelling;

end;

Assign TRVAPopupMenu component to RichViewEdit1.PopupMenu.