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

Public Member Functions

 CHLSpelling (IPMUnknown *boss)
 
 ~CHLSpelling ()
 
virtual bool16 Set (const PMString &rCoreFileName, const PMString &rLexFileName, const PMString &rPhonFileName, const PMString &rBaseLangLexFileName)
 
virtual SpellResult IsCorrect (const WideString &rWord, bool16 *bEndsWithPeriod)
 
virtual bool16 FindAlternatives (const WideString &rWord, WideStringList *pAlternatives)
 
virtual SpellResult Spell (const WideString &rWord, WideStringList *pAlternatives, bool16 *bEndsWithPeriod)
 
virtual SpellResult IsCorrectGrammar (const WideString &rParagraph, int32 *pWordStart, int32 *pWordLength, int32 StartAt)
 
virtual bool16 SupportsCaseSensitive ()
 
virtual
ISpellingService::SpellResult 
FindError (const WideString &rParagraph, int32 startAt, int32 *pErrorStart, int32 *pErrorLength, WideStringList *pAlternatives, bool dir=kFalse)
 
virtual void FindAllErrors (const WideString &rParagraph, int32 startAt, std::vector< SpellingError > *pSpellingErrors)
 
- Public Member Functions inherited from CPMUnknown< ISpellingService >
IPMUnknownQueryInterface (PMIID interfaceID) const
 
void AddRef () const
 
void Release () const
 
void PreDirty (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
void PreDirtyNoMessage (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
 CPMUnknown (const CPMUnknown &)=delete
 
CPMUnknownoperator= (const CPMUnknown &)=delete
 

Additional Inherited Members

- Public Types inherited from ISpellingService
enum  SpellResult {
  kCorrect = 0, kSpellError, kIncorrectWord, kUncapitalizedWord,
  kGrammarError, kRepeatedWord, kUncapitalizedStartOfSentence, kNoteAnchor,
  kDeletedText
}
 
- Protected Member Functions inherited from CPMUnknown< ISpellingService >
 CPMUnknown (IPMUnknown *boss)
 
- Protected Attributes inherited from CPMUnknown< ISpellingService >
HelperInterface fHelperInterface
 

Detailed Description

This sample spelling service was extracted from the Proximity plug-in's implementation. Vendors should replace this implementation with their own.

This simple implementation checks words against a text file dictionary containing one word per line. The word being checked is looked up via a sequential search of the text file.

User dictionaries and the provision of a list of alternative words is not implemented but placeholders are indicated in the code where these facilities would typically be added.

kCHLSpellingImpl implements the spelling service for a single language. The Set method is used to pass paths to supporting data files (dictionaries etc.). IsCorrect(), FindAlternatives(), Spell(), IsCorrectGrammar() methods are called to spell check words when your spelling service has been selected as the active one to check the language.

/ Mitsutoshi Kikuta

Constructor & Destructor Documentation

Binds the C implementation class onto its ImplementationID making the C code callable by the application * CHLSpelling::CHLSpelling (IPMUnknownboss)

Constructor.

Parameters
bossinterface ptr from boss object on which this interface is aggregated.
CHLSpelling::~CHLSpelling ()

Destructor.

Member Function Documentation

void CHLSpelling::FindAllErrors (const WideStringrParagraph,
int32 startAt,
std::vector< SpellingError > * pSpellingErrors 
)
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.

Implements ISpellingService.

bool16 CHLSpelling::FindAlternatives (const WideStringrWord,
WideStringListpAlternatives 
)
virtual

Look for an alternative word.

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

Implements ISpellingService.

ISpellingService::SpellResult CHLSpelling::FindError (const WideStringrParagraph,
int32 startAt,
int32 * pErrorStart,
int32 * pErrorLength,
WideStringListpAlternatives,
bool dir = kFalse 
)
virtual

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

Parameters
rParagraphIN the paragraph to check.
pErrorStartOUT the position where the error starts.
pErrorLengthOUT the length of the error.
StartAtIN the starting position for the paragraph.
Returns
kCorrect if the paragraph is correct, otherwise returns one of the spelling error.

Implements ISpellingService.

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

Confirms whether the word is a correct spelling.

Parameters
rWordIN to be checked word for spelling.
bEndsWithPeriodOUT if the word ends with period.
Returns
Returns kTrue if the word spelling is correct.

Implements ISpellingService.

ISpellingService::SpellResult CHLSpelling::IsCorrectGrammar (const WideStringrParagraph,
int32 * pWordStart,
int32 * pWordLength,
int32 StartAt 
)
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
Returns kCorrect if the paragraph grammar is correct, otherwise returns kGrammarError.

Implements ISpellingService.

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

Setting the spelling service.

Parameters
rCoreFileNameIN the core file name.
rLexFileNameIN the lex file name, not used in this sample.
rPhonFileNameIN the phon file name, not used in this sample.
rBaseLangLexFileNameIN the base language lex file name, not used in this sample.
Returns
Returns kTrue if success.

Implements ISpellingService.

ISpellingService::SpellResult CHLSpelling::Spell (const WideStringrWord,
WideStringListpAlternatives,
bool16 * bEndsWithPeriod 
)
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
Returns kCorrect if the word spelling is correct; otherwise, it will find all the alternative words for this word.

Implements ISpellingService.

virtual bool16 CHLSpelling::SupportsCaseSensitive ()
inlinevirtual

Spelling service supports case sensitive.

Returns
kTrue if spelling service supports case sensitive

Implements ISpellingService.