// Token: 0x060039C5 RID: 14789 RVA: 0x00106614 File Offset: 0x00104814
        public override void Do()
        {
            base.Do();
            ITextContainer textContainer = this._selection.Start.TextContainer;
            ITextPointer   position      = textContainer.CreatePointerAtOffset(this._undoAnchorPositionOffset, this._undoAnchorPositionDirection);
            ITextPointer   position2     = textContainer.CreatePointerAtOffset(this._undoMovingPositionOffset, this._undoMovingPositionDirection);

            this._selection.Select(position, position2);
            this._redoUnit.RecordRedoSelectionState();
        }
Exemplo n.º 2
0
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        #region Public Methods

        /// <summary>
        /// Implements IUndoUnit::Do().  For IParentUndoUnit, this means iterating through
        /// all contained units and calling their Do().
        /// </summary>
        public override void Do()
        {
            base.Do(); // Note: TextParentUndoUnit will be created here by our callback CreateParentUndoUnitForSelf.

            ITextContainer textContainer  = _selection.Start.TextContainer;
            ITextPointer   anchorPosition = textContainer.CreatePointerAtOffset(_undoAnchorPositionOffset, _undoAnchorPositionDirection);
            ITextPointer   movingPosition = textContainer.CreatePointerAtOffset(_undoMovingPositionOffset, _undoMovingPositionDirection);

            _selection.Select(anchorPosition, movingPosition);

            _redoUnit.RecordRedoSelectionState();
        }
Exemplo n.º 3
0
        // Token: 0x0600724A RID: 29258 RVA: 0x0020ADC0 File Offset: 0x00208FC0
        internal static ITextPointer GetContentStart(ITextContainer textContainer, DependencyObject element)
        {
            ITextPointer result;

            if (element is TextElement)
            {
                result = ((TextElement)element).ContentStart;
            }
            else
            {
                Invariant.Assert(element is TextBlock || element is FlowDocument || element is TextBox, "Cannot retrive ContentStart position for EmbeddedObject.");
                result = textContainer.CreatePointerAtOffset(0, LogicalDirection.Forward);
            }
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieves ITextPointer representing content start of given element.
        /// </summary>
        internal static ITextPointer GetContentStart(ITextContainer textContainer, DependencyObject element)
        {
            ITextPointer textPointer;

            // If the element is a TextElement, return the beginning of its content.
            // Otherwise assume that element is the host of text content and return
            // the beginning of TextContainer.
            if (element is TextElement)
            {
                textPointer = ((TextElement)element).ContentStart;
            }
            else
            {
                Invariant.Assert(element is TextBlock || element is FlowDocument || element is TextBox,
                                 "Cannot retrive ContentStart position for EmbeddedObject.");
                textPointer = textContainer.CreatePointerAtOffset(0, LogicalDirection.Forward); // Start
            }
            return(textPointer);
        }
Exemplo n.º 5
0
 // Token: 0x0600724D RID: 29261 RVA: 0x00172F23 File Offset: 0x00171123
 internal static ITextPointer GetTextPointerFromCP(ITextContainer textContainer, int cp, LogicalDirection direction)
 {
     return(textContainer.CreatePointerAtOffset(cp, direction));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Gets dynamic TextPointer form character position. 
 /// </summary>
 internal static ITextPointer GetTextPointerFromCP(ITextContainer textContainer, int cp, LogicalDirection direction) 
 { 
     return textContainer.CreatePointerAtOffset(cp, direction);
 } 
Exemplo n.º 7
0
 /// <summary>
 /// Retrieves ITextPointer representing content start of given element. 
 /// </summary>
 internal static ITextPointer GetContentStart(ITextContainer textContainer, DependencyObject element)
 {
     ITextPointer textPointer; 
     // If the element is a TextElement, return the beginning of its content.
     // Otherwise assume that element is the host of text content and return 
     // the beginning of TextContainer. 
     if (element is TextElement)
     { 
         textPointer = ((TextElement)element).ContentStart;
     }
     else
     { 
         Invariant.Assert(element is TextBlock || element is FlowDocument || element is TextBox,
             "Cannot retrive ContentStart position for EmbeddedObject."); 
         textPointer = textContainer.CreatePointerAtOffset(0, LogicalDirection.Forward); // Start 
     }
     return textPointer; 
 }