Exemplo n.º 1
0
 public void SelektionOptimieren()
 {
     if (this._startPos.AktNode == null)
     {
         return;
     }
     if (this._startPos.AktNode == this._endPos.AktNode)
     {
         if (this._startPos.PosAmNode > this._endPos.PosAmNode)
         {
             XMLCursorPositionen posAmNode = this._startPos.PosAmNode;
             int posImTextnode             = this._startPos.PosImTextnode;
             this._startPos.CursorSetzen(this._endPos.AktNode, this._endPos.PosAmNode, this._endPos.PosImTextnode);
             this._endPos.CursorSetzen(this._endPos.AktNode, posAmNode, posImTextnode);
         }
         else if (this._startPos.PosAmNode == XMLCursorPositionen.CursorInnerhalbDesTextNodes && this._endPos.PosAmNode == XMLCursorPositionen.CursorInnerhalbDesTextNodes && this._startPos.PosImTextnode > this._endPos.PosImTextnode)
         {
             int posImTextnode = this._startPos.PosImTextnode;
             this._startPos.CursorSetzen(this._startPos.AktNode, XMLCursorPositionen.CursorInnerhalbDesTextNodes, this._endPos.PosImTextnode);
             this._endPos.CursorSetzen(this._startPos.AktNode, XMLCursorPositionen.CursorInnerhalbDesTextNodes, posImTextnode);
         }
     }
     else
     {
         if (ToolboxXML.Node1LiegtVorNode2(this._endPos.AktNode, this._startPos.AktNode))
         {
             XMLCursorPos startPos = this._startPos;
             this._startPos = this._endPos;
             this._endPos   = startPos;
         }
         if (ToolboxXML.IstChild(this._endPos.AktNode, this._startPos.AktNode))
         {
             this.BeideCursorPosSetzen(this._startPos.AktNode, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
         }
         if (this._startPos.AktNode.ParentNode != this._endPos.AktNode.ParentNode)
         {
             XmlNode xmlNode  = this.TiefsterGemeinsamerParent(this._startPos.AktNode, this._endPos.AktNode);
             XmlNode aktNode1 = this._startPos.AktNode;
             while (aktNode1.ParentNode != xmlNode)
             {
                 aktNode1 = aktNode1.ParentNode;
             }
             XmlNode aktNode2 = this._endPos.AktNode;
             while (aktNode2.ParentNode != xmlNode)
             {
                 aktNode2 = aktNode2.ParentNode;
             }
             this._startPos.CursorSetzen(aktNode1, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
             this._endPos.CursorSetzen(aktNode2, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
         }
     }
 }
Exemplo n.º 2
0
        private void OwnerDocument_NodeChanged(object sender, XmlNodeChangedEventArgs e)
        {
            if (e.Node == this._node)
            {
                this.BufferLeeren();
            }
            else
            {
                switch (e.Action)
                {
                case XmlNodeChangedAction.Insert:
                    if (e.NewParent == this._node)
                    {
                        this.BufferLeeren();
                        break;
                    }
                    if (ToolboxXML.IstChild(e.NewParent, this._node))
                    {
                        this.BufferLeeren();
                    }
                    break;

                case XmlNodeChangedAction.Remove:
                    if (e.OldParent == this._node)
                    {
                        this.BufferLeeren();
                        break;
                    }
                    if (ToolboxXML.IstChild(e.OldParent, this._node))
                    {
                        this.BufferLeeren();
                    }
                    break;

                case XmlNodeChangedAction.Change:
                    if (ToolboxXML.IstChild(e.Node, this._node))
                    {
                        this.BufferLeeren();
                        break;
                    }
                    break;
                }
            }
        }