示例#1
0
        internal static TextContentRange TextContentRangeFromTrack(
            PtsContext ptsContext,
            IntPtr pfstrack)
        {
            // Get track details
            PTS.FSTRACKDETAILS trackDetails;
            PTS.Validate(PTS.FsQueryTrackDetails(ptsContext.Context, pfstrack, out trackDetails));

            // Combine ranges from all nested paragraphs.
            TextContentRange textContentRange = new TextContentRange();

            if (trackDetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION[] arrayParaDesc;
                PtsHelper.ParaListFromTrack(ptsContext, pfstrack, ref trackDetails, out arrayParaDesc);

                // Merge TextContentRanges for all paragraphs
                BaseParaClient paraClient;
                for (int i = 0; i < arrayParaDesc.Length; i++)
                {
                    paraClient = ptsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient;
                    PTS.ValidateHandle(paraClient);
                    textContentRange.Merge(paraClient.GetTextContentRange());
                }
            }
            return(textContentRange);
        }
        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);
        }
示例#3
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);
        }
        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);
        }
示例#5
0
        internal static TextContentRange TextContentRangeFromTrack(PtsContext ptsContext, IntPtr pfstrack)
        {
            PTS.FSTRACKDETAILS fstrackdetails;
            PTS.Validate(PTS.FsQueryTrackDetails(ptsContext.Context, pfstrack, out fstrackdetails));
            TextContentRange textContentRange = new TextContentRange();

            if (fstrackdetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION[] array;
                PtsHelper.ParaListFromTrack(ptsContext, pfstrack, ref fstrackdetails, out array);
                for (int i = 0; i < array.Length; i++)
                {
                    BaseParaClient baseParaClient = ptsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                    PTS.ValidateHandle(baseParaClient);
                    textContentRange.Merge(baseParaClient.GetTextContentRange());
                }
            }
            return(textContentRange);
        }
        internal TextContentRange GetTextContentRangeFromColumn(IntPtr pfstrack)
        {
            Invariant.Assert(!this.IsDisposed);
            PTS.FSTRACKDETAILS fstrackdetails;
            PTS.Validate(PTS.FsQueryTrackDetails(this.StructuralCache.PtsContext.Context, pfstrack, out fstrackdetails));
            TextContentRange textContentRange = new TextContentRange();

            if (fstrackdetails.cParas != 0)
            {
                PTS.FSPARADESCRIPTION[] array;
                PtsHelper.ParaListFromTrack(this.StructuralCache.PtsContext, pfstrack, ref fstrackdetails, out array);
                for (int i = 0; i < array.Length; i++)
                {
                    BaseParaClient baseParaClient = this.StructuralCache.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                    PTS.ValidateHandle(baseParaClient);
                    textContentRange.Merge(baseParaClient.GetTextContentRange());
                }
            }
            return(textContentRange);
        }
示例#7
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);
        }
示例#8
0
        // Token: 0x06006B3E RID: 27454 RVA: 0x001EF93C File Offset: 0x001EDB3C
        internal void UpdateTextContentRangeFromAttachedObjects(TextContentRange textContentRange, int dcpFirst, int dcpLast, PTS.FSATTACHEDOBJECTDESCRIPTION[] arrayAttachedObjectDesc)
        {
            int num  = dcpFirst;
            int num2 = 0;

            while (this._attachedObjects != null && num2 < this._attachedObjects.Count)
            {
                AttachedObject attachedObject = this._attachedObjects[num2];
                int            paragraphStartCharacterPosition = attachedObject.Para.ParagraphStartCharacterPosition;
                int            cch = attachedObject.Para.Cch;
                if (paragraphStartCharacterPosition >= num && paragraphStartCharacterPosition < dcpLast)
                {
                    textContentRange.Merge(new TextContentRange(num, paragraphStartCharacterPosition, base.StructuralCache.TextContainer));
                    num = paragraphStartCharacterPosition + cch;
                }
                if (dcpLast < num)
                {
                    break;
                }
                num2++;
            }
            if (num < dcpLast)
            {
                textContentRange.Merge(new TextContentRange(num, dcpLast, base.StructuralCache.TextContainer));
            }
            int num3 = 0;

            while (arrayAttachedObjectDesc != null && num3 < arrayAttachedObjectDesc.Length)
            {
                PTS.FSATTACHEDOBJECTDESCRIPTION fsattachedobjectdescription = arrayAttachedObjectDesc[num3];
                BaseParaClient baseParaClient = base.PtsContext.HandleToObject(arrayAttachedObjectDesc[num3].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(baseParaClient);
                textContentRange.Merge(baseParaClient.GetTextContentRange());
                num3++;
            }
        }