mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-18 21:52:34 +08:00
a25ebdfd4d
一般是在 if 控制范围很大的情况下进行调整,如果控制范围小则不调整。 从第三方代码的 Demo 中复制的代码块不修改。
28 lines
624 B
C#
28 lines
624 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
|
|
}
|
|
}
|