本文整理汇总了C#中ITextPointer类的典型用法代码示例。如果您正苦于以下问题:C# ITextPointer类的具体用法?C# ITextPointer怎么用?C# ITextPointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITextPointer类属于命名空间,在下文中一共展示了ITextPointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextParentUndoUnit
internal TextParentUndoUnit(ITextSelection selection, ITextPointer anchorPosition, ITextPointer movingPosition)
: base(String.Empty)
{
_selection = selection;
_undoAnchorPositionOffset = anchorPosition.Offset;
_undoAnchorPositionDirection = anchorPosition.LogicalDirection;
_undoMovingPositionOffset = movingPosition.Offset;
_undoMovingPositionDirection = movingPosition.LogicalDirection;
// Bug 1706768: we are seeing unitialized values when the undo
// undo is pulled off the undo stack. _redoAnchorPositionOffset
// and _redoMovingPositionOffset are supposed to be initialized
// with calls to RecordRedoSelectionState before that happens.
//
// This code path is being left enabled in DEBUG to help track down
// the underlying bug post V1.
#if DEBUG
_redoAnchorPositionOffset = -1;
_redoMovingPositionOffset = -1;
#else
_redoAnchorPositionOffset = 0;
_redoMovingPositionOffset = 0;
#endif
}
示例2: FireChangedEvent
// Raises a Changed event for any listeners, covering the
// specified text.
internal void FireChangedEvent(ITextPointer start, ITextPointer end)
{
if (Changed != null)
{
Changed(this, new SpellerHighlightChangedEventArgs(start, end));
}
}
示例3: DocumentSequenceTextPointer
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
// Ctor always set mutable flag to false
internal DocumentSequenceTextPointer(ChildDocumentBlock childBlock, ITextPointer childPosition)
{
Debug.Assert(childBlock != null);
Debug.Assert(childPosition != null);
_childBlock = childBlock;
_childTp = childPosition;
}
示例4: SpellerStatusTable
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
// Constructor.
internal SpellerStatusTable(ITextPointer textContainerStart, SpellerHighlightLayer highlightLayer)
{
_highlightLayer = highlightLayer;
_runList = new ArrayList(1);
_runList.Add(new Run(textContainerStart, RunType.Dirty));
}
示例5: SpellingError
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
// Creates a new instance.
internal SpellingError(Speller speller, ITextPointer start, ITextPointer end)
{
Invariant.Assert(start.CompareTo(end) < 0);
_speller = speller;
_start = start.GetFrozenPointer(LogicalDirection.Forward);
_end = end.GetFrozenPointer(LogicalDirection.Backward);
}
示例6: TextContainerChangeEventArgs
internal TextContainerChangeEventArgs(ITextPointer textPosition, int count, int charCount, TextChangeType textChange, DependencyProperty property, bool affectsRenderOnly)
{
_textPosition = textPosition.GetFrozenPointer(LogicalDirection.Forward);
_count = count;
_charCount = charCount;
_textChange = textChange;
_property = property;
_affectsRenderOnly = affectsRenderOnly;
}
示例7: VerifyPosition
// Verifies a TextPointer is non-null and is associated with a given TextContainer.
//
// Throws an appropriate exception if a test fails.
internal static void VerifyPosition(ITextContainer container, ITextPointer position, string paramName)
{
if (position == null)
{
throw new ArgumentNullException(paramName);
}
if (position.TextContainer != container)
{
throw new ArgumentException(SR.Get(SRID.NotInAssociatedTree, paramName));
}
}
示例8: GetRectangleFromTextPosition
/// <summary>
/// <see cref="ITextView.GetRectangleFromTextPosition"/>
/// </summary>
/// <remarks>
/// Calls GetRawRectangleFromTextPosition to get a rect and a transform, and applies the transform to the
/// rect.
/// </remarks>
internal virtual Rect GetRectangleFromTextPosition(ITextPointer position)
{
Transform transform;
Rect rect = GetRawRectangleFromTextPosition(position, out transform);
// Transform must not be null. TextViews returning no transform should return identity
Invariant.Assert(transform != null);
if (rect != Rect.Empty)
{
rect = transform.TransformBounds(rect);
}
return rect;
}
示例9: GetTextInRun
// Worker for GetText, accepts any ITextPointer.
internal static string GetTextInRun(ITextPointer position, LogicalDirection direction)
{
char[] text;
int textLength;
int getTextLength;
textLength = position.GetTextRunLength(direction);
text = new char[textLength];
getTextLength = position.GetTextInRun(direction, text, 0, textLength);
Invariant.Assert(getTextLength == textLength, "textLengths returned from GetTextRunLength and GetTextInRun are innconsistent");
return new string(text);
}
示例10: TextRange
// ignoreTextUnitBoundaries - true if normalization should ignore text
// normalization (surrogates, combining marks, etc).
// Used for fine-grained control by IMEs.
internal TextRange(ITextPointer position1, ITextPointer position2, bool ignoreTextUnitBoundaries)
{
if (position1 == null)
{
throw new ArgumentNullException("position1");
}
if (position2 == null)
{
throw new ArgumentNullException("position2");
}
SetFlags(ignoreTextUnitBoundaries, Flags.IgnoreTextUnitBoundaries);
ValidationHelper.VerifyPosition(position1.TextContainer, position1, "position1");
ValidationHelper.VerifyPosition(position1.TextContainer, position2, "position2");
TextRangeBase.Select(this, position1, position2);
}
示例11: TextSegment
/// <summary>
/// Constructor.
/// </summary>
/// <param name="startPosition">
/// Position preceeding the TextSegment's content.
/// </param>
/// <param name="endPosition">
/// Position following the TextSegment's content.
/// </param>
/// <param name="preserveLogicalDirection">
/// Whether preserves LogicalDirection of start and end positions.
/// </param>
internal TextSegment(ITextPointer startPosition, ITextPointer endPosition, bool preserveLogicalDirection)
{
ValidationHelper.VerifyPositionPair(startPosition, endPosition);
if (startPosition.CompareTo(endPosition) == 0)
{
// To preserve segment emptiness
// we use the same instance of a pointer
// for both segment ends.
_start = startPosition.GetFrozenPointer(startPosition.LogicalDirection);
_end = _start;
}
else
{
Invariant.Assert(startPosition.CompareTo(endPosition) < 0);
_start = startPosition.GetFrozenPointer(preserveLogicalDirection ? startPosition.LogicalDirection : LogicalDirection.Backward);
_end = endPosition.GetFrozenPointer(preserveLogicalDirection ? endPosition.LogicalDirection : LogicalDirection.Forward);
}
}
示例12: VerifyPositionPair
// Verifies two positions are safe to use as a logical text span.
//
// Throws ArgumentNullException if startPosition == null || endPosition == null
// ArgumentException if startPosition.TextContainer != endPosition.TextContainer or
// startPosition > endPosition
internal static void VerifyPositionPair(ITextPointer startPosition, ITextPointer endPosition)
{
if (startPosition == null)
{
throw new ArgumentNullException("startPosition");
}
if (endPosition == null)
{
throw new ArgumentNullException("endPosition");
}
if (startPosition.TextContainer != endPosition.TextContainer)
{
throw new ArgumentException(SR.Get(SRID.InDifferentTextContainers, "startPosition", "endPosition"));
}
if (startPosition.CompareTo(endPosition) > 0)
{
throw new ArgumentException(SR.Get(SRID.BadTextPositionOrder, "startPosition", "endPosition"));
}
}
示例13: GetTextWithLimit
// Like GetText, excepts also accepts a limit parameter -- no text is returned past
// this second position.
// limit may be null, in which case it is ignored.
internal static int GetTextWithLimit(ITextPointer thisPointer, LogicalDirection direction, char[] textBuffer, int startIndex, int count, ITextPointer limit)
{
int charsCopied;
if (limit == null)
{
// No limit, just call GetText.
charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, count);
}
else if (direction == LogicalDirection.Forward && limit.CompareTo(thisPointer) <= 0)
{
// Limit completely blocks the read.
charsCopied = 0;
}
else if (direction == LogicalDirection.Backward && limit.CompareTo(thisPointer) >= 0)
{
// Limit completely blocks the read.
charsCopied = 0;
}
else
{
int maxCount;
// Get an upper bound on the amount of text to copy.
// Since GetText always stops on non-text boundaries, it's
// ok if the count too high, it will get truncated anyways.
if (direction == LogicalDirection.Forward)
{
maxCount = Math.Min(count, thisPointer.GetOffsetToPosition(limit));
}
else
{
maxCount = Math.Min(count, limit.GetOffsetToPosition(thisPointer));
}
maxCount = Math.Min(count, maxCount);
charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, maxCount);
}
return charsCopied;
}
示例14: Apply
/// <summary>
/// Apply the display attribute to to the given range.
/// </summary>
internal void Apply(ITextPointer start, ITextPointer end)
{
//
//
#if NOT_YET
if (_attr.crText.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
{
}
if (_attr.crBk.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
{
}
if (_attr.lsStyle != UnsafeNativeMethods.TF_DA_LINESTYLE.TF_LS_NONE)
{
}
#endif
}
示例15: if
/// <summary>
/// Compares this TextPointer with another TextPointer.
/// </summary>
/// <param name="position">
/// The TextPointer to compare with.
/// </param>
/// <returns>
/// Less than zero: this TextPointer preceeds position.
/// Zero: this TextPointer is at the same location as position.
/// Greater than zero: this TextPointer follows position.
/// </returns>
int ITextPointer.CompareTo(ITextPointer position)
{
int offset;
int result;
offset = ((PasswordTextPointer)position)._offset;
if (_offset < offset)
{
result = -1;
}
else if (_offset > offset)
{
result = +1;
}
else
{
result = 0;
}
return result;
}