//------------------------------------------------------ // // Internal Events // //------------------------------------------------------ //------------------------------------------------------ // // Private Methods // //------------------------------------------------------ // get the text from ITfRange. private string StringFromITfRange(UnsafeNativeMethods.ITfRange range, int ecReadOnly) { // Transitory Document uses ther TextStore, which is ACP base. UnsafeNativeMethods.ITfRangeACP rangeacp = (UnsafeNativeMethods.ITfRangeACP)range; int start; int count; int countRet; rangeacp.GetExtent(out start, out count); char[] text = new char[count]; rangeacp.GetText(ecReadOnly, 0, text, count, out countRet); return(new string(text)); }
protected void ConvertToTextPosition(UnsafeNativeMethods.ITfRange range, out ITextPointer start, out ITextPointer end) { UnsafeNativeMethods.ITfRangeACP tfRangeACP = range as UnsafeNativeMethods.ITfRangeACP; int num; int num2; tfRangeACP.GetExtent(out num, out num2); if (num2 < 0) { start = null; end = null; return; } start = this._textstore.CreatePointerAtCharOffset(num, LogicalDirection.Forward); end = this._textstore.CreatePointerAtCharOffset(num + num2, LogicalDirection.Forward); }