/// <summary>
        /// Replaces the selection with the content of the clipboard.
        /// </summary>
        /// <param name="isChanged">True if something was replaced or added.</param>
        public override void Paste(out bool isChanged)
        {
            isChanged = false;

            if (ClipboardHelper.TryReadNode(out Node Node))
            {
                IFocusNodeState State = StateView.State;
                if ((State.ParentInner != null && State.ParentInner.InterfaceType.IsAssignableFrom(Type.FromGetType(Node))) || (State.ParentInner == null && Type.FromGetType(Node) == Type.FromGetType(State.Node)))
                {
                    if (State.ParentIndex is IFocusBrowsingInsertableIndex AsInsertableIndex)
                    {
                        FocusController Controller = StateView.ControllerView.Controller;
                        Node            ParentNode = State.ParentInner.Owner.Node;

                        IFocusInsertionChildIndex ReplaceIndex = (IFocusInsertionChildIndex)AsInsertableIndex.ToInsertionIndex(ParentNode, Node);
                        Controller.Replace(State.ParentInner, ReplaceIndex, out IWriteableBrowsingChildIndex NewIndex);

                        isChanged = true;
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary></summary>
        protected virtual void PasteNode(Node node, out bool isChanged)
        {
            isChanged = false;

            FocusControllerView ControllerView = StateView.ControllerView;

            if (ControllerView.Focus is IFocusTextFocus AsTextFocus)
            {
                IFocusNodeState State = AsTextFocus.CellView.StateView.State;
                if (Type.FromGetType(State.Node).IsAssignableFrom(Type.FromGetType(node)))
                {
                    if (State.ParentIndex is IFocusBrowsingInsertableIndex AsInsertableIndex)
                    {
                        FocusController Controller = StateView.ControllerView.Controller;
                        Node            ParentNode = State.ParentInner.Owner.Node;

                        IFocusInsertionChildIndex ReplaceIndex = (IFocusInsertionChildIndex)AsInsertableIndex.ToInsertionIndex(ParentNode, node);
                        Controller.Replace(State.ParentInner, ReplaceIndex, out IWriteableBrowsingChildIndex NewIndex);

                        isChanged = true;
                    }
                }
            }
        }