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);
        }
        internal override IInputElement InputHitTest(PTS.FSPOINT pt)
        {
            IInputElement inputElement = null;

            if (this._pageContextOfThisPage.FloatingElementList != null)
            {
                int num = 0;
                while (num < this._pageContextOfThisPage.FloatingElementList.Count && inputElement == null)
                {
                    BaseParaClient baseParaClient = this._pageContextOfThisPage.FloatingElementList[num];
                    inputElement = baseParaClient.InputHitTest(pt);
                    num++;
                }
            }
            if (inputElement == null)
            {
                PTS.FSSUBPAGEDETAILS fssubpagedetails;
                PTS.Validate(PTS.FsQuerySubpageDetails(base.PtsContext.Context, this._paraHandle.Value, out fssubpagedetails));
                if (base.Rect.Contains(pt))
                {
                    if (this.ContentRect.Contains(pt))
                    {
                        pt = new PTS.FSPOINT(pt.u - this.ContentRect.u, pt.v - this.ContentRect.v);
                        if (PTS.ToBoolean(fssubpagedetails.fSimple))
                        {
                            inputElement = PtsHelper.InputHitTestTrack(base.PtsContext, pt, 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);
                            int num2 = 0;
                            while (num2 < array.Length && inputElement == null)
                            {
                                inputElement = PtsHelper.InputHitTestTrack(base.PtsContext, pt, ref array[num2]);
                                num2++;
                            }
                        }
                    }
                    if (inputElement == null)
                    {
                        inputElement = (base.Paragraph.Element as IInputElement);
                    }
                }
            }
            return(inputElement);
        }
        private IInputElement InputHitTestPage(PTS.FSPOINT pt)
        {
            IInputElement inputElement = null;

            if (this._pageContextOfThisPage.FloatingElementList != null)
            {
                int num = 0;
                while (num < this._pageContextOfThisPage.FloatingElementList.Count && inputElement == null)
                {
                    BaseParaClient baseParaClient = this._pageContextOfThisPage.FloatingElementList[num];
                    inputElement = baseParaClient.InputHitTest(pt);
                    num++;
                }
            }
            if (inputElement == null)
            {
                PTS.FSPAGEDETAILS fspagedetails;
                PTS.Validate(PTS.FsQueryPageDetails(this.PtsContext.Context, this._ptsPage.Value, out fspagedetails));
                if (PTS.ToBoolean(fspagedetails.fSimple))
                {
                    if (fspagedetails.u.simple.trackdescr.fsrc.Contains(pt))
                    {
                        inputElement = PtsHelper.InputHitTestTrack(this.PtsContext, pt, 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);
                        int num2 = 0;
                        while (num2 < array.Length && inputElement == null)
                        {
                            if (array[num2].fsrc.Contains(pt))
                            {
                                inputElement = this.InputHitTestSection(pt, ref array[num2]);
                            }
                            num2++;
                        }
                    }
                }
            }
            return(inputElement);
        }
Exemplo n.º 4
0
        internal override IInputElement InputHitTest(PTS.FSPOINT pt)
        {
            IInputElement ie = null;


            if (_pageContextOfThisPage.FloatingElementList != null)
            {
                for (int index = 0; index < _pageContextOfThisPage.FloatingElementList.Count && ie == null; index++)
                {
                    BaseParaClient floatingElement = _pageContextOfThisPage.FloatingElementList[index];

                    ie = floatingElement.InputHitTest(pt);
                }
            }

            if (ie == null)
            {
                // Query subpage details
                PTS.FSSUBPAGEDETAILS subpageDetails;
                PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

                if (Rect.Contains(pt))
                {
                    if (ContentRect.Contains(pt))
                    {
                        pt = new PTS.FSPOINT(pt.u - ContentRect.u, pt.v - ContentRect.v);

                        // Hittest subpage content. 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))
                        {
                            ie = PtsHelper.InputHitTestTrack(PtsContext, pt, 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 && ie == null; index++)
                                {
                                    ie = PtsHelper.InputHitTestTrack(PtsContext, pt, ref arrayColumnDesc[index]);
                                }
                            }
                        }
                    }

                    if (ie == null)
                    {
                        ie = Paragraph.Element as IInputElement;
                    }
                }
            }

            return(ie);
        }