PublicKey.swift 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //
  2. // PublicKey.swift
  3. // PDF Master
  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 KMDocumentAnnotationToolbarItemIdentifier = "KMDocumentAnnotationToolbarItemIdentifier"
  16. let KMDocumentPageToolbarItemIdentifier = "KMDocumentPageToolbarItemIdentifier"
  17. let KMDocumentConversonToolbarItemIdentifier = "KMDocumentConversonToolbarItemIdentifier"
  18. let KMDocumentScanOCRToolbarItemIdentifier = "KMDocumentScanOCRToolbarItemIdentifier"
  19. let KMDocumentFormToolbarItemIdentifier = "KMDocumentFormToolbarItemIdentifier"
  20. let KMDocumentEditToolbarItemIdentifier = "KMDocumentPageEditToolbarItemIdentifier"
  21. let KMDocumentFillSginToolbarItemIdentifier = "KMDocumentFillSginToolbarItemIdentifier"
  22. let KMDocumentToolToolbarItemIdentifier = "KMDocumentToolToolbarItemIdentifier"
  23. let KMDocumentPrintToolbarItemIdentifier = "KMDocumentPrintToolbarItemIdentifier"
  24. let KMDocumentAITranslationToolbarItemIdentifier = "KMDocumentAITranslationToolbarItemIdentifier"
  25. let KMDocumentShareToolbarItemIdentifier = "KMDocumentShareToolbarItemIdentifier"
  26. let KMRightControlToolbarItemIdentifier = "KMRightControlToolbarItemIdentifier"
  27. let mainToolIdentifiers = [KMLeftControlToolbarItemIdentifier, KMDocumentZoomToolbarItemIdentifier, KMDocumentZoomOutToolbarItemIdentifier,
  28. KMDocumentZoomViewToolbarItemIdentifier, KMDocumentPreviousPageToolbarItemIdentifier, KMDocumentNextPageToolbarItemIdentifier,
  29. KMDocumentAnnotationToolbarItemIdentifier, KMDocumentPageToolbarItemIdentifier, KMDocumentConversonToolbarItemIdentifier,
  30. KMDocumentScanOCRToolbarItemIdentifier, KMDocumentFormToolbarItemIdentifier, KMDocumentEditToolbarItemIdentifier,
  31. KMDocumentFillSginToolbarItemIdentifier, KMDocumentToolToolbarItemIdentifier, KMDocumentPrintToolbarItemIdentifier,
  32. KMDocumentShareToolbarItemIdentifier, KMRightControlToolbarItemIdentifier]
  33. /// annotation
  34. //
  35. let KMToolbarMoveToolModeItemIdentifier = "KMToolbarPreviousItemIdentifier"
  36. let KMToolbarMagnifyToolModeItemIdentifier = "KMToolbarMagnifyToolModeItemIdentifier"
  37. let KMToolbarSelectToolModeItemIdentifier = "KMToolbarSelectToolModeItemIdentifier"
  38. let KMToolbarZoomToSelectionItemIdentifier = "KMToolbarZoomToSelectionItemIdentifier"
  39. let KMToolbarHighlightAnnotationItemIdentifier = "KMToolbarHighlightAnnotationItemIdentifier"
  40. let KMToolbarUnderlineAnnotationItemIdentifier = "KMToolbarUnderlineAnnotationItemIdentifier"
  41. let KMToolbarStrikeOutAnnotationItemIdentifier = "KMToolbarStrikeOutAnnotationItemIdentifier"
  42. let KMToolbarInkAnnotationItemIdentifier = "KMToolbarInkAnnotationItemIdentifier"
  43. let KMToolbarFreeTextAnnotationItemIdentifier = "KMToolbarFreeTextAnnotationItemIdentifier"
  44. let KMToolbarAnchoredAnnotationItemIdentifier = "KMToolbarAnchoredAnnotationItemIdentifier"
  45. let KMToolbarSquareAnnotationItemIdentifier = "KMToolbarSquareAnnotationItemIdentifier"
  46. let KMToolbarCircleAnnotationItemIdentifier = "KMToolbarCircleAnnotationItemIdentifier"
  47. let KMToolbarLineAnnotationItemIdentifier = "KMToolbarLineAnnotationItemIdentifier"
  48. let KMToolbarArrowAnnotationItemIdentifier = "KMToolbarArrowAnnotationItemIdentifier"
  49. let KMToolbarLinkAnnotationItemIdentifier = "KMToolbarLinkAnnotationItemIdentifier"
  50. let KMToolbarSignSignatureAnnotationItemIdentifier = "KMToolbarSignSignatureAnnotationItemIdentifier"
  51. let KMAnnotationStampToolbarItemIdentifier = "KMAnnotationStampToolbarItemIdentifier"
  52. let KMToolbarShowToolbarItemIdentifier = "KMToolbarShowToolbarItemIdentifier"
  53. let annotationToolIdentifiers = [KMToolbarMoveToolModeItemIdentifier, KMToolbarMagnifyToolModeItemIdentifier, KMToolbarSelectToolModeItemIdentifier,
  54. KMToolbarZoomToSelectionItemIdentifier, KMToolbarHighlightAnnotationItemIdentifier, KMToolbarUnderlineAnnotationItemIdentifier,
  55. KMToolbarStrikeOutAnnotationItemIdentifier, KMToolbarInkAnnotationItemIdentifier, KMToolbarFreeTextAnnotationItemIdentifier,
  56. KMToolbarAnchoredAnnotationItemIdentifier, KMToolbarSquareAnnotationItemIdentifier, KMToolbarCircleAnnotationItemIdentifier,
  57. KMToolbarLineAnnotationItemIdentifier, KMToolbarArrowAnnotationItemIdentifier, KMToolbarLinkAnnotationItemIdentifier,
  58. KMToolbarSignSignatureAnnotationItemIdentifier, KMAnnotationStampToolbarItemIdentifier, KMToolbarShowToolbarItemIdentifier]
  59. // PageEdit
  60. let KMToolbarPageEditPageRangeItemIdentifier = "KMToolbarPageEditPageRangeItemIdentifier"
  61. let KMToolbarPageEditLeftRotateItemIdentifier = "KMToolbarPageEditLeftRotateItemIdentifier"
  62. let KMToolbarPageEditRightRotateItemIdentifier = "KMToolbarPageEditRightRotateItemIdentifier"
  63. let KMToolbarPageEditInsetItemIdentifier = "KMToolbarPageEditInsetItemIdentifier"
  64. let KMToolbarPageEditExtractItemIdentifier = "KMToolbarPageEditExtractItemIdentifier"
  65. let KMToolbarPageEditReplaceItemIdentifier = "KMToolbarPageEditReplaceItemIdentifier"
  66. let KMToolbarPageEditSplitItemIdentifier = "KMToolbarPageEditSplitItemIdentifier"
  67. let KMToolbarPageEditReverseItemIdentifier = "KMToolbarPageEditReverseItemIdentifier"
  68. let KMToolbarPageEditDeleteItemIdentifier = "KMToolbarPageEditDeleteItemIdentifier"
  69. let pageEditToolIdentifiers = [KMToolbarPageEditPageRangeItemIdentifier, KMToolbarPageEditLeftRotateItemIdentifier, KMToolbarPageEditRightRotateItemIdentifier,
  70. KMToolbarPageEditInsetItemIdentifier, KMToolbarPageEditExtractItemIdentifier, KMToolbarPageEditReplaceItemIdentifier,
  71. KMToolbarPageEditSplitItemIdentifier, KMToolbarPageEditReverseItemIdentifier, KMToolbarPageEditDeleteItemIdentifier]
  72. // conversion
  73. let KMToolbarConversionWordItemIdentifier = "KMToolbarConversionWordItemIdentifier"
  74. let KMToolbarConversionExcelItemIdentifier = "KMToolbarConversionExcelItemIdentifier"
  75. let KMToolbarConversionPPTItemIdentifier = "KMToolbarConversionPPTItemIdentifier"
  76. let KMToolbarConversionRTFItemIdentifier = "KMToolbarConversionRTFItemIdentifier"
  77. let KMToolbarConversionCSVItemIdentifier = "KMToolbarConversionCSVItemIdentifier"
  78. let KMToolbarConversionHTMLItemIdentifier = "KMToolbarConversionHTMLItemIdentifier"
  79. let KMToolbarConversionTextItemIdentifier = "KMToolbarConversionTextItemIdentifier"
  80. let KMToolbarConversionImageItemIdentifier = "KMToolbarConversionImageItemIdentifier"
  81. let conversionToolIdentifiers = [KMToolbarConversionWordItemIdentifier, KMToolbarConversionExcelItemIdentifier, KMToolbarConversionPPTItemIdentifier,
  82. KMToolbarConversionRTFItemIdentifier, KMToolbarConversionCSVItemIdentifier, KMToolbarConversionHTMLItemIdentifier,
  83. KMToolbarConversionTextItemIdentifier, KMToolbarConversionImageItemIdentifier]
  84. // EditPDF
  85. let KMToolbarAddTextEditPDFItemIdentifier = "KMToolbarAddTextEditPDFItemIdentifier"
  86. let KMToolbarAddImageEditPDFItemIdentifier = "KMToolbarAddImageEditPDFItemIdentifier"
  87. let editPDFItemIdentifier = [KMToolbarAddTextEditPDFItemIdentifier, KMToolbarAddImageEditPDFItemIdentifier]
  88. let KMToolbarDividerItemIdentifier = "KMToolbarDividerItemIdentifier"
  89. /// Tool
  90. let KMToolbarToolCropItemIdentifier = "KMToolbarToolCropItemIdentifier"
  91. let KMToolbarToolBatesItemIdentifier = "KMToolbarToolBatesItemIdentifier"
  92. let KMToolbarToolHeaderFooterItemIdentifier = "KMToolbarToolHeaderFooterItemIdentifier"
  93. let KMToolbarToolBackgroundItemIdentifier = "KMToolbarToolBackgroundItemIdentifier"
  94. let KMToolbarToolWatermarkItemIdentifier = "KMToolbarToolWatermarkItemIdentifier"
  95. let KMToolbarToolRedactItemIdentifier = "KMToolbarToolRedactItemIdentifier"
  96. let KMToolbarToolCompressItemIdentifier = "KMToolbarToolCompressItemIdentifier"
  97. let KMToolbarToolSecureItemIdentifier = "KMToolbarToolSecureItemIdentifier"
  98. let KMToolbarToolMergeItemIdentifier = "KMToolbarToolMergeItemIdentifier"
  99. let toolToolIdentifiers = [KMToolbarToolCropItemIdentifier, KMToolbarToolBatesItemIdentifier, KMToolbarToolHeaderFooterItemIdentifier,
  100. KMToolbarToolBackgroundItemIdentifier, KMToolbarToolWatermarkItemIdentifier, KMToolbarToolRedactItemIdentifier,
  101. KMToolbarToolCompressItemIdentifier, KMToolbarToolSecureItemIdentifier, KMToolbarToolMergeItemIdentifier]
  102. /// Form
  103. let KMToolbarToolTextFieldItemIdentifier = "KMToolbarToolTextFieldItemIdentifier"
  104. let KMToolbarToolCheckBoxItemIdentifier = "KMToolbarToolCheckBoxItemIdentifier"
  105. let KMToolbarToolRadioButtonItemIdentifier = "KMToolbarToolRadioButtonItemIdentifier"
  106. let KMToolbarToolListBoxItemIdentifier = "KMToolbarToolListBoxItemIdentifier"
  107. let KMToolbarToolPullDownmenuItemIdentifier = "KMToolbarToolPullDownmenuItemIdentifier"
  108. let KMToolbarToolButtonIdentifier = "KMToolbarToolButtonIdentifier"
  109. let KMToolbarToolSignBoxIdentifier = "KMToolbarToolSignBoxIdentifier"
  110. let KMToolbarToolFormAlignIdentifier = "KMToolbarToolFormAlignIdentifier"
  111. let KMToolbarToolFormMoreIdentifier = "KMToolbarToolFormMoreIdentifier"
  112. let formToolIdentifiers = [KMToolbarToolTextFieldItemIdentifier, KMToolbarToolCheckBoxItemIdentifier, KMToolbarToolRadioButtonItemIdentifier,
  113. KMToolbarToolListBoxItemIdentifier, KMToolbarToolPullDownmenuItemIdentifier, KMToolbarToolButtonIdentifier,
  114. KMToolbarToolSignBoxIdentifier, KMToolbarToolFormAlignIdentifier, KMToolbarToolFormMoreIdentifier]
  115. /// FillSign
  116. let KMToolbarToolHookItemIdentifier = "KMToolbarToolHookItemIdentifier"
  117. let KMToolbarToolForkItemIdentifier = "KMToolbarToolForkItemIdentifier"
  118. let KMToolbarToolLineItemIdentifier = "KMToolbarToolLineItemIdentifier"
  119. let KMToolbarToolDotItemIdentifier = "KMToolbarToolDotItemIdentifier"
  120. let KMToolbarToolRectangleIdentifier = "KMToolbarToolRectangleIdentifier"
  121. let KMToolbarToolTextIdentifier = "KMToolbarToolTextIdentifier"
  122. let KMToolbarToolDateIdentifier = "KMToolbarToolDateIdentifier"
  123. let KMToolbarFillSignSignatureIdentifier = "KMToolbarFillSignSignatureIdentifier"
  124. let fillSignToolIdentifiers = [KMToolbarToolHookItemIdentifier, KMToolbarToolForkItemIdentifier, KMToolbarToolLineItemIdentifier,
  125. KMToolbarToolDotItemIdentifier, KMToolbarToolRectangleIdentifier, KMToolbarToolTextIdentifier,
  126. KMToolbarToolDateIdentifier, KMToolbarFillSignSignatureIdentifier]
  127. //Scan OCR
  128. let KMToolbarToolOCRTextIdentifier = "KMToolbarToolOCRTextIdentifier"
  129. let KMToolbarToolEnhancedScanIdentifier = "KMToolbarToolEnhancedScanIdentifier"
  130. let KMToolBarToolPDFShapeStyle = "KMToolBarToolPDFShapeStyle"
  131. public func parentIdentifier(_ identifier: String) -> String {
  132. if (isMainToolItem(identifier)) {
  133. return ""
  134. }
  135. if (editPDFItemIdentifier.contains(identifier)) {
  136. return KMDocumentEditToolbarItemIdentifier
  137. }
  138. if (annotationToolIdentifiers.contains(identifier)) {
  139. return KMDocumentAnnotationToolbarItemIdentifier
  140. }
  141. if (pageEditToolIdentifiers.contains(identifier)) {
  142. return KMDocumentPageToolbarItemIdentifier
  143. }
  144. if (conversionToolIdentifiers.contains(identifier)) {
  145. return KMDocumentConversonToolbarItemIdentifier
  146. }
  147. if (toolToolIdentifiers.contains(identifier)) {
  148. return KMDocumentToolToolbarItemIdentifier
  149. }
  150. if (formToolIdentifiers.contains(identifier)) {
  151. return KMDocumentFormToolbarItemIdentifier
  152. }
  153. if (fillSignToolIdentifiers.contains(identifier)) {
  154. return KMDocumentFillSginToolbarItemIdentifier
  155. }
  156. return ""
  157. }
  158. public func isMainToolItem(_ identifier: String) -> Bool {
  159. if (mainToolIdentifiers.contains(identifier)) {
  160. return true
  161. }
  162. return false
  163. }