Example #1
0
        // Token: 0x06003D45 RID: 15685 RVA: 0x0011BF5C File Offset: 0x0011A15C
        internal DependencyObject GetLogicalTreeNode()
        {
            TextTreeObjectNode textTreeObjectNode = this as TextTreeObjectNode;

            if (textTreeObjectNode != null && textTreeObjectNode.EmbeddedElement is FrameworkElement)
            {
                return(textTreeObjectNode.EmbeddedElement);
            }
            SplayTreeNode           splayTreeNode = this;
            TextTreeTextElementNode textTreeTextElementNode;

            for (;;)
            {
                textTreeTextElementNode = (splayTreeNode as TextTreeTextElementNode);
                if (textTreeTextElementNode != null)
                {
                    break;
                }
                SplayTreeNode containingNode = splayTreeNode.GetContainingNode();
                if (containingNode == null)
                {
                    goto Block_4;
                }
                splayTreeNode = containingNode;
            }
            return(textTreeTextElementNode.TextElement);

Block_4:
            return(((TextTreeRootNode)splayTreeNode).TextContainer.Parent);
        }
        /// <summary>
        /// Copies an embedded UIElement into a ContentContainer.
        /// Returns the next node to examine.
        /// </summary>
        private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out ContentContainer container)
        {
            string xml = XamlWriter.Save(objectNode.EmbeddedElement);

            container = new ObjectContentContainer(xml, objectNode.EmbeddedElement);

            return((TextTreeNode)objectNode.GetNextNode());
        }
Example #3
0
        //------------------------------------------------------
        // 
        //  Internal Methods 
        //
        //------------------------------------------------------ 

        #region Internal Methods

        // Returns a shallow copy of this node. 
        internal override TextTreeNode Clone()
        { 
            TextTreeObjectNode clone; 

            clone = new TextTreeObjectNode(_embeddedElement); 

            return clone;
        }
Example #4
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Returns a shallow copy of this node.
        internal override TextTreeNode Clone()
        {
            TextTreeObjectNode clone;

            clone = new TextTreeObjectNode(_embeddedElement);

            return(clone);
        }
 private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out TextTreeDeleteContentUndoUnit.ContentContainer container)
 {
     if (SecurityHelper.CheckUnmanagedCodePermission())
     {
         string xml = XamlWriter.Save(objectNode.EmbeddedElement);
         container = new TextTreeDeleteContentUndoUnit.ObjectContentContainer(xml, objectNode.EmbeddedElement);
     }
     else
     {
         container = new TextTreeDeleteContentUndoUnit.ObjectContentContainer(null, null);
     }
     return((TextTreeNode)objectNode.GetNextNode());
 }
        /// <summary>
        /// Copies an embedded UIElement into a ContentContainer.
        /// Returns the next node to examine.
        /// </summary>
        private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out ContentContainer container)
        {
            // XamlWriter.Save demands unmanaged code permission. Since it's not safe to assert
            // here as custom type converters and value serializers can potentially execute
            // arbitrary code, we block the call to XamlWriter.Save in partial trust.
            if (SecurityHelper.CheckUnmanagedCodePermission())
            {
                string xml;

                xml = XamlWriter.Save(objectNode.EmbeddedElement);

                container = new ObjectContentContainer(xml, objectNode.EmbeddedElement);
            }
            else
            {
                container = new ObjectContentContainer(null, null);
            }

            return((TextTreeNode)objectNode.GetNextNode());
        }
 // Token: 0x06003D12 RID: 15634 RVA: 0x0011BA44 File Offset: 0x00119C44
 private TextTreeDeleteContentUndoUnit.ContentContainer CopyContent(TextTreeNode node, TextTreeNode haltNode)
 {
     TextTreeDeleteContentUndoUnit.ContentContainer result           = null;
     TextTreeDeleteContentUndoUnit.ContentContainer contentContainer = null;
     while (node != haltNode && node != null)
     {
         TextTreeTextNode textTreeTextNode = node as TextTreeTextNode;
         TextTreeDeleteContentUndoUnit.ContentContainer contentContainer2;
         if (textTreeTextNode != null)
         {
             node = this.CopyTextNode(textTreeTextNode, haltNode, out contentContainer2);
         }
         else
         {
             TextTreeObjectNode textTreeObjectNode = node as TextTreeObjectNode;
             if (textTreeObjectNode != null)
             {
                 node = this.CopyObjectNode(textTreeObjectNode, out contentContainer2);
             }
             else
             {
                 Invariant.Assert(node is TextTreeTextElementNode, "Unexpected TextTreeNode type!");
                 TextTreeTextElementNode elementNode = (TextTreeTextElementNode)node;
                 node = this.CopyElementNode(elementNode, out contentContainer2);
             }
         }
         if (contentContainer == null)
         {
             result = contentContainer2;
         }
         else
         {
             contentContainer.NextContainer = contentContainer2;
         }
         contentContainer = contentContainer2;
     }
     return(result);
 }
        private TextTreeNode CopyObjectNode(TextTreeObjectNode objectNode, out ContentContainer container)
        {
            // XamlWriter.Save demands unmanaged code permission. Since it's not safe to assert 
            // here as custom type converters and value serializers can potentially execute 
            // arbitrary code, we block the call to XamlWriter.Save in partial trust.
            if (SecurityHelper.CheckUnmanagedCodePermission())
            {
                string xml;

                xml = XamlWriter.Save(objectNode.EmbeddedElement);

                container = new ObjectContentContainer(xml, objectNode.EmbeddedElement);
            }
            else
            {
                container = new ObjectContentContainer(null, null);
            }

            return (TextTreeNode)objectNode.GetNextNode();
        }
Example #9
0
        // InsertEmbeddedObject worker.  Adds a UIElement to the tree. 
        internal void InsertEmbeddedObjectInternal(TextPointer position, DependencyObject embeddedObject) 
        {
            TextTreeNode objectNode; 
            int symbolOffset;
            DependencyObject parentLogicalNode;
            TextPointer insertPosition;
 
            Invariant.Assert(!this.PlainTextOnly);
 
            DemandCreateText(); 

            position.SyncToTreeGeneration(); 

            BeforeAddChange();

            parentLogicalNode = position.GetLogicalTreeNode(); 

            // Insert a node. 
            objectNode = new TextTreeObjectNode(embeddedObject); 
            objectNode.InsertAtPosition(position);
 
            // Update the symbol count.
            UpdateContainerSymbolCount(objectNode.GetContainingNode(), objectNode.SymbolCount, objectNode.IMECharCount);

            // Insert the corresponding text. 
            symbolOffset = objectNode.GetSymbolOffset(this.Generation);
            TextTreeText.InsertObject(_rootNode.RootTextBlock, symbolOffset); 
 
            NextGeneration(false /* deletedContent */);
 
            // Handle undo.
            TextTreeUndo.CreateInsertUndoUnit(this, symbolOffset, 1);

            // Tell parent to update Logical Tree 
            LogicalTreeHelper.AddLogicalChild(parentLogicalNode, embeddedObject);
 
            // Raise the public event. 
            // During document load we won't have listeners and we can save
            // an allocation on every insert.  This can easily save 1000's of allocations during boot. 
            if (this.HasListeners)
            {
                insertPosition = new TextPointer(this, objectNode, ElementEdge.BeforeStart);
                AddChange(insertPosition, 1, 1, PrecursorTextChangeType.ContentAdded); 
            }
        }