PublicKey.swift 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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 KMToolbarDividerItemIdentifier = "KMToolbarDividerItemIdentifier"
  88. /// Tool
  89. let KMToolbarToolCropItemIdentifier = "KMToolbarToolCropItemIdentifier"
  90. let KMToolbarToolBatesItemIdentifier = "KMToolbarToolBatesItemIdentifier"
  91. let KMToolbarToolHeaderFooterItemIdentifier = "KMToolbarToolHeaderFooterItemIdentifier"
  92. let KMToolbarToolBackgroundItemIdentifier = "KMToolbarToolBackgroundItemIdentifier"
  93. let KMToolbarToolWatermarkItemIdentifier = "KMToolbarToolWatermarkItemIdentifier"
  94. let KMToolbarToolRedactItemIdentifier = "KMToolbarToolRedactItemIdentifier"
  95. let KMToolbarToolCompressItemIdentifier = "KMToolbarToolCompressItemIdentifier"
  96. let KMToolbarToolSecureItemIdentifier = "KMToolbarToolSecureItemIdentifier"
  97. let KMToolbarToolMergeItemIdentifier = "KMToolbarToolMergeItemIdentifier"
  98. let toolToolIdentifiers = [KMToolbarToolCropItemIdentifier, KMToolbarToolBatesItemIdentifier, KMToolbarToolHeaderFooterItemIdentifier,
  99. KMToolbarToolBackgroundItemIdentifier, KMToolbarToolWatermarkItemIdentifier, KMToolbarToolRedactItemIdentifier,
  100. KMToolbarToolCompressItemIdentifier, KMToolbarToolSecureItemIdentifier, KMToolbarToolMergeItemIdentifier]
  101. /// Form
  102. let KMToolbarToolTextFieldItemIdentifier = "KMToolbarToolTextFieldItemIdentifier"
  103. let KMToolbarToolCheckBoxItemIdentifier = "KMToolbarToolCheckBoxItemIdentifier"
  104. let KMToolbarToolRadioButtonItemIdentifier = "KMToolbarToolRadioButtonItemIdentifier"
  105. let KMToolbarToolListBoxItemIdentifier = "KMToolbarToolListBoxItemIdentifier"
  106. let KMToolbarToolPullDownmenuItemIdentifier = "KMToolbarToolPullDownmenuItemIdentifier"
  107. let KMToolbarToolButtonIdentifier = "KMToolbarToolButtonIdentifier"
  108. let KMToolbarToolSignBoxIdentifier = "KMToolbarToolSignBoxIdentifier"
  109. let KMToolbarToolFormAlignIdentifier = "KMToolbarToolFormAlignIdentifier"
  110. let KMToolbarToolFormMoreIdentifier = "KMToolbarToolFormMoreIdentifier"
  111. let formToolIdentifiers = [KMToolbarToolTextFieldItemIdentifier, KMToolbarToolCheckBoxItemIdentifier, KMToolbarToolRadioButtonItemIdentifier,
  112. KMToolbarToolListBoxItemIdentifier, KMToolbarToolPullDownmenuItemIdentifier, KMToolbarToolButtonIdentifier,
  113. KMToolbarToolSignBoxIdentifier, KMToolbarToolFormAlignIdentifier, KMToolbarToolFormMoreIdentifier]
  114. /// FillSign
  115. let KMToolbarToolHookItemIdentifier = "KMToolbarToolHookItemIdentifier"
  116. let KMToolbarToolForkItemIdentifier = "KMToolbarToolForkItemIdentifier"
  117. let KMToolbarToolLineItemIdentifier = "KMToolbarToolLineItemIdentifier"
  118. let KMToolbarToolDotItemIdentifier = "KMToolbarToolDotItemIdentifier"
  119. let KMToolbarToolRectangleIdentifier = "KMToolbarToolRectangleIdentifier"
  120. let KMToolbarToolTextIdentifier = "KMToolbarToolTextIdentifier"
  121. let KMToolbarToolDateIdentifier = "KMToolbarToolDateIdentifier"
  122. let KMToolbarFillSignSignatureIdentifier = "KMToolbarFillSignSignatureIdentifier"
  123. let fillSignToolIdentifiers = [KMToolbarToolHookItemIdentifier, KMToolbarToolForkItemIdentifier, KMToolbarToolLineItemIdentifier,
  124. KMToolbarToolDotItemIdentifier, KMToolbarToolRectangleIdentifier, KMToolbarToolTextIdentifier,
  125. KMToolbarToolDateIdentifier, KMToolbarFillSignSignatureIdentifier]
  126. //Scan OCR
  127. let KMToolbarToolOCRTextIdentifier = "KMToolbarToolOCRTextIdentifier"
  128. let KMToolbarToolEnhancedScanIdentifier = "KMToolbarToolEnhancedScanIdentifier"
  129. let KMToolBarToolPDFShapeStyle = "KMToolBarToolPDFShapeStyle"
  130. public func parentIdentifier(_ identifier: String) -> String {
  131. if (isMainToolItem(identifier)) {
  132. return ""
  133. }
  134. if (annotationToolIdentifiers.contains(identifier)) {
  135. return KMDocumentAnnotationToolbarItemIdentifier
  136. }
  137. if (pageEditToolIdentifiers.contains(identifier)) {
  138. return KMDocumentPageToolbarItemIdentifier
  139. }
  140. if (conversionToolIdentifiers.contains(identifier)) {
  141. return KMDocumentConversonToolbarItemIdentifier
  142. }
  143. if (toolToolIdentifiers.contains(identifier)) {
  144. return KMDocumentToolToolbarItemIdentifier
  145. }
  146. if (formToolIdentifiers.contains(identifier)) {
  147. return KMDocumentFormToolbarItemIdentifier
  148. }
  149. if (fillSignToolIdentifiers.contains(identifier)) {
  150. return KMDocumentFillSginToolbarItemIdentifier
  151. }
  152. return ""
  153. }
  154. public func isMainToolItem(_ identifier: String) -> Bool {
  155. if (mainToolIdentifiers.contains(identifier)) {
  156. return true
  157. }
  158. return false
  159. }