// Token: 0x06007C49 RID: 31817 RVA: 0x0022F5F8 File Offset: 0x0022D7F8
        internal static void GetMaxMinLocatorPartValues(ContentLocatorPart locatorPart, out int startOffset, out int endOffset)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }
            string text = locatorPart.NameValuePairs["Count"];

            if (text == null)
            {
                throw new ArgumentException(SR.Get("InvalidLocatorPart", new object[]
                {
                    "Count"
                }));
            }
            int num = int.Parse(text, NumberFormatInfo.InvariantInfo);

            startOffset = int.MaxValue;
            endOffset   = 0;
            for (int i = 0; i < num; i++)
            {
                int num2;
                int num3;
                TextSelectionProcessor.GetLocatorPartSegmentValues(locatorPart, i, out num2, out num3);
                if (num2 < startOffset)
                {
                    startOffset = num2;
                }
                if (num3 > endOffset)
                {
                    endOffset = num3;
                }
            }
        }
Example #2
0
        // 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);
        }
        /// <summary>
        ///     Extracts the values of attributes from a locator part.
        /// </summary>
        /// <param name="locatorPart">the locator part to extract values from</param>
        /// <param name="segmentNumber">number of segment value to retrieve</param>
        /// <param name="start">the start point value based on StartXAttribute and StartYAttribute values</param>
        /// <param name="end">the end point value based on EndXAttribyte and EndYattribute values</param>
        private void GetLocatorPartSegmentValues(ContentLocatorPart locatorPart, int segmentNumber, out Point start, out Point end)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            if (FixedTextElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }

            string segmentValue = locatorPart.NameValuePairs[TextSelectionProcessor.SegmentAttribute + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)];

            if (segmentValue == null)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, TextSelectionProcessor.SegmentAttribute + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)));
            }

            string[] values = segmentValue.Split(TextSelectionProcessor.Separator);
            if (values.Length != 4)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, TextSelectionProcessor.SegmentAttribute + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)));
            }
            start = GetPoint(values[0], values[1]);
            end   = GetPoint(values[2], values[3]);
        }
Example #4
0
        // Token: 0x06007C12 RID: 31762 RVA: 0x0022E560 File Offset: 0x0022C760
        private bool ResolveLocatorPart(DependencyObject dependencyObject, LocatorManager.ResolvingLocatorState data, bool visitedViaVisualTree)
        {
            if (data.Finished)
            {
                return(false);
            }
            ContentLocator     contentLocatorBase = data.ContentLocatorBase;
            bool               result             = true;
            ContentLocatorPart contentLocatorPart = contentLocatorBase.Parts[data.LocatorPartIndex];

            if (contentLocatorPart == null)
            {
                result = false;
            }
            SubTreeProcessor subTreeProcessorForLocatorPart = this.GetSubTreeProcessorForLocatorPart(contentLocatorPart);

            if (subTreeProcessorForLocatorPart == null)
            {
                result = false;
            }
            if (contentLocatorPart != null && subTreeProcessorForLocatorPart != null)
            {
                DependencyObject dependencyObject2 = subTreeProcessorForLocatorPart.ResolveLocatorPart(contentLocatorPart, dependencyObject, out result);
                if (dependencyObject2 != null)
                {
                    data.AttachmentLevel = AttachmentLevel.Incomplete;
                    data.AttachedAnchor  = dependencyObject2;
                    result = true;
                    data.LastNodeMatched = dependencyObject2;
                    data.LocatorPartIndex++;
                    if (data.LocatorPartIndex == contentLocatorBase.Parts.Count)
                    {
                        data.AttachmentLevel = AttachmentLevel.Full;
                        data.AttachedAnchor  = dependencyObject2;
                        result = false;
                    }
                    else if (data.LocatorPartIndex == contentLocatorBase.Parts.Count - 1)
                    {
                        contentLocatorPart = contentLocatorBase.Parts[data.LocatorPartIndex];
                        SelectionProcessor selectionProcessorForLocatorPart = this.GetSelectionProcessorForLocatorPart(contentLocatorPart);
                        if (selectionProcessorForLocatorPart != null)
                        {
                            AttachmentLevel attachmentLevel;
                            object          obj = selectionProcessorForLocatorPart.ResolveLocatorPart(contentLocatorPart, dependencyObject2, out attachmentLevel);
                            if (obj != null)
                            {
                                data.AttachmentLevel = attachmentLevel;
                                data.AttachedAnchor  = obj;
                                result = false;
                            }
                            else
                            {
                                result = false;
                            }
                        }
                    }
                }
            }
            return(result);
        }
        // Token: 0x06007BD8 RID: 31704 RVA: 0x0022D05C File Offset: 0x0022B25C
        private void GetLocatorPartSegmentValues(ContentLocatorPart locatorPart, int segmentNumber, out Point start, out Point end)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }
            if (FixedTextSelectionProcessor.FixedTextElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get("IncorrectLocatorPartType", new object[]
                {
                    locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name
                }), "locatorPart");
            }
            string text = locatorPart.NameValuePairs["Segment" + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)];

            if (text == null)
            {
                throw new ArgumentException(SR.Get("InvalidLocatorPart", new object[]
                {
                    "Segment" + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)
                }));
            }
            string[] array = text.Split(TextSelectionProcessor.Separator);
            if (array.Length != 4)
            {
                throw new ArgumentException(SR.Get("InvalidLocatorPart", new object[]
                {
                    "Segment" + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)
                }));
            }
            start = this.GetPoint(array[0], array[1]);
            end   = this.GetPoint(array[2], array[3]);
        }
Example #6
0
 // Token: 0x06007C00 RID: 31744 RVA: 0x0022DA6C File Offset: 0x0022BC6C
 public SubTreeProcessor GetSubTreeProcessorForLocatorPart(ContentLocatorPart locatorPart)
 {
     base.VerifyAccess();
     if (locatorPart == null)
     {
         throw new ArgumentNullException("locatorPart");
     }
     return(this._locatorPartHandlers[locatorPart.PartType] as SubTreeProcessor);
 }
Example #7
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        /// <summary>
        ///     Creates an instance of the locator part type handled by this
        ///     handler that represents node.
        /// </summary>
        /// <param name="page">FixedPage for which a locator part will be created</param>
        /// <returns>
        ///     a locator part of the type handled by this handler representing
        ///     the passed in node; null is returned if the locator part cannot
        ///     be created for the node
        /// </returns>
        static internal ContentLocatorPart CreateLocatorPart(int page)
        {
            Debug.Assert(page >= 0, "page can not be negative");

            ContentLocatorPart part = new ContentLocatorPart(PageNumberElementName);

            part.NameValuePairs.Add(ValueAttributeName, page.ToString(NumberFormatInfo.InvariantInfo));
            return(part);
        }
Example #8
0
        // -------------------------- GoToMark_Click --------------------------
        void GoToMark_Click(object sender, RoutedEventArgs e)
        {
            Annotation ann = null;

            if (sender is Button)
            {
                ann = ((Button)sender).Tag as Annotation;
            }
            else if (sender is MenuItem)
            {
                ann = ((MenuItem)sender).Tag as Annotation;
            }
            if (ann == null)
            {
                return;
            }

            ContentLocator cloc =
                ann.Anchors[0].ContentLocators[0] as ContentLocator;

            if (cloc == null)
            {
                return;
            }
            if (cloc.Parts.Count < 2)
            {
                return;
            }

            ContentLocatorPart cPart = cloc.Parts[1];

            if (cPart == null)
            {
                return;
            }
            if (cPart.NameValuePairs["Segment0"] != null)
            {
                string[]     charPos = cPart.NameValuePairs["Segment0"].Split(',');
                FlowDocument fd      = FDPV.Document as FlowDocument;
                TextPointer  tp      = fd.ContentStart.GetPositionAtOffset(
                    int.Parse(charPos[0]), LogicalDirection.Forward);
                if (tp == null)
                {
                    return;
                }

                FrameworkContentElement fce = tp.Parent as FrameworkContentElement;
                if (fce == null)
                {
                    return;
                }

                fce.BringIntoView();
            }
        }
        // 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>
        ///     Creates a selection object spanning the portion of 'startNode' 
        ///     specified by 'locatorPart'.
        /// </summary>
        /// <param name="locatorPart">locator part specifying data to be spanned</param>
        /// <param name="startNode">the node to be spanned by the created 
        /// selection</param>
        /// <param name="attachmentLevel">always set to AttachmentLevel.Full</param>
        /// <returns>a selection spanning the portion of 'startNode' specified by     
        /// 'locatorPart'</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are 
        /// null</exception>
        /// <exception cref="ArgumentException">locatorPart is of the incorrect type</exception>
        public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel)
        {
            if (startNode == null)
                throw new ArgumentNullException(nameof(startNode));

            if (locatorPart == null)
                throw new ArgumentNullException(nameof(locatorPart));

            attachmentLevel = AttachmentLevel.Full;

            return startNode;
        }
 // Token: 0x06007C56 RID: 31830 RVA: 0x0022F999 File Offset: 0x0022DB99
 public override object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel)
 {
     if (locatorPart == null)
     {
         throw new ArgumentNullException("locatorPart");
     }
     if (startNode == null)
     {
         throw new ArgumentNullException("startNode");
     }
     attachmentLevel = AttachmentLevel.Unresolved;
     return(null);
 }
        // Token: 0x06007C45 RID: 31813 RVA: 0x0022F240 File Offset: 0x0022D440
        public override IList <ContentLocatorPart> GenerateLocatorParts(object selection, DependencyObject startNode)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }
            if (selection == null)
            {
                throw new ArgumentNullException("selection");
            }
            IList <TextSegment> list = null;
            ITextPointer        textPointer;
            ITextPointer        position;

            TextSelectionHelper.CheckSelection(selection, out textPointer, out position, out list);
            if (!(textPointer is TextPointer))
            {
                throw new ArgumentException(SR.Get("WrongSelectionType"), "selection");
            }
            ITextPointer textPointer2;
            ITextPointer textPointer3;

            if (!this.GetNodesStartAndEnd(startNode, out textPointer2, out textPointer3))
            {
                return(null);
            }
            if (textPointer2.CompareTo(position) > 0)
            {
                throw new ArgumentException(SR.Get("InvalidStartNodeForTextSelection"), "startNode");
            }
            if (textPointer3.CompareTo(textPointer) < 0)
            {
                throw new ArgumentException(SR.Get("InvalidStartNodeForTextSelection"), "startNode");
            }
            ContentLocatorPart contentLocatorPart = new ContentLocatorPart(TextSelectionProcessor.CharacterRangeElementName);
            int num  = 0;
            int num2 = 0;

            for (int i = 0; i < list.Count; i++)
            {
                this.GetTextSegmentValues(list[i], textPointer2, textPointer3, out num, out num2);
                contentLocatorPart.NameValuePairs.Add("Segment" + i.ToString(NumberFormatInfo.InvariantInfo), num.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0].ToString() + num2.ToString(NumberFormatInfo.InvariantInfo));
            }
            contentLocatorPart.NameValuePairs.Add("Count", list.Count.ToString(NumberFormatInfo.InvariantInfo));
            return(new List <ContentLocatorPart>(1)
            {
                contentLocatorPart
            });
        }
Example #13
0
        /// <summary>
        ///     Searches the logical tree for a node matching the values of
        ///     locatorPart.  The search begins with startNode.
        /// </summary>
        /// <param name="locatorPart">locator part to be matched, must be of the type
        /// handled by this processor</param>
        /// <param name="startNode">logical tree node to start search at</param>
        /// <param name="continueResolving">return flag indicating whether the search
        /// should continue (presumably because the search was not exhaustive)</param>
        /// <returns>returns a node that matches the locator part; null if no such
        /// node is found</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are
        /// null</exception>
        /// <exception cref="ArgumentException">locatorPart is of the incorrect
        /// type</exception>
        public override DependencyObject ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out bool continueResolving)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            if (DataIdElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }

            // Initial value
            continueResolving = true;

            // Get the values from the locator part...
            string id = locatorPart.NameValuePairs[ValueAttributeName];

            if (id == null)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }

            // and from the node to examine.
            string nodeId = GetNodeId(startNode);

            if (nodeId != null)
            {
                if (nodeId.Equals(id))
                {
                    return(startNode);
                }
                else
                {
                    // If there was a value and it didn't match,
                    // we shouldn't bother checking the subtree
                    continueResolving = false;
                }
            }

            return(null);
        }
Example #14
0
        /// <summary>
        ///     This processor doesn't resolve ContentLocatorParts.  It simply returns null.
        /// </summary>
        /// <param name="locatorPart">locator part specifying data to be spanned</param>
        /// <param name="startNode">the node to be spanned by the created
        /// selection</param>
        /// <param name="attachmentLevel">always set to AttachmentLevel.Unresolved</param>
        /// <returns>always returns null; this processor does not resolve ContentLocatorParts</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are null</exception>
        public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            attachmentLevel = AttachmentLevel.Unresolved;

            // ContentLocator Parts generated by this selection processor cannot be resolved
            return(null);
        }
Example #15
0
        /// <summary>
        ///     Creates a DataId locator part for node.
        /// </summary>
        /// <param name="node">logical tree node for which a locator part will be created</param>
        /// <returns>a DataId locator part for node, or null if node has no
        /// value for the DataIdProperty</returns>
        /// <exception cref="ArgumentNullException">node is null</exception>
        private ContentLocatorPart CreateLocatorPart(DependencyObject node)
        {
            Debug.Assert(node != null, "DependencyObject can not be null");

            // Get values from the node
            string nodeId = GetNodeId(node);

            if ((nodeId == null) || (nodeId.Length == 0))
            {
                return(null);
            }

            ContentLocatorPart part = new ContentLocatorPart(DataIdElementName);

            part.NameValuePairs.Add(ValueAttributeName, nodeId);
            return(part);
        }
        // Token: 0x06007BF0 RID: 31728 RVA: 0x0022D58C File Offset: 0x0022B78C
        public override ContentLocator GenerateLocator(PathNode node, out bool continueGenerating)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            continueGenerating = true;
            ContentLocator     contentLocator     = null;
            ContentLocatorPart contentLocatorPart = this.CreateLocatorPart(node.Node);

            if (contentLocatorPart != null)
            {
                contentLocator = new ContentLocator();
                contentLocator.Parts.Add(contentLocatorPart);
            }
            return(contentLocator);
        }
Example #17
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        /// <summary>
        ///     Extracts the values of attributes from a locator part.
        /// </summary>
        /// <param name="locatorPart">the locator part to extract values from</param>
        /// <param name="segmentNumber">the number of the segment to extract values for</param>
        /// <param name="startOffset">value of offset attribute</param>
        /// <param name="endOffset">value of length attribute</param>
        private static void GetLocatorPartSegmentValues(ContentLocatorPart locatorPart, int segmentNumber, out int startOffset, out int endOffset)
        {
            if (segmentNumber < 0)
            {
                throw new ArgumentException("segmentNumber");
            }

            string segmentString = locatorPart.NameValuePairs[SegmentAttribute + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)];

            string[] values = segmentString.Split(Separator);
            if (values.Length != 2)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, SegmentAttribute + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)));
            }

            startOffset = Int32.Parse(values[0], NumberFormatInfo.InvariantInfo);
            endOffset   = Int32.Parse(values[1], NumberFormatInfo.InvariantInfo);
        }
        // Token: 0x06007C4B RID: 31819 RVA: 0x0022F690 File Offset: 0x0022D890
        private static void GetLocatorPartSegmentValues(ContentLocatorPart locatorPart, int segmentNumber, out int startOffset, out int endOffset)
        {
            if (segmentNumber < 0)
            {
                throw new ArgumentException("segmentNumber");
            }
            string text = locatorPart.NameValuePairs["Segment" + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)];

            string[] array = text.Split(TextSelectionProcessor.Separator);
            if (array.Length != 2)
            {
                throw new ArgumentException(SR.Get("InvalidLocatorPart", new object[]
                {
                    "Segment" + segmentNumber.ToString(NumberFormatInfo.InvariantInfo)
                }));
            }
            startOffset = int.Parse(array[0], NumberFormatInfo.InvariantInfo);
            endOffset   = int.Parse(array[1], NumberFormatInfo.InvariantInfo);
        }
Example #19
0
        /// <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);
        }
        // Token: 0x06007BF1 RID: 31729 RVA: 0x0022D5D0 File Offset: 0x0022B7D0
        public override DependencyObject ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out bool continueResolving)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }
            if (DataIdProcessor.DataIdElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get("IncorrectLocatorPartType", new object[]
                {
                    locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name
                }), "locatorPart");
            }
            continueResolving = true;
            string text = locatorPart.NameValuePairs["Value"];

            if (text == null)
            {
                throw new ArgumentException(SR.Get("IncorrectLocatorPartType", new object[]
                {
                    locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name
                }), "locatorPart");
            }
            string nodeId = this.GetNodeId(startNode);

            if (nodeId != null)
            {
                if (nodeId.Equals(text))
                {
                    return(startNode);
                }
                continueResolving = false;
            }
            return(null);
        }
Example #21
0
        GenerateLocatorParts(Object selection, DependencyObject startNode)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            List <ContentLocatorPart> res = null;

            ITextView textView = VerifySelection(selection);

            res = new List <ContentLocatorPart>(1);

            int startOffset;
            int endOffset;

            if (textView != null && textView.IsValid)
            {
                GetTextViewTextRange(textView, out startOffset, out endOffset);
            }
            else
            {
                // This causes no content to be loaded
                startOffset = -1;
                endOffset   = -1;
            }

            ContentLocatorPart part = new ContentLocatorPart(TextSelectionProcessor.CharacterRangeElementName);// DocumentPageViewLocatorPart();

            part.NameValuePairs.Add(TextSelectionProcessor.CountAttribute, 1.ToString(NumberFormatInfo.InvariantInfo));
            part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + 0.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + endOffset.ToString(NumberFormatInfo.InvariantInfo));
            part.NameValuePairs.Add(TextSelectionProcessor.IncludeOverlaps, Boolean.TrueString);

            res.Add(part);

            return(res);
        }
Example #22
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        /// <summary>
        /// Gets the smallest offset and the largest offset from all the segments defined in the locator part.
        /// </summary>
        internal static void GetMaxMinLocatorPartValues(ContentLocatorPart locatorPart, out int startOffset, out int endOffset)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            string stringCount = locatorPart.NameValuePairs[CountAttribute];

            if (stringCount == null)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, TextSelectionProcessor.CountAttribute));
            }
            int count = Int32.Parse(stringCount, NumberFormatInfo.InvariantInfo);

            startOffset = Int32.MaxValue;
            endOffset   = 0;

            int segStart;
            int segEnd;

            for (int i = 0; i < count; i++)
            {
                GetLocatorPartSegmentValues(locatorPart, i, out segStart, out segEnd);

                if (segStart < startOffset)
                {
                    startOffset = segStart;
                }

                if (segEnd > endOffset)
                {
                    endOffset = segEnd;
                }
            }
        }
        /// <summary>
        ///     Creates a TextRange object spanning the portion of 'startNode'
        ///     specified by 'locatorPart'.
        /// </summary>
        /// <param name="locatorPart">FixedTextRange locator part specifying start and end point of
        /// the TextRange</param>
        /// <param name="startNode">the FixedPage containing this locator part</param>
        /// <param name="attachmentLevel">set to AttachmentLevel.Full if the FixedPage for the locator
        /// part was found, AttachmentLevel.Unresolved otherwise</param>
        /// <returns>a TextRange spanning the text between start end end point in the FixedTextRange
        /// locator part
        /// , null if selection described by locator part could not be
        /// recreated</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are
        /// null</exception>
        /// <exception cref="ArgumentException">locatorPart is of the incorrect type</exception>
        /// <exception cref="ArgumentException">startNode is not a FixedPage</exception>
        /// <exception cref="ArgumentException">startNode does not belong to the DocumentViewer</exception>
        public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            DocumentPage docPage = null;
            FixedPage    page    = startNode as FixedPage;

            if (page != null)
            {
                docPage = GetDocumentPage(page);
            }
            else
            {
                // If we were passed a DPV because we are walking the visual tree,
                // extract the DocumentPage from it;  its TextView will be used to
                // turn coordinates into text positions
                DocumentPageView dpv = startNode as DocumentPageView;
                if (dpv != null)
                {
                    docPage = dpv.DocumentPage as FixedDocumentPage;
                    if (docPage == null)
                    {
                        docPage = dpv.DocumentPage as FixedDocumentSequenceDocumentPage;
                    }
                }
            }

            if (docPage == null)
            {
                throw new ArgumentException(SR.Get(SRID.StartNodeMustBeDocumentPageViewOrFixedPage), "startNode");
            }

            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            attachmentLevel = AttachmentLevel.Unresolved;

            ITextView tv = (ITextView)((IServiceProvider)docPage).GetService(typeof(ITextView));

            Debug.Assert(tv != null);

            ReadOnlyCollection <TextSegment> ts = tv.TextSegments;

            //check first if a TextRange can be generated
            if (ts == null || ts.Count <= 0)
            {
                return(null);
            }

            TextAnchor resolvedAnchor = new TextAnchor();

            if (docPage != null)
            {
                string stringCount = locatorPart.NameValuePairs["Count"];
                if (stringCount == null)
                {
                    throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, TextSelectionProcessor.CountAttribute));
                }
                int count = Int32.Parse(stringCount, NumberFormatInfo.InvariantInfo);

                for (int i = 0; i < count; i++)
                {
                    // First we extract the start and end Point from the locator part.
                    Point start;
                    Point end;
                    GetLocatorPartSegmentValues(locatorPart, i, out start, out end);

                    //calulate start ITextPointer
                    ITextPointer segStart;
                    if (double.IsNaN(start.X) || double.IsNaN(start.Y))
                    {
                        //get start of the page
                        segStart = FindStartVisibleTextPointer(docPage);
                    }
                    else
                    {
                        //convert Point to TextPointer
                        segStart = tv.GetTextPositionFromPoint(start, true);
                    }

                    if (segStart == null)
                    {
                        //selStart can be null if there are no insertion points on this page
                        continue;
                    }

                    //calulate end ITextPointer
                    ITextPointer segEnd;
                    if (double.IsNaN(end.X) || double.IsNaN(end.Y))
                    {
                        segEnd = FindEndVisibleTextPointer(docPage);
                    }
                    else
                    {
                        //convert Point to TextPointer
                        segEnd = tv.GetTextPositionFromPoint(end, true);
                    }

                    //end TP can not be null when start is not
                    Invariant.Assert(segEnd != null, "end TP is null when start TP is not");

                    attachmentLevel = AttachmentLevel.Full;  // Not always true right?
                    resolvedAnchor.AddTextSegment(segStart, segEnd);
                }
            }

            if (resolvedAnchor.TextSegments.Count > 0)
            {
                return(resolvedAnchor);
            }
            else
            {
                return(null);
            }
        }
        GenerateLocatorParts(Object selection, DependencyObject startNode)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            if (selection == null)
            {
                throw new ArgumentNullException("selection");
            }

            CheckSelection(selection);

            FixedPageProxy fp = startNode as FixedPageProxy;

            if (fp == null)
            {
                throw new ArgumentException(SR.Get(SRID.StartNodeMustBeFixedPageProxy), "startNode");
            }

            ContentLocatorPart part = new ContentLocatorPart(FixedTextElementName);

            if (fp.Segments.Count == 0)
            {
                part.NameValuePairs.Add(TextSelectionProcessor.CountAttribute, 1.ToString(NumberFormatInfo.InvariantInfo));
                part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + 0.ToString(NumberFormatInfo.InvariantInfo), ",,,");
            }
            else
            {
                part.NameValuePairs.Add(TextSelectionProcessor.CountAttribute, fp.Segments.Count.ToString(NumberFormatInfo.InvariantInfo));

                for (int i = 0; i < fp.Segments.Count; i++)
                {
                    string value = "";
                    if (!double.IsNaN(fp.Segments[i].Start.X))
                    {
                        value += fp.Segments[i].Start.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].Start.Y.ToString(NumberFormatInfo.InvariantInfo);
                    }
                    else
                    {
                        value += TextSelectionProcessor.Separator[0];
                    }
                    value += TextSelectionProcessor.Separator[0];
                    if (!double.IsNaN(fp.Segments[i].End.X))
                    {
                        value += fp.Segments[i].End.X.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + fp.Segments[i].End.Y.ToString(NumberFormatInfo.InvariantInfo);
                    }
                    else
                    {
                        value += TextSelectionProcessor.Separator[0];
                    }

                    part.NameValuePairs.Add(TextSelectionProcessor.SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), value);
                }
            }
            List <ContentLocatorPart> res = new List <ContentLocatorPart>(1);

            res.Add(part);
            return(res);
        }
 // Token: 0x06007C2E RID: 31790
 public abstract DependencyObject ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out bool continueResolving);
Example #26
0
        // ----------------------- AddBookmarkOrComment -----------------------
        private void AddBookmarkOrComment(ListBox collection, Annotation ann)
        {
            if (ann.Cargos.Count <= 1)
            {
                ann.Cargos.Add(
                    new AnnotationResource(FDPV.MasterPageNumber.ToString()));
            }

            Assembly a = System.Reflection.Assembly.GetExecutingAssembly();

            string path = System.IO.Path.Combine(
                a.Location.Remove(a.Location.LastIndexOf('\\')), "GoButton.xaml");

            StackPanel EntryInList =
                XamlReader.Load(File.OpenRead(path)) as StackPanel;

            EntryInList.Width = BookmarkList.Width - 10;

            Button GoToMark = LogicalTreeHelper.FindLogicalNode(
                EntryInList, "GoToMark") as Button;

            if (GoToMark != null)
            {
                GoToMark.Tag    = ann;
                GoToMark.Click += new RoutedEventHandler(GoToMark_Click);
            }

            MenuItem GoToMenu = LogicalTreeHelper.FindLogicalNode(
                GoToMark.ContextMenu, "GoToMenu") as MenuItem;

            GoToMenu.Click += new RoutedEventHandler(GoToMark_Click);
            GoToMenu.Tag    = ann;

            MenuItem DeleteMark = LogicalTreeHelper.FindLogicalNode(
                GoToMark.ContextMenu, "DeleteMark") as MenuItem;

            DeleteMark.Click += new RoutedEventHandler(DeleteMark_Click);
            DeleteMark.Tag    = ann;

            System.Windows.Shapes.Path markPath =
                LogicalTreeHelper.FindLogicalNode(EntryInList, "MarkPath")
                as System.Windows.Shapes.Path;

            if ((collection == CommentsList) && (markPath != null))
            {
                LinearGradientBrush    lBrush = new LinearGradientBrush();
                GradientStopCollection gColl  = new GradientStopCollection();
                GradientStop           gStop  = new GradientStop(Colors.LightGreen, 0);
                gColl.Add(gStop);
                lBrush.GradientStops = gColl;
                markPath.Fill        = lBrush;
            }

            collection.Items.Add(EntryInList);

            TextBlock spText =
                LogicalTreeHelper.FindLogicalNode(EntryInList, "TB") as TextBlock;

            string MarkText = "";

            if (spText != null)
            {
                ContentLocator cloc =
                    ann.Anchors[0].ContentLocators[0] as ContentLocator;
                if (cloc == null)
                {
                    return;
                }
                if (cloc.Parts.Count < 2)
                {
                    return;
                }

                ContentLocatorPart cPart = cloc.Parts[1];
                if (cPart == null)
                {
                    return;
                }
                if (cPart.NameValuePairs["Segment0"] != null)
                {
                    string[]     charPos = cPart.NameValuePairs["Segment0"].Split(',');
                    FlowDocument fd      = FDPV.Document as FlowDocument;
                    TextPointer  tp      = fd.ContentStart.GetPositionAtOffset(
                        int.Parse(charPos[0]), LogicalDirection.Forward);

                    if (tp == null)
                    {
                        return;
                    }
                    if (tp.GetPointerContext(LogicalDirection.Forward)
                        == TextPointerContext.Text)
                    {
                        MarkText += tp.GetTextInRun(LogicalDirection.Forward);
                    }
                    spText.Text = MarkText.Substring(0,
                                                     (MarkText.Length > 150) ? 150 : MarkText.Length);
                }
            }
        }// end:AddBookmarkOrComment()
Example #27
0
 // Token: 0x06007C28 RID: 31784
 public abstract object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel);
Example #28
0
        /// <summary>
        ///     Creates a selection object spanning the portion of 'startNode'
        ///     specified by 'locatorPart'.
        /// </summary>
        /// <param name="locatorPart">locator part specifying data to be spanned</param>
        /// <param name="startNode">the node to be spanned by the created
        /// selection</param>
        /// <param name="attachmentLevel">set to AttachmentLevel.Full if the entire range of text
        /// was resolved, otherwise set to StartPortion, MiddlePortion, or EndPortion based on
        /// which part of the range was resolved</param>
        /// <returns>a selection spanning the portion of 'startNode' specified by
        /// 'locatorPart', null if selection described by locator part could not be
        /// recreated</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are
        /// null</exception>
        /// <exception cref="ArgumentException">locatorPart is of the incorrect type</exception>
        public override Object ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out AttachmentLevel attachmentLevel)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            if (CharacterRangeElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }

            // First we extract the offset and length of the
            // text range from the locator part.
            int startOffset = 0;
            int endOffset   = 0;

            string stringCount = locatorPart.NameValuePairs[CountAttribute];

            if (stringCount == null)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidLocatorPart, TextSelectionProcessor.CountAttribute));
            }
            int count = Int32.Parse(stringCount, NumberFormatInfo.InvariantInfo);

            TextAnchor anchor = new TextAnchor();

            attachmentLevel = AttachmentLevel.Unresolved;

            for (int i = 0; i < count; i++)
            {
                GetLocatorPartSegmentValues(locatorPart, i, out startOffset, out endOffset);

                // Now we grab the TextRange so we can create a selection.
                // TextBox doesn't expose its internal TextRange so we use
                // its API for creating and getting the selection.
                ITextPointer elementStart;
                ITextPointer elementEnd;
                // If we can't get the start/end of the node then we can't resolve the locator part
                if (!GetNodesStartAndEnd(startNode, out elementStart, out elementEnd))
                {
                    return(null);
                }

                // If the offset is not withing the element's text range we return null
                int textRangeLength = elementStart.GetOffsetToPosition(elementEnd);
                if (startOffset > textRangeLength)
                {
                    return(null);
                }

                ITextPointer start = elementStart.CreatePointer(startOffset);// new TextPointer((TextPointer)elementStart, startOffset);

                ITextPointer end = (textRangeLength <= endOffset) ?
                                   elementEnd.CreatePointer() :           //new TextPointer((TextPointer)elementEnd) :
                                   elementStart.CreatePointer(endOffset); // new TextPointer((TextPointer)elementStart, endOffset);

                //we do not process 0 length selection
                if (start.CompareTo(end) >= 0)
                {
                    return(null);
                }

                anchor.AddTextSegment(start, end);
            }

            //we do not support 0 or negative length selection
            if (anchor.IsEmpty)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectAnchorLength), "locatorPart");
            }

            attachmentLevel = AttachmentLevel.Full;

            if (_clamping)
            {
                ITextPointer     currentStart    = anchor.Start;
                ITextPointer     currentEnd      = anchor.End;
                IServiceProvider serviceProvider = null;
                ITextView        textView        = null;

                if (_targetPage != null)
                {
                    serviceProvider = _targetPage as IServiceProvider;
                }
                else
                {
                    FlowDocument content = currentStart.TextContainer.Parent as FlowDocument;
                    serviceProvider = PathNode.GetParent(content as DependencyObject) as IServiceProvider;
                }

                Invariant.Assert(serviceProvider != null, "No ServiceProvider found to get TextView from.");
                textView = serviceProvider.GetService(typeof(ITextView)) as ITextView;
                Invariant.Assert(textView != null, "Null TextView provided by ServiceProvider.");

                anchor = TextAnchor.TrimToIntersectionWith(anchor, textView.TextSegments);

                if (anchor == null)
                {
                    attachmentLevel = AttachmentLevel.Unresolved;
                }
                else
                {
                    if (anchor.Start.CompareTo(currentStart) != 0)
                    {
                        attachmentLevel &= ~AttachmentLevel.StartPortion;
                    }
                    if (anchor.End.CompareTo(currentEnd) != 0)
                    {
                        attachmentLevel &= ~AttachmentLevel.EndPortion;
                    }
                }
            }

            return(anchor);
        }
Example #29
0
        GenerateLocatorParts(Object selection, DependencyObject startNode)
        {
            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            if (selection == null)
            {
                throw new ArgumentNullException("selection");
            }

            ITextPointer        start;
            ITextPointer        end;
            IList <TextSegment> textSegments = null;

            TextSelectionHelper.CheckSelection(selection, out start, out end, out textSegments);
            if (!(start is TextPointer))
            {
                throw new ArgumentException(SR.Get(SRID.WrongSelectionType), "selection");
            }

            ITextPointer elementStart;
            ITextPointer elementEnd;

            // If we can't get the start/end of the node then we can't generate a locator part
            if (!GetNodesStartAndEnd(startNode, out elementStart, out elementEnd))
            {
                return(null);
            }

            if (elementStart.CompareTo(end) > 0)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStartNodeForTextSelection), "startNode");
            }

            if (elementEnd.CompareTo(start) < 0)
            {
                throw new ArgumentException(SR.Get(SRID.InvalidStartNodeForTextSelection), "startNode");
            }

            ContentLocatorPart part = new ContentLocatorPart(CharacterRangeElementName);

            int startOffset = 0;
            int endOffset   = 0;

            for (int i = 0; i < textSegments.Count; i++)
            {
                GetTextSegmentValues(textSegments[i], elementStart, elementEnd, out startOffset, out endOffset);

                part.NameValuePairs.Add(SegmentAttribute + i.ToString(NumberFormatInfo.InvariantInfo), startOffset.ToString(NumberFormatInfo.InvariantInfo) + TextSelectionProcessor.Separator[0] + endOffset.ToString(NumberFormatInfo.InvariantInfo));
            }

            part.NameValuePairs.Add(CountAttribute, textSegments.Count.ToString(NumberFormatInfo.InvariantInfo));

            List <ContentLocatorPart> res = new List <ContentLocatorPart>(1);

            res.Add(part);

            return(res);
        }
Example #30
0
        /// <summary>
        ///     Searches the logical tree for a node matching the values of
        ///     locatorPart.  A match must be a chunk which produces the same
        ///     fingerprint as in the locator part.
        /// </summary>
        /// <param name="locatorPart">locator part to be matched, must be of the type
        /// handled by this processor</param>
        /// <param name="startNode">logical tree node to start search at</param>
        /// <param name="continueResolving">return flag indicating whether the search
        /// should continue (presumably because the search was not exhaustive). This
        /// processor will return false if the startNode is a FixedPage
        /// with a different page number than the locator part's page number.
        /// Otherwise the return value will be true.
        /// inside the FixedPage(like TextSelection) </param>
        /// <returns>returns a node that matches the locator part; null if no such
        /// node is found</returns>
        /// <exception cref="ArgumentNullException">locatorPart or startNode are
        /// null</exception>
        /// <exception cref="ArgumentException">locatorPart is of the incorrect
        /// type</exception>
        public override DependencyObject ResolveLocatorPart(ContentLocatorPart locatorPart, DependencyObject startNode, out bool continueResolving)
        {
            if (locatorPart == null)
            {
                throw new ArgumentNullException("locatorPart");
            }

            if (startNode == null)
            {
                throw new ArgumentNullException("startNode");
            }

            if (PageNumberElementName != locatorPart.PartType)
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }

            // Initial value
            continueResolving = true;

            int    pageNumber       = 0;
            string pageNumberString = locatorPart.NameValuePairs[ValueAttributeName];

            if (pageNumberString != null)
            {
                pageNumber = Int32.Parse(pageNumberString, NumberFormatInfo.InvariantInfo);
            }
            else
            {
                throw new ArgumentException(SR.Get(SRID.IncorrectLocatorPartType, locatorPart.PartType.Namespace + ":" + locatorPart.PartType.Name), "locatorPart");
            }


            // Get the actual FixedPage for the page number specified in the LocatorPart.  We need
            // the actual FixedPage cause its what exists in the visual tree and what we'll use to
            // anchor the annotations to.
            FixedDocumentPage        page     = null;
            IDocumentPaginatorSource document = null;
            DocumentPageView         dpv      = null;

            if (_useLogicalTree)
            {
                document = startNode as FixedDocument;
                if (document != null)
                {
                    page = document.DocumentPaginator.GetPage(pageNumber) as FixedDocumentPage;
                }
                else
                {
                    document = startNode as FixedDocumentSequence;
                    if (document != null)
                    {
                        FixedDocumentSequenceDocumentPage sequencePage = document.DocumentPaginator.GetPage(pageNumber) as FixedDocumentSequenceDocumentPage;
                        if (sequencePage != null)
                        {
                            page = sequencePage.ChildDocumentPage as FixedDocumentPage;
                        }
                    }
                }
            }
            else
            {
                dpv = startNode as DocumentPageView;
                if (dpv != null)
                {
                    page = dpv.DocumentPage as FixedDocumentPage;
                    if (page == null)
                    {
                        FixedDocumentSequenceDocumentPage sequencePage = dpv.DocumentPage as FixedDocumentSequenceDocumentPage;
                        if (sequencePage != null)
                        {
                            page = sequencePage.ChildDocumentPage as FixedDocumentPage;
                        }
                    }

                    // If this was the wrong fixed page we want to stop searching this subtree
                    if (page != null && dpv.PageNumber != pageNumber)
                    {
                        continueResolving = false;
                        page = null;
                    }
                }
            }

            if (page != null)
            {
                return(page.FixedPage);
            }

            return(null);
        }