123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638 |
- //
- // KMPDFToolbarManager.swift
- // PDF Reader Pro
- //
- // Created by Niehaoyu on 2024/10/22.
- //
- import Foundation
- import KMComponentLibrary
- //注释等颜色发生变化时调用
- let toolbarImageColorChangedNotificationName = NSNotification.Name("ToolbarImageColorChangedNotificationName")
- class KMPDFToolbarManager: NSObject {
-
- var pdfViewManager: KMPDFViewManager?
-
- let dividerProperty = ComponentDividerProperty(type: .vertical, dash: false)
-
- //MARK: -View
- var viewProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, identifier: KMPDFToolbar_ViewDisplay_Identifier)
-
- //MARK: -页面编辑
- var pageProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, identifier: KMPDFToolbar_PageEdit_Identifier)
-
- var page_pageInfo_Property: ComponentSelectProperties = ComponentSelectProperties(size: .xs, state: .normal, isDisabled: false, isError: false, leftIcon: false, placeholder: KMLocalizedString("Select Page"), errorText: nil, creatable: true, text: "")
-
- var page_page_oddPage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Odd Pages Only"), identifier: KMPDFToolbar_PageEdit_page_oddPage_Identifier)
- var page_page_EvenPage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Even Pages Only"), identifier: KMPDFToolbar_PageEdit_page_EvenPage_Identifier)
- var page_page_PortraitPage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Portrait pages"), identifier: KMPDFToolbar_PageEdit_page_PortraitPage_Identifier)
- var page_page_LandscapePage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Landscape pages"), identifier: KMPDFToolbar_PageEdit_page_LandscapePage_Identifier)
- var page_page_AllPage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("All Pages"), identifier: KMPDFToolbar_PageEdit_page_AllPage_Identifier)
- var page_page_CustomPage_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Custom"), identifier: KMPDFToolbar_PageEdit_page_CustomPage_Identifier)
-
- var page_Insert_Property: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Insert"), leftIcon: NSImage(named: "pageEdit_insert"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
-
- var page_Insert_File_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Insert File"), identifier: KMPDFToolbar_PageEdit_InsertFile_Identifier)
- var page_Insert_Blank_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("Insert Blank File"), identifier: KMPDFToolbar_PageEdit_InsertBlank_Identifier)
- var page_Insert_Clip_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("From Clipboard"), identifier: KMPDFToolbar_PageEdit_InsertClip_Identifier)
- var page_Insert_Scanner_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, text: KMLocalizedString("From Scanner"), identifier: KMPDFToolbar_PageEdit_InsertScanner_Identifier)
-
- var page_Extract_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Extract"), icon: NSImage(named: "pageEdit_extract"), keepPressState: false, identifier: KMPDFToolbar_PageEdit_Extract_Identifier)
- var page_Replace_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Replace"), icon: NSImage(named: "pageEdit_replace"), keepPressState: false, identifier: KMPDFToolbar_PageEdit_Replace_Identifier)
- var page_Split_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Split"),icon: NSImage(named: "pageEdit_split"), keepPressState: false, identifier: KMPDFToolbar_PageEdit_Split_Identifier)
- var page_Reverse_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Reverse"), icon: NSImage(named: "pageEdit_reverse"), keepPressState: false, identifier: KMPDFToolbar_PageEdit_Reverse_Identifier)
-
- var page_LeftRotate_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "pageEdit_rotateRight"), keepPressState: false,identifier: KMPDFToolbar_PageEdit_LeftRotate_Identifier)
- var page_RightRotate_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "pageEdit_rotateLeft"), keepPressState: false,identifier: KMPDFToolbar_PageEdit_RightRotate_Identifier)
- var page_Delete_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "pageEdit_delete"), keepPressState: false,identifier: KMPDFToolbar_PageEdit_Delete_Identifier)
- var page_Reduce_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "pageEdit_zoomout"), keepPressState: false,identifier: KMPDFToolbar_PageEdit_Reduce_Identifier)
- var page_Increase_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "pageEdit_zoomin"),keepPressState: false, identifier: KMPDFToolbar_PageEdit_Increase_Identifier)
-
- //MARK: -ToosView
- var toolsProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, leftIcon: NSImage(named: "toolbar_Tools_select"), showDropdown: true)
- var tools_selectProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_select"), keyEquivalent: KMLocalizedString("⇧1"), text: KMLocalizedString("Select"), identifier: KMPDFToolbar_View_Select_Identifier)
- var tools_scrollProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_scroll"), keyEquivalent: KMLocalizedString("⇧2"), text: KMLocalizedString("Scroll"), identifier: KMPDFToolbar_View_Scroll_Identifier)
- var tools_contentProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_content"), keyEquivalent: KMLocalizedString("⇧3"), text: KMLocalizedString("Content Selection"), identifier: KMPDFToolbar_View_ContentSelection_Identifier)
- var tools_magnifyProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_magnify"), keyEquivalent: KMLocalizedString("⇧4"), text: KMLocalizedString("Magnify"), identifier: KMPDFToolbar_View_Magnify_Identifier)
- var tools_areaProperty: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "toolbar_Tools_zoom"), keyEquivalent: KMLocalizedString("⇧5"), text: KMLocalizedString("Area Zoom"), identifier: KMPDFToolbar_View_AreaZoom_Identifier)
-
- //MARK: -缩放比例
- var selectZoomProperty: ComponentSelectZoomProperty = ComponentSelectZoomProperty(state: .normal, isDisabled: false, text: "100%", leftIcon_nor: NSImage(named: "toolbar_minus"), leftIcon_dis: NSImage(named: "toolbar_minus_dis"), dropdownIcon: NSImage(named: "toolbar_zoom_dropdown"), rightIcon_nor: NSImage(named: "toolbar_plus"), rightIcon_dis: NSImage(named: "toolbar_plus_dis"))
-
- //MARK: -工具栏
- let markupMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Markup"), identifier: KMPDFToolbar_Markup_Identifier)
- let editMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Edit"), identifier: KMPDFToolbar_Edit_Identifier)
- let formMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Form"), identifier: KMPDFToolbar_Form_Identifier)
- let fillMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Fill"), identifier: KMPDFToolbar_Fill_Identifier)
- let convertMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Convert"), identifier: KMPDFToolbar_Convert_Identifier)
- let protectMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Protect"), identifier: KMPDFToolbar_Protect_Identifier)
- let toolsMode_Property = ComponentTabsProperty(tabsType: .underline_Center, state: .normal, showIcon: false, title: KMLocalizedString("Tools"), identifier: KMPDFToolbar_Tools_Identifier)
-
- //MARK: -右侧模块
- var undoProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_undo"), keepPressState: false, identifier: KMPDFToolbar_undo_Identifier)
- var redoProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_redo"), keepPressState: false,identifier: KMPDFToolbar_redo_Identifier)
- var saveProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_save"), keepPressState: false,identifier: KMPDFToolbar_save_Identifier)
- var batchProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_batch"), keepPressState: false,identifier: KMPDFToolbar_batch_Identifier)
- var ttsProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_TTS"), keepPressState: false,identifier: KMPDFToolbar_tts_Identifier)
- var pptProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_ppt"), keepPressState: false,identifier: KMPDFToolbar_ppt_Identifier)
- var printProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_print"), keepPressState: false, identifier: KMPDFToolbar_print_Identifier)
- var fileInfo_Property: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_fileInfo"), keepPressState: false, identifier: KMPDFToolbar_fileInfo_Identifier)
- var shareProperty: ComponentDropdownToolProperty = ComponentDropdownToolProperty(state: .normal, leftIcon: NSImage(named: "toolbar_share"), identifier: KMPDFToolbar_share_Identifier)
- var share_PDF_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("PDF"), identifier: KMPDFToolbar_share_PDF_Identifier)
- var share_Flatted_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Flattened Copy"), identifier: KMPDFToolbar_share_Flattened_Identifier)
- var share_Original_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Original PDF"), identifier: KMPDFToolbar_share_Original_Identifier)
-
- var rightViewProperty: ComponentButtonProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_rightView"), identifier: KMPDFToolbar_rightView_Identifier)
-
- //MARK: -Markup
- let highlightProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkup_HighlightImage(), identifier: KMPDFToolbar_highlight_Identifier)
- let UnderlineProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkupUnderlineImage(), identifier: KMPDFToolbar_underline_Identifier)
- let wavelineProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkupwavylineImage(), identifier: KMPDFToolbar_waveline_Identifier)
- let strikethroughProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkupStrikethroughImage(), identifier: KMPDFToolbar_strikethrough_Identifier)
-
- let textProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_text"), identifier: KMPDFToolbar_text_Identifier)
- let noteProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkupNoteImage(), identifier: KMPDFToolbar_note_Identifier)
-
- let penProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: KMPDFToolbarManager.getMarkupPenImage(), identifier: KMPDFToolbar_pen_Identifier)
- let eraserProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_erase"), identifier: KMPDFToolbar_eraser_Identifier)
-
- let rectangleProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_rectangle"), identifier: KMPDFToolbar_rectangle_Identifier)
- let circleProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_oval"), identifier: KMPDFToolbar_circle_Identifier)
- let arrowProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_arrow"), identifier: KMPDFToolbar_arrow_Identifier)
- let lineProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_line"), identifier: KMPDFToolbar_line_Identifier)
- let measureProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "toolbar_measure"), identifier: KMPDFToolbar_measure_Identifier)
-
- let stampProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_stamp"), identifier: KMPDFToolbar_stamp_Identifier)
- let signProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_sign"), identifier: KMPDFToolbar_sign_Identifier)
-
- let eyeProperty = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_show"), identifier: KMPDFToolbar_eye_Identifier)
-
- //MARK: -Edit
- let edit_text_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Text"), icon: NSImage(named: "markup_text"), identifier: KMPDFToolbar_edit_text_Identifier)
- let edit_image_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Image"), icon: NSImage(named: "edit_image"), identifier: KMPDFToolbar_edit_image_Identifier)
- let edit_link_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Link"), icon: NSImage(named: "edit_link"), identifier: KMPDFToolbar_edit_link_Identifier)
-
- let edit_crop_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Crop"), icon: NSImage(named: "edit_crop"), identifier: KMPDFToolbar_edit_crop_Identifier)
-
- let edit_watermark_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Watermark"), leftIcon: NSImage(named: "edit_watermark"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"), identifier: "")
- var edit_watermark_add_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Add Watermark"), identifier: KMPDFToolbar_edit_addWatermark_Identifier)
- var edit_watermark_remove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Remove Watermark"), identifier: KMPDFToolbar_edit_removeWatermark_Identifier)
- var edit_watermark_batchAdd_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Add Watermarks"), identifier: KMPDFToolbar_edit_batch_AddWatermark_Identifier)
- var edit_watermark_batchRemove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Remove Watermarks"), identifier: KMPDFToolbar_edit_batchRemoveWatermark_Identifier)
-
- let edit_background_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Background"), leftIcon: NSImage(named: "edit_background"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"), identifier: "")
- var edit_bg_add_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Add Background"), identifier: KMPDFToolbar_edit_addBG_Identifier)
- var edit_bg_remove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Remove Background"), identifier: KMPDFToolbar_edit_removeBG_Identifier)
- var edit_bg_batchAdd_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Add Background"), identifier: KMPDFToolbar_edit_batch_AddBG_Identifier)
- var edit_bg_batchRemove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Remove Background"), identifier: KMPDFToolbar_edit_batchRemoveBG_Identifier)
-
- let edit_headerfooter_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Header & Footer"), leftIcon: NSImage(named: "edit_headerfooter"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"), identifier: "")
- var edit_hf_add_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Add Header & Footer"), identifier: KMPDFToolbar_edit_addHF_Identifier)
- var edit_hf_remove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Remove Header & Footer"), identifier: KMPDFToolbar_edit_removeHF_Identifier)
- var edit_hf_batchAdd_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Add Header & Footer"), identifier: KMPDFToolbar_edit_batch_AddHF_Identifier)
- var edit_hf_batchRemove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Remove Header & Footer"), identifier: KMPDFToolbar_edit_batchRemoveHF_Identifier)
-
- let edit_bates_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Bates Numbers"), leftIcon: NSImage(named: "edit_bates"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"), identifier: "")
- var edit_bates_add_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Add Bates Numbers"), identifier: KMPDFToolbar_edit_addBates_Identifier)
- var edit_bates_remove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Remove Bates Numbers"), identifier: KMPDFToolbar_edit_removeBates_Identifier)
- var edit_bates_batchAdd_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Add Bates Numbers"), identifier: KMPDFToolbar_edit_batch_AddBates_Identifier)
- var edit_bates_batchRemove_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Remove Bates Numbers"), identifier: KMPDFToolbar_edit_batchRemoveBates_Identifier)
-
- //MARK: -Form
- let form_text_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Text Field"), icon: NSImage(named: "form_text"), identifier: KMPDFToolbar_form_text_Identifier)
- let form_checkbox_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Check Box"), icon: NSImage(named: "form_checkbox"), identifier: KMPDFToolbar_form_checkbox_Identifier)
- let form_radio_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Radio"), icon: NSImage(named: "form_radio"), identifier: KMPDFToolbar_form_radio_Identifier)
- let form_list_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("List"), icon: NSImage(named: "form_listbox"), identifier: KMPDFToolbar_form_list_Identifier)
- let form_dropdown_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Dropdown"), icon: NSImage(named: "form_dropdown"), identifier: KMPDFToolbar_form_dropdown_Identifier)
- let form_OK_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Button"), icon: NSImage(named: "form_OK"), identifier: KMPDFToolbar_form_OK_Identifier)
- let form_digitalSign_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Digital Signature"), icon: NSImage(named: "form_digitalSign"), identifier: KMPDFToolbar_form_digitalSign_Identifier)
-
- let form_alignment_Property = ComponentDropdownToolProperty(state: .normal, text: nil, leftIcon: NSImage(named: "form_alignment"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
- let form_more_Property = ComponentDropdownToolProperty(state: .normal, text: nil, leftIcon: NSImage(named: "form_more"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
-
- var form_alignment_left_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignLeft"), text: KMLocalizedString("Align Left"), identifier: KMPDFToolbar_form_Align_Left_Identifier)
- var form_alignment_Hori_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignXCenter"), text: KMLocalizedString("Align Horizontally"), identifier: KMPDFToolbar_form_Align_Hori_Identifier)
- var form_alignment_Right_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignRight"), text: KMLocalizedString("Align Right"), identifier: KMPDFToolbar_form_Align_Right_Identifier)
- var form_alignment_Top_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignTop"), text: KMLocalizedString("Align Top"), identifier: KMPDFToolbar_form_Align_Top_Identifier)
- var form_alignment_Vert_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignYCenter"), text: KMLocalizedString("Align Vertically"), identifier: KMPDFToolbar_form_Align_Vert_Identifier)
- var form_alignment_Bottom_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignBottom"), text: KMLocalizedString("Align Bottom"), identifier: KMPDFToolbar_form_Align_Bottom_Identifier)
- var form_alignment_Distribute_Vert_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignHorizonal"), text: KMLocalizedString("Distribute Vertically"), identifier: KMPDFToolbar_form_Distribute_Vert_Identifier)
- var form_alignment_Distribute_Hori_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(lefticon: NSImage(named: "alignAverageVertical"), text: KMLocalizedString("Distribute Horizontally"), identifier: KMPDFToolbar_form_Distribute_Hori_Identifier)
-
-
- var form_Highlight_Fields_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(righticon: NSImage(named: "tick_Green"), text: KMLocalizedString("Highlight Existing Fields"), identifier: KMPDFToolbar_form_HighlightFields_Identifier)
- var form_ShowName_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(righticon: NSImage(named: "tick_Green"), text: KMLocalizedString("Show Name"), identifier: KMPDFToolbar_form_ShowName_Identifier)
- var form_ClearForm_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Clear Form"), identifier: KMPDFToolbar_form_ClearForm_Identifier)
-
- //MARK: -Fill
- let fill_tick_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_tick"), identifier: KMPDFToolbar_fill_tick_Identifier)
- let fill_fork_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_fork"), identifier: KMPDFToolbar_fill_fork_Identifier)
- let fill_rectangle_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_rectangle"), identifier: KMPDFToolbar_fill_rectangle_Identifier)
- let fill_line_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_line"), identifier: KMPDFToolbar_fill_line_Identifier)
- let fill_dot_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_dot"), identifier: KMPDFToolbar_fill_dot_Identifier)
- let fill_date_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "fill_date"), identifier: KMPDFToolbar_fill_date_Identifier)
- let fill_sign_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, onlyIcon: true, icon: NSImage(named: "markup_sign"), identifier: KMPDFToolbar_fill_sign_Identifier)
-
- //MARK: -Convert
- let convert_word_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("To Word"), icon: NSImage(named: "convert_word"), keepPressState: false,identifier: KMPDFToolbar_convert_word_Identifier)
- let convert_excel_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("To Excel"), icon: NSImage(named: "convert_excel"), keepPressState: false,identifier: KMPDFToolbar_convert_excel_Identifier)
- let convert_ppt_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("To PPT"), icon: NSImage(named: "convert_ppt"), keepPressState: false,identifier: KMPDFToolbar_convert_ppt_Identifier)
- let convert_image_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("To Image"), icon: NSImage(named: "convert_image"), keepPressState: false,identifier: KMPDFToolbar_convert_image_Identifier)
-
- let convert_others_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("To Others"), leftIcon: NSImage(named: "form_more"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
-
- let convert_imageToPDF_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Image to PDF"), icon: NSImage(named: "convert_imageToPdf"), keepPressState: false,identifier: KMPDFToolbar_convert_imageToPDF_Identifier)
-
- let convert_ocr_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("OCR"), icon: NSImage(named: "convert_ocr"), identifier: KMPDFToolbar_convert_ocr_Identifier)
-
- var convert_RTF_property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "convert_rtf"), keyEquivalent: nil, text: KMLocalizedString("To RTF"), identifier: KMPDFToolbar_convert_RTF_Identifier)
- var convert_CSV_property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "convert_csv"), keyEquivalent: nil, text: KMLocalizedString("To CSV"), identifier: KMPDFToolbar_convert_CSV_Identifier)
- var convert_HTML_property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "convert_html"), keyEquivalent: nil, text: KMLocalizedString("To HTML"), identifier: KMPDFToolbar_convert_HTML_Identifier)
- var convert_Text_property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "convert_text"), keyEquivalent: nil, text: KMLocalizedString("To Text"), identifier: KMPDFToolbar_convert_Text_Identifier)
- var convert_Json_property: ComponentMenuitemProperty = ComponentMenuitemProperty(multipleSelect: false, itemSelected: false, isDisabled: false, lefticon: NSImage(named: "convert_Json"), keyEquivalent: nil, text: KMLocalizedString("To Json"), identifier: KMPDFToolbar_convert_Json_Identifier)
-
- //MARK: -Protect
- let protect_redact_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Redact"), icon: NSImage(named: "protect_redact"), identifier: KMPDFToolbar_protect_redact_Identifier)
- let protect_security_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Security"), icon: NSImage(named: "protect_security"), identifier: KMPDFToolbar_protect_security_Identifier)
- let protect_removeSecurity_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Remove Security"), icon: NSImage(named: "protect_security"), identifier: KMPDFToolbar_protect_removeSecurity_Identifier)
- let protect_digitalSign_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Digital Signature"), icon: NSImage(named: "form_digitalSign"), identifier: KMPDFToolbar_protect_digitalSign_Identifier)
-
- //MARK: -Tools
- let tools_OCR_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("OCR"), icon: NSImage(named: "tools_OCR"), identifier: KMPDFToolbar_tools_OCR_Identifier)
- let tools_merge_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Merge"), icon: NSImage(named: "tools_merge"), identifier: KMPDFToolbar_tools_merge_Identifier)
- let tools_compress_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Compress"), leftIcon: NSImage(named: "tools_compare"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
- var tools_compress_compress_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Compress"), identifier: KMPDFToolbar_tools_compress_Identifier)
- var tools_compress_batchCompress_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Batch Compress"), identifier: KMPDFToolbar_tools_batch_compress_Identifier)
-
- let tools_compare_Property = ComponentDropdownToolProperty(state: .normal, text: KMLocalizedString("Compare"), leftIcon: NSImage(named: "tools_compare"), showDropdown: true, arrowIcon: NSImage(named: "toolbar_arrowDown_fill"))
- var tools_compare_Side_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Compare Side-by-Side"), identifier: KMPDFToolbar_tools_compare_side_Identifier)
- var tools_compare_Overlay_Property: ComponentMenuitemProperty = ComponentMenuitemProperty(text: KMLocalizedString("Compare by Overlay"), identifier: KMPDFToolbar_tools_compare_Overlay_Identifier)
-
- let tools_extractImage_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Extract Image"), icon: NSImage(named: "tools_extractImg"), identifier: KMPDFToolbar_tools_extractImage_Identifier)
- let tools_TTS_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("TTS"), icon: NSImage(named: "tools_TTS"), identifier: KMPDFToolbar_tools_TTS_Identifier)
- let tools_batch_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("Batch"), icon: NSImage(named: "tools_batch"), identifier: KMPDFToolbar_tools_batch_Identifier)
- let tools_AITools_Property = ComponentButtonProperty(type: .text_gray_opacity, size: .xs, showLeftIcon: true, buttonText: KMLocalizedString("AI Tools"), icon: NSImage(named: "tools_AITools"), identifier: KMPDFToolbar_tools_AITools_Identifier)
-
- var totalRightPropertys: [NSObject] = []
- var validRightPropertys: [NSObject] = [] {//右侧展示的icon集合
- didSet {
- var ids: [String] = []
- for property in validRightPropertys {
- if property is ComponentButtonProperty {
- if (property as! ComponentButtonProperty).identifier.count > 0 {
- ids.append((property as! ComponentButtonProperty).identifier)
- }
- } else if property is ComponentDropdownToolProperty {
- if (property as! ComponentDropdownToolProperty).identifier.count > 0 {
- ids.append((property as! ComponentDropdownToolProperty).identifier)
- }
- }
- }
- UserDefaults.standard.setValue(ids, forKey: "ToolBarValidRightPropertysKey")
- }
- }
-
- //MARK: - func
- override init() {
- super.init()
-
- self.initData()
-
- }
-
- func initData() {
- viewProperty.icon = NSImage(named: "toolbar_View")
-
- pageProperty.icon = NSImage(named: "toolbar_Page")
-
- reloadToolsData()
- var menuItemArr: [ComponentMenuitemProperty] = []
- if true {
- menuItemArr.append(tools_selectProperty)
- menuItemArr.append(tools_scrollProperty)
- menuItemArr.append(tools_contentProperty)
- menuItemArr.append(tools_magnifyProperty)
- menuItemArr.append(tools_areaProperty)
- toolsProperty.menuItemArr = menuItemArr
- }
-
- if true {
- selectZoomProperty.menuItemArr = KMPDFToolbarConfig.scaleZoomItems()
- }
-
- undoProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_undo")
- redoProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_redo")
- printProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_print")
- fileInfo_Property.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_fileInfo")
- rightViewProperty.propertyInfo.leftIcon_nor = NSImage(named: "toolbar_rightView")
-
- shareProperty.menuItemArr = [share_PDF_Property, share_Flatted_Property, share_Original_Property]
-
- totalRightPropertys = [undoProperty, redoProperty, saveProperty, fileInfo_Property, batchProperty, ttsProperty, pptProperty, printProperty, shareProperty]
-
- if let propertys = UserDefaults.standard.array(forKey: "ToolBarValidRightPropertysKey") as? [String] {
- validRightPropertys = []
- for buttonProperty in [undoProperty, redoProperty, saveProperty, batchProperty, ttsProperty, pptProperty, printProperty, fileInfo_Property] {
- if propertys.contains(buttonProperty.identifier) {
- validRightPropertys.append(buttonProperty)
- }
- }
- if propertys.contains(shareProperty.identifier) {
- validRightPropertys.append(shareProperty)
- }
- } else {
- validRightPropertys = [undoProperty, redoProperty, printProperty, shareProperty]
- }
-
- refreshMarkupColorImages()
- }
-
- //MARK: - 刷新tools工具
- func reloadToolsData() {
- let toolsType = pdfViewManager?.viewToolsType ?? .none
-
- if toolsType == .Scroll {
- toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_scroll")
- } else if toolsType == .Content_Selection {
- toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_content")
- } else if toolsType == .Magnify {
- toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_magnify")
- } else if toolsType == .AreaZoom {
- toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_zoom")
- } else {
- toolsProperty.leftIcon = NSImage(named: "toolbar_Tools_select")
- }
- }
-
- //MARK: - 获取二级工具栏内容
- func getSubToolItemIdentifys(_ mainIdentify: String) -> [String] {
- var ids: [String] = []
-
- if mainIdentify == KMPDFToolbar_View_Identifier {
- ids.append(contentsOf: [KMPDFToolbar_View_Select_Identifier,
- KMPDFToolbar_View_Scroll_Identifier,
- KMPDFToolbar_View_ContentSelection_Identifier,
- KMPDFToolbar_View_Magnify_Identifier,
- KMPDFToolbar_View_AreaZoom_Identifier])
- } else if mainIdentify == KMPDFToolbar_PageEdit_Identifier {
- ids.append(contentsOf: [page_page_oddPage_Property.identifier, page_page_EvenPage_Property.identifier,
- page_page_PortraitPage_Property.identifier, page_page_LandscapePage_Property.identifier,
- page_page_AllPage_Property.identifier, page_page_CustomPage_Property.identifier])
-
- ids.append(contentsOf: [page_Insert_File_Property.identifier, page_Insert_Blank_Property.identifier,
- page_Insert_Clip_Property.identifier,
- page_Insert_Scanner_Property.identifier])
-
- ids.append(contentsOf: [page_Extract_Property.identifier,
- page_Replace_Property.identifier, page_Split_Property.identifier,
- page_Reverse_Property.identifier,
- page_LeftRotate_Property.identifier, page_RightRotate_Property.identifier,
- page_Delete_Property.identifier])
-
- ids.append(contentsOf: [page_Increase_Property.identifier,page_Reduce_Property.identifier])
-
- } else if mainIdentify == KMPDFToolbar_Markup_Identifier {
- ids.append(contentsOf: [highlightProperty.identifier, UnderlineProperty.identifier,
- wavelineProperty.identifier, strikethroughProperty.identifier,
- textProperty.identifier, noteProperty.identifier,
- penProperty.identifier, eraserProperty.identifier,
- rectangleProperty.identifier, circleProperty.identifier,
- arrowProperty.identifier, lineProperty.identifier,
- measureProperty.identifier,
- stampProperty.identifier, signProperty.identifier,
- eyeProperty.identifier])
- } else if mainIdentify == KMPDFToolbar_Edit_Identifier {
- ids.append(contentsOf: [KMPDFToolbar_edit_Watermark_Identifier, edit_watermark_add_Property.identifier, edit_watermark_remove_Property.identifier,
- edit_watermark_batchAdd_Property.identifier, edit_watermark_batchRemove_Property.identifier])
-
- ids.append(contentsOf: [KMPDFToolbar_edit_BG_Identifier, edit_bg_add_Property.identifier, edit_bg_remove_Property.identifier,
- edit_bg_batchAdd_Property.identifier, edit_bg_batchRemove_Property.identifier])
-
- ids.append(contentsOf: [KMPDFToolbar_edit_HF_Identifier, edit_hf_add_Property.identifier, edit_hf_remove_Property.identifier,
- edit_hf_batchAdd_Property.identifier, edit_hf_batchRemove_Property.identifier])
-
- ids.append(contentsOf: [KMPDFToolbar_edit_Bates_Identifier, edit_bates_add_Property.identifier, edit_bates_remove_Property.identifier,
- edit_bates_batchAdd_Property.identifier, edit_bates_batchRemove_Property.identifier])
-
- ids.append(contentsOf: [edit_text_Property.identifier, edit_image_Property.identifier,
- edit_link_Property.identifier, edit_watermark_Property.identifier,
- edit_background_Property.identifier, edit_headerfooter_Property.identifier,
- edit_bates_Property.identifier, edit_crop_Property.identifier])
-
- } else if mainIdentify == KMPDFToolbar_Form_Identifier {
- ids.append(contentsOf: [KMPDFToolbar_form_Align_Left_Identifier, KMPDFToolbar_form_Align_Hori_Identifier,
- KMPDFToolbar_form_Align_Right_Identifier, KMPDFToolbar_form_Align_Top_Identifier,
- KMPDFToolbar_form_Align_Vert_Identifier, KMPDFToolbar_form_Align_Bottom_Identifier,
- KMPDFToolbar_form_Distribute_Vert_Identifier, KMPDFToolbar_form_Distribute_Hori_Identifier])
-
- ids.append(contentsOf: [form_text_Property.identifier, form_checkbox_Property.identifier, form_radio_Property.identifier, form_list_Property.identifier,
- form_dropdown_Property.identifier, form_OK_Property.identifier, form_digitalSign_Property.identifier,
- form_alignment_Property.identifier, form_more_Property.identifier, KMPDFToolbar_form_HighlightFields_Identifier, KMPDFToolbar_form_ShowName_Identifier,
- KMPDFToolbar_form_ClearForm_Identifier])
-
- } else if mainIdentify == KMPDFToolbar_Fill_Identifier {
- ids.append(contentsOf: [fill_tick_Property.identifier,
- fill_fork_Property.identifier,
- fill_rectangle_Property.identifier,
- fill_line_Property.identifier,
- fill_dot_Property.identifier,
- fill_date_Property.identifier,
- fill_sign_Property.identifier])
-
- } else if mainIdentify == KMPDFToolbar_Convert_Identifier {
- ids.append(contentsOf: [convert_RTF_property.identifier,
- convert_CSV_property.identifier,
- convert_HTML_property.identifier,
- convert_Text_property.identifier,
- convert_Json_property.identifier])
-
- ids.append(contentsOf: [convert_word_Property.identifier,
- convert_excel_Property.identifier,
- convert_ppt_Property.identifier,
- convert_image_Property.identifier,
- convert_imageToPDF_Property.identifier,
- convert_ocr_Property.identifier])
-
- } else if mainIdentify == KMPDFToolbar_Protect_Identifier {
- ids.append(contentsOf: [KMPDFToolbar_protect_redact_Property_Identifier,
- KMPDFToolbar_protect_redact_Apply_Identifier,
- KMPDFToolbar_protect_redact_Exit_Identifier])
-
- ids.append(contentsOf: [protect_redact_Property.identifier,
- protect_security_Property.identifier,
- protect_removeSecurity_Property.identifier,
- protect_digitalSign_Property.identifier])
-
- } else if mainIdentify == KMPDFToolbar_Tools_Identifier {
- ids.append(contentsOf: [tools_OCR_Property.identifier,
- tools_merge_Property.identifier,
- tools_compress_compress_Property.identifier,
- tools_compress_batchCompress_Property.identifier,
- tools_compare_Property.identifier,
- tools_compare_Side_Property.identifier,
- tools_compare_Overlay_Property.identifier,
- tools_extractImage_Property.identifier,
- tools_TTS_Property.identifier,
- tools_batch_Property.identifier,
- tools_AITools_Property.identifier])
- } else if mainIdentify == KMPDFToolbar_Right_Identifiers {
- ids.append(contentsOf: [KMPDFToolbar_undo_Identifier,
- KMPDFToolbar_redo_Identifier,
- KMPDFToolbar_save_Identifier,
- KMPDFToolbar_aiTools_Identifier,
- KMPDFToolbar_batch_Identifier,
- KMPDFToolbar_tts_Identifier,
- KMPDFToolbar_ppt_Identifier,
- KMPDFToolbar_print_Identifier,
- KMPDFToolbar_fileInfo_Identifier,
- KMPDFToolbar_share_PDF_Identifier,
- KMPDFToolbar_share_Flattened_Identifier,
- KMPDFToolbar_share_Original_Identifier])
- }
-
- return ids
- }
-
- func getSubToolbarItems(_ modeType: KMPDFToolsMode = .None, isPageEditMode: Bool = false) -> [NSObject] {
- if isPageEditMode {
-
- page_pageInfo_Property.menuItemArr = [page_page_oddPage_Property, page_page_EvenPage_Property,
- page_page_PortraitPage_Property, page_page_LandscapePage_Property,
- page_page_AllPage_Property, ComponentMenuitemProperty.divider(),
- page_page_CustomPage_Property]
-
- page_Insert_Property.menuItemArr = [page_Insert_File_Property, page_Insert_Blank_Property,
- ComponentMenuitemProperty.divider(), page_Insert_Clip_Property,
- page_Insert_Scanner_Property]
-
- return [page_pageInfo_Property, dividerProperty,
- page_Insert_Property, page_Extract_Property,
- page_Replace_Property, page_Split_Property,
- page_Reverse_Property, dividerProperty,
- page_LeftRotate_Property, page_RightRotate_Property,
- page_Delete_Property]
- }
-
- if modeType == .Markup {
- eyeProperty.propertyInfo.leftIcon_press = NSImage(named: "markup_hide")
- return [highlightProperty, UnderlineProperty, wavelineProperty, strikethroughProperty,
- dividerProperty, textProperty, noteProperty, dividerProperty,
- penProperty, eraserProperty, dividerProperty, rectangleProperty,
- circleProperty, arrowProperty, lineProperty, measureProperty,
- dividerProperty,stampProperty, signProperty, dividerProperty, eyeProperty]
-
- } else if modeType == .Edit {
- edit_watermark_Property.menuItemArr = [edit_watermark_add_Property, edit_watermark_remove_Property,
- ComponentMenuitemProperty.divider(),
- edit_watermark_batchAdd_Property, edit_watermark_batchRemove_Property]
-
- edit_background_Property.menuItemArr = [edit_bg_add_Property, edit_bg_remove_Property,
- ComponentMenuitemProperty.divider(),
- edit_bg_batchAdd_Property, edit_bg_batchRemove_Property]
-
- edit_headerfooter_Property.menuItemArr = [edit_hf_add_Property, edit_hf_remove_Property,
- ComponentMenuitemProperty.divider(),
- edit_hf_batchAdd_Property, edit_hf_batchRemove_Property]
-
- edit_bates_Property.menuItemArr = [edit_bates_add_Property, edit_bates_remove_Property,
- ComponentMenuitemProperty.divider(),
- edit_bates_batchAdd_Property, edit_bates_batchRemove_Property]
-
- return [edit_text_Property, edit_image_Property, edit_link_Property, dividerProperty, edit_watermark_Property, edit_background_Property, edit_headerfooter_Property,
- edit_bates_Property, edit_crop_Property]
-
- } else if modeType == .Form {
- form_alignment_Property.menuItemArr = [form_alignment_left_Property, form_alignment_Hori_Property, form_alignment_Right_Property, ComponentMenuitemProperty.divider(),
- form_alignment_Top_Property, form_alignment_Vert_Property, form_alignment_Bottom_Property, ComponentMenuitemProperty.divider(),
- form_alignment_Distribute_Vert_Property, form_alignment_Distribute_Hori_Property]
-
- self.refreshDefaultConfigItem()
-
- form_more_Property.menuItemArr = [form_Highlight_Fields_Property, form_ShowName_Property, form_ClearForm_Property]
-
- return [form_text_Property, form_checkbox_Property, form_radio_Property, form_list_Property,
- form_dropdown_Property, form_OK_Property, form_digitalSign_Property, dividerProperty,
- form_alignment_Property, form_more_Property]
-
- } else if modeType == .Fill {
- return [fill_tick_Property, fill_fork_Property, fill_rectangle_Property, fill_line_Property,
- fill_dot_Property, fill_date_Property, fill_sign_Property]
-
- } else if modeType == .Convert {
-
- var menuItemArr: [ComponentMenuitemProperty] = []
- if true {
- menuItemArr.append(convert_RTF_property)
- menuItemArr.append(convert_CSV_property)
- menuItemArr.append(convert_HTML_property)
- menuItemArr.append(convert_Text_property)
- menuItemArr.append(convert_Json_property)
- convert_others_Property.menuItemArr = menuItemArr
- }
- return [convert_word_Property, convert_excel_Property, convert_ppt_Property, convert_image_Property,
- convert_others_Property, dividerProperty, convert_imageToPDF_Property, dividerProperty,
- convert_ocr_Property]
-
- } else if modeType == .Protect {
- return [protect_redact_Property, protect_security_Property, protect_removeSecurity_Property, protect_digitalSign_Property]
-
- } else if modeType == .Tools {
- tools_compress_Property.menuItemArr = [tools_compress_compress_Property,
- tools_compress_batchCompress_Property]
- tools_compare_Property.menuItemArr = [tools_compare_Side_Property,
- tools_compare_Overlay_Property]
-
- return[tools_OCR_Property, tools_merge_Property, tools_compress_Property, tools_compare_Property,
- tools_extractImage_Property, tools_TTS_Property, tools_batch_Property, tools_AITools_Property]
- }
-
- return []
- }
-
- func refreshDefaultConfigItem() {
- if CPDFKitConfig.sharedInstance().enableFormFieldHighlight() {
- form_Highlight_Fields_Property.righticon = NSImage(named: "tick_Green")
- } else {
- form_Highlight_Fields_Property.righticon = nil
- }
- }
-
- //MARK: - 刷新Markup二级工具栏特殊图片
- func refreshMarkupColorImages() {
- highlightProperty.icon = KMPDFToolbarManager.getMarkup_HighlightImage()
- highlightProperty.propertyInfo.leftIcon_hov = highlightProperty.icon
- highlightProperty.propertyInfo.leftIcon_press = highlightProperty.icon
-
- UnderlineProperty.icon = KMPDFToolbarManager.getMarkupUnderlineImage()
- UnderlineProperty.propertyInfo.leftIcon_hov = UnderlineProperty.icon
- UnderlineProperty.propertyInfo.leftIcon_press = UnderlineProperty.icon
-
- wavelineProperty.icon = KMPDFToolbarManager.getMarkupwavylineImage()
- wavelineProperty.propertyInfo.leftIcon_hov = wavelineProperty.icon
- wavelineProperty.propertyInfo.leftIcon_press = wavelineProperty.icon
-
- strikethroughProperty.icon = KMPDFToolbarManager.getMarkupStrikethroughImage()
- strikethroughProperty.propertyInfo.leftIcon_hov = strikethroughProperty.icon
- strikethroughProperty.propertyInfo.leftIcon_press = strikethroughProperty.icon
-
- noteProperty.icon = KMPDFToolbarManager.getMarkupNoteImage()
- noteProperty.propertyInfo.leftIcon_hov = noteProperty.icon
- noteProperty.propertyInfo.leftIcon_press = noteProperty.icon
-
- penProperty.icon = KMPDFToolbarManager.getMarkupPenImage()
- penProperty.propertyInfo.leftIcon_hov = penProperty.icon
- penProperty.propertyInfo.leftIcon_press = penProperty.icon
-
- }
-
- //MARK: - 获取Markup相关icon图片
- class func getMarkup_HighlightImage() -> NSImage? {
- let image = NSImage(named: "markup_highlight_base")
- let upImage = NSImage(named: "markup_highlight_Cover")
-
- if let img = NSImage.combineImages(images: [image?.filled(with: CPDFMarkupAnnotation.defaultColor(.highlight)), upImage]) {
- return img
- }
-
- return image
- }
-
- class func getMarkupNoteImage() -> NSImage? {
- let image = NSImage(named: "markup_note_base")
- let upImage = NSImage(named: "markup_note_Cover")
-
- if let img = NSImage.combineImages(images: [image?.filled(with: CPDFTextAnnotation.defaultColor()), upImage]) {
- return img
- }
-
- return image
- }
-
- class func getMarkupPenImage() -> NSImage? {
- let image = NSImage(named: "markup_pen_Cover")
- let upImage = NSImage(named: "markup_pen_base")
-
- if let img = NSImage.combineImages(images: [(image?.filled(with: CPDFInkAnnotation.defaultColor()))!, upImage!]) {
- return img
- }
-
- return image
- }
-
- class func getMarkupStrikethroughImage() -> NSImage? {
- let image = NSImage(named: "markup_strikethrough_Cover")
- let upImage = NSImage(named: "markup_strikethrough_base")
-
- if let img = NSImage.combineImages(images: [(image?.filled(with: CPDFMarkupAnnotation.defaultColor(.strikeOut)))!, upImage!]) {
- return img
- }
-
- return image
- }
-
- class func getMarkupUnderlineImage() -> NSImage? {
- let image = NSImage(named: "markup_underline_Cover")
- let upImage = NSImage(named: "markup_underline_base")
-
- if let img = NSImage.combineImages(images: [(image?.filled(with: CPDFMarkupAnnotation.defaultColor(.underline)))!, upImage!]) {
- return img
- }
-
- return image
- }
-
- class func getMarkupwavylineImage() -> NSImage? {
- let image = NSImage(named: "markup_wavyline_Cover")
- let upImage = NSImage(named: "markup_wavyline_base")
-
- if let img = NSImage.combineImages(images: [(image?.filled(with: CPDFMarkupAnnotation.defaultColor(.squiggly)))!, upImage!]) {
- return img
- }
-
- return image
- }
-
- }
|