SIL.FieldWorks.Common.Framework.FwEditingHelper.OnCharAux C# (CSharp) Method

OnCharAux() protected method

Handle typed character
protected OnCharAux ( string stuInput, VwShiftStatus ss, Keys modifiers ) : void
stuInput string input string
ss VwShiftStatus Status of Shift/Control/Alt key
modifiers Keys key modifiers - shift status, etc.
return void
		protected override void OnCharAux(string stuInput, VwShiftStatus ss, Keys modifiers)
		{
			if (string.IsNullOrEmpty(stuInput))
				return;

			SelectionHelper currSel = CurrentSelection;
			if (modifiers != Keys.Control && modifiers != Keys.Alt && currSel != null)
			{
				ITsTextProps ttpTop = currSel.GetSelProps(SelectionHelper.SelLimitType.Top);
				if (ttpTop != null)
				{
					string sObjData = ttpTop.GetStrPropValue((int)FwTextPropType.ktptObjData);
					string urlTop = TsStringUtils.GetURL(sObjData);
					if (urlTop != null)
					{
						ITsTextProps ttpBottom = currSel.GetSelProps(SelectionHelper.SelLimitType.Bottom);
						if (ttpBottom != null)
						{
							sObjData = ttpBottom.GetStrPropValue((int)FwTextPropType.ktptObjData);
							string urlBottom = TsStringUtils.GetURL(sObjData);
							if (urlBottom != urlTop)
							{
								int nVar;
								ITsTextProps propsToUse = StyleUtils.CharStyleTextProps(null,
									ttpTop.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
								currSel.Selection.SetTypingProps(propsToUse);
							}
							else if (stuInput[0] == (char)VwSpecialChars.kscDelForward ||
								stuInput[0] == (char)VwSpecialChars.kscBackspace)
							{
								if (currSel.IsRange)
								{
									ITsTextProps ttpBefore = currSel.PropsBefore;
									string urlBefore = (ttpBefore == null) ? null :
										TsStringUtils.GetURL(ttpBefore.GetStrPropValue((int)FwTextPropType.ktptObjData));

									ITsTextProps ttpAfter = currSel.PropsAfter;
									string urlAfter = (ttpAfter == null) ? null :
										TsStringUtils.GetURL(ttpAfter.GetStrPropValue((int)FwTextPropType.ktptObjData));

									if (urlBefore != urlTop && urlAfter != urlTop)
									{
										int nVar;
										ITsTextProps propsToUse = ttpBefore ?? StyleUtils.CharStyleTextProps(null,
											ttpTop.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
										currSel.Selection.SetTypingProps(propsToUse);
									}
								}
							}
							else if (!currSel.IsRange)
							{
								ITsTextProps ttpBefore = currSel.PropsBefore;
								string urlBefore = (ttpBefore == null) ? null :
									TsStringUtils.GetURL(ttpBefore.GetStrPropValue((int)FwTextPropType.ktptObjData));
								if (urlBefore != urlTop)
								{
									int nVar;
									ITsTextProps propsToUse = ttpBefore ?? StyleUtils.CharStyleTextProps(null,
										ttpTop.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
									currSel.Selection.SetTypingProps(propsToUse);
								}
								else
								{
									ITsTextProps ttpAfter = currSel.PropsAfter;
									string urlAfter = (ttpAfter == null) ? null :
										TsStringUtils.GetURL(ttpAfter.GetStrPropValue((int)FwTextPropType.ktptObjData));

									if (urlAfter != urlBottom)
									{
										int nVar;
										ITsTextProps propsToUse = ttpAfter ?? StyleUtils.CharStyleTextProps(null,
											ttpTop.GetIntPropValues((int)FwTextPropType.ktptWs, out nVar));
										currSel.Selection.SetTypingProps(propsToUse);
									}
								}
							}
						}
					}
				}
			}
			base.OnCharAux(stuInput, ss, modifiers);
		}