internal PDFSearchResult SetCurrentSearchPosition(PDFSearchResult previous_search_result_placeholder) { PDFRendererControl pdf_renderer_control = GetPDFRendererControl(); if (pdf_renderer_control != null) { foreach (PDFTextItem pdf_text_item in Children.OfType <PDFTextItem>()) { ASSERT.Test(pdf_text_item != null); PDFSearchResult search_result_placeholder = pdf_text_item.Tag as PDFSearchResult; // If there was no previous search location, we use the first we find // If the last text item was the match position, use this next one if (previous_search_result_placeholder == search_result_placeholder) { pdf_renderer_control.SelectPage(page); pdf_text_item.BringIntoView(); pdf_text_item.Opacity = 0; Animations.Fade(pdf_text_item, 0.1, 1); return(search_result_placeholder); } } } return(null); }
internal PDFSearchResult SetNextSearchPosition(PDFSearchResult previous_search_result_placeholder) { bool have_found_last_search_item = false; foreach (PDFTextItem pdf_text_item in Children.OfType <PDFTextItem>()) { PDFSearchResult search_result_placeholder = pdf_text_item.Tag as PDFSearchResult; // If there was no previous search location, we use the first we find // If the last text item was the match position, use this next one if (null == previous_search_result_placeholder || have_found_last_search_item && previous_search_result_placeholder != search_result_placeholder) { pdf_renderer_control_stats.pdf_renderer_control.SelectPage(this.page); pdf_text_item.BringIntoView(); pdf_text_item.Opacity = 0; Animations.Fade(pdf_text_item, 0.1, 1); return(search_result_placeholder); } // If we have just found the last match, flag that the next one is the successor match if (previous_search_result_placeholder == search_result_placeholder) { have_found_last_search_item = true; } } // We have not managed to find a search position if we get this far return(null); }
public void FlashSelectedSearchItem(PDFSearchResult search_result) { FeatureTrackingManager.Instance.UseFeature(Features.DocumentSearch_GoToSearchResultLocation); if (null != search_result) { PDFRendererPageControl page_control = (PDFRendererPageControl)ObjPagesPanel.Children[search_result.page - 1]; previous_search_result_placeholder = page_control.SetCurrentSearchPosition(search_result); } }
private void ListSearchDetails_SearchSelectionChanged(PDFSearchResult search_result) { FeatureTrackingManager.Instance.UseFeature(Features.Library_SearchInsideJumpToLocation); if (null != search_result) { MainWindowServiceDispatcher.Instance.OpenDocument(PDFDocumentBindable.Underlying, search_result.page, LibraryCatalogControl.FilterTerms, false); } }
public void SetSearchKeywords(PDFSearchResultSet search_result_set) { // If we have a new seat of search results if (previous_search_result_set != search_result_set) { previous_search_result_set = search_result_set; previous_search_result_placeholder = null; foreach (PDFRendererPageControl page_control in ObjPagesPanel.Children.OfType <PDFRendererPageControl>()) { ASSERT.Test(page_control != null); page_control.SetSearchKeywords(search_result_set); } } // Now find and flash the next (or first) placeholder { // If we are searching again, go from the placeholder if (null != previous_search_result_placeholder) { for (int page = previous_search_result_placeholder.page; page <= ObjPagesPanel.Children.Count; ++page) { PDFRendererPageControl page_control = (PDFRendererPageControl)ObjPagesPanel.Children[page - 1]; ASSERT.Test(page_control != null); previous_search_result_placeholder = page_control?.SetNextSearchPosition(previous_search_result_placeholder); // If it managed to find a successor search position, stick with that if (null != previous_search_result_placeholder) { break; } } } // If the placeholder hasn't found a successor, start from scratch if (null == previous_search_result_placeholder) { for (int page = 1; page <= ObjPagesPanel.Children.Count; ++page) { PDFRendererPageControl page_control = (PDFRendererPageControl)ObjPagesPanel.Children[page - 1]; ASSERT.Test(page_control != null); previous_search_result_placeholder = page_control.SetNextSearchPosition(previous_search_result_placeholder); // If it managed to find a successor search position, stick with that if (null != previous_search_result_placeholder) { break; } } } } }
private void FocusSearchResult(PDFSearchResult res) { System.Drawing.Point scrollPosition = this.pageViewControl1.ScrollPosition; if (this._pdfDoc.PageWidth > this.pageViewControl1.Width) { scrollPosition.X = res.Position.Left - this.pageViewControl1.Width - this.pageViewControl1.Margin.Size.Width; } if (this._pdfDoc.PageHeight > this.pageViewControl1.Height) { scrollPosition.Y = res.Position.Top - this.pageViewControl1.Height - this.pageViewControl1.Margin.Size.Height; } this.pageViewControl1.ScrollPosition = scrollPosition; }
private void ListSearchDetails_SearchSelectionChanged(PDFSearchResult search_result) { pdf_renderer_control.FlashSelectedSearchItem(search_result); }
internal PDFSearchResult SetNextSearchPosition(PDFSearchResult previous_search_result_placeholder) { return(CanvasSearch.SetNextSearchPosition(previous_search_result_placeholder)); }