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);
        }
Exemple #2
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);
        }
        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);
        }
        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);
        }