KMPDFToolbarConfig.swift 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. //
  2. // KMPDFToolbarConfig.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by Niehaoyu on 2024/10/23.
  6. //
  7. import Foundation
  8. import KMComponentLibrary
  9. //MARK: - 工具栏ID
  10. let KMPDFToolbar_ViewDisplay_Identifier = "KMPDFToolbarViewDisplayIdentifier"
  11. //MARK: -PageEdit
  12. let KMPDFToolbar_PageEdit_Identifier = "KMPDFToolbar_PageEdit_Identifier"
  13. let KMPDFToolbar_PageEdit_page_oddPage_Identifier = "KMPDFToolbar_PageEdit_page_oddPage_Identifier"
  14. let KMPDFToolbar_PageEdit_page_EvenPage_Identifier = "KMPDFToolbar_PageEdit_page_EvenPage_Identifier"
  15. let KMPDFToolbar_PageEdit_page_PortraitPage_Identifier = "KMPDFToolbar_PageEdit_page_PortraitPage_Identifier"
  16. let KMPDFToolbar_PageEdit_page_LandscapePage_Identifier = "KMPDFToolbar_PageEdit_page_LandscapePage_Identifier"
  17. let KMPDFToolbar_PageEdit_page_AllPage_Identifier = "KMPDFToolbar_PageEdit_page_AllPage_Identifier"
  18. let KMPDFToolbar_PageEdit_page_CustomPage_Identifier = "KMPDFToolbar_PageEdit_page_CustomPage_Identifier"
  19. let KMPDFToolbar_PageEdit_InsertFile_Identifier = "KMPDFToolbar_PageEdit_InsertFile_Identifier"
  20. let KMPDFToolbar_PageEdit_InsertBlank_Identifier = "KMPDFToolbar_PageEdit_InsertBlank_Identifier"
  21. let KMPDFToolbar_PageEdit_InsertClip_Identifier = "KMPDFToolbar_PageEdit_InsertClip_Identifier"
  22. let KMPDFToolbar_PageEdit_InsertScanner_Identifier = "KMPDFToolbar_PageEdit_InsertScanner_Identifier"
  23. let KMPDFToolbar_PageEdit_Extract_Identifier = "KMPDFToolbar_PageEdit_Extract_Identifier"
  24. let KMPDFToolbar_PageEdit_Replace_Identifier = "KMPDFToolbar_PageEdit_Replace_Identifier"
  25. let KMPDFToolbar_PageEdit_Split_Identifier = "KMPDFToolbar_PageEdit_Split_Identifier"
  26. let KMPDFToolbar_PageEdit_Reverse_Identifier = "KMPDFToolbar_PageEdit_Reverse_Identifier"
  27. let KMPDFToolbar_PageEdit_LeftRotate_Identifier = "KMPDFToolbar_PageEdit_LeftRotate_Identifier"
  28. let KMPDFToolbar_PageEdit_RightRotate_Identifier = "KMPDFToolbar_PageEdit_RightRotate_Identifier"
  29. let KMPDFToolbar_PageEdit_Delete_Identifier = "KMPDFToolbar_PageEdit_Delete_Identifier"
  30. let KMPDFToolbar_PageEdit_Reduce_Identifier = "KMPDFToolbar_PageEdit_Reduce_Identifier"
  31. let KMPDFToolbar_PageEdit_Increase_Identifier = "KMPDFToolbar_PageEdit_Increase_Identifier"
  32. //MARK: -ViewTools
  33. let KMPDFToolbar_View_Select_Identifier = "KMPDFToolbar_View_Select_Identifier"
  34. let KMPDFToolbar_View_Scroll_Identifier = "KMPDFToolbar_View_Scroll_Identifier"
  35. let KMPDFToolbar_View_ContentSelection_Identifier = "KMPDFToolbar_View_ContentSelection_Identifier"
  36. let KMPDFToolbar_View_Magnify_Identifier = "KMPDFToolbar_View_Magnify_Identifier"
  37. let KMPDFToolbar_View_AreaZoom_Identifier = "KMPDFToolbar_View_AreaZoom_Identifier"
  38. //MARK: -Scale
  39. let KMPDFToolbar_Zoom_AdapWidth_Identifier = "KMPDFToolbar_Zoom_AdapWidth_Identifier"
  40. let KMPDFToolbar_Zoom_AdapPage_Identifier = "KMPDFToolbar_Zoom_AdapPage_Identifier"
  41. let KMPDFToolbar_Zoom_ActualSize_Identifier = "KMPDFToolbar_Zoom_ActualSize_Identifier"
  42. let KMPDFToolbar_Zoom_10_Identifier = "KMPDFToolbar_Zoom_10_Identifier"
  43. let KMPDFToolbar_Zoom_25_Identifier = "KMPDFToolbar_Zoom_25_Identifier"
  44. let KMPDFToolbar_Zoom_50_Identifier = "KMPDFToolbar_Zoom_50_Identifier"
  45. let KMPDFToolbar_Zoom_75_Identifier = "KMPDFToolbar_Zoom_75_Identifier"
  46. let KMPDFToolbar_Zoom_100_Identifier = "KMPDFToolbar_Zoom_100_Identifier"
  47. let KMPDFToolbar_Zoom_150_Identifier = "KMPDFToolbar_Zoom_150_Identifier"
  48. let KMPDFToolbar_Zoom_200_Identifier = "KMPDFToolbar_Zoom_200_Identifier"
  49. let KMPDFToolbar_Zoom_400_Identifier = "KMPDFToolbar_Zoom_400_Identifier"
  50. let KMPDFToolbar_Zoom_800_Identifier = "KMPDFToolbar_Zoom_800_Identifier"
  51. //MARK: -ToolMode
  52. let KMPDFToolbar_Markup_Identifier = "KMPDFToolbar_Markup_Identifier"
  53. let KMPDFToolbar_Edit_Identifier = "KMPDFToolbar_Edit_Identifier"
  54. let KMPDFToolbar_Form_Identifier = "KMPDFToolbar_Form_Identifier"
  55. let KMPDFToolbar_Fill_Identifier = "KMPDFToolbar_Fill_Identifier"
  56. let KMPDFToolbar_Convert_Identifier = "KMPDFToolbar_Convert_Identifier"
  57. let KMPDFToolbar_Protect_Identifier = "KMPDFToolbar_Protect_Identifier"
  58. let KMPDFToolbar_Tools_Identifier = "KMPDFToolbar_Tools_Identifier"
  59. //MARK: -Right
  60. let KMPDFToolbar_undo_Identifier = "KMPDFToolbar_undo_Identifier"
  61. let KMPDFToolbar_redo_Identifier = "KMPDFToolbar_redo_Identifier"
  62. let KMPDFToolbar_save_Identifier = "KMPDFToolbar_save_Identifier"
  63. let KMPDFToolbar_aiTools_Identifier = "KMPDFToolbar_aiTools_Identifier"
  64. let KMPDFToolbar_batch_Identifier = "KMPDFToolbar_batch_Identifier"
  65. let KMPDFToolbar_tts_Identifier = "KMPDFToolbar_tts_Identifier"
  66. let KMPDFToolbar_ppt_Identifier = "KMPDFToolbar_ppt_Identifier"
  67. let KMPDFToolbar_print_Identifier = "KMPDFToolbar_print_Identifier"
  68. let KMPDFToolbar_share_PDF_Identifier = "KMPDFToolbar_share_PDF_Identifier"
  69. let KMPDFToolbar_share_Flattened_Identifier = "KMPDFToolbar_share_Flattened_Identifier"
  70. let KMPDFToolbar_share_Original_Identifier = "KMPDFToolbar_share_Original_Identifier"
  71. let KMPDFToolbar_rightView_Identifier = "KMPDFToolbar_rightView_Identifier"
  72. //MARK: -Markup
  73. let KMPDFToolbar_highlight_Identifier = "KMPDFToolbar_highlight_Identifier"
  74. let KMPDFToolbar_underline_Identifier = "KMPDFToolbar_underline_Identifier"
  75. let KMPDFToolbar_waveline_Identifier = "KMPDFToolbar_waveline_Identifier"
  76. let KMPDFToolbar_strikethrough_Identifier = "KMPDFToolbar_strikethrough_Identifier"
  77. let KMPDFToolbar_text_Identifier = "KMPDFToolbar_text_Identifier"
  78. let KMPDFToolbar_note_Identifier = "KMPDFToolbar_note_Identifier"
  79. let KMPDFToolbar_pen_Identifier = "KMPDFToolbar_pen_Identifier"
  80. let KMPDFToolbar_eraser_Identifier = "KMPDFToolbar_eraser_Identifier"
  81. let KMPDFToolbar_rectangle_Identifier = "KMPDFToolbar_rectangle_Identifier"
  82. let KMPDFToolbar_circle_Identifier = "KMPDFToolbar_circle_Identifier"
  83. let KMPDFToolbar_arrow_Identifier = "KMPDFToolbar_arrow_Identifier"
  84. let KMPDFToolbar_line_Identifier = "KMPDFToolbar_line_Identifier"
  85. let KMPDFToolbar_stamp_Identifier = "KMPDFToolbar_stamp_Identifier"
  86. let KMPDFToolbar_sign_Identifier = "KMPDFToolbar_sign_Identifier"
  87. let KMPDFToolbar_eye_Identifier = "KMPDFToolbar_eye_Identifier"
  88. //MARK: -Edit
  89. let KMPDFToolbar_edit_text_Identifier = "KMPDFToolbar_edit_text_Identifier"
  90. let KMPDFToolbar_edit_image_Identifier = "KMPDFToolbar_edit_image_Identifier"
  91. let KMPDFToolbar_edit_link_Identifier = "KMPDFToolbar_edit_link_Identifier"
  92. let KMPDFToolbar_edit_crop_Identifier = "KMPDFToolbar_edit_crop_Identifier"
  93. let KMPDFToolbar_edit_addWatermark_Identifier = "KMPDFToolbar_edit_addWatermark_Identifier"
  94. let KMPDFToolbar_edit_removeWatermark_Identifier = "KMPDFToolbar_edit_removeWatermark_Identifier"
  95. let KMPDFToolbar_edit_batch_AddWatermark_Identifier = "KMPDFToolbar_edit_batch_AddWatermark_Identifier"
  96. let KMPDFToolbar_edit_batchRemoveWatermark_Identifier = "KMPDFToolbar_edit_batchRemoveWatermark_Identifier"
  97. let KMPDFToolbar_edit_addBG_Identifier = "KMPDFToolbar_edit_addBG_Identifier"
  98. let KMPDFToolbar_edit_removeBG_Identifier = "KMPDFToolbar_edit_removeBG_Identifier"
  99. let KMPDFToolbar_edit_batch_AddBG_Identifier = "KMPDFToolbar_edit_batch_AddBG_Identifier"
  100. let KMPDFToolbar_edit_batchRemoveBG_Identifier = "KMPDFToolbar_edit_batchRemoveBG_Identifier"
  101. let KMPDFToolbar_edit_addHF_Identifier = "KMPDFToolbar_edit_addHF_Identifier"
  102. let KMPDFToolbar_edit_removeHF_Identifier = "KMPDFToolbar_edit_removeHF_Identifier"
  103. let KMPDFToolbar_edit_batch_AddHF_Identifier = "KMPDFToolbar_edit_batch_AddHF_Identifier"
  104. let KMPDFToolbar_edit_batchRemoveHF_Identifier = "KMPDFToolbar_edit_batchRemoveHF_Identifier"
  105. let KMPDFToolbar_edit_addBates_Identifier = "KMPDFToolbar_edit_addBates_Identifier"
  106. let KMPDFToolbar_edit_removeBates_Identifier = "KMPDFToolbar_edit_removeBates_Identifier"
  107. let KMPDFToolbar_edit_batch_AddBates_Identifier = "KMPDFToolbar_edit_batch_AddBates_Identifier"
  108. let KMPDFToolbar_edit_batchRemoveBates_Identifier = "KMPDFToolbar_edit_batchRemoveBates_Identifier"
  109. //MARK: -Form
  110. let KMPDFToolbar_form_text_Identifier = "KMPDFToolbar_form_text_Identifier"
  111. let KMPDFToolbar_form_checkbox_Identifier = "KMPDFToolbar_form_checkbox_Identifier"
  112. let KMPDFToolbar_form_radio_Identifier = "KMPDFToolbar_form_radio_Identifier"
  113. let KMPDFToolbar_form_list_Identifier = "KMPDFToolbar_form_list_Identifier"
  114. let KMPDFToolbar_form_dropdown_Identifier = "KMPDFToolbar_form_dropdown_Identifier"
  115. let KMPDFToolbar_form_OK_Identifier = "KMPDFToolbar_form_OK_Identifier"
  116. let KMPDFToolbar_form_digitalSign_Identifier = "KMPDFToolbar_form_digitalSign_Identifier"
  117. //MARK: -Fill
  118. let KMPDFToolbar_fill_tick_Identifier = "KMPDFToolbar_fill_tick_Identifier"
  119. let KMPDFToolbar_fill_fork_Identifier = "KMPDFToolbar_fill_fork_Identifier"
  120. let KMPDFToolbar_fill_rectangle_Identifier = "KMPDFToolbar_fill_rectangle_Identifier"
  121. let KMPDFToolbar_fill_line_Identifier = "KMPDFToolbar_fill_line_Identifier"
  122. let KMPDFToolbar_fill_dot_Identifier = "KMPDFToolbar_fill_dot_Identifier"
  123. let KMPDFToolbar_fill_date_Identifier = "KMPDFToolbar_fill_date_Identifier"
  124. let KMPDFToolbar_fill_sign_Identifier = "KMPDFToolbar_fill_sign_Identifier"
  125. //MARK: -Convert
  126. let KMPDFToolbar_convert_word_Identifier = "KMPDFToolbar_convert_word_Identifier"
  127. let KMPDFToolbar_convert_excel_Identifier = "KMPDFToolbar_convert_excel_Identifier"
  128. let KMPDFToolbar_convert_ppt_Identifier = "KMPDFToolbar_convert_ppt_Identifier"
  129. let KMPDFToolbar_convert_image_Identifier = "KMPDFToolbar_convert_image_Identifier"
  130. let KMPDFToolbar_convert_others_Identifier = "KMPDFToolbar_convert_others_Identifier"
  131. let KMPDFToolbar_convert_imageToPDF_Identifier = "KMPDFToolbar_convert_imageToPDF_Identifier"
  132. let KMPDFToolbar_convert_ocr_Identifier = "KMPDFToolbar_convert_ocr_Identifier"
  133. let KMPDFToolbar_convert_RTF_Identifier = "KMPDFToolbar_convert_RTF_Identifier"
  134. let KMPDFToolbar_convert_CSV_Identifier = "KMPDFToolbar_convert_CSV_Identifier"
  135. let KMPDFToolbar_convert_HTML_Identifier = "KMPDFToolbar_convert_HTML_Identifier"
  136. let KMPDFToolbar_convert_Text_Identifier = "KMPDFToolbar_convert_Text_Identifier"
  137. let KMPDFToolbar_convert_Json_Identifier = "KMPDFToolbar_convert_Json_Identifier"
  138. //MARK: -Protect
  139. let KMPDFToolbar_protect_redact_Identifier = "KMPDFToolbar_protect_redact_Identifier"
  140. let KMPDFToolbar_protect_security_Identifier = "KMPDFToolbar_protect_security_Identifier"
  141. let KMPDFToolbar_protect_removeSecurity_Identifier = "KMPDFToolbar_protect_removeSecurity_Identifier"
  142. let KMPDFToolbar_protect_digitalSign_Identifier = "KMPDFToolbar_protect_digitalSign_Identifier"
  143. //MARK: -Tools
  144. let KMPDFToolbar_tools_OCR_Identifier = "KMPDFToolbar_tools_OCR_Identifier"
  145. let KMPDFToolbar_tools_merge_Identifier = "KMPDFToolbar_tools_merge_Identifier"
  146. let KMPDFToolbar_tools_compress_Identifier = "KMPDFToolbar_tools_compress_Identifier"
  147. let KMPDFToolbar_tools_compare_Identifier = "KMPDFToolbar_tools_compare_Identifier"
  148. let KMPDFToolbar_tools_extractImage_Identifier = "KMPDFToolbar_tools_extractImage_Identifier"
  149. let KMPDFToolbar_tools_TTS_Identifier = "KMPDFToolbar_tools_TTS_Identifier"
  150. let KMPDFToolbar_tools_batch_Identifier = "KMPDFToolbar_tools_batch_Identifier"
  151. let KMPDFToolbar_tools_AITools_Identifier = "KMPDFToolbar_tools_AITools_Identifier"
  152. class KMPDFToolbarConfig: NSObject {
  153. static func scaleZoomItems() -> [ComponentMenuitemProperty]{
  154. let items: [(String, String)] = [("Adaptation Width", KMPDFToolbar_Zoom_AdapWidth_Identifier),
  155. ("Adapt to Page", KMPDFToolbar_Zoom_AdapPage_Identifier),
  156. ("Actual Size", KMPDFToolbar_Zoom_ActualSize_Identifier),
  157. (" ", " "),
  158. ("10%", KMPDFToolbar_Zoom_10_Identifier),
  159. ("25%", KMPDFToolbar_Zoom_25_Identifier),
  160. ("50%", KMPDFToolbar_Zoom_50_Identifier),
  161. ("75%", KMPDFToolbar_Zoom_75_Identifier),
  162. ("100%", KMPDFToolbar_Zoom_100_Identifier),
  163. ("150%", KMPDFToolbar_Zoom_150_Identifier),
  164. ("200%", KMPDFToolbar_Zoom_200_Identifier),
  165. ("400%", KMPDFToolbar_Zoom_400_Identifier),
  166. ("800%", KMPDFToolbar_Zoom_800_Identifier)]
  167. var menuItemArr: [ComponentMenuitemProperty] = []
  168. for (i, value) in items {
  169. var itemProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, keyEquivalent: nil, text: KMLocalizedString(i, comment: ""), identifier: value)
  170. if i == " " {
  171. itemProperty = ComponentMenuitemProperty.divider()
  172. }
  173. menuItemArr.append(itemProperty)
  174. }
  175. return menuItemArr
  176. }
  177. }