mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-18 21:52:34 +08:00
31 lines
788 B
C#
31 lines
788 B
C#
using System;
|
|
|
|
namespace PDFPatcher.Processor
|
|
{
|
|
sealed class LevelUpProcessor : IPdfInfoXmlProcessor
|
|
{
|
|
#region IInfoDocProcessor 成员
|
|
|
|
public string Name => "设置书签为父书签";
|
|
|
|
public IUndoAction Process(System.Xml.XmlElement item) {
|
|
if (item.ParentNode.Name != Constants.Bookmark) {
|
|
return null;
|
|
}
|
|
var undo = new UndoActionGroup();
|
|
var fs = item.SelectNodes("following-sibling::" + Constants.Bookmark);
|
|
foreach (System.Xml.XmlElement f in fs) {
|
|
undo.Add(new AddElementAction(f));
|
|
item.AppendChild(f);
|
|
undo.Add(new RemoveElementAction(f));
|
|
}
|
|
undo.Add(new AddElementAction(item));
|
|
item.ParentNode.ParentNode.InsertAfter(item, item.ParentNode);
|
|
undo.Add(new RemoveElementAction(item));
|
|
return undo;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|