PublicKey.swift 15 KB

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