コード例 #1
0
        // Token: 0x06006B6E RID: 27502 RVA: 0x001F0978 File Offset: 0x001EEB78
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            MbpInfo mbpInfo = MbpInfo.FromElement(base.Paragraph.Element, base.Paragraph.StructuralCache.TextFormatterHost.PixelsPerDip);

            PtsHelper.UpdateMirroringTransform(base.PageFlowDirection, base.ThisFlowDirection, this._visual, TextDpi.FromTextDpi(2 * this._rect.u + this._rect.du));
            UIElementIsland uielementIsland = ((UIElementParagraph)base.Paragraph).UIElementIsland;

            if (uielementIsland != null)
            {
                if (this._visual.Children.Count != 1 || this._visual.Children[0] != uielementIsland)
                {
                    Visual visual = VisualTreeHelper.GetParent(uielementIsland) as Visual;
                    if (visual != null)
                    {
                        ContainerVisual containerVisual = visual as ContainerVisual;
                        Invariant.Assert(containerVisual != null, "Parent should always derives from ContainerVisual.");
                        containerVisual.Children.Remove(uielementIsland);
                    }
                    this._visual.Children.Clear();
                    this._visual.Children.Add(uielementIsland);
                }
                uielementIsland.Offset = new PTS.FSVECTOR(this._rect.u + mbpInfo.BPLeft, this._rect.v + mbpInfo.BPTop).FromTextDpi();
            }
            else
            {
                this._visual.Children.Clear();
            }
            Brush backgroundBrush = (Brush)base.Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            this._visual.DrawBackgroundAndBorder(backgroundBrush, mbpInfo.BorderBrush, mbpInfo.Border, this._rect.FromTextDpi(), this.IsFirstChunk, this.IsLastChunk);
        }
コード例 #2
0
        internal ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent)
        {
            PTS.FSSUBTRACKDETAILS fssubtrackdetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails));
            hasTextContent = false;
            if (fssubtrackdetails.cParas == 0)
            {
                return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0)));
            }
            PTS.FSPARADESCRIPTION[] array;
            PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out array);
            List <ParagraphResult> list = new List <ParagraphResult>(array.Length);

            for (int i = 0; i < array.Length; i++)
            {
                BaseParaClient baseParaClient = base.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(baseParaClient);
                ParagraphResult paragraphResult = baseParaClient.CreateParagraphResult();
                if (paragraphResult.HasTextContent)
                {
                    hasTextContent = true;
                }
                list.Add(paragraphResult);
            }
            return(new ReadOnlyCollection <ParagraphResult>(list));
        }
コード例 #3
0
        // ------------------------------------------------------------------
        // Calculates a page margin adjustment to eliminate free space if column width is not flexible
        // ------------------------------------------------------------------
        internal static double CalculatePageMarginAdjustment(StructuralCache structuralCache, double pageMarginWidth)
        {
            double pageMarginAdjustment = 0.0;

            DependencyObject o = structuralCache.Section.Element;

            if (o is FlowDocument)
            {
                ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(o);

                if (!columnProperties.IsColumnWidthFlexible)
                {
                    double     lineHeight     = DynamicPropertyReader.GetLineHeightValue(o);
                    double     pageFontSize   = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
                    FontFamily pageFontFamily = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);

                    int ccol = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageMarginWidth, pageFontSize, pageFontFamily, true);

                    double columnWidth;
                    double freeSpace;
                    double gap;

                    GetColumnMetrics(columnProperties, pageMarginWidth,
                                     pageFontSize, pageFontFamily, true, ccol,
                                     ref lineHeight, out columnWidth, out freeSpace, out gap);

                    pageMarginAdjustment = freeSpace;
                }
            }

            return(pageMarginAdjustment);
        }
コード例 #4
0
 internal void ArrangePage()
 {
     if (this.IsEmpty)
     {
         return;
     }
     this._section.UpdateSegmentLastFormatPositions();
     PTS.FSPAGEDETAILS fspagedetails;
     PTS.Validate(PTS.FsQueryPageDetails(this.PtsContext.Context, this._ptsPage.Value, out fspagedetails));
     if (PTS.ToBoolean(fspagedetails.fSimple))
     {
         this._section.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, fspagedetails.u.simple.trackdescr.fsrc, this._finitePage);
         PtsHelper.ArrangeTrack(this.PtsContext, ref fspagedetails.u.simple.trackdescr, PTS.FlowDirectionToFswdir(this._section.StructuralCache.PageFlowDirection));
         this._section.StructuralCache.CurrentArrangeContext.PopPageData();
         return;
     }
     ErrorHandler.Assert(fspagedetails.u.complex.cFootnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
     if (fspagedetails.u.complex.cSections != 0)
     {
         PTS.FSSECTIONDESCRIPTION[] array;
         PtsHelper.SectionListFromPage(this.PtsContext, this._ptsPage.Value, ref fspagedetails, out array);
         for (int i = 0; i < array.Length; i++)
         {
             this.ArrangeSection(ref array[i]);
         }
     }
 }
コード例 #5
0
        // Token: 0x06006835 RID: 26677 RVA: 0x001D5B40 File Offset: 0x001D3D40
        internal PageBreakRecord FormatFinite(Size pageSize, Thickness pageMargin, PageBreakRecord breakRecord)
        {
            Invariant.Assert(!this.IsDisposed);
            this._formattedLinesCount = 0;
            TextDpi.EnsureValidPageSize(ref pageSize);
            TextDpi.EnsureValidPageMargin(ref pageMargin, pageSize);
            double num = PtsHelper.CalculatePageMarginAdjustment(this._structuralCache, pageSize.Width - (pageMargin.Left + pageMargin.Right));

            if (!DoubleUtil.IsZero(num))
            {
                pageMargin.Right += num - num / 100.0;
            }
            this._pageMargin = pageMargin;
            base.SetSize(pageSize);
            base.SetContentBox(new Rect(pageMargin.Left, pageMargin.Top, pageSize.Width - (pageMargin.Left + pageMargin.Right), pageSize.Height - (pageMargin.Top + pageMargin.Bottom)));
            using (this._structuralCache.SetDocumentFormatContext(this))
            {
                this.OnBeforeFormatPage();
                if (this._ptsPage.PrepareForFiniteUpdate(breakRecord))
                {
                    this._structuralCache.CurrentFormatContext.PushNewPageData(pageSize, this._pageMargin, true, true);
                    this._ptsPage.UpdateFinitePage(breakRecord);
                }
                else
                {
                    this._structuralCache.CurrentFormatContext.PushNewPageData(pageSize, this._pageMargin, false, true);
                    this._ptsPage.CreateFinitePage(breakRecord);
                }
                this._structuralCache.CurrentFormatContext.PopPageData();
                this.OnAfterFormatPage();
                this._structuralCache.DetectInvalidOperation();
            }
            return(this._ptsPage.BreakRecord);
        }
コード例 #6
0
 private void ArrangeSection(ref PTS.FSSECTIONDESCRIPTION sectionDesc)
 {
     PTS.FSSECTIONDETAILS fssectiondetails;
     PTS.Validate(PTS.FsQuerySectionDetails(this.PtsContext.Context, sectionDesc.pfssection, out fssectiondetails));
     if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes))
     {
         ErrorHandler.Assert(fssectiondetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
         if (fssectiondetails.u.withpagenotes.cBasicColumns != 0)
         {
             PTS.FSTRACKDESCRIPTION[] array;
             PtsHelper.TrackListFromSection(this.PtsContext, sectionDesc.pfssection, ref fssectiondetails, out array);
             for (int i = 0; i < array.Length; i++)
             {
                 this._section.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, array[i].fsrc, this._finitePage);
                 PtsHelper.ArrangeTrack(this.PtsContext, ref array[i], fssectiondetails.u.withpagenotes.fswdir);
                 this._section.StructuralCache.CurrentArrangeContext.PopPageData();
             }
             return;
         }
     }
     else
     {
         ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
     }
 }
コード例 #7
0
 // Token: 0x06006852 RID: 26706 RVA: 0x001D6628 File Offset: 0x001D4828
 private void UpdateVisual()
 {
     if (this.PageVisual == null)
     {
         base.SetVisual(new PageVisual(this));
     }
     if (this._visualNeedsUpdate)
     {
         this.PageVisual.DrawBackground((Brush)this._structuralCache.PropertyOwner.GetValue(FlowDocument.BackgroundProperty), new Rect(this._partitionSize));
         ContainerVisual containerVisual = null;
         using (this._structuralCache.SetDocumentVisualValidationContext(this))
         {
             containerVisual = this._ptsPage.GetPageVisual();
             this._structuralCache.DetectInvalidOperation();
         }
         this.PageVisual.Child = containerVisual;
         FlowDirection childFD = (FlowDirection)this._structuralCache.PropertyOwner.GetValue(FlowDocument.FlowDirectionProperty);
         PtsHelper.UpdateMirroringTransform(FlowDirection.LeftToRight, childFD, containerVisual, this.Size.Width);
         using (this._structuralCache.SetDocumentVisualValidationContext(this))
         {
             this._ptsPage.ClearUpdateInfo();
             this._structuralCache.DetectInvalidOperation();
         }
         this._visualNeedsUpdate = false;
     }
 }
コード例 #8
0
        internal override List <Rect> GetRectangles(ContentElement e, int start, int length)
        {
            List <Rect> list = new List <Rect>();

            if (base.Paragraph.Element as ContentElement == e)
            {
                this.GetRectanglesForParagraphElement(out list);
            }
            else
            {
                PTS.FSSUBTRACKDETAILS fssubtrackdetails;
                PTS.Validate(PTS.FsQuerySubtrackDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubtrackdetails));
                if (fssubtrackdetails.cParas != 0)
                {
                    PTS.FSPARADESCRIPTION[] arrayParaDesc;
                    PtsHelper.ParaListFromSubtrack(base.PtsContext, this._paraHandle.Value, ref fssubtrackdetails, out arrayParaDesc);
                    list = PtsHelper.GetRectanglesInParaList(base.PtsContext, e, start, length, arrayParaDesc);
                }
                else
                {
                    list = new List <Rect>();
                }
            }
            Invariant.Assert(list != null);
            return(list);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        internal static void UpdateTrackVisuals(PtsContext ptsContext, VisualCollection visualCollection, PTS.FSKUPDATE fskupdInherited, ref PTS.FSTRACKDESCRIPTION trackDesc)
        {
            PTS.FSKUPDATE fskupdate = trackDesc.fsupdinf.fskupd;
            if (trackDesc.fsupdinf.fskupd == PTS.FSKUPDATE.fskupdInherited)
            {
                fskupdate = fskupdInherited;
            }
            if (fskupdate == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            ErrorHandler.Assert(fskupdate != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
            bool flag = trackDesc.pfstrack == IntPtr.Zero;

            if (!flag)
            {
                PTS.FSTRACKDETAILS fstrackdetails;
                PTS.Validate(PTS.FsQueryTrackDetails(ptsContext.Context, trackDesc.pfstrack, out fstrackdetails));
                flag = (fstrackdetails.cParas == 0);
                if (!flag)
                {
                    PTS.FSPARADESCRIPTION[] arrayParaDesc;
                    PtsHelper.ParaListFromTrack(ptsContext, trackDesc.pfstrack, ref fstrackdetails, out arrayParaDesc);
                    PtsHelper.UpdateParaListVisuals(ptsContext, visualCollection, fskupdate, arrayParaDesc);
                }
            }
            if (flag)
            {
                visualCollection.Clear();
            }
        }
コード例 #11
0
        internal ReadOnlyCollection <ParagraphResult> GetChildrenParagraphResults(out bool hasTextContent)
        {
#if TEXTPANELLAYOUTDEBUG
            TextPanelDebug.IncrementCounter("ContainerPara.GetParagraphs", TextPanelDebug.Category.TextView);
#endif
            // Query paragraph details
            PTS.FSSUBTRACKDETAILS subtrackDetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails));

            // hasTextContent is set to true if any of the children paragraphs has text content, not just attached objects
            hasTextContent = false;

            if (subtrackDetails.cParas == 0)
            {
                return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0)));
            }

            // Get list of paragraphs
            PTS.FSPARADESCRIPTION [] arrayParaDesc;
            PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

            List <ParagraphResult> paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length);
            for (int i = 0; i < arrayParaDesc.Length; i++)
            {
                BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(paraClient);
                ParagraphResult paragraphResult = paraClient.CreateParagraphResult();
                if (paragraphResult.HasTextContent)
                {
                    hasTextContent = true;
                }
                paragraphResults.Add(paragraphResult);
            }
            return(new ReadOnlyCollection <ParagraphResult>(paragraphResults));
        }
コード例 #12
0
        protected override void OnArrange()
        {
            base.OnArrange();

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

            // Adjust rectangle and offset to take into account MBPs
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element);

            if (ParentFlowDirection != PageFlowDirection)
            {
                mbp.MirrorMargin();
            }

            _rect.u  += mbp.MarginLeft;
            _rect.du -= mbp.MarginLeft + mbp.MarginRight;

            _rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du);
            _rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv);

            uint fswdirSubtrack = PTS.FlowDirectionToFswdir(_flowDirection);

            // There is possibility to get empty track.
            if (subtrackDetails.cParas != 0)
            {
                // Get list of paragraphs
                PTS.FSPARADESCRIPTION [] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                PtsHelper.ArrangeParaList(PtsContext, subtrackDetails.fsrc, arrayParaDesc, fswdirSubtrack);
            }
        }
コード例 #13
0
        internal override void ValidateVisual(PTS.FSKUPDATE fskupdInherited)
        {
            // Query paragraph details
            PTS.FSSUBTRACKDETAILS subtrackDetails;
            PTS.Validate(PTS.FsQuerySubtrackDetails(PtsContext.Context, _paraHandle.Value, out subtrackDetails));

            // Draw border and background info.

            // Adjust rectangle and offset to take into account MBPs
            MbpInfo mbp = MbpInfo.FromElement(Paragraph.Element);

            if (ThisFlowDirection != PageFlowDirection)
            {
                mbp.MirrorBP();
            }

            Brush backgroundBrush = (Brush)Paragraph.Element.GetValue(TextElement.BackgroundProperty);

            _visual.DrawBackgroundAndBorder(backgroundBrush, mbp.BorderBrush, mbp.Border, _rect.FromTextDpi(), IsFirstChunk, IsLastChunk);

            // There might be possibility to get empty sub-track, skip the sub-track in such case.
            if (subtrackDetails.cParas != 0)
            {
                // Get list of paragraphs
                PTS.FSPARADESCRIPTION [] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                // Render list of paragraphs
                PtsHelper.UpdateParaListVisuals(PtsContext, _visual.Children, fskupdInherited, arrayParaDesc);
            }
            else
            {
                _visual.Children.Clear();
            }
        }
コード例 #14
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);
        }
コード例 #15
0
ファイル: SubpageParaClient.cs プロジェクト: beda2280/wpf-1
        // ------------------------------------------------------------------
        // Returns a collection of ParagraphResults for the column's paragraphs.
        //
        //      pfstrack - Pointer to PTS track representing a column.
        //      parentOffset - Parent offset from the top of the page.
        //      hasTextContent - true if any of the children paras has text content
        // ------------------------------------------------------------------
        internal ReadOnlyCollection <ParagraphResult> GetParagraphResultsFromColumn(IntPtr pfstrack, Vector parentOffset, out bool hasTextContent)
        {
            // Get track details
            PTS.FSTRACKDETAILS trackDetails;
            PTS.Validate(PTS.FsQueryTrackDetails(PtsContext.Context, pfstrack, out trackDetails));
            hasTextContent = false;

            if (trackDetails.cParas == 0)
            {
                return(null);
            }

            PTS.FSPARADESCRIPTION[] arrayParaDesc;
            PtsHelper.ParaListFromTrack(PtsContext, pfstrack, ref trackDetails, out arrayParaDesc);

            List <ParagraphResult> paragraphResults = new List <ParagraphResult>(arrayParaDesc.Length);

            for (int i = 0; i < arrayParaDesc.Length; i++)
            {
                BaseParaClient paraClient = PtsContext.HandleToObject(arrayParaDesc[i].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(paraClient);
                ParagraphResult paragraphResult = paraClient.CreateParagraphResult();
                if (paragraphResult.HasTextContent)
                {
                    hasTextContent = true;
                }
                paragraphResults.Add(paragraphResult);
            }
            return(new ReadOnlyCollection <ParagraphResult>(paragraphResults));
        }
コード例 #16
0
        private List <Rect> GetRectanglesInPage(ContentElement e, int start, int length)
        {
            List <Rect> list = new List <Rect>();

            Invariant.Assert(!this.IsEmpty);
            PTS.FSPAGEDETAILS fspagedetails;
            PTS.Validate(PTS.FsQueryPageDetails(this.PtsContext.Context, this._ptsPage.Value, out fspagedetails));
            if (PTS.ToBoolean(fspagedetails.fSimple))
            {
                list = PtsHelper.GetRectanglesInTrack(this.PtsContext, e, start, length, ref fspagedetails.u.simple.trackdescr);
            }
            else
            {
                ErrorHandler.Assert(fspagedetails.u.complex.cFootnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                if (fspagedetails.u.complex.cSections != 0)
                {
                    PTS.FSSECTIONDESCRIPTION[] array;
                    PtsHelper.SectionListFromPage(this.PtsContext, this._ptsPage.Value, ref fspagedetails, out array);
                    for (int i = 0; i < array.Length; i++)
                    {
                        list = this.GetRectanglesInSection(e, start, length, ref array[i]);
                        Invariant.Assert(list != null);
                        if (list.Count != 0)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    list = new List <Rect>();
                }
            }
            return(list);
        }
コード例 #17
0
        internal ReadOnlyCollection <ParagraphResult> GetParagraphResultsFromColumn(IntPtr pfstrack, Vector parentOffset, out bool hasTextContent)
        {
            Invariant.Assert(!this.IsDisposed);
            PTS.FSTRACKDETAILS fstrackdetails;
            PTS.Validate(PTS.FsQueryTrackDetails(this.StructuralCache.PtsContext.Context, pfstrack, out fstrackdetails));
            hasTextContent = false;
            if (fstrackdetails.cParas == 0)
            {
                return(new ReadOnlyCollection <ParagraphResult>(new List <ParagraphResult>(0)));
            }
            PTS.FSPARADESCRIPTION[] array;
            PtsHelper.ParaListFromTrack(this.StructuralCache.PtsContext, pfstrack, ref fstrackdetails, out array);
            List <ParagraphResult> list = new List <ParagraphResult>(array.Length);

            for (int i = 0; i < array.Length; i++)
            {
                BaseParaClient baseParaClient = this.StructuralCache.PtsContext.HandleToObject(array[i].pfsparaclient) as BaseParaClient;
                PTS.ValidateHandle(baseParaClient);
                ParagraphResult paragraphResult = baseParaClient.CreateParagraphResult();
                if (paragraphResult.HasTextContent)
                {
                    hasTextContent = true;
                }
                list.Add(paragraphResult);
            }
            return(new ReadOnlyCollection <ParagraphResult>(list));
        }
コード例 #18
0
 internal override void UpdateViewport(ref PTS.FSRECT viewport)
 {
     PTS.FSSUBPAGEDETAILS fssubpagedetails;
     PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
     PTS.FSRECT fsrect = default(PTS.FSRECT);
     fsrect.u  = viewport.u - this.ContentRect.u;
     fsrect.v  = viewport.v - this.ContentRect.v;
     fsrect.du = viewport.du;
     fsrect.dv = viewport.dv;
     if (PTS.ToBoolean(fssubpagedetails.fSimple))
     {
         PtsHelper.UpdateViewportTrack(base.PtsContext, ref fssubpagedetails.u.simple.trackdescr, ref fsrect);
         return;
     }
     if (fssubpagedetails.u.complex.cBasicColumns != 0)
     {
         PTS.FSTRACKDESCRIPTION[] array;
         PtsHelper.TrackListFromSubpage(base.PtsContext, this._paraHandle.Value, ref fssubpagedetails, out array);
         if (array.Length != 0)
         {
             for (int i = 0; i < array.Length; i++)
             {
                 PtsHelper.UpdateViewportTrack(base.PtsContext, ref array[i], ref fsrect);
             }
         }
     }
 }
コード例 #19
0
 protected override void OnArrange()
 {
     base.OnArrange();
     ((FloaterParagraph)base.Paragraph).UpdateSegmentLastFormatPositions();
     PTS.FSSUBPAGEDETAILS fssubpagedetails;
     PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
     this._pageContext.AddFloatingParaClient(this);
     if (PTS.ToBoolean(fssubpagedetails.fSimple))
     {
         this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.simple.trackdescr.fsrc);
         base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, fssubpagedetails.u.simple.trackdescr.fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);
         PtsHelper.ArrangeTrack(base.PtsContext, ref fssubpagedetails.u.simple.trackdescr, fssubpagedetails.u.simple.fswdir);
         base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
         return;
     }
     this._pageContextOfThisPage.PageRect = new PTS.FSRECT(fssubpagedetails.u.complex.fsrc);
     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++)
         {
             base.Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(this._pageContextOfThisPage, array[i].fsrc, base.Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);
             PtsHelper.ArrangeTrack(base.PtsContext, ref array[i], fssubpagedetails.u.complex.fswdir);
             base.Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
         }
     }
 }
コード例 #20
0
        internal override List <Rect> GetRectangles(ContentElement e, int start, int length)
        {
            List <Rect> list = new List <Rect>();

            if (base.Paragraph.Element as ContentElement == e)
            {
                this.GetRectanglesForParagraphElement(out list);
            }
            else
            {
                PTS.FSSUBPAGEDETAILS fssubpagedetails;
                PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
                if (PTS.ToBoolean(fssubpagedetails.fSimple))
                {
                    list = PtsHelper.GetRectanglesInTrack(base.PtsContext, e, start, length, ref fssubpagedetails.u.simple.trackdescr);
                }
                else 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++)
                    {
                        List <Rect> rectanglesInTrack = PtsHelper.GetRectanglesInTrack(base.PtsContext, e, start, length, ref array[i]);
                        Invariant.Assert(rectanglesInTrack != null);
                        if (rectanglesInTrack.Count != 0)
                        {
                            list.AddRange(rectanglesInTrack);
                        }
                    }
                }
                list = PtsHelper.OffsetRectangleList(list, TextDpi.FromTextDpi(this.ContentRect.u), TextDpi.FromTextDpi(this.ContentRect.v));
            }
            Invariant.Assert(list != null);
            return(list);
        }
コード例 #21
0
        private List <Rect> GetRectanglesInSection(ContentElement e, int start, int length, ref PTS.FSSECTIONDESCRIPTION sectionDesc)
        {
            PTS.FSSECTIONDETAILS fssectiondetails;
            PTS.Validate(PTS.FsQuerySectionDetails(this.PtsContext.Context, sectionDesc.pfssection, out fssectiondetails));
            List <Rect> list = new List <Rect>();

            if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes))
            {
                ErrorHandler.Assert(fssectiondetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                if (fssectiondetails.u.withpagenotes.cBasicColumns != 0)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSection(this.PtsContext, sectionDesc.pfssection, ref fssectiondetails, out array);
                    for (int i = 0; i < array.Length; i++)
                    {
                        List <Rect> rectanglesInTrack = PtsHelper.GetRectanglesInTrack(this.PtsContext, e, start, length, ref array[i]);
                        Invariant.Assert(rectanglesInTrack != null);
                        if (rectanglesInTrack.Count != 0)
                        {
                            list.AddRange(rectanglesInTrack);
                        }
                    }
                }
            }
            else
            {
                ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
            }
            return(list);
        }
コード例 #22
0
        private IInputElement InputHitTestSection(PTS.FSPOINT pt, ref PTS.FSSECTIONDESCRIPTION sectionDesc)
        {
            IInputElement result = null;

            PTS.FSSECTIONDETAILS fssectiondetails;
            PTS.Validate(PTS.FsQuerySectionDetails(this.PtsContext.Context, sectionDesc.pfssection, out fssectiondetails));
            if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes))
            {
                ErrorHandler.Assert(fssectiondetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                if (fssectiondetails.u.withpagenotes.cBasicColumns != 0)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSection(this.PtsContext, sectionDesc.pfssection, ref fssectiondetails, out array);
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (array[i].fsrc.Contains(pt))
                        {
                            result = PtsHelper.InputHitTestTrack(this.PtsContext, pt, ref array[i]);
                            break;
                        }
                    }
                }
            }
            else
            {
                ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
            }
            return(result);
        }
コード例 #23
0
        // ------------------------------------------------------------------
        // Returns calculated column information -  count, width, gap and rule.
        // ------------------------------------------------------------------
        internal static void GetColumnMetrics(StructuralCache structuralCache, out int cColumns, out double width, out double gap, out double rule)
        {
            ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(structuralCache.PropertyOwner);
            FontFamily            pageFontFamily   = (FontFamily)structuralCache.PropertyOwner.GetValue(Block.FontFamilyProperty);
            double    lineHeight   = DynamicPropertyReader.GetLineHeightValue(structuralCache.PropertyOwner);
            double    pageFontSize = (double)structuralCache.PropertyOwner.GetValue(Block.FontSizeProperty);
            Size      pageSize     = structuralCache.CurrentFormatContext.PageSize;
            Thickness pageMargin   = structuralCache.CurrentFormatContext.PageMargin;
            double    pageWidth    = pageSize.Width - (pageMargin.Left + pageMargin.Right);

            cColumns = PtsHelper.CalculateColumnCount(columnProperties, lineHeight, pageWidth, pageFontSize, pageFontFamily, true);

            double freeSpace;

            rule = columnProperties.ColumnRuleWidth;
            PtsHelper.GetColumnMetrics(columnProperties, pageWidth,
                                       pageFontSize, pageFontFamily, true, cColumns,
                                       ref lineHeight, out width, out freeSpace, out gap);

            if (columnProperties.IsColumnWidthFlexible && columnProperties.ColumnSpaceDistribution == ColumnSpaceDistribution.Between)
            {
                width += freeSpace / cColumns;
            }

            width = Math.Min(width, pageWidth);
        }
コード例 #24
0
        internal override IInputElement InputHitTest(PTS.FSPOINT pt)
        {
            IInputElement ie = null;

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

            // Hittest subtrack content.

            // There might be possibility to get empty sub-track, skip the sub-track
            // in such case.
            if (subtrackDetails.cParas != 0)
            {
                // Get list of paragraphs
                PTS.FSPARADESCRIPTION [] arrayParaDesc;
                PtsHelper.ParaListFromSubtrack(PtsContext, _paraHandle.Value, ref subtrackDetails, out arrayParaDesc);

                // Render list of paragraphs
                ie = PtsHelper.InputHitTestParaList(PtsContext, pt, ref subtrackDetails.fsrc, arrayParaDesc);
            }

            // If nothing is hit, return the owner of the paragraph.
            if (ie == null && _rect.Contains(pt))
            {
                ie = Paragraph.Element as IInputElement;
            }

            return(ie);
        }
コード例 #25
0
ファイル: SubpageParaClient.cs プロジェクト: beda2280/wpf-1
        // ------------------------------------------------------------------
        // 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);
        }
コード例 #26
0
        internal ReadOnlyCollection <ColumnResult> GetColumnResults(out bool hasTextContent)
        {
            Invariant.Assert(!this.IsDisposed);
            List <ColumnResult> list = new List <ColumnResult>(0);

            hasTextContent = false;
            if (!(this._ptsPage.PageHandle == IntPtr.Zero))
            {
                PTS.FSPAGEDETAILS fspagedetails;
                PTS.Validate(PTS.FsQueryPageDetails(this.StructuralCache.PtsContext.Context, this._ptsPage.PageHandle, out fspagedetails));
                if (PTS.ToBoolean(fspagedetails.fSimple))
                {
                    PTS.FSTRACKDETAILS fstrackdetails;
                    PTS.Validate(PTS.FsQueryTrackDetails(this.StructuralCache.PtsContext.Context, fspagedetails.u.simple.trackdescr.pfstrack, out fstrackdetails));
                    if (fstrackdetails.cParas > 0)
                    {
                        list = new List <ColumnResult>(1);
                        ColumnResult columnResult = new ColumnResult(this, ref fspagedetails.u.simple.trackdescr, default(Vector));
                        list.Add(columnResult);
                        if (columnResult.HasTextContent)
                        {
                            hasTextContent = true;
                        }
                    }
                }
                else if (fspagedetails.u.complex.cSections > 0)
                {
                    PTS.FSSECTIONDESCRIPTION[] array;
                    PtsHelper.SectionListFromPage(this.StructuralCache.PtsContext, this._ptsPage.PageHandle, ref fspagedetails, out array);
                    PTS.FSSECTIONDETAILS fssectiondetails;
                    PTS.Validate(PTS.FsQuerySectionDetails(this.StructuralCache.PtsContext.Context, array[0].pfssection, out fssectiondetails));
                    if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes) && fssectiondetails.u.withpagenotes.cBasicColumns > 0)
                    {
                        PTS.FSTRACKDESCRIPTION[] array2;
                        PtsHelper.TrackListFromSection(this.StructuralCache.PtsContext, array[0].pfssection, ref fssectiondetails, out array2);
                        list = new List <ColumnResult>(fssectiondetails.u.withpagenotes.cBasicColumns);
                        foreach (PTS.FSTRACKDESCRIPTION fstrackdescription in array2)
                        {
                            if (fstrackdescription.pfstrack != IntPtr.Zero)
                            {
                                PTS.FSTRACKDETAILS fstrackdetails2;
                                PTS.Validate(PTS.FsQueryTrackDetails(this.StructuralCache.PtsContext.Context, fstrackdescription.pfstrack, out fstrackdetails2));
                                if (fstrackdetails2.cParas > 0)
                                {
                                    ColumnResult columnResult2 = new ColumnResult(this, ref fstrackdescription, default(Vector));
                                    list.Add(columnResult2);
                                    if (columnResult2.HasTextContent)
                                    {
                                        hasTextContent = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Invariant.Assert(list != null);
            return(new ReadOnlyCollection <ColumnResult>(list));
        }
コード例 #27
0
        private void UpdateSectionVisuals(SectionVisual visual, PTS.FSKUPDATE fskupdInherited, ref PTS.FSSECTIONDESCRIPTION sectionDesc)
        {
            PTS.FSKUPDATE fskupdate = sectionDesc.fsupdinf.fskupd;
            if (fskupdate == PTS.FSKUPDATE.fskupdInherited)
            {
                fskupdate = fskupdInherited;
            }
            ErrorHandler.Assert(fskupdate != PTS.FSKUPDATE.fskupdShifted, ErrorHandler.UpdateShiftedNotValid);
            if (fskupdate == PTS.FSKUPDATE.fskupdNoChange)
            {
                return;
            }
            PTS.FSSECTIONDETAILS fssectiondetails;
            PTS.Validate(PTS.FsQuerySectionDetails(this.PtsContext.Context, sectionDesc.pfssection, out fssectiondetails));
            bool flag;

            if (PTS.ToBoolean(fssectiondetails.fFootnotesAsPagenotes))
            {
                ErrorHandler.Assert(fssectiondetails.u.withpagenotes.cEndnoteColumns == 0, ErrorHandler.NotSupportedFootnotes);
                flag = (fssectiondetails.u.withpagenotes.cBasicColumns == 0);
                if (!flag)
                {
                    PTS.FSTRACKDESCRIPTION[] array;
                    PtsHelper.TrackListFromSection(this.PtsContext, sectionDesc.pfssection, ref fssectiondetails, out array);
                    flag = (array.Length == 0);
                    if (!flag)
                    {
                        ColumnPropertiesGroup columnProperties = new ColumnPropertiesGroup(this._section.Element);
                        visual.DrawColumnRules(ref array, TextDpi.FromTextDpi(sectionDesc.fsrc.v), TextDpi.FromTextDpi(sectionDesc.fsrc.dv), columnProperties);
                        VisualCollection children = visual.Children;
                        if (fskupdate == PTS.FSKUPDATE.fskupdNew)
                        {
                            children.Clear();
                            for (int i = 0; i < array.Length; i++)
                            {
                                children.Add(new ContainerVisual());
                            }
                        }
                        ErrorHandler.Assert(children.Count == array.Length, ErrorHandler.ColumnVisualCountMismatch);
                        for (int j = 0; j < array.Length; j++)
                        {
                            ContainerVisual containerVisual = (ContainerVisual)children[j];
                            PtsHelper.UpdateTrackVisuals(this.PtsContext, containerVisual.Children, fskupdate, ref array[j]);
                        }
                    }
                }
            }
            else
            {
                ErrorHandler.Assert(false, ErrorHandler.NotSupportedCompositeColumns);
                flag = true;
            }
            if (flag)
            {
                visual.Children.Clear();
            }
        }
コード例 #28
0
        protected override void OnArrange()
        {
            base.OnArrange();

            ((FloaterParagraph)Paragraph).UpdateSegmentLastFormatPositions();

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

            _pageContext.AddFloatingParaClient(this);

            // Arrange subpage content. Subpage content may be simple or complex -
            // depending of set of features used in the content of the subpage.
            // (1) simple subpage (contains only one track)
            // (2) complex subpage (contains columns)
            if (PTS.ToBoolean(subpageDetails.fSimple))
            {
                _pageContextOfThisPage.PageRect = new PTS.FSRECT(subpageDetails.u.simple.trackdescr.fsrc);

                // (1) simple subpage (contains only one track)
                // Exceptions don't need to pop, as the top level arrange context will be nulled out if thrown.
                Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(_pageContextOfThisPage, subpageDetails.u.simple.trackdescr.fsrc,
                                                                                Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);

                PtsHelper.ArrangeTrack(PtsContext, ref subpageDetails.u.simple.trackdescr, subpageDetails.u.simple.fswdir);

                Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
            }
            else
            {
                _pageContextOfThisPage.PageRect = new PTS.FSRECT(subpageDetails.u.complex.fsrc);

                // (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++)
                    {
                        // Exceptions don't need to pop, as the top level arrange context will be nulled out if thrown.
                        Paragraph.StructuralCache.CurrentArrangeContext.PushNewPageData(_pageContextOfThisPage, arrayColumnDesc[index].fsrc,
                                                                                        Paragraph.StructuralCache.CurrentArrangeContext.FinitePage);

                        PtsHelper.ArrangeTrack(PtsContext, ref arrayColumnDesc[index], subpageDetails.u.complex.fswdir);

                        Paragraph.StructuralCache.CurrentArrangeContext.PopPageData();
                    }
                }
            }
        }
コード例 #29
0
        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);
        }
コード例 #30
0
        internal override List <Rect> GetRectangles(ContentElement e, int start, int length)
        {
            List <Rect> rectangles = new List <Rect>();

            if (Paragraph.Element as ContentElement == e)
            {
                // We have found the element. Return rectangles for this paragraph.
                GetRectanglesForParagraphElement(out rectangles);
            }
            else
            {
                // Query subpage details
                PTS.FSSUBPAGEDETAILS subpageDetails;
                PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

                // Check subpage content for element. 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)
                    rectangles = PtsHelper.GetRectanglesInTrack(PtsContext, e, start, length, ref subpageDetails.u.simple.trackdescr);
                }
                else
                {
                    // (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++)
                        {
                            List <Rect> trackRectangles = PtsHelper.GetRectanglesInTrack(PtsContext, e, start, length, ref arrayColumnDesc[index]);
                            Invariant.Assert(trackRectangles != null);
                            if (trackRectangles.Count != 0)
                            {
                                // Add rectangles found in this track to all rectangles
                                rectangles.AddRange(trackRectangles);
                            }
                        }
                    }
                }

                rectangles = PtsHelper.OffsetRectangleList(rectangles, TextDpi.FromTextDpi(ContentRect.u), TextDpi.FromTextDpi(ContentRect.v));
            }

            Invariant.Assert(rectangles != null);
            return(rectangles);
        }