mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-18 21:52:34 +08:00
34 lines
884 B
C#
34 lines
884 B
C#
|
|
namespace PDFPatcher.Processor
|
|
{
|
|
sealed class BookmarkOpenStatusProcessor : IPdfInfoXmlProcessor, IPdfInfoXmlProcessor<bool>
|
|
{
|
|
/// <summary>
|
|
/// 表示处理器是否应打开书签。
|
|
/// </summary>
|
|
public bool Parameter { get; set; }
|
|
public BookmarkOpenStatusProcessor() {
|
|
}
|
|
public BookmarkOpenStatusProcessor(bool open) {
|
|
Parameter = open;
|
|
}
|
|
|
|
#region IInfoDocProcessor 成员
|
|
|
|
public string Name => $"设置书签状态为{(Parameter ? "打开" : "关闭")}";
|
|
|
|
public IUndoAction Process(System.Xml.XmlElement item) {
|
|
if (item.SelectSingleNode(Constants.Bookmark) == null) {
|
|
return null;
|
|
}
|
|
var v = item.HasChildNodes && item.SelectSingleNode(Constants.Bookmark) != null && Parameter
|
|
? Constants.Boolean.True
|
|
: null;
|
|
return UndoAttributeAction.GetUndoAction(item, Constants.BookmarkAttributes.Open, v);
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|