PublicKey.swift 15 KB

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