// Token: 0x06007BC7 RID: 31687 RVA: 0x0022C590 File Offset: 0x0022A790 public override ContentLocator GenerateLocator(PathNode node, out bool continueGenerating) { if (node == null) { throw new ArgumentNullException("node"); } continueGenerating = true; ContentLocator contentLocator = null; DocumentPageView documentPageView = node.Node as DocumentPageView; int num = -1; if (documentPageView != null) { if (documentPageView.DocumentPage is FixedDocumentPage || documentPageView.DocumentPage is FixedDocumentSequenceDocumentPage) { num = documentPageView.PageNumber; } } else { FixedTextSelectionProcessor.FixedPageProxy fixedPageProxy = node.Node as FixedTextSelectionProcessor.FixedPageProxy; if (fixedPageProxy != null) { num = fixedPageProxy.Page; } } if (num >= 0) { contentLocator = new ContentLocator(); ContentLocatorPart item = FixedPageProcessor.CreateLocatorPart(num); contentLocator.Parts.Add(item); } return(contentLocator); }
// Token: 0x06007BD2 RID: 31698 RVA: 0x0022CA60 File Offset: 0x0022AC60 public override IList <ContentLocatorPart> GenerateLocatorParts(object selection, DependencyObject startNode) { if (startNode == null) { throw new ArgumentNullException("startNode"); } if (selection == null) { throw new ArgumentNullException("selection"); } this.CheckSelection(selection); FixedTextSelectionProcessor.FixedPageProxy fixedPageProxy = startNode as FixedTextSelectionProcessor.FixedPageProxy; if (fixedPageProxy == null) { throw new ArgumentException(SR.Get("StartNodeMustBeFixedPageProxy"), "startNode"); } ContentLocatorPart contentLocatorPart = new ContentLocatorPart(FixedTextSelectionProcessor.FixedTextElementName); if (fixedPageProxy.Segments.Count == 0) { contentLocatorPart.NameValuePairs.Add("Count", 1.ToString(NumberFormatInfo.InvariantInfo)); contentLocatorPart.NameValuePairs.Add("Segment" + 0.ToString(NumberFormatInfo.InvariantInfo), ",,,"); } else { contentLocatorPart.NameValuePairs.Add("Count", fixedPageProxy.Segments.Count.ToString(NumberFormatInfo.InvariantInfo)); for (int i = 0; i < fixedPageProxy.Segments.Count; i++) { string text = ""; if (!double.IsNaN(fixedPageProxy.Segments[i].Start.X)) { text = text + fixedPageProxy.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0].ToString() + fixedPageProxy.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo); } else { text += TextSelectionProcessor.Separator[0].ToString(); } text += TextSelectionProcessor.Separator[0].ToString(); if (!double.IsNaN(fixedPageProxy.Segments[i].End.X)) { text = text + fixedPageProxy.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0].ToString() + fixedPageProxy.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo); } else { text += TextSelectionProcessor.Separator[0].ToString(); } contentLocatorPart.NameValuePairs.Add("Segment" + i.ToString(NumberFormatInfo.InvariantInfo), text); } } return(new List <ContentLocatorPart>(1) { contentLocatorPart }); }
/// <summary> /// Generates locators identifying 'chunks'. If node is a chunk, /// generates a locator with a single locator part containing a /// fingerprint of the chunk. Otherwise null is returned. /// </summary> /// <param name="node">the node to generate a locator for</param> /// <param name="continueGenerating">return flag indicating whether the search /// should continue (presumably because the search was not exhaustive). /// This processor will always return true because it is possible to locate /// parts of the node (if it is FixedPage or FixedPageProxy)</param> /// <returns>if node is a FixedPage or FixedPageProxy, a ContentLocator /// with a single locator part containing the page number; null if node is not /// FixedPage or FixedPageProxy </returns> /// <exception cref="ArgumentNullException">node is null</exception> /// <exception cref="ArgumentException">node points to a Document Page View which /// doesn't contain a FixedDocumentPage</exception> public override ContentLocator GenerateLocator(PathNode node, out bool continueGenerating) { if (node == null) { throw new ArgumentNullException("node"); } // Initial value continueGenerating = true; ContentLocator locator = null; DocumentPageView dpv = node.Node as DocumentPageView; int pageNb = -1; if (dpv != null) { // Only produce locator parts for FixedDocumentPages if (dpv.DocumentPage is FixedDocumentPage || dpv.DocumentPage is FixedDocumentSequenceDocumentPage) { pageNb = dpv.PageNumber; } } else { FixedTextSelectionProcessor.FixedPageProxy fPage = node.Node as FixedTextSelectionProcessor.FixedPageProxy; if (fPage != null) { pageNb = fPage.Page; } } if (pageNb >= 0) { locator = new ContentLocator(); ContentLocatorPart locatorPart = CreateLocatorPart(pageNb); locator.Parts.Add(locatorPart); } return(locator); }