PageEditHistory.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using ComPDFKitViewer;
  2. using PDF_Master.ViewModels.PageEdit;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. namespace PDF_Master.Model.PageEdit
  10. {
  11. public class PageEditHistory:IHistory
  12. {
  13. /// <summary>
  14. /// 操作类型
  15. /// </summary>
  16. public ActionType Type { get; set; }
  17. /// <summary>
  18. /// 原位置-新位置集合 用于倒序、旋转、拖拽排序
  19. /// </summary>
  20. public Dictionary<int, int> SourceTargetValue { get; set; }
  21. /// <summary>
  22. /// 插入位置
  23. /// </summary>
  24. public int InsertIndex { get; set; }
  25. /// <summary>
  26. ///插入文件的文件路径
  27. /// </summary>
  28. public string InsertFilePath { get; set; }
  29. /// <summary>
  30. /// 插入文件的密码
  31. /// </summary>
  32. public string InsertFilePassWord { get; set; }
  33. /// <summary>
  34. /// 插入文档的页面总数
  35. /// </summary>
  36. public int InsertPageCount { get; set; }
  37. /// <summary>
  38. /// 插入的页面尺寸大小
  39. /// </summary>
  40. public Size PageSize { get; set; }
  41. /// <summary>
  42. /// 为方便处理 暂时直接调用页面编辑部分的undo redo 方法
  43. /// </summary>
  44. public PageEditContentViewModel viewmodel { get; set; }
  45. public bool Redo()
  46. {
  47. viewmodel.Redo(this);
  48. return true;
  49. }
  50. public bool Undo()
  51. {
  52. viewmodel.Undo(this);
  53. return true;
  54. }
  55. }
  56. /// <summary>
  57. /// 操作类型
  58. /// </summary>
  59. public enum ActionType
  60. {
  61. /// <summary>
  62. /// 页面右旋转
  63. /// </summary>
  64. RightRotate,
  65. /// <summary>
  66. /// 页面左旋转
  67. /// </summary>
  68. LeftRotate,
  69. /// <summary>
  70. /// 从文件插入
  71. /// </summary>
  72. InsertFromFile,
  73. /// <summary>
  74. /// 插入自定义页面
  75. /// </summary>
  76. InsertCustomPages,
  77. /// <summary>
  78. /// 拖拽排序
  79. /// </summary>
  80. DragSort,
  81. /// <summary>
  82. /// 倒序
  83. /// </summary>
  84. Reverse,
  85. /// <summary>
  86. /// 粘贴
  87. /// </summary>
  88. Paste
  89. }
  90. }