LunarPresentation/Commands/Paste.cs

(开头部分) 16KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void Paste(bool before = true)
        {
            String clipboardText = Clipboard.GetText(TextDataFormat.UnicodeText);
            if (clipboardText == null || clipboardText.Length == 0)
            {
                //如果没有文本,看看是否要粘贴图片框。
                Command.PasteImageFromClipboard();
                return;
            }

            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            Expressions.Expression curEx = Globals.selectedEditor.SelectedExpression;

            if (curEx is Expressions.LeafPanel)
            {
                if (clipboardText.StartsWith("<TreeLeaves") &&
                    clipboardText.EndsWith("</TreeLeaves>"))
                {
                    Command.PasteLeaf(); return;
                }

                //否则当作向普通子面板粘贴处理。
            }

            ModifingItem mi = new ModifingItem() { OldSelectedExID = curEx.ExID };

            if (curEx is Expressions.SubPanel)
            {
                //MessageBox.Show("不能把公式粘贴到“子面板”前面!", Globals.appName,
                //    MessageBoxButton.OK, MessageBoxImage.Warning);
                //return;//子面板不支持Paste。

                Expressions.SubPanel subPanel = curEx as Expressions.SubPanel;
                if (subPanel.BasePanel != null && subPanel.BasePanel.Children.Count > 0 &&
                    subPanel.BasePanel.Children[0] is Expressions.Expression)
                {
                    curEx = subPanel.BasePanel.Children[0] as Expressions.Expression;
                }
                else
                {
                    System.Windows.MessageBox.Show("子面板中无公式,无法执行粘贴公式操作!",
                        Globals.appName, System.Windows.MessageBoxButton.OK,
                        System.Windows.MessageBoxImage.Warning);
                    return;
                }
            }

            Expressions.Expression newEx = InsertExpressionByXmlString(before, clipboardText, curEx);
后面还有 332 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。