LMD-Tools SpellPack Guide
LMD SpellPack supports *.oxt dictionary file format. The file is actually a zip file, which contain several dictionaries along with required meta-data. Basic English dictionary file is included as part of LMD SpellPack installation: dict-en.oxt. More dictionary files can be downloaded from here:
https://extensions.openoffice.org/en/search?f%5B0%5D=field_project_tags%3A157
Supported *.oxt files may contain two kinds of dictionaries:
•Spell (spell check, analyze, suggest)
•Hyphenation (hyphenate)
Access to dictionary files is required at application run-time, so, the application should store available dictionary files somewhere on the disk on user's computer. TLMDSpellChecker stores full file paths in its configuration, so, moving application between folders will require to change configured dictionaries.
To simplify experimenting with spell checker the component supports design-time dictionaries configuration. Design-time component editor shows configuration dialog, described below; it can be executed as usually from component context menu:
However, real applications should consider to provide this functionality to end user at application's run-time using TLMDSpellConfigDialog component. Standard Execute method can be used to show dialog:
The dialog shows a list of dictionary files; files can be added or removed from configuration. Active files are kept in shared-read mode in OS file system. Dictionary list contains dictionaries read from the content of active dictionary files. Only active dictionaries participate in spell checking.
Initial directory for file open dialog, which is executed by clicking on Add button can be specified using InitialDir property.
Application can hide files list to force user to use dictionaries from pre-configured files only by setting ShowFiles property to False:
User's configuration can be saved into abstract stream, file or registry using SaveConfig, SaveConfigReg, LoadConfig and LoadConfigReg methods:
procedure TMainForm.FormCreate(Sender: TObject);
var
flnm: string;
begin
flnm := 'config.ini';
if TFile.Exists(flnm) then
SpellChecker.LoadConfig(flnm);
end;
procedure TMainForm.FormDestroy(Sender: TObject);
var
flnm: string;
begin
flnm := 'config.ini';
SpellChecker.SaveConfig(flnm);
end;
ASaveFiles parameter in above methods allow to suppress dictionary files list saving in configuration file in case they are pre-configured by application's code.