mirror of
https://github.com/wmjordan/PDFPatcher.git
synced 2026-10-18 21:52:34 +08:00
45 lines
942 B
C#
45 lines
942 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 Commands.CollapseAll:
|
|
b.CollapseAll();
|
|
break;
|
|
case Commands.ExpandAll:
|
|
b.ExpandAll();
|
|
break;
|
|
case Commands.CollapseChildren:
|
|
foreach (var item in b.GetSelectedElements(false)) {
|
|
foreach (XmlNode ci in item.SubBookmarks) {
|
|
b.Collapse(ci);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|