123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- //
- // KMEnumExtensions.swift
- // PDF Master
- //
- // Created by tangchao on 2023/7/14.
- //
- import Foundation
- protocol KMSubscribeWaterMarkTypeConvertProtocol {
- func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType
- }
- /*
- @objc enum KMToolbarType: Int {
- /// conversion
- case word = 3000
- case excel = 3001
- case ppt = 3002
- case rtf = 3003
- case csv = 3004
- case html = 3005
- case conversion_text = 3006
- case conversion_image = 3007
-
- /// tool
- case compress = 8000
- case merge = 8001
- case fileCompare = 8002
- case secure = 8003
- case redact = 8004
- case watermark = 8005
- case background = 8006
- case headerAndFooter = 8007
- case bates = 8008
- case crop = 8009
- }
- */
- extension KMToolbarType: KMSubscribeWaterMarkTypeConvertProtocol {
- func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
- switch self {
- case .word:
- return .toWord
- case .excel:
- return .toExcel
- case .ppt:
- return .toPPT
- case .rtf:
- return .toRTF
- case .csv:
- return .toCSV
- case .html:
- return .toHTML
- case .conversion_text:
- return .toText
- case .conversion_image:
- return .toImage
- case .compress:
- return .compress
- case .merge:
- return .merge
- default:
- return .none
- }
- }
- }
- /*
- enum KMPDFConvertType: Int {
- case word = 0
- case excel = 1
- case ppt = 2
- case rtf = 3
- case csv = 4
- case html = 5
- case text = 6
- case jpeg = 7
- case jpg = 8
- case png = 9
- case gif = 10
- case tiff = 11
- case tga = 12
- case bmp = 13
- case jp2 = 14
-
- static let image: KMPDFConvertType = .jpeg
- }
- */
- extension KMPDFConvertType: KMSubscribeWaterMarkTypeConvertProtocol {
- func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
- switch self {
- case .word:
- return .toWord
- case .excel:
- return .toExcel
- case .ppt:
- return .toPPT
- case .rtf:
- return .toRTF
- case .csv:
- return .toCSV
- case .html:
- return .toHTML
- case .text:
- return .toText
- case .image:
- return .toImage
- default:
- return .none
- }
- }
- }
- /*
- @objc enum KMItemKey: Int {
- case print = 0 // 打印
- case delete
- case leftRotate
- case rightRotate
- case cut
- case paste
- }
- */
- extension KMItemKey: KMSubscribeWaterMarkTypeConvertProtocol {
- func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
- switch self {
- case .leftRotate:
- return .rotate
- case .rightRotate:
- return .rotate
- case .paste:
- return .copy
- case .delete:
- return .delete
- default:
- return .none
- }
- }
- }
- /*
- enum KMPageEditType: Int {
- case pageRange = 1
- case leftRotate
- case rightRotate
- case insert
- case extract
- case replace
- case split
- case reverse
- case delete
-
- case zoomOut
- case zoomIn
-
- static let none: KMPageEditType = KMPageEditType(rawValue: 0)!
-
- static var insert_files: Int {
- get {
- return self.insert.rawValue + 1000
- }
- }
- static var insert_blank_page: Int {
- get {
- return self.insert.rawValue + 1001
- }
- }
- static var insert_custom_page: Int {
- get {
- return self.insert.rawValue + 1002
- }
- }
- }
- */
- extension KMPageEditType: KMSubscribeWaterMarkTypeConvertProtocol {
- func toSubscribeWaterMarkType() -> KMSubscribeWaterMarkType {
- switch self {
- case .leftRotate:
- return .rotate
- case .rightRotate:
- return .rotate
- case .insert:
- return .insert
- case .extract:
- return .extract
- case .replace:
- return .replace
- case .split:
- return .split
- case .reverse:
- return .none
- case .delete:
- return .delete
- case .paste:
- return .copy
- default:
- return .none
- }
- }
- }
|