InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ISpellingService Class Referenceabstract
Inheritance diagram for ISpellingService:
IPMUnknownCPMUnknown< ISpellingService >CHLSpelling

Classes

class  SpellingError
 

Public Types

enum  SpellResult {
  kCorrect = 0, kSpellError, kIncorrectWord, kUncapitalizedWord,
  kGrammarError, kRepeatedWord, kUncapitalizedStartOfSentence, kNoteAnchor,
  kDeletedText
}
 

Public Member Functions

virtual SpellResult IsCorrect (const WideString &rWord, bool16 *bEndsWithPeriod)=0
 
virtual bool16 FindAlternatives (const WideString &rWord, WideStringList *pAlternatives)=0
 
virtual SpellResult Spell (const WideString &rWord, WideStringList *pAlternatives, bool16 *bEndsWithPeriod)=0
 
virtual SpellResult IsCorrectGrammar (const WideString &rParagraph, int32 *pWordStart, int32 *pWordLength, int32 startAt=0)=0
 
virtual bool16 Set (const PMString &rCoreFileName, const PMString &rLexFileName, const PMString &rPhonFileName, const PMString &rBaseLangLexFileName)=0
 
virtual bool16 SupportsCaseSensitive ()=0
 
virtual SpellResult FindError (const WideString &rParagraph, int32 startAt, int32 *pErrorStart, int32 *pErrorLength, WideStringList *pAlternatives, bool searchBackwards=false)=0
 
virtual void FindAllErrors (const WideString &rParagraph, int32 startAt, std::vector< SpellingError > *pSpellingErrors)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Member Enumeration Documentation

Spelling results. Items after kSpellError are spelling errors. Items after kGrammarError are grammar errors.
Enumerator
kCorrect 

Word is spelled correctly or no grammar error.

kSpellError 

Denotes beginning of spelling errors. Not valid return value.

kIncorrectWord 

Word is spelled incorrectly.

kUncapitalizedWord 

Word is not correctly capitalized.

kGrammarError 

Denotes beginning of grammar errors. Not valid return value.

kRepeatedWord 

Word is repeated.

kUncapitalizedStartOfSentence 

Sentence is not correctly capitalized.

kNoteAnchor 

used to indicate that current index is a note. not returned by any routines in ISpellingService. Spelling walker is using

kDeletedText 

used to indicate that current index is deleted text. not currently returned by any routines in ISpellingService. Spelling walker is using

Member Function Documentation

virtual void ISpellingService::FindAllErrors (const WideStringrParagraph,
int32 startAt,
std::vector< SpellingError > * pSpellingErrors 
)
pure virtual

FindAllErrors() assumes that rParagraph is a paragraph that has to start with a capital.

Parameters
rParagraphIN the paragraph to check.
startAtIN the starting position for where to start reporting errors in the paragraph.
pSpellingErrorsOUT errors. vector is empty if no errors.

Implemented in CHLSpelling.

virtual bool16 ISpellingService::FindAlternatives (const WideStringrWord,
WideStringListpAlternatives 
)
pure virtual

Look for alternate spellings for word.

Parameters
rWordIN to be checked word for alternative word.
pAlternativesOUT the list of alternative words for this word.
Returns
kTrue if there is at least one alternative word found.

Implemented in CHLSpelling.

virtual SpellResult ISpellingService::FindError (const WideStringrParagraph,
int32 startAt,
int32 * pErrorStart,
int32 * pErrorLength,
WideStringListpAlternatives,
bool searchBackwards = false 
)
pure virtual

FindError() finds first error in rParagraph starting at startAt. assumes that rParagraph is a paragraph that has to start with a capital.

Parameters
rParagraphIN the paragraph to check.
startAtIN the starting position for where to start reporting errors in the paragraph.
pErrorStartOUT the position where the error starts.
pErrorLengthOUT the length of the error.
pAlternativesOUT the alternatives for this error. Can be nil.
searchBackwardsIN the direction of spell check. Spell check works in reverse direction if this bool is true.
Returns
kCorrect if the paragraph is correct, otherwise returns one of the spelling error.

Implemented in CHLSpelling.

virtual SpellResult ISpellingService::IsCorrect (const WideStringrWord,
bool16 * bEndsWithPeriod 
)
pure virtual

Checks whether the word is spelled correctly.

Parameters
rWordIN to be checked word for spelling.
bEndsWithPeriodOUT if the word ends with period (ex. Mr. would return kFalse). If kTrue the calling code will attempt to remove the trailing period.
Returns
kTrue if the word spelling is correct.

Implemented in CHLSpelling.

virtual SpellResult ISpellingService::IsCorrectGrammar (const WideStringrParagraph,
int32 * pWordStart,
int32 * pWordLength,
int32 startAt = 0 
)
pure virtual

IsCorrectGrammar() assumes that rParagraph is a paragraph that has to start with a capital. Notice that IsCorrectGrammar() does not check the word at the position, use IsCorrect() and Spell() instead.

Parameters
rParagraphIN the paragraph to check its grammar.
pWordStartOUT the position where the word start.
pWordLengthOUT the length of the word.
StartAtIN the starting position for the paragraph.
Returns
kCorrect if the paragraph grammar is correct, otherwise returns one of the grammar errors.

Implemented in CHLSpelling.

virtual bool16 ISpellingService::Set (const PMStringrCoreFileName,
const PMStringrLexFileName,
const PMStringrPhonFileName,
const PMStringrBaseLangLexFileName 
)
pure virtual

Set up the spelling service.

Parameters
rCoreFileNameIN the core file name.
rLexFileNameIN the lex file name.
rPhonFileNameIN the phon file name.
rBaseLangLexFileNameIN the base language lex file name.
Returns
Returns kTrue if success.

Implemented in CHLSpelling.

virtual SpellResult ISpellingService::Spell (const WideStringrWord,
WideStringListpAlternatives,
bool16 * bEndsWithPeriod 
)
pure virtual

Spell checking the word.

Parameters
rWordIN to be checked word for spelling.
pAlternativesOUT the list of alternative words for this word.
bEndsWithPeriodOUT if the word ends with period.
Returns
kCorrect if the word spelling is correct; otherwise, it will find all the alternative words for this word.

Implemented in CHLSpelling.

virtual bool16 ISpellingService::SupportsCaseSensitive ()
pure virtual

Spelling service supports case sensitive.

Returns
kTrue if spelling service supports case sensitive

Implemented in CHLSpelling.