Files
PDFPatcher/App/Functions/Editor/Commands/BookmarkSelectionCommand.cs
T
2022-01-06 09:08:16 +08:00

45 lines
924 B
C#

using System;
using System.Xml;
using BrightIdeasSoftware;
namespace PDFPatcher.Functions.Editor
{
sealed class BookmarkSelectionCommand : IEditorCommand
{
readonly string _command;
public BookmarkSelectionCommand(string command) {
_command = command;
}
public void Process(Controller controller, params string[] parameters) {
var b = controller.View.Bookmark;
switch (_command) {
case Commands.SelectAllItems:
b.SelectAll();
break;
case Commands.SelectNone:
b.DeselectAll();
break;
case Commands.InvertSelectItem:
b.InvertSelect();
break;
case "_CollapseAll":
b.CollapseAll();
break;
case "_ExpandAll":
b.ExpandAll();
break;
case "_CollapseChildren":
foreach (var item in b.GetSelectedElements(false)) {
foreach (XmlNode ci in item.SubBookmarks) {
b.Collapse(ci);
}
}
break;
}
}
}
}