KMEnumExtensions.swift 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // KMEnumExtensions.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2023/7/14.
  6. //
  7. import Foundation
  8. @objc enum KMSubscribeWaterMarkType: Int {
  9. case none = 0
  10. case stamp = 1
  11. case link
  12. case sign
  13. case editText
  14. case editImage
  15. case insert
  16. case extract
  17. case replace
  18. case split
  19. case delete
  20. case rotate
  21. case copy
  22. case toWord
  23. case toExcel
  24. case toPPT
  25. case toRTF
  26. case toCSV
  27. case toHTML
  28. case toText
  29. case toImage
  30. case compress
  31. case merge
  32. case setPassword
  33. case removePassword
  34. case crop
  35. case aiTranslate
  36. case aiRewrite
  37. case aiCorrect
  38. case save
  39. }
  40. protocol KMSubscribeWaterMarkTypeConvertProtocol {
  41. func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType
  42. }
  43. extension KMToolbarType: KMSubscribeWaterMarkTypeConvertProtocol {
  44. func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
  45. switch self {
  46. case .word:
  47. return .toWord
  48. case .excel:
  49. return .toExcel
  50. case .ppt:
  51. return .toPPT
  52. case .rtf:
  53. return .toRTF
  54. case .csv:
  55. return .toCSV
  56. case .html:
  57. return .toHTML
  58. case .conversion_text:
  59. return .toText
  60. case .conversion_image:
  61. return .toImage
  62. case .compress:
  63. return .compress
  64. case .merge:
  65. return .merge
  66. default:
  67. return .none
  68. }
  69. }
  70. }
  71. extension KMPDFConvertType: KMSubscribeWaterMarkTypeConvertProtocol {
  72. func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
  73. switch self {
  74. case .word:
  75. return .toWord
  76. case .excel:
  77. return .toExcel
  78. case .ppt:
  79. return .toPPT
  80. case .rtf:
  81. return .toRTF
  82. case .csv:
  83. return .toCSV
  84. case .html:
  85. return .toHTML
  86. case .text:
  87. return .toText
  88. case .image:
  89. return .toImage
  90. default:
  91. return .none
  92. }
  93. }
  94. }
  95. extension KMItemKey: KMSubscribeWaterMarkTypeConvertProtocol {
  96. func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
  97. switch self {
  98. case .leftRotate:
  99. return .rotate
  100. case .rightRotate:
  101. return .rotate
  102. case .paste:
  103. return .copy
  104. case .delete:
  105. return .delete
  106. default:
  107. return .none
  108. }
  109. }
  110. }
  111. extension KMPageEditType: KMSubscribeWaterMarkTypeConvertProtocol {
  112. func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
  113. switch self {
  114. case .leftRotate:
  115. return .rotate
  116. case .rightRotate:
  117. return .rotate
  118. case .insert:
  119. return .insert
  120. case .extract:
  121. return .extract
  122. case .replace:
  123. return .replace
  124. case .split:
  125. return .split
  126. case .reverse:
  127. return .none
  128. case .delete:
  129. return .delete
  130. case .paste:
  131. return .copy
  132. default:
  133. return .none
  134. }
  135. }
  136. }