Example #1
0
        private void ConstructSomElement(NamedElement ne)
        {
            NameHashFixedNode fen;
            if (_nameHashTable.TryGetValue(ne.NameReference, out fen) == true)
            {
                if (fen.uiElement is Glyphs || fen.uiElement is Path ||
                    fen.uiElement is Image)
                {
                    // Elements that can't have childrent
                    AddFixedNodeInFlow(fen.index, fen.uiElement);
                }
                else
                {
                    if (fen.uiElement is Canvas)
                    {
                        // We need to find all the fixed nodes inside the scope of 
                        // this grouping element, add all of them in the arraylist.
                        int[] childIndex = _fixedPage._CreateChildIndex(fen.uiElement);

                        AddChildofFixedNodeinFlow(childIndex, ne);
                    }
                }
            }
        }
Example #2
0
        private void AddChildofFixedNodeinFlow(int[] childIndex, NamedElement ne)
        {
            // Create a fake FixedNode to help binary search.
            FixedNode fn = FixedNode.Create(((FixedNode)_fixedNodes[0]).Page, childIndex);
            // Launch the binary search to find the matching FixedNode 
            int index = _fixedNodes.BinarySearch(fn);

            if (index >= 0)
            {
                int startIndex;
                // Search backward for the first Node in this scope
                for (startIndex = index - 1; startIndex >= 0; startIndex--)
                {
                    fn = (FixedNode)_fixedNodes[startIndex];
                    if (fn.ComparetoIndex(childIndex) != 0)
                    {
                        break;
                    }
                }

                // Search forward to add all the nodes in order.
                for (int i = startIndex+1; i < _fixedNodes.Count; i++)
                {
                    fn = (FixedNode)_fixedNodes[i];
                    if (fn.ComparetoIndex(childIndex) == 0)
                    {
                        AddFixedNodeInFlow(i, null);
                    }
                    else break;
                }

            }
        }