PublicKey.swift 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. //
  2. // PublicKey.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lxy on 2022/12/1.
  6. //
  7. import Foundation
  8. /// Main Tool
  9. let KMLeftControlToolbarItemIdentifier = "KMLeftControlToolbarItemIdentifier"
  10. let KMDocumentZoomViewToolbarItemIdentifier = "KMDocumentZoomViewToolbarItemIdentifier"
  11. let KMDocumentPreviousPageToolbarItemIdentifier = "KMDocumentPreviousPageToolbarItemIdentifier"
  12. let KMDocumentHomeToolbarItemIdentifier = "KMDocumentHomeToolbarItemIdentifier"
  13. let KMDocumentAnnotationToolbarItemIdentifier = "KMDocumentAnnotationToolbarItemIdentifier"
  14. let KMDocumentPageToolbarItemIdentifier = "KMDocumentPageToolbarItemIdentifier"
  15. let KMDocumentConversonToolbarItemIdentifier = "KMDocumentConversonToolbarItemIdentifier"
  16. let KMDocumentScanOCRToolbarItemIdentifier = "KMDocumentScanOCRToolbarItemIdentifier"
  17. let KMDocumentFormToolbarItemIdentifier = "KMDocumentFormToolbarItemIdentifier"
  18. let KMDocumentEditToolbarItemIdentifier = "KMDocumentPageEditToolbarItemIdentifier"
  19. let KMDocumentFillSginToolbarItemIdentifier = "KMDocumentFillSginToolbarItemIdentifier"
  20. let KMDocumentToolToolbarItemIdentifier = "KMDocumentToolToolbarItemIdentifier"
  21. let KMDocumentRedactToolbarItemIdentifier = "KMDocumentRedactToolbarItemIdentifier"
  22. let KMDocumentDigitalSignToolbarItemIdentifier = "KMDocumentDigitalSignToolbarItemIdentifier"
  23. let KMDocumentSignToolbarItemIdentifier = "KMDocumentSignToolbarItemIdentifier"
  24. let KMDocumentViewDisplayToolbarItemIdentifier = "KMDocumentViewDisplayToolbarItemIdentifier"
  25. let KMDocumentPrintToolbarItemIdentifier = "KMDocumentPrintToolbarItemIdentifier"
  26. let KMDocumentAITranslationToolbarItemIdentifier = "KMDocumentAITranslationToolbarItemIdentifier"
  27. let KMDocumentShareToolbarItemIdentifier = "KMDocumentShareToolbarItemIdentifier"
  28. let KMDocumentSearchToolbarItemIdentifier = "KMDocumentSearchToolbarItemIdentifier"
  29. let KMRightControlToolbarItemIdentifier = "KMRightControlToolbarItemIdentifier"
  30. let KMDocumentAIToolsToolbarItemIdentifier = "KMDocumentAIToolsToolbarItemIdentifier"
  31. let KMDocumentPageInputToolbarItemIdentifier = "KMDocumentPageInputToolbarItemIdentifier"
  32. let KMDocumentPreviousBackToolbarItemIdentifier = "previousBackItemIdentifier"
  33. let KMDocumentFirstLastToolbarItemIdentifier = "firstLastItemIdentifier"
  34. let KMDocumentPageIndicatorToolbarItemIdentifier = "pageIndicatorItemIdentifier"
  35. let KMDocumentPresentationToolbarItemIdentifier = "presentationItemIdentifier"
  36. // KMDocumentHomeToolbarItemIdentifier, KMDocumentAnnotationToolbarItemIdentifier, KMDocumentPageToolbarItemIdentifier, KMDocumentConversonToolbarItemIdentifier,KMDocumentRedactToolbarItemIdentifier,KMDocumentViewDisplayToolbarItemIdentifier,KMDocumentScanOCRToolbarItemIdentifier, KMDocumentFormToolbarItemIdentifier, KMDocumentEditToolbarItemIdentifier, KMDocumentDigitalSignToolbarItemIdentifier,
  37. let mainToolIdentifiers = [KMLeftControlToolbarItemIdentifier,
  38. KMDocumentZoomViewToolbarItemIdentifier, KMDocumentPreviousPageToolbarItemIdentifier,
  39. KMDocumentHomeToolbarItemIdentifier, KMDocumentAnnotationToolbarItemIdentifier, KMDocumentPageToolbarItemIdentifier, KMDocumentConversonToolbarItemIdentifier,KMDocumentRedactToolbarItemIdentifier,
  40. KMDocumentAIToolsToolbarItemIdentifier,
  41. KMDocumentViewDisplayToolbarItemIdentifier,KMDocumentScanOCRToolbarItemIdentifier, KMDocumentFormToolbarItemIdentifier, KMDocumentEditToolbarItemIdentifier,
  42. KMDocumentDigitalSignToolbarItemIdentifier,KMDocumentSignToolbarItemIdentifier,
  43. KMDocumentFillSginToolbarItemIdentifier, KMDocumentToolToolbarItemIdentifier, KMDocumentPrintToolbarItemIdentifier,
  44. KMDocumentShareToolbarItemIdentifier, KMDocumentSearchToolbarItemIdentifier, KMRightControlToolbarItemIdentifier,
  45. KMDocumentPreviousBackToolbarItemIdentifier, KMDocumentFirstLastToolbarItemIdentifier,
  46. // KMDocumentPageIndicatorToolbarItemIdentifier,
  47. KMDocumentPresentationToolbarItemIdentifier, KMDocumentPageInputToolbarItemIdentifier]
  48. /// annotation
  49. //
  50. let KMToolbarMoveToolModeItemIdentifier = "KMToolbarPreviousItemIdentifier"
  51. let KMToolbarMagnifyToolModeItemIdentifier = "KMToolbarMagnifyToolModeItemIdentifier"
  52. let KMToolbarSelectToolModeItemIdentifier = "KMToolbarSelectToolModeItemIdentifier"
  53. let KMToolbarZoomToSelectionItemIdentifier = "KMToolbarZoomToSelectionItemIdentifier"
  54. let KMToolbarHighlightAnnotationItemIdentifier = "KMToolbarHighlightAnnotationItemIdentifier"
  55. let KMToolbarUnderlineAnnotationItemIdentifier = "KMToolbarUnderlineAnnotationItemIdentifier"
  56. let KMToolbarStrikeOutAnnotationItemIdentifier = "KMToolbarStrikeOutAnnotationItemIdentifier"
  57. let KMToolbarSquigglyAnnotationItemIdentifier = "KMToolbarSquigglyAnnotationItemIdentifier"
  58. let KMToolbarInkAnnotationItemIdentifier = "KMToolbarInkAnnotationItemIdentifier"
  59. let KMToolbarEraserAnnotationItemIdentifier = "KMToolbarEraserAnnotationItemIdentifier"
  60. let KMToolbarFreeTextAnnotationItemIdentifier = "KMToolbarFreeTextAnnotationItemIdentifier"
  61. let KMToolbarAnchoredAnnotationItemIdentifier = "KMToolbarAnchoredAnnotationItemIdentifier"
  62. let KMToolbarSquareAnnotationItemIdentifier = "KMToolbarSquareAnnotationItemIdentifier"
  63. let KMToolbarCircleAnnotationItemIdentifier = "KMToolbarCircleAnnotationItemIdentifier"
  64. let KMToolbarLineAnnotationItemIdentifier = "KMToolbarLineAnnotationItemIdentifier"
  65. let KMToolbarArrowAnnotationItemIdentifier = "KMToolbarArrowAnnotationItemIdentifier"
  66. let KMToolbarLinkAnnotationItemIdentifier = "KMToolbarLinkAnnotationItemIdentifier"
  67. let KMToolbarSignSignatureAnnotationItemIdentifier = "KMToolbarSignatureAnnotationItemIdentifier"
  68. let KMAnnotationStampToolbarItemIdentifier = "KMToolbarStampAnnotationItemIdentifier"
  69. let KMAnnotationImageToolbarItemIdentifier = "KMToolbarImageAnnotationItemIdentifier"
  70. let KMAnnotationTableToolbarItemIdentifier = "KMToolbarTableAnnotationItemIdentifier"
  71. let KMToolbarShowToolbarItemIdentifier = "KMToolbarShowToolbarItemIdentifier"
  72. let KMToolbarAnnotationSettingItemIdentifier = "KMToolbarAnnotationSettingItemIdentifier"
  73. let annotationToolIdentifiers = [KMToolbarMoveToolModeItemIdentifier, KMToolbarMagnifyToolModeItemIdentifier, KMToolbarSelectToolModeItemIdentifier,
  74. KMToolbarZoomToSelectionItemIdentifier, KMToolbarHighlightAnnotationItemIdentifier, KMToolbarUnderlineAnnotationItemIdentifier,
  75. KMToolbarStrikeOutAnnotationItemIdentifier, KMToolbarSquigglyAnnotationItemIdentifier, KMToolbarInkAnnotationItemIdentifier, KMToolbarEraserAnnotationItemIdentifier,
  76. KMToolbarFreeTextAnnotationItemIdentifier,
  77. KMToolbarAnchoredAnnotationItemIdentifier, KMToolbarSquareAnnotationItemIdentifier, KMToolbarCircleAnnotationItemIdentifier,
  78. KMToolbarLineAnnotationItemIdentifier, KMToolbarArrowAnnotationItemIdentifier, KMToolbarLinkAnnotationItemIdentifier,
  79. KMToolbarSignSignatureAnnotationItemIdentifier, KMAnnotationStampToolbarItemIdentifier, KMAnnotationImageToolbarItemIdentifier, KMAnnotationTableToolbarItemIdentifier, KMToolbarAnnotationSettingItemIdentifier, KMToolbarShowToolbarItemIdentifier]
  80. // PageEdit
  81. let KMToolbarPageEditPageRangeItemIdentifier = "KMToolbarPageEditPageRangeItemIdentifier"
  82. let KMToolbarPageEditRotateItemIdentifier = "KMToolbarPageEditRotateItemIdentifier"
  83. let KMToolbarPageEditLeftRotateItemIdentifier = "KMToolbarPageEditLeftRotateItemIdentifier"
  84. let KMToolbarPageEditRightRotateItemIdentifier = "KMToolbarPageEditRightRotateItemIdentifier"
  85. let KMToolbarPageEditInsetItemIdentifier = "KMToolbarPageEditInsertItemIdentifier"
  86. let KMToolbarPageEditExtractItemIdentifier = "KMToolbarPageEditExtractItemIdentifier"
  87. let KMToolbarPageEditReplaceItemIdentifier = "KMToolbarPageEditReplaceItemIdentifier"
  88. let KMToolbarPageEditSplitItemIdentifier = "KMToolbarPageEditSplitItemIdentifier"
  89. let KMToolbarPageEditReverseItemIdentifier = "KMToolbarPageEditReverseItemIdentifier"
  90. let KMToolbarPageEditCopyItemIdentifier = "KMToolbarPageEditCopyItemIdentifier"
  91. let KMToolbarPageEditPasteItemIdentifier = "KMToolbarPageEditPasteItemIdentifier"
  92. let KMToolbarPageEditDeleteItemIdentifier = "KMToolbarPageEditDeleteItemIdentifier"
  93. let pageEditToolIdentifiers = [KMToolbarPageEditPageRangeItemIdentifier, KMToolbarPageEditRotateItemIdentifier,
  94. KMToolbarPageEditLeftRotateItemIdentifier,KMToolbarPageEditRightRotateItemIdentifier,
  95. KMToolbarPageEditInsetItemIdentifier, KMToolbarPageEditExtractItemIdentifier,
  96. KMToolbarPageEditReplaceItemIdentifier, KMToolbarPageEditSplitItemIdentifier,
  97. KMToolbarPageEditReverseItemIdentifier, KMToolbarPageEditCopyItemIdentifier,
  98. KMToolbarPageEditPasteItemIdentifier, KMToolbarPageEditDeleteItemIdentifier]
  99. // conversion
  100. let KMToolbarConversionCreatePDFItemIdentifier = "KMToolbarImageToPDFItemIdentifier"
  101. let KMToolbarConversionWordItemIdentifier = "KMToolbarPDFToWordItemIdentifier"
  102. let KMToolbarConversionExcelItemIdentifier = "KMToolbarPDFToExcelItemIdentifier"
  103. let KMToolbarConversionPPTItemIdentifier = "KMToolbarPDFToPPTItemIdentifier"
  104. let KMToolbarConversionRTFItemIdentifier = "KMToolbarPDFToRTFItemIdentifier"
  105. let KMToolbarConversionCSVItemIdentifier = "KMToolbarPDFToCSVItemIdentifier"
  106. let KMToolbarConversionHTMLItemIdentifier = "KMToolbarPDFToHtmlItemIdentifier"
  107. let KMToolbarConversionTextItemIdentifier = "KMToolbarPDFToTextItemIdentifier"
  108. let KMToolbarConversionImageItemIdentifier = "KMToolbarPDFToImageItemIdentifier"
  109. let KMToolbarConversionImageToPDFItemIdentifier = "KMToolbarImageToPDFNewItemIdentifier"
  110. let KMToolbarConversionOtherItemIdentifier = "KMToolbarPDFToOtherItemIdentifier"
  111. let KMToolbarConversionOCRIdentifier = "KMToolbarConversionOCRIdentifier"
  112. let KMToolbarConversionExportImageItemIdentifier = "KMToolbarExtractPDFImageItemIdentifier"
  113. let conversionToolIdentifiers = [KMToolbarConversionCreatePDFItemIdentifier,
  114. KMToolbarConversionWordItemIdentifier, KMToolbarConversionExcelItemIdentifier,
  115. KMToolbarConversionPPTItemIdentifier, KMToolbarConversionRTFItemIdentifier,
  116. KMToolbarConversionCSVItemIdentifier, KMToolbarConversionHTMLItemIdentifier,
  117. KMToolbarConversionTextItemIdentifier, KMToolbarConversionImageItemIdentifier, KMToolbarConversionImageToPDFItemIdentifier, KMToolbarConversionOtherItemIdentifier,
  118. KMToolbarConversionOCRIdentifier, KMToolbarConversionExportImageItemIdentifier]
  119. // EditPDF
  120. let KMToolbarAddTextEditPDFItemIdentifier = "KMToolbarAddTextEditPDFItemIdentifier"
  121. let KMToolbarAddImageEditPDFItemIdentifier = "KMToolbarAddImageEditPDFItemIdentifier"
  122. let editPDFItemIdentifiers = [KMToolbarAddTextEditPDFItemIdentifier, KMToolbarAddImageEditPDFItemIdentifier]
  123. let KMToolbarDividerItemIdentifier = "KMToolbarDividerItemIdentifier"
  124. /// Tool
  125. let KMToolbarToolCropItemIdentifier = "KMToolbarToolCropItemIdentifier"
  126. let KMToolbarToolBatesItemIdentifier = "KMToolbarBatesItemIdentifier"
  127. let KMToolbarToolHeaderFooterItemIdentifier = "KMToolbarHeaderFooterItemIdentifier"
  128. let KMToolbarToolBackgroundItemIdentifier = "KMToolbarBackgroundItemIdentifier"
  129. let KMToolbarToolWatermarkItemIdentifier = "KMToolbarWatermarkItemIdentifier"
  130. let KMToolbarToolRedactItemIdentifier = "KMToolbarToolRedactItemIdentifier"
  131. let KMToolbarToolCompressItemIdentifier = "KMToolbarCompressionItemIdentifier"
  132. let KMToolbarToolSecureItemIdentifier = "KMToolbarSecurityItemIdentifier"
  133. let KMToolbarToolMergeItemIdentifier = "KMToolbarMergeItemIdentifier"
  134. let KMToolbarComparisonItemIdentifier = "KMToolbarComparisonItemIdentifier"
  135. let KMToolbarMeasureItemIdentifier = "KMToolbarMeasureItemIdentifier"
  136. let KMToolbarAIItemIdentifier = "KMToolbarAIItemIdentifier"
  137. let toolToolIdentifiers = [KMToolbarToolCropItemIdentifier, KMToolbarToolBatesItemIdentifier,
  138. KMToolbarToolHeaderFooterItemIdentifier, KMToolbarToolBackgroundItemIdentifier,
  139. KMToolbarToolWatermarkItemIdentifier, KMToolbarToolRedactItemIdentifier,
  140. KMToolbarToolCompressItemIdentifier, KMToolbarToolSecureItemIdentifier,
  141. KMToolbarToolMergeItemIdentifier,KMToolbarComparisonItemIdentifier,
  142. KMToolbarMeasureItemIdentifier]
  143. /// Form
  144. let KMToolbarToolTextFieldItemIdentifier = "KMToolbarFormTextFieldItemIdentifier"
  145. let KMToolbarToolCheckBoxItemIdentifier = "KMToolbarFormCheckBoxItemIdentifier"
  146. let KMToolbarToolRadioButtonItemIdentifier = "KMToolbarFormRadioButtonItemIdentifier"
  147. let KMToolbarToolListBoxItemIdentifier = "KMToolbarToolListBoxItemIdentifier"
  148. let KMToolbarToolPullDownmenuItemIdentifier = "KMToolbarFormComboBoxItemIdentifier"
  149. let KMToolbarToolButtonIdentifier = "KMToolbarFormActionButtonItemIdentifier"
  150. let KMToolbarToolSignBoxIdentifier = "KMToolbarFormSignatureButtonItemIdentifier"
  151. let KMToolbarToolFormAlignIdentifier = "KMToolbarFormAlignmentIdentifier"
  152. let KMToolbarToolFormMoreIdentifier = "KMToolbarToolFormMoreIdentifier"
  153. let formToolIdentifiers = [KMToolbarToolTextFieldItemIdentifier, KMToolbarToolCheckBoxItemIdentifier,
  154. KMToolbarToolRadioButtonItemIdentifier, KMToolbarToolListBoxItemIdentifier,
  155. KMToolbarToolPullDownmenuItemIdentifier, KMToolbarToolButtonIdentifier,
  156. KMToolbarToolSignBoxIdentifier, KMToolbarToolFormAlignIdentifier,
  157. KMToolbarToolFormMoreIdentifier]
  158. /// FillSign
  159. let KMToolbarToolHookItemIdentifier = "KMToolbarToolHookItemIdentifier"
  160. let KMToolbarToolForkItemIdentifier = "KMToolbarToolForkItemIdentifier"
  161. let KMToolbarToolLineItemIdentifier = "KMToolbarToolLineItemIdentifier"
  162. let KMToolbarToolDotItemIdentifier = "KMToolbarToolDotItemIdentifier"
  163. let KMToolbarToolRectangleIdentifier = "KMToolbarToolRectangleIdentifier"
  164. let KMToolbarToolTextIdentifier = "KMToolbarToolTextIdentifier"
  165. let KMToolbarToolDateIdentifier = "KMToolbarToolDateIdentifier"
  166. let KMToolbarToolProfileIdentifier = "KMToolbarToolProfileIdentifier"
  167. let KMToolbarFillSignSignatureIdentifier = "KMToolbarFillSignSignatureIdentifier"
  168. let fillSignToolIdentifiers = [KMToolbarToolHookItemIdentifier, KMToolbarToolForkItemIdentifier,
  169. KMToolbarToolLineItemIdentifier, KMToolbarToolDotItemIdentifier,
  170. KMToolbarToolRectangleIdentifier, KMToolbarToolTextIdentifier,
  171. KMToolbarToolDateIdentifier, KMToolbarToolProfileIdentifier,
  172. KMToolbarFillSignSignatureIdentifier]
  173. //Scan OCR
  174. let KMToolbarToolOCRTextIdentifier = "KMToolbarToolOCRTextIdentifier"
  175. let KMToolbarToolEnhancedScanIdentifier = "KMToolbarToolEnhancedScanIdentifier"
  176. let KMToolbarViewSettingIdentifier = "KMToolbarSplitScreenModeItemIdentifier"
  177. let KMToolbarCropIdentifier = "KMToolbarCropItemIdentifier"
  178. let KMToolbarSnapshotIdentifier = "KMToolbarTakeSnapshotItemIdentifier"
  179. let KMToolbarTTSIdentifier = "KMToolbarTTSViewItemIdentifier"
  180. let KMViewDisplayIdentifiers = [KMToolbarViewSettingIdentifier, KMToolbarCropIdentifier, KMToolbarSnapshotIdentifier, KMToolbarTTSIdentifier]
  181. let KMSignDigitalSignToolbarItemIdentifier = "KMSignDigitalSignToolbarItemIdentifier"
  182. let KMSignIdentifiers = [KMToolbarToolSignBoxIdentifier, KMSignDigitalSignToolbarItemIdentifier]
  183. let KMNewToolbarSpaceItemIdentifier = "KMNewToolbarSpaceItemIdentifier"
  184. //let KMToolbarDividerItemIdentifier = "KMToolbarDividerItemIdentifier"
  185. // 固定宽度
  186. let KMToolbarFixedSpaceItemIdentifier = "fixedSpaceItemIdentifier"
  187. // 可变宽度
  188. let KMToolbarFlexibleSpaceItemIdentifier = "flexibleSpaceItemIdentifier"
  189. let KMToolBarToolPDFShapeStyle = "KMToolBarToolPDFShapeStyle"
  190. public func parentIdentifier(_ identifier: String) -> String {
  191. if (isMainToolItem(identifier)) {
  192. return ""
  193. }
  194. if (editPDFItemIdentifiers.contains(identifier)) {
  195. return KMDocumentEditToolbarItemIdentifier
  196. }
  197. if (annotationToolIdentifiers.contains(identifier)) {
  198. return KMDocumentAnnotationToolbarItemIdentifier
  199. }
  200. if (pageEditToolIdentifiers.contains(identifier)) {
  201. return KMDocumentPageToolbarItemIdentifier
  202. }
  203. if (conversionToolIdentifiers.contains(identifier)) {
  204. return KMDocumentConversonToolbarItemIdentifier
  205. }
  206. if (toolToolIdentifiers.contains(identifier)) {
  207. return KMDocumentToolToolbarItemIdentifier
  208. }
  209. if (formToolIdentifiers.contains(identifier)) {
  210. return KMDocumentFormToolbarItemIdentifier
  211. }
  212. if (fillSignToolIdentifiers.contains(identifier)) {
  213. return KMDocumentFillSginToolbarItemIdentifier
  214. }
  215. if KMViewDisplayIdentifiers.contains(identifier) {
  216. return KMDocumentViewDisplayToolbarItemIdentifier
  217. }
  218. return ""
  219. }
  220. public func isMainToolItem(_ identifier: String) -> Bool {
  221. if (mainToolIdentifiers.contains(identifier)) {
  222. return true
  223. }
  224. return false
  225. }