KMConvertWordWindowController.swift 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // KMConvertWordWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2022/12/6.
  6. //
  7. import Cocoa
  8. import ComPDFKit_Conversion
  9. import KMComponentLibrary
  10. // 转档 Word 窗口
  11. class KMConvertWordWindowController: KMConvertBaseWindowController {
  12. override var fileExtension: String {
  13. return KMPDFConvert.pathExtension(.word)
  14. }
  15. override func initContentView() {
  16. super.initContentView()
  17. self.titleLabel.stringValue = NSLocalizedString("PDF to Word", comment: "")
  18. }
  19. override func initSettingView() -> KMConvertSettingView? {
  20. return KMConvertWordSettingView.createFromNib()
  21. }
  22. override func initConvert() -> KMPDFConvert {
  23. return KMPDFConvertWord()
  24. }
  25. override func convertModelAppendParams(convert: KMPDFConvert) {
  26. super.convertModelAppendParams(convert: convert)
  27. if let _convert = convert as? KMPDFConvertWord {
  28. let settingView: KMConvertWordSettingView = self.settingView as! KMConvertWordSettingView
  29. if (settingView.pageSettingSelectedIndex == 0) {
  30. _convert.layoutOptions = .retainFlowingText
  31. } else {
  32. /// 流排
  33. _convert.layoutOptions = .retainPageLayout
  34. }
  35. }
  36. }
  37. override func updateViewColor() {
  38. super.updateViewColor()
  39. KMMainThreadExecute {
  40. let settingV = self.settingView as? KMConvertWordSettingView
  41. settingV?.pageSettingTitleLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
  42. self.settingView?.updateViewColor()
  43. }
  44. }
  45. }