Files
2024-10-07 16:17:27 +08:00

28 lines
619 B
C#

namespace PDFPatcher.Processor
{
sealed class LevelDownProcessor : IPdfInfoXmlProcessor
{
#region IInfoDocProcessor 成员
public string Name => "设置书签为子书签";
public IUndoAction Process(System.Xml.XmlElement item) {
if (item == item.ParentNode.FirstChild) {
return null;
}
var undo = new UndoActionGroup();
var n = item.SelectSingleNode($"preceding-sibling::{Constants.Bookmark}[1]");
if (n == null) {
return null;
}
undo.Add(new AddElementAction(item));
n.AppendChild(item);
undo.Add(new RemoveElementAction(item));
return undo;
}
#endregion
}
}