Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A Spell Checking Engine

, 5 Feb 2001
A free spell checking engine for use in your C++ applications. Includes the current US English dictionary
#if !defined(AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__INCLUDED_)
#define AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DlgSpellChecker.h : header file
//

class CFPSSpellCheckEngine;

typedef struct CDlgSpellChecker_CHANGEALLTAG
{
	CString strBad;
	CString strGood;
} CDlgSpellChecker_CHANGEALL;

/////////////////////////////////////////////////////////////////////////////
// CDlgSpellChecker dialog

class CDlgSpellChecker : public CDialog
{
// Construction
public:
	CDlgSpellChecker(CWnd* pParent = NULL);   // standard constructor
	~CDlgSpellChecker();

// Dialog Data
	//{{AFX_DATA(CDlgSpellChecker)
	enum { IDD = IDD_SPELL_CHECK };
	CListBox	m_lstSuggestions;
	CEdit	m_editSentence;
	//}}AFX_DATA

	CEdit*	m_pEdit;
	CRichEditCtrl* m_pRichEdit;
	CFPSSpellCheckEngine* m_pEngine;


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDlgSpellChecker)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual void ChangeCancelToClose();
	virtual CDlgSpellChecker_CHANGEALL* FindChangeAll(LPCSTR lpszBad);
	virtual void SaveSentence();
	virtual void AddChangeAll(LPCSTR lpszBad, LPCSTR lpszGood);
	virtual void ContinueChecking(int iPos);
	virtual void FindSuggestions();
	virtual BOOL CheckSentence(CString& strSentence, int iStartAt = 0);
	virtual BOOL GetSentence(int iSentence, int& iBeginsAt, CString& strSentence);
	virtual BOOL GetNextSentence();
	virtual void BeginSpellCheck();

	// Generated message map functions
	//{{AFX_MSG(CDlgSpellChecker)
	afx_msg void OnAdd();
	afx_msg void OnAutoCorrect();
	afx_msg void OnCancel();
	afx_msg void OnChange();
	afx_msg void OnChangeAll();
	afx_msg void OnIgnore();
	afx_msg void OnIgnoreAll();
	afx_msg void OnOptions();
	afx_msg void OnUndo();
	afx_msg void OnDblclkSuggestions();
	virtual BOOL OnInitDialog();
	afx_msg void OnChangeSentence();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

	int m_iSentence;
	int m_iSentenceBegin;
	int m_iSentenceLen;
	int m_iWordBegin;
	CString m_strMisSpelledWord;
	CString m_strOutWord;

	CTypedPtrList<CPtrList, CDlgSpellChecker_CHANGEALL*> m_ChangeAll;
};

void CheckSpellingEdit (CFPSSpellCheckEngine* pEngine, CEdit* pEdit);
void CheckSpellingRich (CFPSSpellCheckEngine* pEngine, CRichEditCtrl* pEdit);

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

#endif // !defined(AFX_DLGSPELLCHECKER_H__B58E6D0E_FB89_4E48_9080_16A951BB4939__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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Matt Gullett
Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 6 Feb 2001
Article Copyright 2001 by Matt Gullett
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid