Neil wrote:

>> Spell checking:
>> 1) Where do dictionaries go? Both default and personal. I have the 
>> system dictionaries living in defaults/dictionaries. 
>

For the netscape implementation of the spellchecker, we put the 
spellchecker dll and the dictionaries it relies on in the 
components/spellchecker directory.  This has the benefit of allowing the 
spellchecker to be autoregistered the next time mozilla is started, if 
it was not previously installed.

The user dictionary should be written out to the user's profile 
directory since that is probably the only place you will have write 
access on most platforms.

Note that the location and format of the dictionaries used by the 
implementation was purposely left out of the API definition.

>> 2) Where does the spell checker go? I have included it in 
>> editor/txtsvc, but I suspect that it should live in its own module, 
>> probably somewhere in the extensions hierarchy.
>

I would probably put it under 
mozilla/extensions/spellchecker/{spellchecker name}. I specified the 
{spellchecker name} portion because others might want to implement 
different backends.

>> 4) Should NextMispelled word call SetSelection and 
>> ScrollSelectionIntoView? Probably.
>

The current spellchecker dialog code expects the spellchecker to handle 
the hiliting, scrolling, and replacement.

If I had the time, I would've re-written the spellchecker interface to 
be even more basic, with just a CheckWord() method and the other 
existing dictionary methods, and just have the app/dialog itself manage 
the breaking up of the document into words, handle selection, 
replacement, etc. This would simplify the process of implementing new 
spellchecker backends, and prevent everyone from relying on the 
nsITextServicesDocument object.

As it stands now, each new implementation has to do all of this.

>> 3) How are you supposed to signal no spelling errors in 
>> NextMisspelledWord? Leaving the word parameter blank and returning 
>> NS_OK seems to work but is it intended? 
>

Yes, I should probably update the method description comments to say that.

>> 4) Should Replace wrap if we are replacing all occurrences? Probably 
>> not. 
>

The netscape implementation does a wrap, but it's up to you.

>> 5) How should multiple dictionaries work It seems that if I populate 
>> the StringArray, this has no effect on the combo box. How should it 
>> be working? 
>

If you're talking about how to populate the "Language:" combobox in the 
spellchecker dialog UI, it should be enough to just implement the 
GetDictionaryList() method of the nsISpellChecker interface.

If you're talking about how to use the current UI to specify multiple 
active dictionaries, that's currentlly not supported.

>> Infrastructure.
>> 6) Strings. Is there any more documentation than 
>> http://lxr.mozilla.org/seamonkey/source/string/doc/string-guide.html 
>> for the new strings? Is there a stretch of code that exercises them 
>> elegantly? Till then I am using the old strings, there are more 
>> examples of their use.
>> 7) Files. Is there any documentation other than header files on the 
>> stuff in xpcom/io? 
>

You'll probably have better luck asking these questions on the 
news://netscape.public.mozilla.xpcom newsgroup.

>>
>>
>> to open the dictionary I do
>>
>> nsCOMPtr<nsIFile> aFile;
>> res = NS_GetSpecialDirectory(NS_APP_DEFAULTS_50_DIR, 
>> getter_AddRefs(aFile));
>> if (NS_FAILED(res)) return res;
>> res = aFile->Append("dictionaries");
>> if (NS_FAILED(res)) return res;
>> nsXPIDLCString pathBuf;
>> aFile->GetPath(getter_Copies(pathBuf));
>> nsCOMPtr<nsIFileSpec> tempSpec;
>> res = NS_NewFileSpec(getter_AddRefs(tempSpec));
>> if (NS_FAILED(res)) return res;
>> res = tempSpec->SetNativePath(pathBuf);
>> if (NS_FAILED(res)) return res;
>> nsFileSpec dirSpec;
>> res = tempSpec->GetFileSpec(&dirSpec);
>> if (NS_FAILED(res)) return res;
>> nsAutoString hashName(dictName);
>> hashName.AppendWithConversion(".dic");
>> nsInputFileStream strm(dirSpec+hashName);
>>
>> I can almost certainly do without the nsIFileSpec -> FileSpec 
>> conversion, but is the rest of that necessary, or even safe. This was 
>> copied more or less from the cookie code, so it should work. 
>

I think you can accomplish what you are trying to do with just a single 
nsIFile and an nsIInputStream ... checkout:

    
http://lxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIFileStreams.idl

>>
>>
>> I18N
>> 8) Are there equivalents to the ctype functions for unicode that 
>> should be used. At least for western languages isalpha
>> and isupper and is lower are useful for spell checkers.
>>
>> 9) Is there some documentation/examples on the character conversion 
>> routines? I will need to be able to convert words from unicode to 
>> whatever charset the dictionary is in and back. Right now I am just 
>> happily using ascii, and that is easy to convert, and more than 
>> sufficient for a USAian dictionary. 
>

You'll probably have better luck asking on the 
news://netscape.public.mozilla.i18n newsgroup.




Reply via email to