using System.Text;
using System;
using SubSystems.TE;
namespace TextEditorKeyoti
{
public class TernX : SubSystems.TE.Tern, Keyoti.RapidSpell.ISpellCheckableTextComponent
{
public override string Text
{
get
{
this.TerCommand(tc.ID_SELECT_ALL);
string text = this.TerGetTextSel();
this.DeselectTerText(true);
text = (text == null) ? string.Empty : text;
return text;
}
set
{
base.Text = value;
}
}
#region ISpellCheckableTextComponent Members
private bool bHideSelection;
public bool HideSelection
{
get { return bHideSelection; } //isn't used in TE. It's either painted when an action is performed or not.
set { bHideSelection = value; this.DeselectTerText(true); }
}
public void ScrollToCaret()
{
this.TerEngageCaret(false);
}
public string SelectedText
{
get
{
return this.TerGetTextSel();
}
set
{
this.TerDeleteBlock(false);
this.InsertTerText(value,true);
}
If you prefer to add an 'adapter' class, rather than subclassing the control you can do that too.
To do this, you would pass an instance of the editor to the adapter class (which would implement ISpellCheckableTextComponent) and
map the Text, SelectionStart, SelectionLength and SelectedText properties to the appropriate calls in the editor control instance.
Then, the adapter class can be passed to the spell checker's ThirdPartyTextComponentToCheck property.