// Token: 0x060039C1 RID: 14785 RVA: 0x001064C0 File Offset: 0x001046C0
        private static bool IsAdjacentToFormatElement(ITextPointer pointer, LogicalDirection direction)
        {
            bool result = false;

            if (direction == LogicalDirection.Forward)
            {
                TextPointerContext pointerContext = pointer.GetPointerContext(LogicalDirection.Forward);
                if (pointerContext == TextPointerContext.ElementStart && TextSchema.IsFormattingType(pointer.GetElementType(LogicalDirection.Forward)))
                {
                    result = true;
                }
                else if (pointerContext == TextPointerContext.ElementEnd && TextSchema.IsFormattingType(pointer.ParentType))
                {
                    result = true;
                }
            }
            else
            {
                TextPointerContext pointerContext = pointer.GetPointerContext(LogicalDirection.Backward);
                if (pointerContext == TextPointerContext.ElementEnd && TextSchema.IsFormattingType(pointer.GetElementType(LogicalDirection.Backward)))
                {
                    result = true;
                }
                else if (pointerContext == TextPointerContext.ElementStart && TextSchema.IsFormattingType(pointer.ParentType))
                {
                    result = true;
                }
            }
            return(result);
        }
Beispiel #2
0
        // Token: 0x060038DB RID: 14555 RVA: 0x00100F94 File Offset: 0x000FF194
        private static ITextPointer GetNextTextPosition(ITextPointer position, ITextPointer limit, LogicalDirection direction, out char character)
        {
            bool flag = false;

            character = '\0';
            while (position != null && !flag && (limit == null || position.CompareTo(limit) < 0))
            {
                switch (position.GetPointerContext(direction))
                {
                case TextPointerContext.Text:
                {
                    char[] array = new char[1];
                    position.GetTextInRun(direction, array, 0, 1);
                    character = array[0];
                    flag      = true;
                    continue;
                }

                case TextPointerContext.ElementStart:
                case TextPointerContext.ElementEnd:
                    if (TextSchema.IsFormattingType(position.GetElementType(direction)))
                    {
                        position = position.CreatePointer(1);
                        continue;
                    }
                    position = null;
                    continue;
                }
                position = null;
            }
            return(position);
        }
        // Token: 0x06002EFA RID: 12026 RVA: 0x000D47DC File Offset: 0x000D29DC
        private void _SkipFormattingTags(ITextPointer textPointer)
        {
            LogicalDirection logicalDirection = textPointer.LogicalDirection;
            int offset = (logicalDirection == LogicalDirection.Forward) ? 1 : -1;

            while (TextSchema.IsFormattingType(textPointer.GetElementType(logicalDirection)))
            {
                textPointer.MoveByOffset(offset);
            }
        }
Beispiel #4
0
        private void _SkipFormattingTags(ITextPointer textPointer)
        {
            Debug.Assert(!textPointer.IsFrozen, "Can't reposition a frozen pointer!");

            LogicalDirection dir = textPointer.LogicalDirection;
            int increment        = (dir == LogicalDirection.Forward ? +1 : -1);

            while (TextSchema.IsFormattingType(textPointer.GetElementType(dir)))
            {
                textPointer.MoveByOffset(increment);
            }
        }
        // Returns the position preceeding the next text character in a specified
        // direction, or null if no such position exists.
        // The scan will halt if limit is encounted; limit may be null.
        private static ITextPointer GetNextTextPosition(ITextPointer position, ITextPointer limit, LogicalDirection direction, out char character)
        {
            bool foundText = false;

            character = (char)0;

            while (position != null &&
                   !foundText &&
                   (limit == null || position.CompareTo(limit) < 0))
            {
                switch (position.GetPointerContext(direction))
                {
                case TextPointerContext.Text:
                    char[] buffer = new char[1];
                    position.GetTextInRun(direction, buffer, 0, 1);
                    character = buffer[0];
                    foundText = true;
                    break;

                case TextPointerContext.ElementStart:
                case TextPointerContext.ElementEnd:
                    if (TextSchema.IsFormattingType(position.GetElementType(direction)))
                    {
                        position = position.CreatePointer(+1);
                    }
                    else
                    {
                        position = null;
                    }
                    break;

                case TextPointerContext.EmbeddedElement:
                case TextPointerContext.None:
                default:
                    position = null;
                    break;
                }
            }

            return(position);
        }
 // Token: 0x06003BEF RID: 15343 RVA: 0x001144BC File Offset: 0x001126BC
 internal static bool IsMergeableInline(Type elementType)
 {
     return(TextSchema.IsFormattingType(elementType) && !TextSchema.IsNonMergeableInline(elementType));
 }
 // Token: 0x06003BEE RID: 15342 RVA: 0x0011449D File Offset: 0x0011269D
 internal static bool IsNonFormattingInline(Type elementType)
 {
     return(typeof(Inline).IsAssignableFrom(elementType) && !TextSchema.IsFormattingType(elementType));
 }