Click here to Skip to main content
15,892,005 members
Articles / Desktop Programming / MFC

Spell Checker Dictionary Engine

Rate me:
Please Sign up or sign in to vote.
4.86/5 (34 votes)
20 May 2003CPOL6 min read 118.7K   4.6K   70  
A dictionary engine for use in applications requiring spell checking
// SpellingDoc.h : interface of the CSpellingDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_SPELLINGDOC_H__1BE2B3FD_2221_4C33_A348_A2C491804B6E__INCLUDED_)
#define AFX_SPELLINGDOC_H__1BE2B3FD_2221_4C33_A348_A2C491804B6E__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CDictionary;

class CSpellingDoc : public CDocument
{
protected: // create from serialization only
	CSpellingDoc();
	DECLARE_DYNCREATE(CSpellingDoc)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSpellingDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
	virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CSpellingDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CSpellingDoc)
	afx_msg void OnCheckWord();
	afx_msg void OnInsertWord();
	afx_msg void OnUpdateCheckWord(CCmdUI* pCmdUI);
	afx_msg void OnUpdateInsertWord(CCmdUI* pCmdUI);
	afx_msg void OnPatternMatch();
	afx_msg void OnUpdatePatternMatch(CCmdUI* pCmdUI);
	afx_msg void OnRemoveWord();
	afx_msg void OnUpdateRemoveWord(CCmdUI* pCmdUI);
	afx_msg void OnInsertWordlist();
	afx_msg void OnUpdateInsertWordlist(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
    void AddOutputString(const CString & strOutput);
    CString BuildSuggestions(const CString & strWord, bool bCaseOnly);

    CDictionary * m_pDictionary;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SPELLINGDOC_H__1BE2B3FD_2221_4C33_A348_A2C491804B6E__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United Kingdom United Kingdom
I started computer programming on the Spectrum (writing nothing more complicated than "Hello World" and a few programs that tunelessly Beeped ad infinitum) but then progressed to slightly more serious programming on the Amiga.

After A-Levels in Maths, Physics and Chemistry, I went to the University of East Anglia, Norwich, and studied beer, women and Computing Science.
Some years after graduating, I still have an appreciation of Computing Science, but as I am now married, my other studies are frowned upon.

Since graduating, I have worked on many diverse projects in areas including call centres, logistics, architecture and engineering, and heritage.

Comments and Discussions