示例#1
0
        /// <summary>
        /// Gets existing views for pages from start to end. Scans only existing view to
        /// avoid loading of unloaded pages.
        /// </summary>
        /// <param name="idp">IDocumentPaginatorSource</param>
        /// <param name="startPageNumber">start page number</param>
        /// <param name="endPageNumber">end page number</param>
        /// <returns>returns a list of text views</returns>
        private static List <ITextView> ProcessMultiplePages(IDocumentPaginatorSource idp, int startPageNumber, int endPageNumber)
        {
            Invariant.Assert(idp != null, "IDocumentPaginatorSource is null");

            //now get available views
            DocumentViewerBase viewer = PathNode.GetParent(idp as DependencyObject) as DocumentViewerBase;

            Invariant.Assert(viewer != null, "DocumentViewer not found");

            // If the pages for the text segment are reversed (possibly a floater where the floater
            // reflow on to a page that comes after its anchor) we just swap them
            if (endPageNumber < startPageNumber)
            {
                int temp = endPageNumber;
                endPageNumber   = startPageNumber;
                startPageNumber = temp;
            }

            List <ITextView> res = null;

            if (idp != null && startPageNumber >= 0 && endPageNumber >= startPageNumber)
            {
                res = new List <ITextView>(endPageNumber - startPageNumber + 1);
                for (int pageNb = startPageNumber; pageNb <= endPageNumber; pageNb++)
                {
                    DocumentPageView view = AnnotationHelper.FindView(viewer, pageNb);
                    if (view != null)
                    {
                        IServiceProvider serviceProvider = view.DocumentPage as IServiceProvider;
                        if (serviceProvider != null)
                        {
                            ITextView textView = serviceProvider.GetService(typeof(ITextView)) as ITextView;
                            if (textView != null)
                            {
                                res.Add(textView);
                            }
                        }
                    }
                }
            }

            return(res);
        }
示例#2
0
        // Token: 0x06007C3F RID: 31807 RVA: 0x0022F168 File Offset: 0x0022D368
        private static List <ITextView> ProcessMultiplePages(IDocumentPaginatorSource idp, int startPageNumber, int endPageNumber)
        {
            Invariant.Assert(idp != null, "IDocumentPaginatorSource is null");
            DocumentViewerBase documentViewerBase = PathNode.GetParent(idp as DependencyObject) as DocumentViewerBase;

            Invariant.Assert(documentViewerBase != null, "DocumentViewer not found");
            if (endPageNumber < startPageNumber)
            {
                int num = endPageNumber;
                endPageNumber   = startPageNumber;
                startPageNumber = num;
            }
            List <ITextView> list = null;

            if (idp != null && startPageNumber >= 0 && endPageNumber >= startPageNumber)
            {
                list = new List <ITextView>(endPageNumber - startPageNumber + 1);
                for (int i = startPageNumber; i <= endPageNumber; i++)
                {
                    DocumentPageView documentPageView = AnnotationHelper.FindView(documentViewerBase, i);
                    if (documentPageView != null)
                    {
                        IServiceProvider serviceProvider = documentPageView.DocumentPage as IServiceProvider;
                        if (serviceProvider != null)
                        {
                            ITextView textView = serviceProvider.GetService(typeof(ITextView)) as ITextView;
                            if (textView != null)
                            {
                                list.Add(textView);
                            }
                        }
                    }
                }
            }
            return(list);
        }