mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-19 06:21:06 +08:00
28 lines
619 B
C#
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
|
|
}
|
|
}
|