LunarPresentation/Commands/CopyAsOutLine.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Documents;
namespace SHomeWorkshop.LunarPresentation.Commands
{
public partial class Command
{
/// <summary>
/// 将当前子面板中的所有格式化为“标题”文本块及正文文本块的文本内容复制成富文本块格式的提纲。
/// </summary>
public static void CopyAsOutLine()
{
if (Globals.selectedEditor == null) return;
if (Globals.selectedEditor.SelectedExpression == null)
{
MessageBox.Show(" 请先选中一个公式来导出提纲。选中普通公式会导出父面板中所有文本块构成的提纲。",
Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
LunarPresentation.Expressions.Expression curEx
= Globals.selectedEditor.SelectedExpression;
LunarPresentation.Expressions.SubPanel curSubPanel = curEx as LunarPresentation.Expressions.SubPanel;
if (curSubPanel == null)
{
curSubPanel = curEx.ParentPanel;
}
if (curSubPanel == null)
{
MessageBox.Show("发生意外,未找到要导出提纲的子面板。",
Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
Dialogs.OutLineDialog oDlg = new Dialogs.OutLineDialog(Globals.MainWindow);
if (curSubPanel.Editor.DefaultBackground == Brushes.Black)
{
oDlg.MainRTB.Background = Brushes.White;//如果是黑底白字,自动反色。
}
else
{
oDlg.MainRTB.Background = curSubPanel.Editor.DefaultBackground;
}
foreach (Expressions.Expression ex in curSubPanel.BasePanel.Children)
{
Expressions.BaseText bt = ex as Expressions.BaseText;
if (bt == null) continue;
Paragraph newParagraph;
string autoNumString = bt.AutoNumString;
if (autoNumString != null && autoNumString != "")
{
newParagraph = new Paragraph(new Span(new Run(autoNumString + bt.Text)));
后面还有 74 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。