Ejemplo n.º 1
0
        // Token: 0x0600284F RID: 10319 RVA: 0x000BC21C File Offset: 0x000BA41C
        internal override List <AutomationPeer> GetAutomationPeersFromRange(ITextPointer start, ITextPointer end)
        {
            base.GetChildren();
            TextElement textElement = (TextElement)base.Owner;

            return(TextContainerHelper.GetAutomationPeersFromRange(start, end, textElement.ContentStart));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Invalidate content's structural cache. Returns: 'true' if entire paragraph
        /// is invalid.
        /// </summary>
        /// <param name="startPosition">
        /// Position to start invalidation from.
        /// </param>
        internal virtual bool InvalidateStructure(int startPosition)
        {
            Debug.Assert(ParagraphEndCharacterPosition >= startPosition);
            int openEdgeCp = TextContainerHelper.GetCPFromElement(StructuralCache.TextContainer, Element, ElementEdge.BeforeStart);

            return(openEdgeCp == startPosition);
        }
Ejemplo n.º 3
0
        // Token: 0x06006B2D RID: 27437 RVA: 0x001EF394 File Offset: 0x001ED594
        private List <TextElement> GetAttachedObjectElements(int dcpFirst, int dcpLast)
        {
            List <TextElement> list              = new List <TextElement>();
            ITextPointer       contentStart      = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element);
            ITextPointer       textPointerFromCP = TextContainerHelper.GetTextPointerFromCP(base.StructuralCache.TextContainer, base.ParagraphStartCharacterPosition + dcpFirst, LogicalDirection.Forward);

            if (dcpLast > base.Cch)
            {
                dcpLast = base.Cch;
            }
            while (contentStart.GetOffsetToPosition(textPointerFromCP) < dcpLast)
            {
                if (textPointerFromCP.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
                {
                    TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointerFromCP).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                    if (adjacentElementFromOuterPosition is Figure || adjacentElementFromOuterPosition is Floater)
                    {
                        list.Add(adjacentElementFromOuterPosition);
                        textPointerFromCP.MoveByOffset(adjacentElementFromOuterPosition.SymbolCount);
                    }
                    else
                    {
                        textPointerFromCP.MoveToNextContextPosition(LogicalDirection.Forward);
                    }
                }
                else
                {
                    textPointerFromCP.MoveToNextContextPosition(LogicalDirection.Forward);
                }
            }
            return(list);
        }
Ejemplo n.º 4
0
        internal void FormatCellBottomless(uint fswdir, double width, out PTS.FSFMTRBL fmtrbl, out int dvrUsed)
        {
            if (this.CellParagraph.StructuralCache.DtrList != null)
            {
                this.CellParagraph.InvalidateStructure(TextContainerHelper.GetCPFromElement(this.CellParagraph.StructuralCache.TextContainer, this.CellParagraph.Element, ElementEdge.BeforeStart));
            }
            PTS.FSPAP fspap = default(PTS.FSPAP);
            this.CellParagraph.GetParaProperties(ref fspap);
            IntPtr value;

            PTS.FSBBOX fsbbox;
            IntPtr     zero;

            PTS.FSKCLEAR fskclear;
            int          num;
            int          num2;

            this.CellParagraph.FormatParaBottomless(this, PTS.FromBoolean(false), fswdir, 0, TextDpi.ToTextDpi(width), 0, null, PTS.FSKCLEAR.fskclearNone, PTS.FromBoolean(true), out fmtrbl, out value, out dvrUsed, out fsbbox, out zero, out fskclear, out num, out num2);
            if (zero != IntPtr.Zero)
            {
                MarginCollapsingState marginCollapsingState = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                PTS.ValidateHandle(marginCollapsingState);
                dvrUsed += marginCollapsingState.Margin;
                marginCollapsingState.Dispose();
                zero = IntPtr.Zero;
            }
            this._paraHandle.Value = value;
        }
        // Token: 0x060027CC RID: 10188 RVA: 0x000BAA60 File Offset: 0x000B8C60
        internal override List <AutomationPeer> GetAutomationPeersFromRange(ITextPointer start, ITextPointer end)
        {
            base.GetChildren();
            RichTextBox richTextBox = (RichTextBox)base.Owner;

            return(TextContainerHelper.GetAutomationPeersFromRange(start, end, richTextBox.TextContainer.Start));
        }
Ejemplo n.º 6
0
        internal void FormatCellFinite(Size subpageSize, IntPtr breakRecordIn, bool isEmptyOk, uint fswdir, PTS.FSKSUPPRESSHARDBREAKBEFOREFIRSTPARA fsksuppresshardbreakbeforefirstparaIn, out PTS.FSFMTR fsfmtr, out int dvrUsed, out IntPtr breakRecordOut)
        {
            if (this.CellParagraph.StructuralCache.DtrList != null)
            {
                this.CellParagraph.InvalidateStructure(TextContainerHelper.GetCPFromElement(this.CellParagraph.StructuralCache.TextContainer, this.CellParagraph.Element, ElementEdge.BeforeStart));
            }
            PTS.FSPAP fspap = default(PTS.FSPAP);
            this.CellParagraph.GetParaProperties(ref fspap);
            PTS.FSRECT fsrect = default(PTS.FSRECT);
            fsrect.u  = (fsrect.v = 0);
            fsrect.du = TextDpi.ToTextDpi(subpageSize.Width);
            fsrect.dv = TextDpi.ToTextDpi(subpageSize.Height);
            bool   condition = breakRecordIn != IntPtr.Zero;
            IntPtr value;

            PTS.FSBBOX fsbbox;
            IntPtr     zero;

            PTS.FSKCLEAR fskclear;
            int          num;

            this.CellParagraph.FormatParaFinite(this, breakRecordIn, PTS.FromBoolean(true), IntPtr.Zero, PTS.FromBoolean(isEmptyOk), PTS.FromBoolean(condition), fswdir, ref fsrect, null, PTS.FSKCLEAR.fskclearNone, fsksuppresshardbreakbeforefirstparaIn, out fsfmtr, out value, out breakRecordOut, out dvrUsed, out fsbbox, out zero, out fskclear, out num);
            if (zero != IntPtr.Zero)
            {
                MarginCollapsingState marginCollapsingState = base.PtsContext.HandleToObject(zero) as MarginCollapsingState;
                PTS.ValidateHandle(marginCollapsingState);
                dvrUsed += marginCollapsingState.Margin;
                marginCollapsingState.Dispose();
                zero = IntPtr.Zero;
            }
            this._paraHandle.Value = value;
        }
        internal override TextContentRange GetTextContentRange()
        {
            PTS.FSSUBPAGEDETAILS fssubpagedetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
            TextContentRange textContentRange;

            if (PTS.ToBoolean(fssubpagedetails.fSimple))
            {
                textContentRange = PtsHelper.TextContentRangeFromTrack(base.PtsContext, fssubpagedetails.u.simple.trackdescr.pfstrack);
            }
            else
            {
                textContentRange = new TextContentRange();
                if (fssubpagedetails.u.complex.cBasicColumns != 0)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array);
                    for (int i = 0; i < array.Length; i++)
                    {
                        textContentRange.Merge(PtsHelper.TextContentRangeFromTrack(base.PtsContext, array[i].pfstrack));
                    }
                }
            }
            if (this.IsFirstChunk)
            {
                textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(base.Paragraph.Element as TextElement, ElementEdge.BeforeStart));
            }
            if (this.IsLastChunk)
            {
                textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(base.Paragraph.Element as TextElement, ElementEdge.AfterEnd));
            }
            return(textContentRange);
        }
Ejemplo n.º 8
0
        // ------------------------------------------------------------------
        // Return TextContentRange for the content of the paragraph.
        // ------------------------------------------------------------------
        internal override TextContentRange GetTextContentRange()
        {
            TextContentRange textContentRange;

            // Query subpage details
            PTS.FSSUBPAGEDETAILS subpageDetails;
            PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

            // Subpage content may be simple or complex -
            // depending of set of features used in the content of the page.
            // (1) simple subpage (contains only one track)
            // (2) complex subpage (contains columns)
            if (PTS.ToBoolean(subpageDetails.fSimple))
            {
                // (1) simple subpage (contains only one track)
                textContentRange = PtsHelper.TextContentRangeFromTrack(PtsContext, subpageDetails.u.simple.trackdescr.pfstrack);
            }
            else
            {
                textContentRange = new TextContentRange();

                // (2) complex page (contains columns)
                // cBasicColumns == 0, means that subpage content is empty
                if (subpageDetails.u.complex.cBasicColumns != 0)
                {
                    // Retrieve description for each column.
                    PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
                    PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc);

                    // Arrange each track
                    for (int index = 0; index < arrayColumnDesc.Length; index++)
                    {
                        // Merge TextContentRanges for all columns
                        textContentRange.Merge(PtsHelper.TextContentRangeFromTrack(PtsContext, arrayColumnDesc[index].pfstrack));
                    }
                }
            }

            TextElement elementOwner = this.Paragraph.Element as TextElement;

            // If the first paragraph is the first paragraph in the container and it is the first chunk,
            // include start position of this element.
            if (_isFirstChunk)
            {
                textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(
                                           elementOwner, ElementEdge.BeforeStart));
            }

            // If the last paragraph is the last paragraph in the container and it is the last chunk,
            // include end position of this element.
            if (_isLastChunk)
            {
                textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(
                                           elementOwner, ElementEdge.AfterEnd));
            }

            Invariant.Assert(textContentRange != null);
            return(textContentRange);
        }
Ejemplo n.º 9
0
        // Token: 0x06006862 RID: 26722 RVA: 0x001D6B08 File Offset: 0x001D4D08
        internal void GetDurFigureAnchor(FigureParagraph paraFigure, uint fswdir, out int dur)
        {
            int    cpfromElement            = TextContainerHelper.GetCPFromElement(this._paraClient.Paragraph.StructuralCache.TextContainer, paraFigure.Element, ElementEdge.BeforeStart);
            int    firstCharacterIndex      = cpfromElement - this._cpPara;
            double distanceFromCharacterHit = this._line.GetDistanceFromCharacterHit(new CharacterHit(firstCharacterIndex, 0));

            dur = TextDpi.ToTextDpi(distanceFromCharacterHit);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Gets collection of AutomationPeers for given text range.
        /// </summary>
        internal override List <AutomationPeer> GetAutomationPeersFromRange(ITextPointer start, ITextPointer end)
        {
            // Force children connection to automation tree.
            GetChildren();

            TextElement textElement = (TextElement)Owner;

            return(TextContainerHelper.GetAutomationPeersFromRange(start, end, textElement.ContentStart));
        }
 // Token: 0x06006797 RID: 26519 RVA: 0x001CF7E8 File Offset: 0x001CD9E8
 void ISegment.GetFirstPara(out int fSuccessful, out IntPtr firstParaName)
 {
     if (this._ur != null)
     {
         int cpfromElement = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart);
         if (this._ur.SyncPara != null && cpfromElement == this._ur.SyncPara.ParagraphStartCharacterPosition)
         {
             this._ur.SyncPara.Previous = null;
             if (this._ur.Next != null && this._ur.Next.FirstPara == this._ur.SyncPara)
             {
                 this._ur.SyncPara.SetUpdateInfo(this._ur.Next.ChangeType, false);
             }
             else
             {
                 this._ur.SyncPara.SetUpdateInfo(PTS.FSKCHANGE.fskchNone, this._ur.Next == null);
             }
             Invariant.Assert(this._firstChild == null);
             this._firstChild = this._ur.SyncPara;
             this._ur         = this._ur.Next;
         }
     }
     if (this._firstChild != null)
     {
         if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate && this._ur == null && this.NeedsUpdate() && !this._firstParaValidInUpdateMode)
         {
             if (!base.StructuralCache.CurrentFormatContext.FinitePage)
             {
                 for (BaseParagraph baseParagraph = this._firstChild; baseParagraph != null; baseParagraph = baseParagraph.Next)
                 {
                     baseParagraph.Dispose();
                 }
                 this._firstChild = null;
             }
             this._firstParaValidInUpdateMode = true;
         }
         else if (this._ur != null && this._ur.InProcessing && this._ur.FirstPara == this._firstChild)
         {
             this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false);
         }
     }
     if (this._firstChild == null)
     {
         ITextPointer contentStart = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element);
         this._firstChild = this.GetParagraph(contentStart, false);
         if (this._ur != null && this._firstChild != null)
         {
             this._firstChild.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
         }
     }
     if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate)
     {
         this._firstParaValidInUpdateMode = true;
     }
     this._lastFetchedChild = this._firstChild;
     fSuccessful            = PTS.FromBoolean(this._firstChild != null);
     firstParaName          = ((this._firstChild != null) ? this._firstChild.Handle : IntPtr.Zero);
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Get Text effect index from text source character index. Return int value of Text effect index.
        /// </summary>
        /// <param name="dcp">
        /// dcp of CharacterHit relative to start of line
        /// </param>
        internal override int GetTextEffectCharacterIndexFromTextSourceCharacterIndex(int dcp)
        {
            // Text effect index is an index relative to the start of the Text Container.
            // To convert a text source index to text effect index, we first convert the dcp into text pointer
            // and call GetDistance() from the start of the text container.
            ITextPointer position = TextContainerHelper.GetTextPointerFromCP(_paraClient.Paragraph.StructuralCache.TextContainer, _cpPara + dcp, LogicalDirection.Forward);

            return(position.TextContainer.Start.GetOffsetToPosition(position));
        }
 /// <summary>Gets the collection of child elements for the <see cref="T:System.Windows.FrameworkContentElement" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.DocumentAutomationPeer" />. This method is called by <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetChildren" />.</summary>
 /// <returns>Because <see cref="T:System.Windows.Automation.Peers.DocumentAutomationPeer" /> gives access to its content through <see cref="T:System.Windows.Automation.TextPattern" />, this method always returns <see langword="null" />.</returns>
 // Token: 0x0600265A RID: 9818 RVA: 0x000B6C30 File Offset: 0x000B4E30
 protected override List <AutomationPeer> GetChildrenCore()
 {
     if (this._childrenStart != null && this._childrenEnd != null)
     {
         ITextContainer textContainer = ((IServiceProvider)base.Owner).GetService(typeof(ITextContainer)) as ITextContainer;
         return(TextContainerHelper.GetAutomationPeersFromRange(this._childrenStart, this._childrenEnd, textContainer.Start));
     }
     return(null);
 }
        /// <summary>
        /// Gets collection of AutomationPeers for given text range.
        /// </summary>
        internal override List <AutomationPeer> GetAutomationPeersFromRange(ITextPointer start, ITextPointer end)
        {
            // Force children connection to automation tree.
            GetChildren();

            RichTextBox owner = (RichTextBox)Owner;

            return(TextContainerHelper.GetAutomationPeersFromRange(start, end, owner.TextContainer.Start));
        }
        internal override TextContentRange GetTextContentRange()
        {
            TextElement      elementOwner = this.Paragraph.Element as TextElement;
            TextContentRange textContentRange;
            BaseParaClient   paraClient;

            PTS.FSSUBTRACKDETAILS   subtrackDetails;
            PTS.FSPARADESCRIPTION[] arrayParaDesc;

            Invariant.Assert(elementOwner != null, "Expecting TextElement as owner of ContainerParagraph.");

            // Query paragraph details
            PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails));

            // If container is empty, return range for the entire element.
            // If the beginning and the end of content of the paragraph is
            // part of this ParaClient, return range for the entire element.
            // Otherwise combine ranges from all nested paragraphs.
            if (subtrackDetails.cParas == 0 || (_isFirstChunk && _isLastChunk))
            {
                textContentRange = TextContainerHelper.GetTextContentRangeForTextElement(elementOwner);
            }
            else
            {
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                // Merge TextContentRanges for all paragraphs
                textContentRange = new TextContentRange();
                for (int i = 0; i < arrayParaDesc.Length; i++)
                {
                    paraClient = Paragraph.StructuralCache.PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient;
                    PTS.ValidateHandle(paraClient);
                    textContentRange.Merge(paraClient.GetTextContentRange());
                }

                // If the first paragraph is the first paragraph in the container and it is the first chunk,
                // include start position of this element.
                if (_isFirstChunk)
                {
                    textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(
                                               elementOwner, ElementEdge.BeforeStart));
                }

                // If the last paragraph is the last paragraph in the container and it is the last chunk,
                // include end position of this element.
                if (_isLastChunk)
                {
                    textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(
                                               elementOwner, ElementEdge.AfterEnd));
                }
            }

            Invariant.Assert(textContentRange != null);
            return(textContentRange);
        }
Ejemplo n.º 16
0
        /// <summary>Gets the collection of child elements of the <see cref="T:System.Windows.Controls.TextBlock" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.TextBlockAutomationPeer" />. Called by <see cref="M:System.Windows.Automation.Peers.AutomationPeer.GetChildren" />.</summary>
        /// <returns>A collection of child elements, or <see langword="null" /> if the <see cref="T:System.Windows.Controls.TextBlock" /> is empty.</returns>
        // Token: 0x06002837 RID: 10295 RVA: 0x000BBD58 File Offset: 0x000B9F58
        protected override List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> result    = null;
            TextBlock             textBlock = (TextBlock)base.Owner;

            if (textBlock.HasComplexContent)
            {
                result = TextContainerHelper.GetAutomationPeersFromRange(textBlock.TextContainer.Start, textBlock.TextContainer.End, null);
            }
            return(result);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// <see cref="AutomationPeer.GetChildrenCore"/>
        /// </summary>
        protected override List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> peers = null;
            TextBlock             owner = (TextBlock)Owner;

            // TextBlock has children only if it has complex content.
            if (owner.HasComplexContent)
            {
                peers = TextContainerHelper.GetAutomationPeersFromRange(owner.TextContainer.Start, owner.TextContainer.End, null);
            }
            return(peers);
        }
Ejemplo n.º 18
0
        // Token: 0x06006B2C RID: 27436 RVA: 0x001EF318 File Offset: 0x001ED518
        internal int GetLastDcpAttachedObjectBeforeLine(int dcpFirst)
        {
            ITextPointer textPointerFromCP = TextContainerHelper.GetTextPointerFromCP(base.StructuralCache.TextContainer, base.ParagraphStartCharacterPosition + dcpFirst, LogicalDirection.Forward);
            ITextPointer contentStart      = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element);

            while (textPointerFromCP.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
            {
                TextElement adjacentElementFromOuterPosition = ((TextPointer)textPointerFromCP).GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                if (!(adjacentElementFromOuterPosition is Figure) && !(adjacentElementFromOuterPosition is Floater))
                {
                    break;
                }
                textPointerFromCP.MoveByOffset(adjacentElementFromOuterPosition.SymbolCount);
            }
            return(contentStart.GetOffsetToPosition(textPointerFromCP));
        }
        /// <summary>
        /// FormatCellBottomless
        /// </summary>
        /// <param name="fswdir">Text Direction</param>
        /// <param name="width">Width of cell (height is specified by row props)</param>
        /// <param name="fmtrbl">bottomless format result</param>
        /// <param name="dvrUsed">dvr Used</param>
        internal void FormatCellBottomless(uint fswdir, double width, out PTS.FSFMTRBL fmtrbl, out int dvrUsed)
        {
            IntPtr pfspara;

            PTS.FSBBOX fsbbox;
            IntPtr     pmcsclientOut;

            PTS.FSKCLEAR fskclearOut;
            int          dvrTopSpace;
            int          fPageBecomesUninterruptable;

            PTS.FSPAP fspap;


            if (CellParagraph.StructuralCache.DtrList != null)
            {
                CellParagraph.InvalidateStructure(TextContainerHelper.GetCPFromElement(CellParagraph.StructuralCache.TextContainer, CellParagraph.Element, ElementEdge.BeforeStart));
            }

            fspap = new PTS.FSPAP();
            CellParagraph.GetParaProperties(ref fspap);

            CellParagraph.FormatParaBottomless(this, PTS.FromBoolean(false),
                                               fswdir, 0, TextDpi.ToTextDpi(width),
                                               0, null, PTS.FSKCLEAR.fskclearNone,
                                               PTS.FromBoolean(true),
                                               out fmtrbl,
                                               out pfspara,
                                               out dvrUsed,
                                               out fsbbox,
                                               out pmcsclientOut,
                                               out fskclearOut,
                                               out dvrTopSpace,
                                               out fPageBecomesUninterruptable);

            if (pmcsclientOut != IntPtr.Zero)
            {
                MarginCollapsingState mcs = PtsContext.HandleToObject(pmcsclientOut) as MarginCollapsingState;
                PTS.ValidateHandle(mcs);
                dvrUsed += mcs.Margin;
                mcs.Dispose();
                pmcsclientOut = IntPtr.Zero;
            }

            _paraHandle.Value = pfspara;
        }
 // Token: 0x0600679A RID: 26522 RVA: 0x001CFD2C File Offset: 0x001CDF2C
 internal void UpdGetSegmentChange(out PTS.FSKCHANGE fskch)
 {
     if (base.StructuralCache.CurrentFormatContext.FinitePage)
     {
         DtrList dtrList = base.StructuralCache.DtrsFromRange(TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.BeforeStart), base.LastFormatCch);
         if (dtrList != null)
         {
             int            cpfromElement  = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart);
             DirtyTextRange dirtyTextRange = dtrList[0];
             int            num            = cpfromElement;
             BaseParagraph  baseParagraph  = this._firstChild;
             if (num < dirtyTextRange.StartIndex)
             {
                 while (baseParagraph != null && num + baseParagraph.LastFormatCch <= dirtyTextRange.StartIndex && (num + baseParagraph.LastFormatCch != dirtyTextRange.StartIndex || !(baseParagraph is TextParagraph)))
                 {
                     num          += baseParagraph.Cch;
                     baseParagraph = baseParagraph.Next;
                 }
                 if (baseParagraph != null)
                 {
                     baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchInside, false);
                 }
             }
             else
             {
                 baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
             }
             if (baseParagraph != null)
             {
                 for (baseParagraph = baseParagraph.Next; baseParagraph != null; baseParagraph = baseParagraph.Next)
                 {
                     baseParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
                 }
             }
             this._changeType = PTS.FSKCHANGE.fskchInside;
         }
     }
     fskch = this._changeType;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Get text immediately before specified text source position. Return CharacterBufferRange
        /// containing this text.
        /// </summary>
        /// <param name="dcp">
        /// dcp of position relative to start of line
        /// </param>
        internal override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp)
        {
            // Parameter validation
            Invariant.Assert(dcp >= 0);

            int nonTextLength = 0;
            CharacterBufferRange precedingText = CharacterBufferRange.Empty;
            CultureInfo          culture       = null;

            if (dcp > 0)
            {
                // Create TextPointer at dcp, and pointer at paragraph start to compare
                ITextPointer startPosition = TextContainerHelper.GetTextPointerFromCP(_paraClient.Paragraph.StructuralCache.TextContainer, _cpPara, LogicalDirection.Forward);
                ITextPointer position      = TextContainerHelper.GetTextPointerFromCP(_paraClient.Paragraph.StructuralCache.TextContainer, _cpPara + dcp, LogicalDirection.Forward);

                // Move backward until we find a position at the end of a text run, or reach start of TextContainer
                while (position.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text &&
                       position.CompareTo(startPosition) != 0)
                {
                    position.MoveByOffset(-1);
                    nonTextLength++;
                }


                // Return text in run. If it is at start of TextContainer this will return an empty string
                string precedingTextString = position.GetTextInRun(LogicalDirection.Backward);
                precedingText = new CharacterBufferRange(precedingTextString, 0, precedingTextString.Length);


                StaticTextPointer pointer = position.CreateStaticPointer();
                DependencyObject  element = (pointer.Parent != null) ? pointer.Parent : _paraClient.Paragraph.Element;
                culture = DynamicPropertyReader.GetCultureInfo(element);
            }

            return(new TextSpan <CultureSpecificCharacterBufferRange>(
                       nonTextLength + precedingText.Length,
                       new CultureSpecificCharacterBufferRange(culture, precedingText)
                       ));
        }
Ejemplo n.º 22
0
        // Token: 0x0600686D RID: 26733 RVA: 0x001D7434 File Offset: 0x001D5634
        internal IInputElement InputHitTest(int urOffset)
        {
            DependencyObject dependencyObject = null;
            int          num = this.CalculateUOffsetShift();
            CharacterHit characterHitFromDistance;

            if (this._line.HasOverflowed && this.TextParagraph.Properties.TextTrimming != TextTrimming.None)
            {
                Invariant.Assert(num == 0);
                TextLine textLine = this._line.Collapse(new TextCollapsingProperties[]
                {
                    this.GetCollapsingProps(this._wrappingWidth, this.TextParagraph.Properties)
                });
                Invariant.Assert(textLine.HasCollapsed, "Line has not been collapsed");
                characterHitFromDistance = textLine.GetCharacterHitFromDistance(TextDpi.FromTextDpi(urOffset));
            }
            else
            {
                characterHitFromDistance = this._line.GetCharacterHitFromDistance(TextDpi.FromTextDpi(urOffset - num));
            }
            int         cp          = this._paraClient.Paragraph.ParagraphStartCharacterPosition + characterHitFromDistance.FirstCharacterIndex + characterHitFromDistance.TrailingLength;
            TextPointer textPointer = TextContainerHelper.GetTextPointerFromCP(this._paraClient.Paragraph.StructuralCache.TextContainer, cp, LogicalDirection.Forward) as TextPointer;

            if (textPointer != null)
            {
                TextPointerContext pointerContext = textPointer.GetPointerContext((characterHitFromDistance.TrailingLength == 0) ? LogicalDirection.Forward : LogicalDirection.Backward);
                if (pointerContext == TextPointerContext.Text || pointerContext == TextPointerContext.ElementEnd)
                {
                    dependencyObject = textPointer.Parent;
                }
                else if (pointerContext == TextPointerContext.ElementStart)
                {
                    dependencyObject = textPointer.GetAdjacentElementFromOuterPosition(LogicalDirection.Forward);
                }
            }
            return(dependencyObject as IInputElement);
        }
Ejemplo n.º 23
0
        // Token: 0x06006B2F RID: 27439 RVA: 0x001EF478 File Offset: 0x001ED678
        internal List <AttachedObject> GetAttachedObjects(int dcpFirst, int dcpLast)
        {
            ITextPointer          contentStart           = TextContainerHelper.GetContentStart(base.StructuralCache.TextContainer, base.Element);
            List <AttachedObject> list                   = new List <AttachedObject>();
            List <TextElement>    attachedObjectElements = this.GetAttachedObjectElements(dcpFirst, dcpLast);

            for (int i = 0; i < attachedObjectElements.Count; i++)
            {
                TextElement textElement = attachedObjectElements[i];
                if (textElement is Figure && base.StructuralCache.CurrentFormatContext.FinitePage)
                {
                    FigureParagraph figureParagraph = new FigureParagraph(textElement, base.StructuralCache);
                    if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate)
                    {
                        figureParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
                    }
                    FigureObject item = new FigureObject(contentStart.GetOffsetToPosition(textElement.ElementStart), figureParagraph);
                    list.Add(item);
                }
                else
                {
                    FloaterParagraph floaterParagraph = new FloaterParagraph(textElement, base.StructuralCache);
                    if (base.StructuralCache.CurrentFormatContext.IncrementalUpdate)
                    {
                        floaterParagraph.SetUpdateInfo(PTS.FSKCHANGE.fskchNew, false);
                    }
                    FloaterObject item2 = new FloaterObject(contentStart.GetOffsetToPosition(textElement.ElementStart), floaterParagraph);
                    list.Add(item2);
                }
            }
            if (list.Count != 0)
            {
                this.SubmitAttachedObjects(dcpFirst, dcpLast, list);
            }
            return(list);
        }
Ejemplo n.º 24
0
        // Token: 0x06006B36 RID: 27446 RVA: 0x001EF6F4 File Offset: 0x001ED8F4
        internal override bool InvalidateStructure(int startPosition)
        {
            Invariant.Assert(base.ParagraphEndCharacterPosition >= startPosition);
            bool result = false;

            if (base.ParagraphStartCharacterPosition == startPosition)
            {
                result = true;
                AnchoredBlock anchoredBlock = null;
                if (this._attachedObjects != null && this._attachedObjects.Count > 0)
                {
                    anchoredBlock = (AnchoredBlock)this._attachedObjects[0].Element;
                }
                if (anchoredBlock != null && startPosition == anchoredBlock.ElementStartOffset)
                {
                    StaticTextPointer staticTextPointerFromCP = TextContainerHelper.GetStaticTextPointerFromCP(base.StructuralCache.TextContainer, startPosition);
                    if (staticTextPointerFromCP.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart)
                    {
                        result = (anchoredBlock != staticTextPointerFromCP.GetAdjacentElement(LogicalDirection.Forward));
                    }
                }
            }
            this.InvalidateTextFormatCache();
            if (this._attachedObjects != null)
            {
                for (int i = 0; i < this._attachedObjects.Count; i++)
                {
                    BaseParagraph para = this._attachedObjects[i].Para;
                    if (para.ParagraphEndCharacterPosition >= startPosition)
                    {
                        para.InvalidateStructure(startPosition);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 25
0
 // Token: 0x06006B46 RID: 27462 RVA: 0x001EFDF0 File Offset: 0x001EDFF0
 private TextParagraphProperties GetLineProperties(bool firstLine, int dcpLine)
 {
     this.EnsureLineProperties();
     if (firstLine && this._lineProperties.HasFirstLineProperties)
     {
         if (dcpLine != 0)
         {
             firstLine = false;
         }
         else
         {
             int cpfromElement = TextContainerHelper.GetCPFromElement(base.StructuralCache.TextContainer, base.Element, ElementEdge.AfterStart);
             if (cpfromElement < base.ParagraphStartCharacterPosition)
             {
                 firstLine = false;
             }
         }
         if (firstLine)
         {
             return(this._lineProperties.FirstLineProps);
         }
     }
     return(this._lineProperties);
 }
Ejemplo n.º 26
0
        // Token: 0x06006864 RID: 26724 RVA: 0x001D6C0C File Offset: 0x001D4E0C
        internal override TextSpan <CultureSpecificCharacterBufferRange> GetPrecedingText(int dcp)
        {
            Invariant.Assert(dcp >= 0);
            int num = 0;
            CharacterBufferRange empty   = CharacterBufferRange.Empty;
            CultureInfo          culture = null;

            if (dcp > 0)
            {
                ITextPointer textPointerFromCP  = TextContainerHelper.GetTextPointerFromCP(this._paraClient.Paragraph.StructuralCache.TextContainer, this._cpPara, LogicalDirection.Forward);
                ITextPointer textPointerFromCP2 = TextContainerHelper.GetTextPointerFromCP(this._paraClient.Paragraph.StructuralCache.TextContainer, this._cpPara + dcp, LogicalDirection.Forward);
                while (textPointerFromCP2.GetPointerContext(LogicalDirection.Backward) != TextPointerContext.Text && textPointerFromCP2.CompareTo(textPointerFromCP) != 0)
                {
                    textPointerFromCP2.MoveByOffset(-1);
                    num++;
                }
                string textInRun = textPointerFromCP2.GetTextInRun(LogicalDirection.Backward);
                empty = new CharacterBufferRange(textInRun, 0, textInRun.Length);
                StaticTextPointer staticTextPointer = textPointerFromCP2.CreateStaticPointer();
                DependencyObject  element           = (staticTextPointer.Parent != null) ? staticTextPointer.Parent : this._paraClient.Paragraph.Element;
                culture = DynamicPropertyReader.GetCultureInfo(element);
            }
            return(new TextSpan <CultureSpecificCharacterBufferRange>(num + empty.Length, new CultureSpecificCharacterBufferRange(culture, empty)));
        }
Ejemplo n.º 27
0
        internal override TextContentRange GetTextContentRange()
        {
            TextElement textElement = base.Paragraph.Element as TextElement;

            Invariant.Assert(textElement != null, "Expecting TextElement as owner of ContainerParagraph.");
            PTS.FSSUBTRACKDETAILS fssubtrackdetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails));
            TextContentRange textContentRange;

            if (fssubtrackdetails.cParas == 0 || (this._isFirstChunk && this._isLastChunk))
            {
                textContentRange = TextContainerHelper.GetTextContentRangeForTextElement(textElement);
            }
            else
            {
                PTS.FSPARADESCRIPTION[] array;
                PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out array);
                textContentRange = new TextContentRange();
                for (int i = 0; i < array.Length; i++)
                {
                    BaseParaClient baseParaClient = base.Paragraph.StructuralCache.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                    PTS.ValidateHandle(baseParaClient);
                    textContentRange.Merge(baseParaClient.GetTextContentRange());
                }
                if (this._isFirstChunk)
                {
                    textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(textElement, ElementEdge.BeforeStart));
                }
                if (this._isLastChunk)
                {
                    textContentRange.Merge(TextContainerHelper.GetTextContentRangeForTextElementEdge(textElement, ElementEdge.AfterEnd));
                }
            }
            Invariant.Assert(textContentRange != null);
            return(textContentRange);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Returns TextContentRange for the content of the paragraph.
        /// </summary>
        internal override TextContentRange GetTextContentRange()
        {
            BlockUIContainer elementOwner = (BlockUIContainer)Paragraph.Element;

            return(TextContainerHelper.GetTextContentRangeForTextElement(elementOwner));
        }
        /// <summary>
        /// <see cref="AutomationPeer.GetChildrenCore"/>
        /// </summary>
        protected override List <AutomationPeer> GetChildrenCore()
        {
            RichTextBox owner = (RichTextBox)Owner;

            return(TextContainerHelper.GetAutomationPeersFromRange(owner.TextContainer.Start, owner.TextContainer.End, null));
        }
        // Token: 0x06006749 RID: 26441 RVA: 0x001CDDE4 File Offset: 0x001CBFE4
        internal virtual bool InvalidateStructure(int startPosition)
        {
            int cpfromElement = TextContainerHelper.GetCPFromElement(this.StructuralCache.TextContainer, this.Element, ElementEdge.BeforeStart);

            return(cpfromElement == startPosition);
        }