Quellcode durchsuchen

【综合】OCToSwift的代码同步develop分支

tangchao vor 1 Jahr
Ursprung
Commit
ffe62e580f
100 geänderte Dateien mit 6104 neuen und 5499 gelöschten Zeilen
  1. 680 1204
      PDF Office/PDF Master.xcodeproj/project.pbxproj
  2. 1 1
      PDF Office/PDF Master.xcodeproj/xcshareddata/xcschemes/PDF Master.xcscheme
  3. 280 119
      PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 576 0
      PDF Office/PDF Master.xcodeproj/xcuserdata/kdanwj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  5. 1442 535
      PDF Office/PDF Master.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  6. 21 32
      PDF Office/PDF Master/AppDelegate.swift
  7. 3 3
      PDF Office/PDF Master/Base.lproj/Main.storyboard
  8. 8 9
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  9. 7 9
      PDF Office/PDF Master/Class/Common/Base/KMBaseViewController.swift
  10. 49 0
      PDF Office/PDF Master/Class/Common/Category/NSFont+KMExtension.swift
  11. 41 0
      PDF Office/PDF Master/Class/Common/Category/NSImage+ KMExtension.swift
  12. 336 0
      PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift
  13. 47 0
      PDF Office/PDF Master/Class/Common/Category/NSPopover+KMExtension.swift
  14. 49 0
      PDF Office/PDF Master/Class/Common/Category/NSString+KMExtension.swift
  15. 37 0
      PDF Office/PDF Master/Class/Common/Category/View/NSButton+KMExtension.swift
  16. 126 0
      PDF Office/PDF Master/Class/Common/Category/View/NSMenu+KMExtension.swift
  17. 54 0
      PDF Office/PDF Master/Class/Common/Category/View/NSTextView+KMExtension.swift
  18. 63 0
      PDF Office/PDF Master/Class/Common/Control/KMCoverButton.swift
  19. 116 0
      PDF Office/PDF Master/Class/Common/Control/KMPageIndicator.swift
  20. 1 0
      PDF Office/PDF Master/Class/Common/KMCommonDefine.swift
  21. 0 21
      PDF Office/PDF Master/Class/Common/OC/Category/NSTextView+KMExtension.h
  22. 0 44
      PDF Office/PDF Master/Class/Common/OC/Category/NSTextView+KMExtension.m
  23. 0 26
      PDF Office/PDF Master/Class/Common/OC/Control/KMCoverButton.h
  24. 0 53
      PDF Office/PDF Master/Class/Common/OC/Control/KMCoverButton.m
  25. 0 16
      PDF Office/PDF Master/Class/Common/OC/Control/WaitingView.h
  26. 0 68
      PDF Office/PDF Master/Class/Common/OC/Control/WaitingView.m
  27. 2 2
      PDF Office/PDF Master/Class/Common/OC/EmailSubscription/KMEmailSubWindowController.m
  28. 6 6
      PDF Office/PDF Master/Class/Common/OC/Property/InfoWindow.xib
  29. 584 0
      PDF Office/PDF Master/Class/Common/OC/Property/KMInfoWindowController.swift
  30. 0 64
      PDF Office/PDF Master/Class/Common/OC/Property/SKInfoWindowController.h
  31. 0 613
      PDF Office/PDF Master/Class/Common/OC/Property/SKInfoWindowController.m
  32. 0 43
      PDF Office/PDF Master/Class/Common/OC/Property/SKWindowController.h
  33. 0 50
      PDF Office/PDF Master/Class/Common/OC/Property/SKWindowController.m
  34. 0 40
      PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.h
  35. 0 119
      PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.m
  36. 29 0
      PDF Office/PDF Master/Class/Common/Tools/KMPageSizeTool.swift
  37. 3 9
      PDF Office/PDF Master/Class/Common/Tools/KMTools.swift
  38. 1 1
      PDF Office/PDF Master/Class/Home/Category/NSColor+KMExtensions.swift
  39. 1 1
      PDF Office/PDF Master/Class/Home/View/KMBox.swift
  40. 34 0
      PDF Office/PDF Master/Class/Home/View/KMComboBox.swift
  41. 14 14
      PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.swift
  42. 5 5
      PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift
  43. 2 2
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift
  44. 1 1
      PDF Office/PDF Master/Class/Home/ViewController/KMCloudDocumentsViewController.swift
  45. 10 10
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift
  46. 2 2
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift
  47. 2 2
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.swift
  48. 1 1
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift
  49. 1 1
      PDF Office/PDF Master/Class/Home/WindowController/KMURLToPDFWindowController.swift
  50. 0 24
      PDF Office/PDF Master/Class/KMLightMember/Extension/NSObject+DeviceInfo/NSObject+DeviceInfo.h
  51. 0 122
      PDF Office/PDF Master/Class/KMLightMember/Extension/NSObject+DeviceInfo/NSObject+DeviceInfo.m
  52. 0 15
      PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.h
  53. 0 71
      PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.m
  54. 71 0
      PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.swift
  55. 179 0
      PDF Office/PDF Master/Class/Merge/Model/KMFileAttribute.swift
  56. 0 19
      PDF Office/PDF Master/Class/Merge/OCPart/Category/PDFPage_SKExtensions.h
  57. 0 220
      PDF Office/PDF Master/Class/Merge/OCPart/Category/PDFPage_SKExtensions.m
  58. 0 18
      PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.h
  59. 0 97
      PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.m
  60. 95 0
      PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.swift
  61. 0 35
      PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.h
  62. 0 146
      PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.m
  63. 176 0
      PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.swift
  64. 0 42
      PDF Office/PDF Master/Class/Merge/OCPart/KMFileAttribute.h
  65. 0 183
      PDF Office/PDF Master/Class/Merge/OCPart/KMFileAttribute.m
  66. 0 13
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.h
  67. 0 12
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.m
  68. 18 0
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.swift
  69. 12 25
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m
  70. 48 48
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.xib
  71. 0 45
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.h
  72. 0 303
      PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.m
  73. 0 17
      PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.h
  74. 0 40
      PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.m
  75. 40 0
      PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.swift
  76. 6 6
      PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.xib
  77. 0 23
      PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.h
  78. 0 84
      PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.m
  79. 98 0
      PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.swift
  80. 76 0
      PDF Office/PDF Master/Class/Merge/View/KMPDFMergeFileNameTabelViewCell.swift
  81. 155 0
      PDF Office/PDF Master/Class/Merge/View/KMPDFMergePageRangeTabelViewCell.swift
  82. 63 0
      PDF Office/PDF Master/Class/Merge/View/KMPDFMergeSizeTabelViewCell.swift
  83. 1 1
      PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWindowController.swift
  84. 251 0
      PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManager.swift
  85. 0 19
      PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManagerOC.h
  86. 0 303
      PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManagerOC.m
  87. 2 2
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.swift
  88. 7 7
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/ProgressSheet.xib
  89. 0 61
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.h
  90. 0 191
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.m
  91. 151 0
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift
  92. 1 1
      PDF Office/PDF Master/Class/PDFTools/Convert/View/KMConvertCSVSettingView.swift
  93. 2 2
      PDF Office/PDF Master/Class/PDFTools/Convert/View/KMConvertOCRSettingItemView.swift
  94. 4 4
      PDF Office/PDF Master/Class/PDFTools/Crop/Controller/KMCropPreviewController.swift
  95. 1 1
      PDF Office/PDF Master/Class/PDFTools/OCR/KMDocumentAIPDFView.m
  96. 4 10
      PDF Office/PDF Master/Class/PDFTools/OCR/KMDocumentAIViewController.m
  97. 8 8
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift
  98. 0 30
      PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.h
  99. 0 125
      PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.m
  100. 0 0
      PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.swift

Datei-Diff unterdrückt, da er zu groß ist
+ 680 - 1204
PDF Office/PDF Master.xcodeproj/project.pbxproj


+ 1 - 1
PDF Office/PDF Master.xcodeproj/xcshareddata/xcschemes/PDF Master.xcscheme

@@ -31,7 +31,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 280 - 119
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -7,174 +7,271 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-<<<<<<< HEAD
-            uuid = "A7ACDD2F-B42B-4BBD-932D-3FDEF2524998"
+            uuid = "5A10F6CA-8EFB-4226-8DC2-0DBAC5057198"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.swift"
+            filePath = "PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "288"
-            endingLineNumber = "288"
-            landmarkName = "openFile(withFilePath:)"
-=======
-            uuid = "8158ADB6-5705-4EED-BF1D-B34E68C76962"
+            startingLineNumber = "217"
+            endingLineNumber = "217"
+            landmarkName = "register(userName:password:verifyCode:complete:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "152CCB94-DFDF-452D-AEE6-643991622327"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/KMLightMember/Controller/ComparativeTable/KMComparativeTableViewController.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Extension.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "181"
-            endingLineNumber = "181"
-            landmarkName = "subscribeAction(controller:isRestore:)"
->>>>>>> develop
+            startingLineNumber = "105"
+            endingLineNumber = "105"
+            landmarkName = "-checkSpelling:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-<<<<<<< HEAD
-            uuid = "EBBB4FDA-05E9-4C31-A7DD-B14B9A396755"
+            uuid = "8DE8E32D-5F0B-47F9-9DBF-8B7EFBBCA913"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Home/ViewController/KMHomeViewController.swift"
+            filePath = "PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "130"
-            endingLineNumber = "130"
-            landmarkName = "KMHomeViewController"
-<<<<<<< HEAD
-            landmarkType = "21">
+            startingLineNumber = "1240"
+            endingLineNumber = "1240"
+            landmarkName = "openBlankPage(_:)"
+            landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "67617EE7-8DC0-4426-AB0A-42A1A9D99BF1"
-            shouldBeEnabled = "No"
+            uuid = "D9465E32-7786-4AFC-BF9A-1602FA07BAC9"
+            shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/KMLightMember/Controller/SubscriptionView/WaterMark/KMSubscribeWaterMarkWindowController.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "250"
-            endingLineNumber = "250"
-            landmarkName = "isSampleController()"
-=======
-            uuid = "A6E177AA-36E9-4680-8477-CBFAA745EEE1"
+            startingLineNumber = "245"
+            endingLineNumber = "245"
+            landmarkName = "_closedArrowExPoints(_:point:cpoint:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "D22DB8C9-04C7-490E-ABEF-653803D4918A"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/KMLightMember/Controller/ComparativeTable/KMComparativeTableViewController.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "198"
-            endingLineNumber = "198"
-            landmarkName = "subscribeAction(controller:isRestore:)"
->>>>>>> develop
+            startingLineNumber = "277"
+            endingLineNumber = "277"
+            landmarkName = "_squareExPoints(_:point:cpoint:borderWidth:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-<<<<<<< HEAD
-<<<<<<< HEAD
-            uuid = "2F73CA33-14D7-434F-A2C2-7267A1A1E1F3"
+            uuid = "734C870F-06D9-4009-B30B-FA60A8A7A087"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Document/KMMainDocument.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "51"
-            endingLineNumber = "51"
-            landmarkName = "save(to:ofType:for:delegate:didSave:contextInfo:)"
+            startingLineNumber = "321"
+            endingLineNumber = "321"
+            landmarkName = "_circleExPoints(_:point:cpoint:borderWidth:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "5566D3A6-CD33-46F4-95AB-B60ACB70F4FC"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "364"
+            endingLineNumber = "364"
+            landmarkName = "_diamondExPoints(_:point:cpoint:borderWidth:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "75445273-3A79-4813-A25F-A80D13E12E07"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "229"
+            endingLineNumber = "229"
+            landmarkName = "-setAnnotations:"
             landmarkType = "7">
-            <Locations>
-               <Location
-                  uuid = "2F73CA33-14D7-434F-A2C2-7267A1A1E1F3 - 92c3b73b346d863d"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "PDF_Master.KMMainDocument.save(to: Foundation.URL, ofType: Swift.String, for: __C.NSSaveOperationType, delegate: Swift.Optional&lt;Any&gt;, didSave: Swift.Optional&lt;ObjectiveC.Selector&gt;, contextInfo: Swift.Optional&lt;Swift.UnsafeMutableRawPointer&gt;) -&gt; ()"
-                  moduleName = "PDF Master"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "51"
-                  endingLineNumber = "51"
-                  offsetFromSymbolStart = "944">
-               </Location>
-               <Location
-                  uuid = "2F73CA33-14D7-434F-A2C2-7267A1A1E1F3 - 809a9f6237b6a858"
-                  shouldBeEnabled = "Yes"
-                  ignoreCount = "0"
-                  continueAfterRunningActions = "No"
-                  symbolName = "closure #1 () -&gt; () in PDF_Master.KMMainDocument.save(to: Foundation.URL, ofType: Swift.String, for: __C.NSSaveOperationType, delegate: Swift.Optional&lt;Any&gt;, didSave: Swift.Optional&lt;ObjectiveC.Selector&gt;, contextInfo: Swift.Optional&lt;Swift.UnsafeMutableRawPointer&gt;) -&gt; ()"
-                  moduleName = "PDF Master"
-                  usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
-                  startingColumnNumber = "9223372036854775807"
-                  endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "51"
-                  endingLineNumber = "51"
-                  offsetFromSymbolStart = "18">
-               </Location>
-            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-=======
->>>>>>> develop
-            uuid = "0546589D-0550-4D37-AD70-CD08C1BDA53B"
+            uuid = "C0F0D9F6-1082-49B7-AF0D-1672A9B46941"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Document/KMMainDocument.swift"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "224"
-            endingLineNumber = "224"
-            landmarkName = "saveAs(_:)"
+            startingLineNumber = "204"
+            endingLineNumber = "204"
+            landmarkName = "-setAnnotations:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "8326ACDF-C755-45BD-AB22-A56787E78298"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "223"
+            endingLineNumber = "223"
+            landmarkName = "-setAnnotations:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "DB92A795-6981-44FD-A1D0-F2CE3EEC789C"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "222"
+            endingLineNumber = "222"
+            landmarkName = "-setAnnotations:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "D629E2B7-BC91-4F10-8F4C-68B3BA662969"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/NSObject/KMAnnotationPropertiesColorManager.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "582"
+            endingLineNumber = "582"
+            landmarkName = "-fetchColorsWithKey:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4F487AE6-365E-41BB-9516-6A0A1291B103"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/NSObject/KMAnnotationPropertiesColorManager.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "567"
+            endingLineNumber = "567"
+            landmarkName = "-saveColorsWithColors:key:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "C97F14F8-C173-4C6C-9A2A-173F0C009027"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/Manager/KMEditPDFTextManager.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "324"
+            endingLineNumber = "324"
+            landmarkName = "setCommonlyFontColor(color:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4AA5DDA9-7119-40D7-89B4-F368372F819A"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/Manager/KMEditPDFTextManager.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "332"
+            endingLineNumber = "332"
+            landmarkName = "setFontAlignment(alignment:)"
             landmarkType = "7">
             <Locations>
                <Location
-                  uuid = "0546589D-0550-4D37-AD70-CD08C1BDA53B - 62ab35cb2aa46459"
+                  uuid = "4AA5DDA9-7119-40D7-89B4-F368372F819A - 844f8b9c5ebe0774"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
-                  symbolName = "PDF_Master.KMMainDocument.saveAs(Swift.Optional&lt;Any&gt;) -&gt; ()"
+                  symbolName = "PDF_Master.KMEditPDFTextManager.setFontAlignment(alignment: __C.NSTextAlignment) -&gt; ()"
                   moduleName = "PDF Master"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/EditPDF/Manager/KMEditPDFTextManager.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "224"
-                  endingLineNumber = "224"
-                  offsetFromSymbolStart = "150">
+                  startingLineNumber = "332"
+                  endingLineNumber = "332"
+                  offsetFromSymbolStart = "186">
                </Location>
                <Location
-                  uuid = "0546589D-0550-4D37-AD70-CD08C1BDA53B - b0181a647e19a750"
+                  uuid = "4AA5DDA9-7119-40D7-89B4-F368372F819A - 844f8b9c5ebe0774"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
-                  symbolName = "closure #1 (Swift.Bool, Any...) -&gt; () in PDF_Master.KMMainDocument.saveAs(Swift.Optional&lt;Any&gt;) -&gt; ()"
+                  symbolName = "PDF_Master.KMEditPDFTextManager.setFontAlignment(alignment: __C.NSTextAlignment) -&gt; ()"
                   moduleName = "PDF Master"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/EditPDF/Manager/KMEditPDFTextManager.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "224"
-                  endingLineNumber = "224"
-                  offsetFromSymbolStart = "122">
+                  startingLineNumber = "332"
+                  endingLineNumber = "332"
+                  offsetFromSymbolStart = "299">
                </Location>
             </Locations>
          </BreakpointContent>
@@ -182,65 +279,129 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "46837646-FF5A-4F7D-9187-94857C5E940A"
+            uuid = "7A815601-D92D-4133-9AD5-135810C22224"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/Document/KMMainDocument.swift"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "243"
-            endingLineNumber = "243"
-            landmarkName = "runModalSavePanel(for:delegate:didSave:contextInfo:)"
+            startingLineNumber = "125"
+            endingLineNumber = "125"
+            landmarkName = "-goToDestination:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "E3D2735D-BC29-49D0-8560-DAA6C7C1EBB1"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "129"
+            endingLineNumber = "129"
+            landmarkName = "-goToRect:onPage:animated:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "0EC3A09D-7C90-4833-A5BC-39C213D8E2B2"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "137"
+            endingLineNumber = "137"
+            landmarkName = "-goToTargetPoint:onPage:atScrollPosition:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7D95F342-B074-4DA1-8B8A-FE872037ED83"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "55"
+            endingLineNumber = "55"
+            landmarkName = "init?(coder:)"
             landmarkType = "7">
             <Locations>
                <Location
-                  uuid = "46837646-FF5A-4F7D-9187-94857C5E940A - d6a94eca6fc0bd1d"
+                  uuid = "7D95F342-B074-4DA1-8B8A-FE872037ED83 - e5bb98ce5d956827"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
-                  symbolName = "PDF_Master.KMMainDocument.runModalSavePanel(for: __C.NSSaveOperationType, delegate: Swift.Optional&lt;Any&gt;, didSave: Swift.Optional&lt;ObjectiveC.Selector&gt;, contextInfo: Swift.Optional&lt;Swift.UnsafeMutableRawPointer&gt;) -&gt; ()"
+                  symbolName = "PDF_Master.KMSignature.init(coder: __C.NSCoder) -&gt; Swift.Optional&lt;PDF_Master.KMSignature&gt;"
                   moduleName = "PDF Master"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "243"
-                  endingLineNumber = "243"
-                  offsetFromSymbolStart = "312">
+                  startingLineNumber = "55"
+                  endingLineNumber = "55"
+                  offsetFromSymbolStart = "826">
                </Location>
                <Location
-                  uuid = "46837646-FF5A-4F7D-9187-94857C5E940A - 6fe9b9739f26932e"
+                  uuid = "7D95F342-B074-4DA1-8B8A-FE872037ED83 - e5bb98ce5d956827"
                   shouldBeEnabled = "Yes"
                   ignoreCount = "0"
                   continueAfterRunningActions = "No"
-                  symbolName = "closure #1 (Swift.Bool, Any...) -&gt; () in PDF_Master.KMMainDocument.runModalSavePanel(for: __C.NSSaveOperationType, delegate: Swift.Optional&lt;Any&gt;, didSave: Swift.Optional&lt;ObjectiveC.Selector&gt;, contextInfo: Swift.Optional&lt;Swift.UnsafeMutableRawPointer&gt;) -&gt; ()"
+                  symbolName = "PDF_Master.KMSignature.init(coder: __C.NSCoder) -&gt; Swift.Optional&lt;PDF_Master.KMSignature&gt;"
                   moduleName = "PDF Master"
                   usesParentBreakpointCondition = "Yes"
-                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/Document/KMMainDocument.swift"
+                  urlString = "file:///Users/kdanmobile/work/tangchao/git/PDFOffice/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift"
                   startingColumnNumber = "9223372036854775807"
                   endingColumnNumber = "9223372036854775807"
-                  startingLineNumber = "243"
-                  endingLineNumber = "243"
-                  offsetFromSymbolStart = "201">
+                  startingLineNumber = "55"
+                  endingLineNumber = "55"
+                  offsetFromSymbolStart = "1370">
                </Location>
             </Locations>
-=======
-            landmarkType = "3">
->>>>>>> dev_dmg_v1.2
-=======
-            uuid = "1D42B63E-3E64-4C58-BB41-A7DC4E7F81A9"
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "A3B3880C-1091-413D-BAA2-8878F4F2EE54"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "35"
+            endingLineNumber = "35"
+            landmarkName = "init()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "28AEB13C-12E0-4DE8-90CF-29754B61B6FB"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/KMLightMember/InAppPurchase/Appstore/KMInAppPurchaseManager.swift"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignature.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "108"
-            endingLineNumber = "108"
-            landmarkName = "purchaseProduct(productIdentifier:orderId:completion:)"
+            startingLineNumber = "68"
+            endingLineNumber = "68"
+            landmarkName = "encode(with:)"
             landmarkType = "7">
->>>>>>> develop
          </BreakpointContent>
       </BreakpointProxy>
    </Breakpoints>

+ 576 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanwj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3,4 +3,580 @@
    uuid = "A8D1F77E-FE7C-4DEF-A02B-F317BAFFC2B6"
    type = "1"
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4CD2E361-59B2-4BEC-AB49-CD89E9D436A1"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/Windows/CPDFListViewAnimatedBorderlessWindow.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "140"
+            endingLineNumber = "140"
+            landmarkName = "setBackgroundImage(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "AEDFDA22-CF24-47EC-8355-D33610AE7F8E"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/SelfSign/CSelfSignAnnotationFreeText.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "239"
+            endingLineNumber = "239"
+            landmarkName = "-initPDFListViewNoteWithDocument:subType:string:bounds:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7E1825AF-E855-45EF-83DC-1ED9D7E37B67"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "63"
+            endingLineNumber = "63"
+            landmarkName = "-initStandardStampWithType:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4B57244A-66B2-46CD-9B54-23FEC08F62A1"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "140"
+            endingLineNumber = "140"
+            landmarkName = "-initImageStampWithFilePath:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7B96ED6A-31ED-44FE-B784-8FB6D54BEC63"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "151"
+            endingLineNumber = "151"
+            landmarkName = "-initWithText:detailText:style:shape:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4836CCED-63C1-40EF-9163-34484B12E369"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "166"
+            endingLineNumber = "166"
+            landmarkName = "-initWithDynamicText:dynamicDetailText:dynamicStyle:needExchangeFontSize:dynamicShape:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "B95D123A-FB0D-4537-A356-4CEDAA77A78C"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "181"
+            endingLineNumber = "181"
+            landmarkName = "-initWithText:detailText:dateText:color:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "6639AE5E-D429-4C24-9DD5-03B6C45BA521"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "192"
+            endingLineNumber = "192"
+            landmarkName = "-initSignatureWithImage:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "A5959AC5-83F9-4AB8-B685-1CC150507508"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "201"
+            endingLineNumber = "201"
+            landmarkName = "-initSignatureWithText:attributed:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "993A4EED-8F36-45CF-9419-BA14E7FA3BFD"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "211"
+            endingLineNumber = "211"
+            landmarkName = "-initSignatureWithPaths:signatureColor:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "1503A6F8-5C9B-40C5-8D0D-3224C5CF28B1"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Home/View/KMComboBox.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "75"
+            endingLineNumber = "75"
+            landmarkName = "select(withFrame:in:editor:delegate:start:length:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "C2C5184C-C2F2-429B-BF6A-5FBBBC5FCF4F"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "149"
+            endingLineNumber = "149"
+            landmarkName = "init(imageStampFilePath:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "E897285E-EB9D-4340-9D1E-BA7CAFD24456"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "155"
+            endingLineNumber = "155"
+            landmarkName = "init(text:detailText:style:shape:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "D0E817D2-DA8D-42D5-B90F-4D06E44B9BE3"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "175"
+            endingLineNumber = "175"
+            landmarkName = "init(text:detailText:dateText:color:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "CEB455B3-A5F1-499D-BEE1-D537E31DCDE5"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "192"
+            endingLineNumber = "192"
+            landmarkName = "init(signatureText:attributed:)"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "CEB455B3-A5F1-499D-BEE1-D537E31DCDE5 - effb4f0950143b17"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master.CStampSignatureObject.init(signatureText: Swift.String, attributed: Swift.Dictionary&lt;__C.NSAttributedStringKey, Any&gt;) -&gt; PDF_Master.CStampSignatureObject"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "192"
+                  endingLineNumber = "192"
+                  offsetFromSymbolStart = "1012">
+               </Location>
+               <Location
+                  uuid = "CEB455B3-A5F1-499D-BEE1-D537E31DCDE5 - effb4f0950143b17"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Master.CStampSignatureObject.init(signatureText: Swift.String, attributed: Swift.Dictionary&lt;__C.NSAttributedStringKey, Any&gt;) -&gt; PDF_Master.CStampSignatureObject"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "192"
+                  endingLineNumber = "192"
+                  offsetFromSymbolStart = "1032">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "4D6195FC-EFBF-49B1-8EA8-96F397A18D90"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "201"
+            endingLineNumber = "201"
+            landmarkName = "init(paths:signatureColor:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "C153658E-EE27-4BB7-A793-68BA56D7700E"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "141"
+            endingLineNumber = "141"
+            landmarkName = "-reloadDataSignaturesIsSelectLast:"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "C153658E-EE27-4BB7-A793-68BA56D7700E - d9457e82a77e2369"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[KMSignatureAnnotationViewController reloadDataSignaturesIsSelectLast:]"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "141"
+                  endingLineNumber = "141"
+                  offsetFromSymbolStart = "500">
+               </Location>
+               <Location
+                  uuid = "C153658E-EE27-4BB7-A793-68BA56D7700E - d9457e82a77e2369"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[KMSignatureAnnotationViewController reloadDataSignaturesIsSelectLast:]"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "141"
+                  endingLineNumber = "141"
+                  offsetFromSymbolStart = "580">
+               </Location>
+               <Location
+                  uuid = "C153658E-EE27-4BB7-A793-68BA56D7700E - d9457e82a77e2388"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[KMSignatureAnnotationViewController reloadDataSignaturesIsSelectLast:]"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "142"
+                  endingLineNumber = "142"
+                  offsetFromSymbolStart = "688">
+               </Location>
+               <Location
+                  uuid = "C153658E-EE27-4BB7-A793-68BA56D7700E - d9457e82a77e2369"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[KMSignatureAnnotationViewController reloadDataSignaturesIsSelectLast:]"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureAnnotationViewController.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "141"
+                  endingLineNumber = "141"
+                  offsetFromSymbolStart = "688">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "EFCE422C-D0FB-4A07-A065-834B32FE15C4"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "333"
+            endingLineNumber = "333"
+            landmarkName = "stampPreImage()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "2663335F-67EF-4F61-8983-CEB488032570"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Toolbar/KMPopMenuButtonCell.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "19"
+            endingLineNumber = "19"
+            landmarkName = "-drawTitle:withFrame:inView:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "967FC898-EF8C-4FEF-A1DD-A8D7271A4A43"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Toolbar/KMCustomButtonPopMenuViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "101"
+            endingLineNumber = "101"
+            landmarkName = "-viewDidLoad"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "9C456A37-E4D4-4569-ABBC-E8A2CA575E03"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationLinkViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "166"
+            endingLineNumber = "166"
+            landmarkName = "-viewDidLoad"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "11E0ACA8-701F-42B9-954C-50AC702FB2D7"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Common/Tools/KMTools.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "334"
+            endingLineNumber = "334"
+            landmarkName = "feekback()"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "11E0ACA8-701F-42B9-954C-50AC702FB2D7 - 41f3e2fd374839bd"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "static PDF_Master.KMTools.feekback() -&gt; ()"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/Common/Tools/KMTools.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "334"
+                  endingLineNumber = "334"
+                  offsetFromSymbolStart = "1488">
+               </Location>
+               <Location
+                  uuid = "11E0ACA8-701F-42B9-954C-50AC702FB2D7 - 41f3e2fd374839bd"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "static PDF_Master.KMTools.feekback() -&gt; ()"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/Common/Tools/KMTools.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "334"
+                  endingLineNumber = "334"
+                  offsetFromSymbolStart = "1492">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "04AD0342-7CE7-4CD5-A9DE-AFEF7320452D"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Merge/OCPart/KMBlankView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "49"
+            endingLineNumber = "49"
+            landmarkName = "-draggingEntered:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "5E7DBFF6-97BA-4011-B25E-2674C8DF0CD5"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1381"
+            endingLineNumber = "1381"
+            landmarkName = "-buttonItemClick_Append:"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "5E7DBFF6-97BA-4011-B25E-2674C8DF0CD5 - c1c7efc213d86e6f"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "__48-[KMPDFEditAppendWindow buttonItemClick_Append:]_block_invoke_3"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "1381"
+                  endingLineNumber = "1381"
+                  offsetFromSymbolStart = "72">
+               </Location>
+               <Location
+                  uuid = "5E7DBFF6-97BA-4011-B25E-2674C8DF0CD5 - c1c7efc213d86e6f"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "__48-[KMPDFEditAppendWindow buttonItemClick_Append:]_block_invoke_3"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanwj/Git/Mac/PDF%20Office/PDF%20Office/PDF%20Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "1381"
+                  endingLineNumber = "1381"
+                  offsetFromSymbolStart = "152">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "479B8DF9-5FCD-4EA9-BB9E-3161AFF88535"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListHoverAnnotationViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "29"
+            endingLineNumber = "29"
+            landmarkName = "-initWithNibName:bundle:annotation:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "303443DF-70EE-45C2-BA8E-586DA23B2E10"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/CPDFListHoverAnnotationViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "38"
+            endingLineNumber = "38"
+            landmarkName = "-viewDidLoad"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>

Datei-Diff unterdrückt, da er zu groß ist
+ 1442 - 535
PDF Office/PDF Master.xcodeproj/xcuserdata/lizhe.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist


Datei-Diff unterdrückt, da er zu groß ist
+ 21 - 32
PDF Office/PDF Master/AppDelegate.swift


+ 3 - 3
PDF Office/PDF Master/Base.lproj/Main.storyboard

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -808,7 +808,7 @@ CA
                     </connections>
                 </application>
                 <customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="PDF_Master" customModuleProvider="target"/>
-                <customObject id="86N-QX-1VH" userLabel="KMDocumentController" customClass="KMDocumentController"/>
+                <customObject id="86N-QX-1VH" userLabel="KMDocumentController" customClass="KMDocumentController" customModule="PDF_Master" customModuleProvider="target"/>
                 <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
                 <customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
             </objects>

+ 8 - 9
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -38,26 +38,25 @@ import Cocoa
         NotificationCenter.default.addObserver(self, selector: #selector(closeAllTabs(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerCloseAllTabs"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(openNewWindow(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerOpenNewWindow"), object: nil)
         
-        if (WelcomeWindowController.welcomeHasShow() == false) {
+        if (KMWelcomeWindowController.welcomeHasShow() == false) {
             //AI 版本禁掉首次开启帮助文档
 //            KMTools.openQuickStartStudy()
             
             DispatchQueue.main.async {
-                let welcome = WelcomeWindowController()
-                self.window?.beginSheet(welcome.window!)
-                
+                let welcome = KMWelcomeWindowController()
+                self.km_beginSheet(windowC: welcome)
                 welcome.itemClick = { [weak self] idx, param in
                     if (idx == 1) { // 关闭
-                        self?.window?.endSheet((param as! NSWindowController).window!)
+                        self?.km_endSheet()
                     } else if (idx == 2) { // 以后提醒
-                        self?.window?.endSheet((param as! NSWindowController).window!)
+                        self?.km_endSheet()
                     } else if (idx == 3) { // 注册
-                        self?.window?.endSheet((param as! NSWindowController).window!)
-                        
+                        self?.km_endSheet()
+
                         guard let window_ = self?.window else {
                             return
                         }
-                        let _ = KMLoginWindowController.show(window: window_, .Batch, .register)
+                        _ = KMLoginWindowController.show(window: window_, .Batch, .register)
                     }
                 }
             }

+ 7 - 9
PDF Office/PDF Master/Class/Common/Base/KMBaseViewController.swift

@@ -85,13 +85,13 @@ class KMBaseViewController: NSViewController {
         for (index, fileUrl) in fileUrls.enumerated() {
             let filePath = fileUrl.path
             let folderPath = "convertToPDF_\(index).pdf"
-            let savePath = folderPath.kUrlToPDFFolderPath()
+            let savePath: String? = folderPath.kUrlToPDFFolderPath() as String
             if (savePath == nil) {
                 continue
             }
             
             dispatchGroup.enter()
-            KMConvertPDFManagerOC.convertFile(filePath, savePath: savePath!) { success, errorDic in
+            KMConvertPDFManager.convertFile(filePath, savePath: savePath!) { success, errorDic in
                 if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
                     dispatchGroup.leave()
                     
@@ -145,10 +145,8 @@ class KMBaseViewController: NSViewController {
     func km_open_file_multi(type: KMPasswordInputWindowType = .open, progressBlock: ((_ index: Int, _ params: Any...)->Void)? = nil, completionBlock:@escaping ([CPDFDocument])->Void) {
         NSPanel.km_open_multi_success(self.view.window!) { panel in
             var array: [String] = []
-            for fileType in KMConvertPDFManagerOC.supportFileType() {
-                if let string = fileType as? String {
-                    array.append(string)
-                }
+            for fileType in KMConvertPDFManager.supportFileType() {
+                array.append(fileType)
             }
             panel.allowedFileTypes = KMTools.pdfExtensions + array
         } completion: { urls in
@@ -382,13 +380,13 @@ class KMBaseViewController: NSViewController {
         }
         
         let progressC = SKProgressController()
-        progressC.showClose = false
-        progressC.message = message
         progressC.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progressC.window?.contentView?.wantsLayer = true
         progressC.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progressC.progressField.textColor = NSColor.white
-        
+        progressC.showClose = false
+        progressC.message = message
+
         self.progressC = progressC
         self.view.window?.beginSheet(progressC.window!)
     }

+ 49 - 0
PDF Office/PDF Master/Class/Common/Category/NSFont+KMExtension.swift

@@ -0,0 +1,49 @@
+//
+//  NSFont+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/27.
+//
+
+import Foundation
+
+private var _layoutManager: NSLayoutManager?
+@objc extension NSFont {
+    func defaultViewLineHeight() -> CGFloat {
+        if (_layoutManager == nil) {
+            _layoutManager = NSLayoutManager()
+            _layoutManager?.typesetterBehavior = .behavior_10_2_WithCompatibility
+        }
+        return _layoutManager?.defaultLineHeight(for: self) ?? 0.0
+    }
+    
+    var style: String? {
+        get {
+            return self.fontDescriptor.object(forKey: .face) as? String
+        }
+    }
+    
+    var km_styles: [String] {
+        get {
+            let styleAttributedString: [String] = []
+            let fontName: String = self.fontDescriptor.object(forKey: .family) as? String ?? ""
+            for dic in NSFont.km_supportFonts {
+                let familyString = dic.keys.first
+                if (familyString == fontName) {
+                    return dic[fontName] as? [String] ?? []
+                }
+            }
+            return styleAttributedString
+        }
+    }
+    
+    class var km_supportFonts: [Dictionary<String, Any>] {
+        get {
+            return [
+                ["Courier" : ["Regular","Bold","Bold Oblique","Oblique"]],
+                ["Helvetica": ["Regular","Bold","Bold Oblique","Oblique"]],
+                ["Times" :["Roman","Bold","Bold Italic","Italic"]]
+            ]
+        }
+    }
+}

+ 41 - 0
PDF Office/PDF Master/Class/Common/Category/NSImage+ KMExtension.swift

@@ -0,0 +1,41 @@
+//
+//  NSImage+ KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/9.
+//
+
+import Foundation
+
+extension NSImage {
+    /*
+     + (NSImage*)imageCustomColor:(NSColor *)color
+     {
+         NSSize size = NSMakeSize(160, 80);
+         CGContextRef context = CGBitmapContextCreate(nil, size.width, size.height, 8, 0,
+                                                      CGColorSpaceCreateDeviceRGB(),
+                                                      kCGImageAlphaPremultipliedLast);
+         //画距形边框
+         CGRect rect = CGRectMake(28, 8, 92, 64);
+         CGContextSetRGBStrokeColor(context, 0.0, 0.0, 0.0, 1.0);
+         CGContextSetLineWidth(context, 8.0);
+         CGContextAddRect(context, rect);
+         CGContextStrokePath(context);
+         CGContextSetFillColorWithColor(context, color.CGColor);
+         CGContextAddRect(context, rect);
+         CGContextFillPath(context);
+         
+         //画下三角
+         CGContextSetFillColorWithColor(context, [NSColor blackColor].CGColor);
+         CGContextMoveToPoint(context, 136, 44);
+         CGContextAddLineToPoint(context, 145, 28);
+         CGContextAddLineToPoint(context, 154, 44);
+         CGContextFillPath(context);
+         
+         CGImageRef newImage = CGBitmapContextCreateImage(context);
+         NSImage *image = [[NSImage alloc] initWithCGImage:newImage size:NSMakeSize(size.width, size.height)];
+         CGContextRelease(context);
+         return image;
+     }
+     */
+}

+ 336 - 0
PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift

@@ -0,0 +1,336 @@
+//
+//  NSObject+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/26.
+//
+
+import Foundation
+
+func GetDeviceInfo(key: String) -> Any? {
+    var ret: Any?
+    var platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"))
+
+    var serialNumberAsCFString: CFTypeRef?
+    serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, key as CFString, kCFAllocatorDefault, 0).takeRetainedValue()
+    if (serialNumberAsCFString != nil) {
+        ret = serialNumberAsCFString as Any
+    }
+    IOObjectRelease(platformExpert)
+    platformExpert = 0
+
+    return ret
+}
+
+func GetHardwareUUID() -> String? {
+    let info = GetDeviceInfo(key: "IOPlatformUUID")
+    if let data = info as? Data {
+        return String(data: data, encoding: .utf8)
+    }
+    return info as? String
+}
+
+func GetProductName() -> String? {
+    let info = GetDeviceInfo(key: "product-name")
+    if let data = info as? Data {
+        return String(data: data, encoding: .utf8)
+    }
+    return info as? String
+}
+
+func GetHardwareSerialNumber() -> String? {
+    let info = GetDeviceInfo(key: "IOPlatformSerialNumber")
+    if let data = info as? Data {
+        return String(data: data, encoding: .utf8)
+    }
+    return info as? String
+}
+
+func GetCompatible() -> String? {
+    let info = GetDeviceInfo(key: "compatible")
+    if let data = info as? Data {
+        return String(data: data, encoding: .utf8)
+    }
+    return info as? String
+}
+
+func GetDeviceName() -> String? {
+    let info = GetDeviceInfo(key: "name")
+    if let data = info as? Data {
+        return String(data: data, encoding: .utf8)
+    }
+    return info as? String
+}
+
+/*
+ NSString *GetSystemVersion(void) {
+     NSTask *task;
+     task = [[NSTask alloc] init];
+     [task setLaunchPath: @"/usr/bin/sw_vers"];
+     
+     NSArray *arguments;
+     arguments = [NSArray arrayWithObjects: @"-productVersion", nil];
+     [task setArguments: arguments];
+     
+     NSPipe *pipe;
+     pipe = [NSPipe pipe];
+     [task setStandardOutput: pipe];
+     
+     NSFileHandle *file;
+     file = [pipe fileHandleForReading];
+     
+     [task launch];
+     
+     NSData *data;
+     data = [file readDataToEndOfFile];
+     
+     NSString *string;
+     string = [[NSString alloc] initWithData: data
+                                    encoding: NSUTF8StringEncoding];
+ //    NSLog (@"got\n%@", string);
+     string = [string stringByReplacingOccurrencesOfString:@"\r\0" withString:@""];
+     string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
+     return string;
+ }
+ */
+
+extension NSSharingServicePicker {
+    class func menu(forSharingItems items: [Any], subjectContext subString: String?, withTarget target: Any?, selector aSel: Selector?, serviceDelegate del: Any?) -> NSMenu? {
+        let sharingServices = NSSharingService.sharingServices(forItems: items)
+        if (sharingServices.count == 0) {
+            return nil
+        }
+        let menu = NSMenu(title: "MountainLionSharingMenu")
+        for currentService in sharingServices {
+            let item = NSMenuItem(title: currentService.title, action: aSel, keyEquivalent: "")
+            item.image = currentService.image
+            currentService.subject = subString ?? ""
+            item.representedObject = currentService
+            currentService.delegate = (del as? any NSSharingServiceDelegate)
+            item.target = target as AnyObject?
+            menu.addItem(item)
+        }
+        return menu
+    }
+}
+
+// MARK: - NSGeometry_SKExtensions
+
+//public func KMConstrainRect(rect: inout NSRect, boundary: NSRect) -> NSRect {
+//    if (NSWidth(rect) > NSWidth(boundary)) {
+//        rect.size.width = NSWidth(boundary)
+//    }
+//    if (NSHeight(rect) > NSHeight(boundary)) {
+//        rect.size.height = NSHeight(boundary)
+//    }
+//    if (NSMinX(rect) < NSMinX(boundary)) {
+//        rect.origin.x = NSMinX(boundary)
+//    } else if (NSMaxX(rect) > NSMaxX(boundary)) {
+//        rect.origin.x = NSMaxX(boundary) - NSWidth(rect)
+//    }
+//    if (NSMinY(rect) < NSMinY(boundary)) {
+//        rect.origin.y = NSMinY(boundary)
+//    } else if (NSMaxY(rect) > NSMaxY(boundary)) {
+//        rect.origin.y = NSMaxY(boundary) - NSHeight(rect)
+//    }
+//
+//    return rect
+//}
+//
+//public func SKIntersectionRect(rect: NSRect, boundary: NSRect) -> NSRect {
+//    let minX: CGFloat = fmin(fmax(NSMinX(rect), NSMinX(boundary)), NSMaxX(boundary))
+//    let maxX: CGFloat = fmax(fmin(NSMaxX(rect), NSMaxX(boundary)), NSMinX(boundary))
+//    let minY: CGFloat = fmin(fmax(NSMinY(rect), NSMinY(boundary)), NSMaxY(boundary))
+//    let maxY: CGFloat = fmax(fmin(NSMaxY(rect), NSMaxY(boundary)), NSMinY(boundary))
+//    return NSMakeRect(minX, minY, maxX - minX, maxY - minY)
+//}
+
+// MARK: - NSBezierPath_SKExtensions
+
+@objc extension NSBezierPath {
+    func getAllSignCirclePoint() -> [String] {
+        var points: [String] = []
+        
+        let flatPath: NSBezierPath = self.flattened
+        let count = flatPath.elementCount
+        var curr = CGPointZero
+        for i in 0 ..< count {
+            flatPath.element(at: i, associatedPoints: &curr)
+            points.append(NSStringFromPoint(curr))
+        }
+        return points
+    }
+    
+    func kmCGPath() -> CGPath {
+        let mutablePath = CGMutablePath()
+        let numElements = self.elementCount
+//        let points: NSPointArray = NSPointArray(bitPattern: 3)!
+        var points = UnsafeMutablePointer<NSPoint>.allocate(capacity: 3)
+        
+        for i in 0 ..< numElements {
+            switch self.element(at: i, associatedPoints: points) {
+            case .moveTo:
+                mutablePath.move(to: points[0])
+            case .lineTo:
+                mutablePath.addLine(to: points[0])
+            case .curveTo:
+                mutablePath.addCurve(to: points[0], control1: points[1], control2: points[2])
+            case .closePath:
+                mutablePath.closeSubpath()
+            default:
+                break
+            }
+        }
+        
+        let path = mutablePath.copy()
+        return path!
+    }
+}
+
+// MARK: - NSEvent_SKExtensions
+
+private var _currentPointingDeviceType: NSEvent.PointingDeviceType = .unknown
+@objc extension NSEvent {
+    class func currentPointingDeviceType() -> NSEvent.PointingDeviceType {
+        return _currentPointingDeviceType
+    }
+    
+    class func setCurrentPointingDeviceType(_ deviceType: NSEvent.PointingDeviceType) {
+        _currentPointingDeviceType = deviceType
+    }
+}
+
+// MARK: - CGContext 相关
+
+func KMContextSaveGState(_ ctx: CGContext?) {
+    ctx?.saveGState()
+}
+
+func KMContextRestoreGState(_ ctx: CGContext?) {
+    ctx?.restoreGState()
+}
+
+func KMContextSetLineWidth(_ ctx: CGContext?, _ width: CGFloat) {
+    ctx?.setLineWidth(width)
+}
+
+func KMContextSetLineCap(_ ctx: CGContext?, _ cap: CGLineCap) {
+    ctx?.setLineCap(cap)
+}
+
+func CGContextSetLineJoin(_ ctx: CGContext?, _ join: CGLineJoin) {
+    ctx?.setLineJoin(join)
+}
+
+func KMContextSetLineDash(_ ctx: CGContext?, _ phase: CGFloat, _ lengths: [CGFloat]?, _ count: UInt) {
+    if let data = lengths {
+        ctx?.setLineDash(phase: phase, lengths: data)
+    }
+}
+
+func KMContextMoveToPoint(_ ctx: CGContext?, _ x: CGFloat, _ y: CGFloat) {
+    ctx?.move(to: CGPointMake(x, y))
+}
+
+func KMContextAddLineToPoint(_ ctx: CGContext?, _ x: CGFloat, _ y: CGFloat) {
+    ctx?.addLine(to: CGPointMake(x, y))
+}
+
+func KMContextFillRect(_ ctx: CGContext?, _ c: CGRect) {
+    ctx?.fill(c)
+}
+
+func KMContextFillRects(_ ctx: CGContext?, _ rects: [CGRect]?, _ count: UInt) {
+    if let data = rects {
+        ctx?.fill(data)
+    }
+}
+
+func KMContextStrokeRect(_ ctx: CGContext?, _ rect: CGRect) {
+    ctx?.stroke(rect)
+}
+
+func KMContextStrokeRectWithWidth(_ ctx: CGContext?, _ rect: CGRect, _ width: CGFloat) {
+    ctx?.stroke(rect, width: width)
+}
+
+func KMContextDrawPath(_ ctx: CGContext?, _ mode: CGPathDrawingMode) {
+    ctx?.drawPath(using: mode)
+}
+
+func KMContextStrokePath(_ ctx: CGContext?) {
+    ctx?.strokePath()
+}
+
+func KMContextSetFillColorWithColor(_ ctx: CGContext?, _ color: CGColor?) {
+    if let data = color {
+        ctx?.setFillColor(data)
+    }
+}
+
+func KMContextFillEllipseInRect(_ ctx: CGContext?, _ rect: CGRect) {
+    ctx?.fillEllipse(in: rect)
+}
+
+
+func KMContextStrokeEllipseInRect(_ ctx: CGContext?, _ rect: CGRect) {
+    ctx?.strokeEllipse(in: rect)
+}
+
+func KMContextSetStrokeColorWithColor(_ ctx: CGContext?, _ color: CGColor?) {
+    if let data = color {
+        ctx?.setStrokeColor(data)
+    }
+}
+
+// MARK: - CGPath
+
+func KMPathMoveToPoint(_ path: CGMutablePath?, _ m: CGAffineTransform?, _ x: CGFloat, _ y: CGFloat) {
+    path?.move(to: CGPoint(x: x, y: y), transform: m ?? .identity)
+}
+
+func KMPathAddLineToPoint(_ path: CGMutablePath?, _ m: CGAffineTransform?, _ x: CGFloat, _ y: CGFloat) {
+    path?.addLine(to: CGPoint(x: x, y: y), transform: m ?? .identity)
+}
+
+func KMPathAddCurveToPoint(_ path: CGMutablePath?, _ m: CGAffineTransform?, _ cp1x: CGFloat, _ cp1y: CGFloat, _ cp2x: CGFloat, _ cp2y: CGFloat, _ x: CGFloat, _ y: CGFloat) {
+    path?.addCurve(to: CGPoint(x: x, y: y), control1: CGPoint(x: cp1x, y: cp1y), control2: CGPoint(x: cp2x, y: cp2y), transform: m ?? .identity)
+}
+ 
+func KMPathCloseSubpath(_ path: CGMutablePath?) {
+    path?.closeSubpath()
+}
+
+func KMPathCreateCopy(_ path: CGPath?) -> CGPath? {
+    return path?.copy()
+}
+
+// MARK: - Float
+
+extension Float {
+    var cgFloat: CGFloat {
+        get {
+            return CGFloat(self)
+        }
+    }
+}
+
+extension UInt {
+    var cgFloat: CGFloat {
+        get {
+            return CGFloat(self)
+        }
+    }
+}
+
+extension Int {
+    var cgFloat: CGFloat {
+        get {
+            return CGFloat(self)
+        }
+    }
+}
+
+func KMLocalizedString(_ key: String, _ comment: String?) -> String {
+    NSLocalizedString(key, comment: comment ?? "")
+}

+ 47 - 0
PDF Office/PDF Master/Class/Common/Category/NSPopover+KMExtension.swift

@@ -0,0 +1,47 @@
+//
+//  NSPopover+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/9.
+//
+
+import Foundation
+
+@objc extension NSPopover {
+    private static var _backgroundViewKey = "backgroundViewKey"
+    func backgroundView() -> NSView {
+        var view = objc_getAssociatedObject(self, &NSPopover._backgroundViewKey) as? NSView
+        if (view == nil) {
+            view = NSView()
+            objc_setAssociatedObject(self, &NSPopover._backgroundViewKey, view, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+            
+            NotificationCenter.default.addObserver(self, selector: #selector(popoverWillOpen), name: NSPopover.willShowNotification, object: self)
+        }
+        return view!
+    }
+    
+    @objc func popoverWillOpen(_ notification: Notification) {
+        let backgroundView = self.backgroundView()
+        if (backgroundView.superview == nil) {
+            let contentView = self.contentViewController?.view
+            let frameView = contentView?.superview
+            frameView?.wantsLayer = true
+            backgroundView.frame = NSInsetRect(frameView?.frame ?? NSZeroRect, 1.0, 1.0)
+            backgroundView.autoresizingMask = [.width, .height]
+            frameView?.addSubview(backgroundView, positioned: .below, relativeTo: contentView)
+        }
+    }
+    
+    func setBackgroundColor(_ backgroundColor: NSColor) {
+        let backgroundView = self.backgroundView()
+        backgroundView.wantsLayer = true
+        backgroundView.layer?.backgroundColor = backgroundColor.cgColor
+    }
+    
+    func backgroundColor() -> NSColor? {
+        if let backgroundColor = self.backgroundView().layer?.backgroundColor {
+            return NSColor(cgColor: backgroundColor)
+        }
+        return nil
+    }
+}

+ 49 - 0
PDF Office/PDF Master/Class/Common/Category/NSString+KMExtension.swift

@@ -0,0 +1,49 @@
+//
+//  NSString+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/27.
+//
+
+import Foundation
+
+extension NSString {
+    func kUrlToPDFFolderPath() -> NSString {
+        guard let path = NSSearchPathForDirectoriesInDomains(.applicationSupportDirectory, .userDomainMask, true).last else {
+            return ""
+        }
+        
+        return path.stringByAppendingPathComponent(Bundle.main.bundleIdentifier ?? "PDF Master bundleIdentifier").stringByAppendingPathComponent(self as String) as NSString
+    }
+    
+    @objc var typeName: NSString {
+        get {
+            let comment = "Description for export"
+            if (self.isEqual(to: "FreeText")) {
+                return NSLocalizedString("Text Box", comment: comment) as NSString
+            } else if (self.isEqual(to: "Note")) {
+                return NSLocalizedString("Anchored Note", comment: comment) as NSString
+            } else if (self.isEqual(to: "Circle")) {
+                return NSLocalizedString("Circle", comment: comment) as NSString
+            } else if (self.isEqual(to: "Square")) {
+                return NSLocalizedString("Rectangle", comment: comment) as NSString
+            } else if (self.isEqual(to: "Highlight")) {
+                return NSLocalizedString("Highlight", comment: comment) as NSString
+            } else if (self.isEqual(to: "Underline")) {
+                return NSLocalizedString("Underline", comment: comment) as NSString
+            } else if (self.isEqual(to: "Strikeout")) {
+                return NSLocalizedString("Strikethrough", comment: comment) as NSString
+            } else if (self.isEqual(to: "Arrow")) {
+                return NSLocalizedString("Arrow", comment: comment) as NSString
+            } else if (self.isEqual(to: "Line")) {
+                return NSLocalizedString("Line", comment: comment) as NSString
+            } else if (self.isEqual(to: "Freehand")) {
+                return NSLocalizedString("Freehand", comment: comment) as NSString
+            } else if (self.isEqual(to: "Stamp")) {
+                return NSLocalizedString("Stamp", comment: comment) as NSString
+            }
+            return NSLocalizedString(self as String, comment: comment) as NSString
+        }
+    }
+}
+

+ 37 - 0
PDF Office/PDF Master/Class/Common/Category/View/NSButton+KMExtension.swift

@@ -0,0 +1,37 @@
+//
+//  NSButton+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/27.
+//
+
+import Foundation
+
+@objc extension NSButton {
+    func setTitleColor(color: NSColor, font: NSFont? = nil) {
+        let cell: NSButtonCell = self.cell as! NSButtonCell
+        let txtColor = color
+        let attrStr1 = cell.attributedTitle
+        var myAttr = NSMutableAttributedString(attributedString: attrStr1)
+        myAttr.addAttribute(.foregroundColor, value: txtColor, range: NSMakeRange(0, myAttr.length))
+        if let _font = font {
+            myAttr.addAttribute(.font, value: _font, range: NSMakeRange(0, myAttr.length))
+        }
+        cell.attributedTitle = myAttr
+        self.updateCell(cell)
+    }
+    
+    func setAlternateTitleColor(color: NSColor) {
+        let cell: NSButtonCell = self.cell as! NSButtonCell
+        let txtColor = color
+        let attrStr1 = cell.attributedTitle
+        var myAttr = NSMutableAttributedString(attributedString: attrStr1)
+        myAttr.addAttribute(.foregroundColor, value: txtColor, range: NSMakeRange(0, myAttr.length))
+        cell.attributedAlternateTitle = myAttr
+        self.updateCell(cell)
+    }
+    
+    func setTitleColor(_ color: NSColor) {
+        self.setTitleColor(color: color)
+    }
+}

+ 126 - 0
PDF Office/PDF Master/Class/Common/Category/View/NSMenu+KMExtension.swift

@@ -0,0 +1,126 @@
+//
+//  NSMenu+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/28.
+//
+
+import Foundation
+
+@objc extension NSMenu {
+    func insertItem(title: String, action: Selector?, target: AnyObject?, tag: Int, atIndex: Int) -> NSMenuItem? {
+        let item: NSMenuItem = NSMenuItem(title: title, action: action, target: target, tag: tag)
+        self.insertItem(item, at: atIndex)
+        return item
+    }
+    
+    func insertItem(title: String, action: Selector?, target: AnyObject?, atIndex: Int) -> NSMenuItem? {
+        let item: NSMenuItem = NSMenuItem(title: title, action: action, target: target)
+        self.insertItem(item, at: atIndex)
+        return item
+    }
+    
+    func addItem(title: String, action: Selector?, target: AnyObject?, tag: Int) -> NSMenuItem? {
+        return self.insertItem(title: title, action: action, target: target, tag: tag, atIndex: self.numberOfItems)
+    }
+    
+    func addItem(title: String, action: Selector?, target: AnyObject?) -> NSMenuItem? {
+        return self.insertItem(title: title, action: action, target: target, atIndex: self.numberOfItems)
+    }
+}
+
+extension NSMenu {
+    func insertItem(withTitle title: String, action: Selector?, target: AnyObject?, tag: Int, at atIndex: Int) -> NSMenuItem? {
+        return self.insertItem(title: title, action: action, target: target, tag: tag, atIndex: atIndex)
+    }
+    
+    func insertItem(withTitle title: String, action: Selector?, target: AnyObject?, at atIndex: Int) -> NSMenuItem? {
+        return self.insertItem(title: title, action: action, target: target, atIndex: atIndex)
+    }
+    
+    func addItem(withTitle title: String, action: Selector?, target: AnyObject?, tag: Int) -> NSMenuItem? {
+        return self.addItem(title: title, action: action, target: target, tag: tag)
+    }
+    
+    func addItem(withTitle title: String, action: Selector?, target: AnyObject?) -> NSMenuItem? {
+        return self.addItem(title: title, action: action, target: target)
+    }
+    
+//    func addItem_r(withTitle title: String, action: Selector?, target: AnyObject?) -> NSMenuItem {
+//        return self.addItem(title: title, action: action, target: target)
+//    }
+}
+
+/*
+ + (NSMenu *)menu {
+     return [[NSMenu alloc] initWithTitle:@""];
+ }
+
+ - (NSMenuItem *)insertItemWithTitle:(NSString *)aString imageNamed:(NSString *)anImageName action:(SEL)aSelector target:(id)aTarget tag:(NSInteger)aTag atIndex:(NSInteger)anIndex {
+     NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:aString imageNamed:anImageName action:aSelector target:aTarget tag:aTag];
+     [self insertItem:item atIndex:anIndex];
+     return item;
+ }
+
+ - (NSMenuItem *)addItemWithTitle:(NSString *)aString imageNamed:(NSString *)anImageName action:(SEL)aSelector target:(id)aTarget tag:(NSInteger)aTag {
+     return [self insertItemWithTitle:aString imageNamed:anImageName action:aSelector target:aTarget tag:aTag atIndex:[self numberOfItems]];
+ }
+
+ - (NSMenuItem *)insertItemWithSubmenuAndTitle:(NSString *)aString atIndex:(NSInteger)anIndex {
+     NSMenuItem *item = [[NSMenuItem alloc] initWithSubmenuAndTitle:aString];
+     [self insertItem:item atIndex:anIndex];
+     return item;
+ }
+
+ - (NSMenuItem *)addItemWithTitle:(NSString *)aString forView:(NSView*)view action:(SEL)aSelector target:(id)aTarget tag:(NSInteger)aTag atIndex:(NSInteger)anIndex {
+     NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:aString inView:view action:aSelector target:aTarget tag:aTag];
+     [self insertItem:item atIndex:anIndex];
+     return item;
+     
+ }
+
+ - (NSMenuItem *)addItemWithSubmenuAndTitle:(NSString *)aString {
+     return [self insertItemWithSubmenuAndTitle:aString atIndex:[self numberOfItems]];
+ }
+ */
+
+@objc extension NSMenuItem {
+    class func menuItem(title: String, action: Selector, target: AnyObject?, tag: Int = 0) -> NSMenuItem? {
+        return NSMenuItem(title: title, action: action, target: target, tag: tag)
+    }
+    
+    convenience init(title: String, imageNamed: String? = nil, action: Selector?, target: AnyObject?, tag: Int = 0) {
+        self.init(title: title, action: action, keyEquivalent: "")
+        if let data = imageNamed {
+            self.image = NSImage(named: data)
+        }
+        self.target = target
+        self.tag = tag
+    }
+    
+    convenience init(title: String, inView: NSView?, action: Selector?, target: AnyObject?, tag: Int = 0) {
+        self.init(title: title, action: action, keyEquivalent: "")
+        if let data = inView {
+            self.view = data
+        }
+        self.target = target
+        self.tag = tag
+    }
+}
+
+/*
+
+ + (NSMenuItem *)menuItemWithSubmenuAndTitle:(NSString *)aString {
+     return [[NSMenuItem alloc] initWithSubmenuAndTitle:aString];
+ }
+
+ - (id)initWithSubmenuAndTitle:(NSString *)aString {
+     self = [self initWithTitle:aString action:NULL keyEquivalent:@""];
+     if (self) {
+         NSMenu *menu = [[NSMenu alloc] initWithTitle:aString];
+         [self setSubmenu:menu];
+     }
+     return self;
+ }
+
+ */

+ 54 - 0
PDF Office/PDF Master/Class/Common/Category/View/NSTextView+KMExtension.swift

@@ -0,0 +1,54 @@
+//
+//  NSTextView+KMExtension.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/26.
+//
+
+import Foundation
+
+@objc extension NSTextView {
+    var km_placeholderString: String? {
+        get {
+            return self._placeholderLabel.placeholderString
+        }
+        set {
+            self._placeholderLabel.placeholderString = newValue
+        }
+    }
+    
+    var km_placeholderAttributedString: NSAttributedString? {
+        get {
+            return self._placeholderLabel.placeholderAttributedString
+        }
+        set {
+            self._placeholderLabel.placeholderAttributedString = newValue
+        }
+    }
+    
+    var placeholderLabel: NSTextField {
+        get {
+            return self._placeholderLabel
+        }
+    }
+    
+    private static var _placeholderLabelKey = "_placeholderLabelKey"
+    private var _placeholderLabel: NSTextField {
+        get {
+            if let label = objc_getAssociatedObject(self, &NSTextView._placeholderLabelKey) as? NSTextField {
+                return label
+            }
+            
+            let label = NSTextField(labelWithString: "")
+            self.addSubview(label)
+            
+            let x = self.textContainerInset.width
+            let y = self.textContainerInset.height
+            label.frame = NSMakeRect(x+2, y, NSWidth(self.bounds)-2*x, 20)
+            label.autoresizingMask = [.width]
+            objc_setAssociatedObject(self, &NSTextView._placeholderLabelKey, label, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+            return label
+        }
+    }
+}
+

+ 63 - 0
PDF Office/PDF Master/Class/Common/Control/KMCoverButton.swift

@@ -0,0 +1,63 @@
+//
+//  KMCoverButton.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/7.
+//
+
+import Cocoa
+
+@objc enum KMCoverAction: Int {
+    case enter = 0
+    case move
+    case exit
+}
+
+@objcMembers
+class KMCoverButton: NSButton {
+    
+//    var coverAction: ((KMCoverButton, KMCoverAction) -> Void)?
+    var coverAction: ((_ button: KMCoverButton, _ actionType: KMCoverAction) -> Void)?
+
+    private var area: NSTrackingArea?
+    
+    deinit {
+        if let trackingArea = area {
+            self.removeTrackingArea(trackingArea)
+        }
+    }
+
+    override func updateTrackingAreas() {
+        super.updateTrackingAreas()
+
+        if let existingArea = self.area {
+            self.removeTrackingArea(existingArea)
+            self.area = nil
+        }
+
+        let opts: NSTrackingArea.Options = [.mouseEnteredAndExited, .mouseMoved, .activeAlways]
+        self.area = NSTrackingArea(rect: bounds, options: opts, owner: self, userInfo: nil)
+
+        if let trackingArea = self.area {
+            self.addTrackingArea(trackingArea)
+        }
+    }
+    
+    override func mouseEntered(with event: NSEvent) {
+        if let coverAction = coverAction {
+            coverAction(self, .enter)
+        }
+    }
+    
+    override func mouseExited(with event: NSEvent) {
+        if let coverAction = coverAction {
+            coverAction(self, .exit)
+        }
+    }
+
+    override func mouseMoved(with event: NSEvent) {
+        if let coverAction = coverAction {
+            coverAction(self, .move)
+        }
+    }
+}

+ 116 - 0
PDF Office/PDF Master/Class/Common/Control/KMPageIndicator.swift

@@ -0,0 +1,116 @@
+//
+//  KMPageIndicator.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/10.
+//
+
+import Cocoa
+
+@objc(TCPageIndicatorDelegate)
+protocol KMPageIndicatorDelegate: AnyObject {
+    func pageIndicator(_ pageIndicator: KMPageIndicator, didSelectPageAt index: UInt)
+}
+
+@objc (TCPageIndicator)
+@objcMembers class KMPageIndicator: NSView {
+    weak var delegate: KMPageIndicatorDelegate?
+    var selectedColor: NSColor?
+    var normalColor: NSColor?
+    
+    var indicatorMargin: CGFloat = 8.0 {
+        didSet {
+            self.needsDisplay = true
+        }
+    }
+    var currentPage: UInt = 0 {
+        didSet {
+            self.needsDisplay = true
+        }
+    }
+    
+    var numberOfPages: UInt = 0 {
+        didSet {
+            self.needsDisplay = true
+        }
+    }
+    var pageIndicatorSize: NSSize = CGSizeMake(6, 6) {
+        didSet {
+            self.needsDisplay = true
+        }
+    }
+    
+    // 是否响应事件 [默认为 YES ]
+    var enabled = true
+    
+    private var _indicatorRects: [NSValue]?
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        
+        self.initDefaultValue()
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+        
+        self.initDefaultValue()
+    }
+    
+    func initDefaultValue() {
+        self.selectedColor = NSColor.gray
+        self.normalColor = NSColor.gray.withAlphaComponent(0.5)
+        
+        self._indicatorRects = [NSValue](repeating: NSValue(rect: NSZeroRect), count: 10)
+    }
+    
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        
+        var indicatorAreaWidth = 0.0
+        if (self.numberOfPages > 0) {
+            indicatorAreaWidth = self.pageIndicatorSize.width * self.numberOfPages.cgFloat + self.indicatorMargin * (self.numberOfPages-1).cgFloat
+        }
+        
+        var leftPosition = (self.bounds.size.width - indicatorAreaWidth) * 0.5
+        let topPadding = (self.bounds.size.height - self.pageIndicatorSize.height) * 0.5
+        
+        self._indicatorRects?.removeAll()
+        for i in 0 ..< self.numberOfPages {
+            let position = NSMakePoint(leftPosition, topPadding)
+            let rect = CGRectMake(position.x, position.y, self.pageIndicatorSize.width, self.pageIndicatorSize.height)
+            self._indicatorRects?.append(NSValue(rect: rect))
+            
+            let path = NSBezierPath(ovalIn: rect)
+            if (self.currentPage == i) {
+                self.selectedColor?.setFill()
+            } else {
+                self.normalColor?.setFill()
+            }
+            path.fill()
+            leftPosition += (self.pageIndicatorSize.width + self.indicatorMargin)
+        }
+    }
+    
+    override func mouseDown(with event: NSEvent) {
+        super.mouseDown(with: event)
+        
+        if (self.enabled == false) {
+            return
+        }
+        
+        let eventLocation = event.locationInWindow
+        /// 转换成视图的本地坐标
+        let pointInView = self.convert(eventLocation, from: nil)
+        for i in 0 ..< self.numberOfPages {
+            if let datas = self._indicatorRects {
+                let rect = CGRectInset(datas[Int(i)].rectValue, -2, -2)
+                if (NSPointInRect(pointInView, rect)) {
+                    self.currentPage = i
+                    
+                    self.delegate?.pageIndicator(self, didSelectPageAt: i)
+                }
+            }
+        }
+    }
+}

+ 1 - 0
PDF Office/PDF Master/Class/Common/KMCommonDefine.swift

@@ -32,6 +32,7 @@ public func km_synchronized<T>(_ lock: AnyObject, _ body: () throws -> T) rethro
 typealias KMItemClickBlock<T> = (_ item: T?, _ index: Int)->()
 typealias KMCommonClickBlock = (_ index: Int, _ params: Any...)->()
 typealias KMCommonBlock = (_ params: Any...)->()
+typealias KMEmptyBlock = ()->Void
 
 typealias KMValueDidChangeBlock = (_ value: Any?, _ change: [NSKeyValueChangeKey : Any]?)->()
 typealias KMResultBlock = (_ result: KMResult?, _ params: Any...)->Void

+ 0 - 21
PDF Office/PDF Master/Class/Common/OC/Category/NSTextView+KMExtension.h

@@ -1,21 +0,0 @@
-//
-//  NSTextView+KMExtension.h
-//  PDF Master
-//
-//  Created by tangchao on 2023/4/13.
-//
-
-#import <Cocoa/Cocoa.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface NSTextView (KMExtension)
-
-@property (nonatomic, copy) NSString *km_placeholderString;
-@property (nonatomic, copy) NSAttributedString *km_placeholderAttributedString;
-
-@property (nonatomic, strong, readonly) NSTextField *placeholderLabel;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 44
PDF Office/PDF Master/Class/Common/OC/Category/NSTextView+KMExtension.m

@@ -1,44 +0,0 @@
-//
-//  NSTextView+KMExtension.m
-//  PDF Master
-//
-//  Created by tangchao on 2023/4/13.
-//
-
-#import "NSTextView+KMExtension.h"
-#import <objc/runtime.h>
-
-@implementation NSTextView (KMExtension)
-
-- (void)setKm_placeholderString:(NSString *)km_placeholderString {
-    [self placeholderLabel].placeholderString = km_placeholderString;
-}
-
-- (NSString *)km_placeholderString {
-    return [self placeholderLabel].placeholderString;
-}
-
-- (void)setKm_placeholderAttributedString:(NSAttributedString *)km_placeholderAttributedString {
-    [self placeholderLabel].placeholderAttributedString = km_placeholderAttributedString;
-}
-
-- (NSAttributedString *)km_placeholderAttributedString {
-    return [self placeholderLabel].placeholderAttributedString;
-}
-
-- (NSTextField *)placeholderLabel {
-    NSTextField *label = objc_getAssociatedObject(self, @selector(placeholderLabel));
-    if (label) return label;
-    
-    label = [NSTextField labelWithString:@""];
-    [self addSubview:label];
-    
-    CGFloat x = self.textContainerInset.width;
-    CGFloat y = self.textContainerInset.height;
-    label.frame = NSMakeRect(x+2, y, NSWidth(self.bounds)-2*x, 20);
-    label.autoresizingMask = NSViewWidthSizable;
-    objc_setAssociatedObject(self, @selector(placeholderLabel), label, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-    return label;
-}
-
-@end

+ 0 - 26
PDF Office/PDF Master/Class/Common/OC/Control/KMCoverButton.h

@@ -1,26 +0,0 @@
-//
-//  KMCoverButton.h
-//  PDF Reader
-//
-//  Created by tangchao on 2022/2/24.
-//  Copyright © 2022 Kdan Mobile. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef NS_ENUM(NSUInteger, KMCoverAction) {
-    KMCoverActionEnter = 0,
-    KMCoverActionMove,
-    KMCoverActionExit
-};
-
-/** hover按钮 */
-@interface KMCoverButton : NSButton
-
-@property (nonatomic, copy) void(^coverAction)(KMCoverButton *button, KMCoverAction action);
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 53
PDF Office/PDF Master/Class/Common/OC/Control/KMCoverButton.m

@@ -1,53 +0,0 @@
-//
-//  KMCoverButton.m
-//  PDF Reader
-//
-//  Created by tangchao on 2022/2/24.
-//  Copyright © 2022 Kdan Mobile. All rights reserved.
-//
-
-#import "KMCoverButton.h"
-
-@interface KMCoverButton ()
-
-@property (nonatomic, strong) NSTrackingArea *area;
-
-@end
-
-@implementation KMCoverButton
-
-- (void)dealloc {
-    [self removeTrackingArea:_area];
-}
-
-- (void)updateTrackingAreas {
-    [super updateTrackingAreas];
-    
-    if (self.area) {
-        [self removeTrackingArea:self.area];
-        self.area = nil;
-    }
-    
-    int opts = (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveAlways);
-    self.area = [[NSTrackingArea alloc] initWithRect:self.bounds options:opts owner:self userInfo:nil];
-    
-    [self addTrackingArea:self.area];
-}
-
-- (void)mouseEntered:(NSEvent *)event {
-    if (self.coverAction) {
-        self.coverAction(self, KMCoverActionEnter);
-    }
-}
-- (void)mouseExited:(NSEvent *)event {
-    if (self.coverAction) {
-        self.coverAction(self, KMCoverActionExit);
-    }
-}
-- (void)mouseMoved:(NSEvent *)event {
-    if (self.coverAction) {
-        self.coverAction(self, KMCoverActionMove);
-    }
-}
-
-@end

+ 0 - 16
PDF Office/PDF Master/Class/Common/OC/Control/WaitingView.h

@@ -1,16 +0,0 @@
-//
-//  WaitingView.h
-//  NoteLedge for Mac
-//
-//  Created by kdanmobile on 14-3-31.
-//  Copyright (c) 2014年 kdanmobile. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface WaitingView : NSView
-{
-    NSProgressIndicator             *_indicator;
-}
-- (void)startAnimation;
-@end

+ 0 - 68
PDF Office/PDF Master/Class/Common/OC/Control/WaitingView.m

@@ -1,68 +0,0 @@
-//
-//  WaitingView.m
-//  NoteLedge for Mac
-//
-//  Created by kdanmobile on 14-3-31.
-//  Copyright (c) 2014年 kdanmobile. All rights reserved.
-//
-
-#import "WaitingView.h"
-@implementation NSView (Centering)
-
-- (void) center {
-    
-    if (![self superview]) return;
-    
-    [self setFrame:NSMakeRect(
-                              
-                              0.5 * ([self superview].frame.size.width - self.frame.size.width),
-                              0.5 * ([self superview].frame.size.height - self.frame.size.height),
-                              
-                              self.frame.size.width, 
-                              self.frame.size.height
-                              
-                              )];
-    
-}
-
-@end
-@implementation WaitingView
-
-- (id)initWithFrame:(NSRect)frame
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        _indicator = [[NSProgressIndicator alloc] init];
-        [_indicator setBezeled:NO];
-        [_indicator setAutoresizingMask:63];
-        [_indicator setStyle:NSProgressIndicatorSpinningStyle];
-        [_indicator setControlSize:NSRegularControlSize];
-        [_indicator setUsesThreadedAnimation:YES];
-        [_indicator sizeToFit];
-       
-        [self addSubview:_indicator];
-         [_indicator center];
-    }
-    return self;
-}
-
-- (void)startAnimation
-{
-    [_indicator startAnimation:nil];
-}
-- (void)drawRect:(NSRect)dirtyRect
-{
-	[[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:0.5] set];
-    [NSBezierPath fillRect:self.bounds];
-}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
-    
-}
-- (void)mouseUp:(NSEvent *)theEvent
-{
-    
-}
-
-@end

+ 2 - 2
PDF Office/PDF Master/Class/Common/OC/EmailSubscription/KMEmailSubWindowController.m

@@ -6,7 +6,7 @@
 //
 
 #import "KMEmailSubWindowController.h"
-#import "NSButton+TitleColor.h"
+#import <PDF_Master-Swift.h>
 
 @interface KMEmailSubWindowController ()
 
@@ -46,7 +46,7 @@
     self.button.layer.masksToBounds = YES;
     self.button.layer.cornerRadius = 2;
     self.button.layer.backgroundColor = [NSColor colorWithRed:46.0/255.0 green:114.0/255.0 blue:230.0/255.0 alpha:1.0].CGColor;
-    [self.button setTitleColor:[NSColor whiteColor]];
+    [self.button setTitleColorWithColor:[NSColor whiteColor] font:nil];
 }
 
 #pragma mark - Button Actions

+ 6 - 6
PDF Office/PDF Master/Class/Common/OC/Property/InfoWindow.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="SKInfoWindowController">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMInfoWindowController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="attributesTableView" destination="235" id="244"/>
                 <outlet property="summaryTableView" destination="225" id="231"/>
@@ -32,18 +32,18 @@
                         <tabViewItems>
                             <tabViewItem label="Summary" identifier="1" id="94">
                                 <view key="view" id="95">
-                                    <rect key="frame" x="10" y="25" width="414" height="310"/>
+                                    <rect key="frame" x="10" y="29" width="414" height="306"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
                                         <scrollView focusRingType="none" fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="22" horizontalPageScroll="10" verticalLineScroll="22" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="222">
-                                            <rect key="frame" x="17" y="17" width="380" height="287"/>
+                                            <rect key="frame" x="17" y="17" width="380" height="283"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="tba-ii-VJE">
-                                                <rect key="frame" x="0.0" y="0.0" width="380" height="287"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="380" height="283"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <subviews>
                                                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="20" rowSizeStyle="automatic" viewBased="YES" id="225">
-                                                        <rect key="frame" x="0.0" y="0.0" width="389" height="287"/>
+                                                        <rect key="frame" x="0.0" y="0.0" width="389" height="283"/>
                                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                         <size key="intercellSpacing" width="3" height="2"/>
                                                         <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -141,7 +141,7 @@
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="RKB-CK-2VI">
                                                 <rect key="frame" x="0.0" y="0.0" width="380" height="287"/>
-                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                <autoresizingMask key="autoresizingMask"/>
                                                 <subviews>
                                                     <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="20" rowSizeStyle="automatic" viewBased="YES" id="235">
                                                         <rect key="frame" x="0.0" y="0.0" width="389" height="287"/>

+ 584 - 0
PDF Office/PDF Master/Class/Common/OC/Property/KMInfoWindowController.swift

@@ -0,0 +1,584 @@
+//
+//  KMInfoWindowController.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/10.
+//
+
+import Cocoa
+
+/*
+ #define SKInfoWindowFrameAutosaveName @"SKInfoWindow"
+
+ #define LABEL_COLUMN_ID @"label"
+ #define VALUE_COLUMN_ID @"value"
+ */
+  
+private let LABEL_COLUMN_ID = "label"
+private let VALUE_COLUMN_ID = "value"
+
+private let KMInfoVersionKey = "Version"
+private let KMInfoPageCountKey = "PageCount"
+private let KMInfoPageSizeKey = "PageSize"
+private let KMInfoPageWidthKey = "PageWidth"
+private let KMInfoPageHeightKey = "PageHeight"
+private let KMInfoKeywordsStringKey = "KeywordsString"
+private let KMInfoEncryptedKey = "Encrypted"
+private let KMInfoAllowsPrintingKey = "AllowsPrinting"
+private let KMInfoAllowsCopyingKey = "AllowsCopying"
+private let KMInfoAllowsDocumentAssemblyKey = "AllowsDocumentAssembly"
+private let KMInfoAllowsContentAccessibilityKey = "AllowsContentAccessibility"
+private let KMInfoAllowsCommentingKey = "AllowsCommenting"
+private let KMInfoAllowsFormFieldEntryKey = "AllowsFormFieldEntry"
+private let KMInfoFileNameKey = "FileName"
+private let KMInfoFileSizeKey = "FileSize"
+private let KMInfoPhysicalSizeKey = "PhysicalSize"
+private let KMInfoLogicalSizeKey = "LogicalSize"
+private let KMInfoTagsKey = "Tags"
+private let KMInfoRatingKey = "Rating"
+
+private let kKMWindowDidBecomeMainNotificationName = Notification.Name(rawValue: "KMWindowDidBecomeMainNotificationName")
+
+typealias KMInfoWindowC = KMInfoWindowController
+
+class KMInfoWindowController: NSWindowController {
+    public static let windowDidBecomeMainNotification = kKMWindowDidBecomeMainNotificationName
+    
+    @IBOutlet weak var summaryTableView: NSTableView!
+    @IBOutlet weak var attributesTableView: NSTableView!
+    @IBOutlet weak var tabView: NSTabView!
+    var info: NSDictionary?
+    
+    var editDictionary: NSMutableDictionary = NSMutableDictionary()
+    
+    private var _summaryKeys: [String] = []
+    var summaryKeys: [String] {
+        get {
+            return self._summaryKeys
+        }
+    }
+    private var _attributesKeys: [String] = []
+    var attributesKeys: [String] {
+        get {
+            return self._attributesKeys
+        }
+    }
+    
+    private var _labels: [String : String] = [:]
+    var labels: [String : String] {
+        get {
+            return self._labels
+        }
+    }
+    
+    private weak var _currentDocument: NSDocument?
+    
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        
+        Swift.debugPrint("KMInfoWindowController 已释放")
+    }
+    
+    static let shared = KMInfoWindowController()
+    
+    convenience init() {
+        self.init(windowNibName: "InfoWindow")
+        
+        self.info = nil;
+        self._summaryKeys = [KMInfoFileNameKey,
+                             KMInfoFileSizeKey,
+                             KMInfoPageSizeKey,
+                             KMInfoPageCountKey,
+                             KMInfoVersionKey,
+                             "",
+                             KMInfoEncryptedKey,
+                             KMInfoAllowsPrintingKey,
+                             KMInfoAllowsCopyingKey,
+                             KMInfoAllowsDocumentAssemblyKey,
+                             KMInfoAllowsContentAccessibilityKey,
+                             KMInfoAllowsCommentingKey,
+                             KMInfoAllowsFormFieldEntryKey]
+        
+        self._attributesKeys = [PDFDocumentAttribute.titleAttribute.rawValue,
+                                PDFDocumentAttribute.authorAttribute.rawValue,
+                                PDFDocumentAttribute.subjectAttribute.rawValue,
+                                PDFDocumentAttribute.creatorAttribute.rawValue,
+                                PDFDocumentAttribute.producerAttribute.rawValue,
+                                PDFDocumentAttribute.creationDateAttribute.rawValue,
+                                PDFDocumentAttribute.modificationDateAttribute.rawValue,
+                                KMInfoKeywordsStringKey]
+        self._labels = [KMLocalizedString("File name:", "Info label") : KMInfoFileNameKey,
+                        KMLocalizedString("File size:", "Info label") : KMInfoFileSizeKey,
+                        KMLocalizedString("Page size:", "Info label") : KMInfoPageSizeKey,
+                        KMLocalizedString("Page count:", "Info label") : KMInfoPageCountKey,
+                        KMLocalizedString("PDF Version:", "Info label") : KMInfoVersionKey,
+                        KMLocalizedString("Encrypted:", "Info label") : KMInfoEncryptedKey,
+                        KMLocalizedString("Printing:", "Info label") : KMInfoAllowsPrintingKey,
+                        KMLocalizedString("Content Copying:", "Info label") : KMInfoAllowsCopyingKey,
+                        KMLocalizedString("Document Assembly:", "Info label") : KMInfoAllowsDocumentAssemblyKey,
+                        KMLocalizedString("Content Copying for Accessibility:", "Info label") : KMInfoAllowsContentAccessibilityKey,
+                        KMLocalizedString("Commenting:", "Info label") : KMInfoAllowsCommentingKey,
+                        KMLocalizedString("Filling of form fields:", "Info label") : KMInfoAllowsFormFieldEntryKey,
+                        KMLocalizedString("Title:", "Info label") : PDFDocumentAttribute.titleAttribute.rawValue,
+                        KMLocalizedString("Author:", "Info label") : PDFDocumentAttribute.authorAttribute.rawValue,
+                        KMLocalizedString("Subject:", "Info label") : PDFDocumentAttribute.subjectAttribute.rawValue,
+                        KMLocalizedString("Content Creator:", "Info label") : PDFDocumentAttribute.creatorAttribute.rawValue,
+                        KMLocalizedString("PDF Producer:", "Info label") : PDFDocumentAttribute.producerAttribute.rawValue,
+                        KMLocalizedString("Creation date:", "Info label") : PDFDocumentAttribute.creationDateAttribute.rawValue,
+                        KMLocalizedString("Modification date:", "Info label") : PDFDocumentAttribute.modificationDateAttribute.rawValue,
+                        KMLocalizedString("Keywords:", "Info label") : KMInfoKeywordsStringKey]
+    }
+    
+    override func loadWindow() {
+        super.loadWindow()
+        
+        self.window?.localizeStrings(fromTable: self.windowNibName)
+    }
+
+    override func windowDidLoad() {
+        super.windowDidLoad()
+    
+        self.updateForDocument(NSApp.mainWindow?.windowController?.document as? NSDocument)
+        
+        self.summaryTableView.selectionHighlightStyle = .none
+        self.attributesTableView.selectionHighlightStyle = .none
+
+        self.tabView.selectTabViewItem(at: 1)
+
+        NotificationCenter.default.addObserver(self, selector: #selector(_handleViewFrameDidChangeNotification), name: NSView.frameDidChangeNotification, object: self.attributesTableView.enclosingScrollView)
+        NotificationCenter.default.addObserver(self, selector: #selector(_handleWindowDidBecomeMainNotification), name: NSWindow.didBecomeMainNotification, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(_handleWindowDidResignMainNotification), name: NSWindow.didResignMainNotification, object: nil)
+//    //    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePDFDocumentInfoDidChangeNotification:)
+//    //                                                 name: SKPDFPageBoundsDidChangeNotification object: nil];
+//    //    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleDocumentFileURLDidChangeNotification:)
+//    //                                                 name: SKDocumentFileURLDidChangeNotification object: nil];
+        NotificationCenter.default.addObserver(self, selector: #selector(_handlePDFDocumentInfoDidChangeNotification), name: NSNotification.Name.PDFDocumentDidUnlock, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(_handleWindowWillCloseNotification), name: NSWindow.willCloseNotification, object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(_km_handleWindowDidBecomeMainNotification), name: KMInfoWindowC.windowDidBecomeMainNotification, object: nil)
+    }
+    
+    func updateForDocument(_ doc: NSDocument?) {
+        self._currentDocument = doc
+
+        let info = self._infoForDocument(doc)
+        var dic = NSMutableDictionary(dictionary: info)
+        for key in self.editDictionary.allKeys {
+            dic.setObject(self.editDictionary[key], forKey: key as! NSCopying)
+        }
+        self.info = dic
+        self.summaryTableView.reloadData()
+        self.attributesTableView.reloadData()
+    }
+    
+    // MARK: - Private Methods
+     
+    private func _infoForDocument(_ doc: NSDocument?) -> NSDictionary {
+        var dictionary: NSMutableDictionary = NSMutableDictionary()
+        var logicalSize: Int64 = 0
+        var physicalSize: Int64 = 0
+        
+        if let data = doc, data.isKind(of: KMMainDocument.self) {
+            if let pdfDoc = (data as! KMMainDocument).mainViewController?.document {
+                dictionary.addEntries(from: pdfDoc.documentAttributes())
+                dictionary.setValue(String(format: "%ld.%ld", pdfDoc.majorVersion, pdfDoc.minorVersion), forKey: KMInfoVersionKey)
+                dictionary.setValue(NSNumber(value: pdfDoc.pageCount), forKey: KMInfoPageCountKey)
+                if (pdfDoc.pageCount > 0) {
+                    let page: CPDFPage = pdfDoc.page(at:0)!
+                    let cropSize = page.bounds(for: .cropBox).size
+                    let mediaSize = page.bounds(for: .mediaBox).size
+                    dictionary.setValue(KMSizeString(cropSize, mediaSize), forKey: KMInfoPageSizeKey)
+                    dictionary.setValue(NSNumber(value: cropSize.width), forKey: KMInfoPageWidthKey)
+                    dictionary.setValue(NSNumber(value: cropSize.height), forKey: KMInfoPageHeightKey)
+                }
+                if let keyworks = dictionary.value(forKey: CPDFDocumentAttribute.keywordsAttribute.rawValue) {
+                    if (keyworks as AnyObject).isKind(of: NSArray.self) {
+                        dictionary.setValue(keyworks, forKey: KMInfoKeywordsStringKey)
+                    }
+                }
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.isEncrypted), forKey: KMInfoEncryptedKey)
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsPrinting), forKey: KMInfoAllowsPrintingKey)
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsCopying), forKey: KMInfoAllowsCopyingKey)
+                
+//                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsContentAccessibility), forKey: KMInfoAllowsContentAccessibilityKey)
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsCommenting), forKey: KMInfoAllowsCommentingKey)
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsFormFieldEntry), forKey: KMInfoAllowsDocumentAssemblyKey)
+                dictionary.setValue(NSNumber(booleanLiteral: pdfDoc.allowsFormFieldEntry), forKey: KMInfoAllowsFormFieldEntryKey)
+            }
+        }
+        
+        dictionary.setValue(doc?.fileURL?.path.lastPathComponent, forKey: KMInfoFileNameKey)
+//        [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL], &physicalSize, &logicalSize) forKey:SKInfoFileSizeKey];
+        dictionary.setValue(NSNumber(value: physicalSize), forKey: KMInfoPhysicalSizeKey)
+        dictionary.setValue(NSNumber(value: logicalSize), forKey: KMInfoLogicalSizeKey)
+        return dictionary
+    }
+    
+    @objc private func _handleViewFrameDidChangeNotification(_ sender: Notification) {
+        self.attributesTableView.noteHeightOfRows(withIndexesChanged: IndexSet(integer: self.attributesKeys.count-1))
+    }
+    
+    @objc private func _handleWindowDidBecomeMainNotification(_ sender: Notification) {
+        self.editDictionary.removeAllObjects()
+        self.updateForDocument((sender.object as? NSWindow)?.windowController?.document as? NSDocument)
+    }
+    
+    @objc private func _handleWindowDidResignMainNotification(_ sender: Notification) {
+        self.editDictionary.removeAllObjects()
+        self.updateForDocument(nil)
+    }
+    
+    @objc private func _handlePDFDocumentInfoDidChangeNotification(_ sender: Notification) {
+        guard let doc = NSApp.mainWindow?.windowController?.document else {
+            return
+        }
+        
+        if (doc.isKind(of: KMMainDocument.self)) {
+            guard let pdfDocument = (doc as! KMMainDocument).mainViewController?.document else {
+                return
+            }
+            if (pdfDocument.isEqual(to: sender.object)) {
+                self.editDictionary.removeAllObjects()
+                self.updateForDocument((doc as! NSDocument))
+            }
+        }
+    }
+    
+    @objc private func _handleWindowWillCloseNotification(_ sender: Notification) {
+        if let object = sender.object as? AnyObject, object.isEqual(self.window) {
+            if (self.editDictionary.count > 0) {
+                if let windowController = NSApp.mainWindow?.windowController, windowController.isKind(of: KMBrowserWindowController.self) {
+                    let document = (windowController as! KMBrowserWindowController).document as? KMMainDocument
+                    var dic: NSMutableDictionary = NSMutableDictionary(dictionary: document?.mainViewController?.document?.documentAttributes() ?? [:])
+                    var isSave = false
+                    for key in self.editDictionary.allKeys {
+                        if let data = key as? NSString, data.isEqual(to: KMInfoKeywordsStringKey) {
+                            let string = self.editDictionary[key]
+                            if let data = string as? NSString, data.isEqual(to: dic[PDFDocumentAttribute.keywordsAttribute.rawValue]) {
+                                isSave = true
+                                dic.setObject(string as Any, forKey: CPDFDocumentAttribute.keywordsAttribute.rawValue as NSCopying)
+                            }
+                        } else {
+                            if let data = dic[key] as? NSString, data.isEqual(to: self.editDictionary[key]) == false {
+                                isSave = true
+                                dic.setObject(self.editDictionary[key] as Any, forKey: key as! NSCopying)
+                            }
+                        }
+                    }
+                    if (isSave) {
+                        document?.mainViewController?.document?.setDocumentAttributes(dic as? [CPDFDocumentAttribute : Any])
+                        document?.save(nil)
+                    }
+                }
+            }
+            self.editDictionary.removeAllObjects()
+        }
+    }
+    
+    @objc private func _km_handleWindowDidBecomeMainNotification(_ sender: Notification) {
+        self.editDictionary.removeAllObjects()
+        self.updateForDocument(sender.object as? NSDocument)
+    }
+    
+    /*
+     - (void)handlePDFDocumentInfoDidChangeNotification:(NSNotification *)notification {
+         [self.editDictionary removeAllObjects];
+         NSDocument *doc = [[[NSApp mainWindow] windowController] document];
+         if ([doc isKindOfClass:[KMMainDocument class]]) {
+             CPDFDocument *pdfDocument = ((KMMainDocument *)doc).mainViewController.document;
+             if ([pdfDocument isEqual:notification.object]) {
+                 [self updateForDocument:doc];
+             }
+         }
+     }
+
+     - (void)handleDocumentFileURLDidChangeNotification:(NSNotification *)notification {
+         [self.editDictionary removeAllObjects];
+         NSDocument *doc = [[[NSApp mainWindow] windowController] document];
+         if ([doc isEqual:[notification object]])
+             [self updateForDocument:doc];
+     }
+     */
+
+    override func showWindow(_ sender: Any?) {
+        super.showWindow(sender)
+        
+        self.editDictionary.removeAllObjects()
+        self.attributesTableView.reloadData()
+    }
+    /*
+
+     #define BYTE_FACTOR 1024
+     #define BYTE_FACTOR_F 1024.0f
+     #define BYTE_SHIFT 10
+
+     static NSString *SKFileSizeStringForFileURL(NSURL *fileURL, unsigned long long *physicalSizePtr, unsigned long long *logicalSizePtr) {
+         if (fileURL == nil)
+             return @"";
+         
+         FSRef fileRef;
+         FSCatalogInfo catalogInfo;
+         unsigned long long size, logicalSize = 0;
+         BOOL gotSize = NO, isDir = NO;
+         NSMutableString *string = [NSMutableString string];
+         
+         Boolean gotRef = CFURLGetFSRef((CFURLRef)fileURL, &fileRef);
+         if (gotRef && noErr == FSGetCatalogInfo(&fileRef, kFSCatInfoDataSizes | kFSCatInfoRsrcSizes | kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL, NULL)) {
+             size = catalogInfo.dataPhysicalSize + catalogInfo.rsrcPhysicalSize;
+             logicalSize = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
+             isDir = (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0;
+             gotSize = YES;
+         }
+         
+         if (gotSize == NO) {
+             // this seems to give the logical size
+             NSDictionary *fileAttrs = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:NULL];
+             logicalSize = size = [[fileAttrs objectForKey:NSFileSize] unsignedLongLongValue];
+             isDir = [[fileAttrs fileType] isEqualToString:NSFileTypeDirectory];
+         }
+         
+         if (isDir) {
+             NSString *path = [fileURL path];
+             unsigned long long componentSize;
+             unsigned long long logicalComponentSize;
+             for (NSString *file in [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:path error:NULL]) {
+                 SKFileSizeStringForFileURL([NSURL fileURLWithPath:[path stringByAppendingPathComponent:file]], &componentSize, &logicalComponentSize);
+                 size += componentSize;
+                 logicalSize += logicalComponentSize;
+             }
+         }
+         
+         if (physicalSizePtr)
+             *physicalSizePtr = size;
+         if (logicalSizePtr)
+             *logicalSizePtr = logicalSize;
+         
+         if (size < BYTE_FACTOR) {
+             [string appendFormat:@"%qu %@", size, NSLocalizedString(@"bytes", @"size unit")];
+         } else {
+             #define numUnits 6
+             NSString *units[numUnits] = {NSLocalizedString(@"kB", @"size unit"), NSLocalizedString(@"MB", @"size unit"), NSLocalizedString(@"GB", @"size unit"), NSLocalizedString(@"TB", @"size unit"), NSLocalizedString(@"PB", @"size unit"), NSLocalizedString(@"EB", @"size unit")};
+             NSUInteger i;
+             for (i = 0; i < numUnits; i++, size >>= BYTE_SHIFT) {
+                 if ((size >> BYTE_SHIFT) < BYTE_FACTOR || i == numUnits - 1) {
+                     [string appendFormat:@"%.1f %@", size / BYTE_FACTOR_F, units[i]];
+                     break;
+                 }
+             }
+         }
+         
+         NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
+         
+         [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
+         [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
+         [string appendFormat:@" (%@ %@)", [formatter stringFromNumber:[NSNumber numberWithUnsignedLongLong:logicalSize]], NSLocalizedString(@"bytes", @"size unit")];
+         
+         return string;
+     }
+
+     - (NSArray *)keys {
+         return [attributesKeys arrayByAddingObjectsFromArray:summaryKeys];
+     }
+     */
+}
+
+extension KMInfoWindowController: NSTableViewDelegate, NSTableViewDataSource {
+    func numberOfRows(in tableView: NSTableView) -> Int {
+        if (tableView.isEqual(to: self.summaryTableView)) {
+            return self.summaryKeys.count
+        } else if (tableView.isEqual(to: self.attributesTableView)) {
+            return self.attributesKeys.count
+        }
+        return 0
+    }
+    
+    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
+        var shortDateFormatter = DateFormatter()
+        shortDateFormatter.dateStyle = .short
+        shortDateFormatter.timeStyle = .none
+        
+        var keys: [String]?
+        if (tableView.isEqual(to: self.summaryTableView)) {
+            keys = self.summaryKeys
+        } else if (tableView.isEqual(to: self.attributesTableView)) {
+            keys = self.attributesKeys
+        }
+        
+        let key = keys![row]
+        let tcID = tableColumn?.identifier.rawValue
+        var value: Any?
+        if (key.isEmpty) {
+            value = ""
+        } else {
+            if let data = tcID, data == LABEL_COLUMN_ID {
+                value = self.labels[key] != nil ? self.labels[key] : key.appending(":")
+            } else if let data = tcID, data == VALUE_COLUMN_ID {
+                value = self.info?.object(forKey: key)
+                if (value == nil) {
+                    value = "-"
+                } else if let data = value as? NSDate {
+                    value = shortDateFormatter.string(from: data as Date)
+                } else if let data = value as? NSNumber {
+                    if (key == KMInfoEncryptedKey) {
+                        value = data.boolValue ? KMLocalizedString("Yes", "") : KMLocalizedString("No", "")
+                    } else {
+                        value = key == KMInfoPageCountKey ? data.stringValue : (data.boolValue ? KMLocalizedString("Allowed", "") : KMLocalizedString("Not Allowed", ""))
+                    }
+                }
+            }
+        }
+        
+        var cellView = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: tcID ?? ""), owner: self) as? NSTableCellView
+        cellView?.textField?.stringValue = (value as? String) ?? ""
+        if (tableView.isEqual(to: self.attributesTableView) && tableColumn?.identifier.rawValue == VALUE_COLUMN_ID) {
+            if (row == 0 || row == 1 || row == 2 || row == 3 || row == 7) {
+                cellView?.textField?.bezelStyle = .squareBezel
+                cellView?.textField?.isEditable = true
+                cellView?.textField?.isSelectable = true
+                cellView?.textField?.isBordered = true
+                cellView?.textField?.isBezeled = true
+                cellView?.textField?.drawsBackground = true
+                cellView?.textField?.delegate = self
+                
+                if (row == 1) {
+                    let cell = tableView.view(atColumn: 1, row: 0, makeIfNecessary: true) as? NSTableCellView
+                    cell?.textField?.nextKeyView = cellView!.textField
+                } else if (row == 2) {
+                    let cell = tableView.view(atColumn: 1, row: 1, makeIfNecessary: true) as? NSTableCellView
+                    cell?.textField?.nextKeyView = cellView!.textField
+                } else if (row == 3) {
+                    let cell = tableView.view(atColumn: 1, row: 2, makeIfNecessary: true) as? NSTableCellView
+                    cell?.textField?.nextKeyView = cellView!.textField
+                } else if (row == 7) {
+                    let cell = tableView.view(atColumn: 1, row: 3, makeIfNecessary: true) as? NSTableCellView
+                    cell?.textField?.nextKeyView = cellView!.textField
+                }
+            } else {
+                cellView?.textField?.isEditable = false
+                cellView?.textField?.isSelectable = false
+                cellView?.textField?.isBordered = false
+                cellView?.textField?.isBezeled = false
+                cellView?.textField?.drawsBackground = false
+                cellView?.textField?.delegate = nil;
+            }
+            cellView?.textField?.tag = row
+        }
+    
+        return cellView
+    }
+    
+    func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
+        var rowHeight = tableView.rowHeight
+        if (tableView.isEqual(to: self.attributesTableView) && row == tableView.numberOfRows-1) {
+            
+            //        }
+            //        if ([tv isEqual:attributesTableView] && row == [tv numberOfRows] - 1)
+            rowHeight = fmax(rowHeight, NSHeight(tableView.enclosingScrollView?.bounds ?? NSZeroRect) - tableView.numberOfRows.cgFloat * (rowHeight + tableView.intercellSpacing.height) + rowHeight)
+        }
+        return rowHeight
+    }
+    /*
+     - (id)tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
+         static NSDateFormatter *shortDateFormatter = nil;
+         if(shortDateFormatter == nil) {
+             shortDateFormatter = [[NSDateFormatter alloc] init];
+             [shortDateFormatter setDateStyle:NSDateFormatterShortStyle];
+             [shortDateFormatter setTimeStyle:NSDateFormatterNoStyle];
+         }
+         NSArray *keys = nil;
+         if ([tv isEqual:summaryTableView])
+             keys = summaryKeys;
+         else if ([tv isEqual:attributesTableView])
+             keys = attributesKeys;
+         NSString *key = [keys objectAtIndex:row];
+         NSString *tcID = [tableColumn identifier];
+         id value = nil;
+         if ([key length]) {
+             if ([tcID isEqualToString:LABEL_COLUMN_ID]) {
+                 value = [labels objectForKey:key] ?: [key stringByAppendingString:@":"];
+             } else if ([tcID isEqualToString:VALUE_COLUMN_ID]) {
+                 value = [info objectForKey:key];
+                 if (value == nil)
+                     value = @"-";
+                 else if ([value isKindOfClass:[NSDate class]])
+                     value = [shortDateFormatter stringFromDate:value];
+                 else if ([value isKindOfClass:[NSNumber class]]){
+                     if ([key isEqualToString:SKInfoEncryptedKey]) {
+                         value = [value boolValue] ? NSLocalizedString(@"Yes", @"") : NSLocalizedString(@"No", @"");
+                     } else {
+                         value = ([key isEqualToString:SKInfoPageCountKey] ? [value stringValue] : ([value boolValue] ? NSLocalizedString(@"Allowed", @"") : NSLocalizedString(@"Not Allowed", @"")));
+                     }
+                 }
+             }
+         }
+         return value;
+     }
+
+     - (void)tableView:(NSTableView *)tv willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
+         if ([tv isEqual:attributesTableView] && [[tableColumn identifier] isEqualToString:LABEL_COLUMN_ID])
+             [cell setLineBreakMode:row == [tv numberOfRows] - 1 ? NSLineBreakByWordWrapping : NSLineBreakByTruncatingTail];
+     }
+
+     - (CGFloat)tableView:(NSTableView *)tv heightOfRow:(NSInteger)row {
+         CGFloat rowHeight = [tv rowHeight];
+         if ([tv isEqual:attributesTableView] && row == [tv numberOfRows] - 1)
+             rowHeight = fmax(rowHeight, NSHeight([[tv enclosingScrollView] bounds]) - [tv numberOfRows] * (rowHeight + [tv intercellSpacing].height) + rowHeight);
+         return rowHeight;
+     }
+
+     - (BOOL)tableView:(NSTableView *)tv shouldSelectRow:(NSInteger)row {
+         return YES;
+     }
+
+     - (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(nullable NSTabViewItem *)tabViewItem
+     {
+         if ([tabView indexOfTabViewItem:tabViewItem] == 1) {
+             if (self.currentDocument) {
+                 NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:[self infoForDocument:self.currentDocument]];
+                 for (NSString *key in self.editDictionary.allKeys) {
+                     [dic setObject:self.editDictionary[key] forKey:key];
+                 }
+                 [self setInfo:dic];
+             }
+             
+             [self.attributesTableView reloadData];
+         } else {
+             [self.summaryTableView reloadData];
+         }
+     }
+     */
+}
+
+extension KMInfoWindowController: NSTextFieldDelegate {
+    func controlTextDidChange(_ obj: Notification) {
+        if let textField = obj.object as? NSTextField {
+            if (textField.tag == 0) {
+                self.editDictionary.setObject(textField.stringValue, forKey: PDFDocumentAttribute.titleAttribute.rawValue as NSCopying)
+            } else if (textField.tag == 1) {
+                self.editDictionary.setObject(textField.stringValue, forKey: PDFDocumentAttribute.authorAttribute.rawValue as NSCopying)
+            } else if (textField.tag == 2) {
+                self.editDictionary.setObject(textField.stringValue, forKey: PDFDocumentAttribute.subjectAttribute.rawValue as NSCopying)
+            } else if (textField.tag == 3) {
+                self.editDictionary.setObject(textField.stringValue, forKey: PDFDocumentAttribute.creatorAttribute.rawValue as NSCopying)
+            } else if (textField.tag == 7) {
+                self.editDictionary.setObject(textField.stringValue, forKey: KMInfoKeywordsStringKey as NSCopying)
+            }
+        }
+    }
+}
+
+private let CM_PER_POINT = 0.035277778
+private let INCH_PER_POINT = 0.013888889
+private func KMSizeString(_ size: NSSize, _ altSize: NSSize) -> String {
+    var useMetric = false
+    if let data = ((NSLocale.current as NSLocale).object(forKey: .usesMetricSystem) as? NSNumber) {
+        useMetric = data.boolValue
+    }
+    
+    let factor = useMetric ? CM_PER_POINT : INCH_PER_POINT
+    let units = useMetric ? KMLocalizedString("cm", "size unit") : KMLocalizedString("in", "size unit")
+    if (NSEqualSizes(size, altSize)) {
+        return String(format: "%.2f x %.2f %@", size.width * factor, size.height * factor, units)
+    } else {
+        return String(format: "%.2f x %.2f %@  (%.2f x %.2f %@)", size.width * factor, size.height * factor, units, altSize.width * factor, altSize.height * factor, units)
+    }
+}

+ 0 - 64
PDF Office/PDF Master/Class/Common/OC/Property/SKInfoWindowController.h

@@ -1,64 +0,0 @@
-//
-//  SKInfoWindowController.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 12/17/06.
-/*
- This software is Copyright (c) 2006-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-#import "SKWindowController.h"
-
-extern NSString * const kKMWindowDidBecomeMainNotificationName;
-
-@interface SKInfoWindowController : SKWindowController {
-    NSTableView *summaryTableView;
-    NSTableView *attributesTableView;
-    NSTabView *tabView;
-    NSDictionary *info;
-    NSArray *summaryKeys;
-    NSArray *attributesKeys;
-    NSDictionary *labels;
-}
-
-@property (nonatomic, retain) IBOutlet NSTableView *summaryTableView, *attributesTableView;
-@property (nonatomic, retain) IBOutlet NSTabView *tabView;
-@property (nonatomic, copy) NSDictionary *info;
-@property (nonatomic, readonly) NSArray *keys;
-@property (nonatomic, retain) NSMutableDictionary *editDictionary;
-
-+ (id)sharedInstance;
-
-- (NSDictionary *)infoForDocument:(NSDocument *)doc;
-
-@end

+ 0 - 613
PDF Office/PDF Master/Class/Common/OC/Property/SKInfoWindowController.m

@@ -1,613 +0,0 @@
-//
-//  SKInfoWindowController.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 12/17/06.
-/*
- This software is Copyright (c) 2006-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKInfoWindowController.h"
-//#import "SKMainDocument.h"
-//#import "NSDocument_SKExtensions.h"
-#import "PDFPage_SKExtensions.h"
-#import <Quartz/Quartz.h>
-//#import "SKMainWindowController.h"
-
-#if VERSION_DMG
-#import <PDF_Master-Swift.h>
-#else
-#import <PDF_Master-Swift.h>
-#endif
-
-#define SKInfoWindowFrameAutosaveName @"SKInfoWindow"
-
-#define SKInfoVersionKey @"Version"
-#define SKInfoPageCountKey @"PageCount"
-#define SKInfoPageSizeKey @"PageSize"
-#define SKInfoPageWidthKey @"PageWidth"
-#define SKInfoPageHeightKey @"PageHeight"
-#define SKInfoKeywordsStringKey @"KeywordsString"
-#define SKInfoEncryptedKey @"Encrypted"
-#define SKInfoAllowsPrintingKey @"AllowsPrinting"
-#define SKInfoAllowsCopyingKey @"AllowsCopying"
-#define SKInfoAllowsDocumentAssemblyKey @"AllowsDocumentAssembly"
-#define SKInfoAllowsContentAccessibilityKey @"AllowsContentAccessibility"
-#define SKInfoAllowsCommentingKey @"AllowsCommenting"
-#define SKInfoAllowsFormFieldEntryKey @"AllowsFormFieldEntry"
-#define SKInfoFileNameKey @"FileName"
-#define SKInfoFileSizeKey @"FileSize"
-#define SKInfoPhysicalSizeKey @"PhysicalSize"
-#define SKInfoLogicalSizeKey @"LogicalSize"
-#define SKInfoTagsKey @"Tags"
-#define SKInfoRatingKey @"Rating"
-
-#define LABEL_COLUMN_ID @"label"
-#define VALUE_COLUMN_ID @"value"
-
-NSString * const kKMWindowDidBecomeMainNotificationName = @"KMWindowDidBecomeMainNotificationName";
-
-@interface SKInfoWindowController (SKPrivate) <NSTextFieldDelegate>
-- (void)handleViewFrameDidChangeNotification:(NSNotification *)notification;
-- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification;
-- (void)handleWindowDidResignMainNotification:(NSNotification *)notification;
-- (void)handlePDFDocumentInfoDidChangeNotification:(NSNotification *)notification;
-- (void)handleDocumentFileURLDidChangeNotification:(NSNotification *)notification;
-
-@end
-
-@interface SKInfoWindowController ()
-
-@property (nonatomic, weak) NSDocument *currentDocument;
-
-@end
-
-@implementation SKInfoWindowController
-
-@synthesize summaryTableView, attributesTableView, tabView, info, editDictionary;
-@dynamic keys;
-
-static SKInfoWindowController *sharedInstance = nil;
-    
-+ (id)sharedInstance {
-    @synchronized (self) {
-        if (sharedInstance == nil) {
-            sharedInstance = [[super allocWithZone:NULL] init];
-        }
-    }
-    return sharedInstance;
-}
-
-+ (instancetype)allocWithZone:(struct _NSZone *)zone {
-    return  [self sharedInstance];
-}
-
-- (id)init {
-    if (sharedInstance) NSLog(@"Attempt to allocate second instance of %@", [self class]);
-    self = [super initWithWindowNibName:@"InfoWindow"];
-    if (self){
-        info = nil;
-        if (@available(macOS 10.13, *)) {
-            summaryKeys = [[NSArray alloc] initWithObjects:
-                           SKInfoFileNameKey,
-                           SKInfoFileSizeKey,
-                           SKInfoPageSizeKey,
-                           SKInfoPageCountKey,
-                           SKInfoVersionKey,
-                           @"",
-                           SKInfoEncryptedKey,
-                           SKInfoAllowsPrintingKey,
-                           SKInfoAllowsCopyingKey,
-                           SKInfoAllowsDocumentAssemblyKey,
-                           SKInfoAllowsContentAccessibilityKey,
-                           SKInfoAllowsCommentingKey,
-                           SKInfoAllowsFormFieldEntryKey,nil];
-        } else {
-            summaryKeys = [[NSArray alloc] initWithObjects:
-                           SKInfoFileNameKey,
-                           SKInfoFileSizeKey,
-                           SKInfoPageSizeKey,
-                           SKInfoPageCountKey,
-                           SKInfoVersionKey,
-                           @"",
-                           SKInfoEncryptedKey,
-                           SKInfoAllowsPrintingKey,
-                           SKInfoAllowsCopyingKey, nil];
-            
-        }
-        attributesKeys = [[NSArray alloc] initWithObjects:
-                            PDFDocumentTitleAttribute,
-                            PDFDocumentAuthorAttribute,
-                            PDFDocumentSubjectAttribute,
-                            PDFDocumentCreatorAttribute,
-                            PDFDocumentProducerAttribute,
-                            PDFDocumentCreationDateAttribute,
-                            PDFDocumentModificationDateAttribute,
-                            SKInfoKeywordsStringKey, nil];
-        labels = [[NSDictionary alloc] initWithObjectsAndKeys:
-                            NSLocalizedString(@"File name:", @"Info label"), SKInfoFileNameKey, 
-                            NSLocalizedString(@"File size:", @"Info label"), SKInfoFileSizeKey, 
-                            NSLocalizedString(@"Page size:", @"Info label"), SKInfoPageSizeKey, 
-                            NSLocalizedString(@"Page count:", @"Info label"), SKInfoPageCountKey, 
-                            NSLocalizedString(@"PDF Version:", @"Info label"), SKInfoVersionKey, 
-                            NSLocalizedString(@"Encrypted:", @"Info label"), SKInfoEncryptedKey, 
-                            NSLocalizedString(@"Printing:", @"Info label"), SKInfoAllowsPrintingKey,
-                            NSLocalizedString(@"Content Copying:", @"Info label"), SKInfoAllowsCopyingKey,
-                            NSLocalizedString(@"Document Assembly:", @"Info label"), SKInfoAllowsDocumentAssemblyKey,
-                            NSLocalizedString(@"Content Copying for Accessibility:", @"Info label"), SKInfoAllowsContentAccessibilityKey,
-                            NSLocalizedString(@"Commenting:", @"Info label"), SKInfoAllowsCommentingKey,
-                            NSLocalizedString(@"Filling of form fields:", @"Info label"), SKInfoAllowsFormFieldEntryKey,
-                            NSLocalizedString(@"Title:", @"Info label"), PDFDocumentTitleAttribute,
-                            NSLocalizedString(@"Author:", @"Info label"), PDFDocumentAuthorAttribute, 
-                            NSLocalizedString(@"Subject:", @"Info label"), PDFDocumentSubjectAttribute, 
-                            NSLocalizedString(@"Content Creator:", @"Info label"), PDFDocumentCreatorAttribute, 
-                            NSLocalizedString(@"PDF Producer:", @"Info label"), PDFDocumentProducerAttribute, 
-                            NSLocalizedString(@"Creation date:", @"Info label"), PDFDocumentCreationDateAttribute, 
-                            NSLocalizedString(@"Modification date:", @"Info label"), PDFDocumentModificationDateAttribute, 
-                            NSLocalizedString(@"Keywords:", @"Info label"), SKInfoKeywordsStringKey, nil];
-    }
-    return self;
-}
-
-- (void)dealloc {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (void)updateForDocument:(NSDocument *)doc {
-    self.currentDocument = doc;
-    
-    NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:[self infoForDocument:doc]];
-    for (NSString *key in self.editDictionary.allKeys) {
-        [dic setObject:self.editDictionary[key] forKey:key];
-    }
-    [self setInfo:dic];
-    [summaryTableView reloadData];
-    [attributesTableView reloadData];
-}
-
-- (void)windowDidLoad {
-    [self updateForDocument:[[[NSApp mainWindow] windowController] document]];
-    
-    if (@available(macOS 10.13, *)) {
-    } else {
-        [self.window setFrame:CGRectMake(self.window.frame.origin.x, self.window.frame.origin.y, 460, 310) display:YES animate:YES];
-    }
-
-    [summaryTableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone];
-    [attributesTableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleNone];
-    
-    self.editDictionary = [NSMutableDictionary dictionary];
-    
-    [self.tabView selectTabViewItemAtIndex:1];
-
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleViewFrameDidChangeNotification:)
-                                                 name: NSViewFrameDidChangeNotification object: [attributesTableView enclosingScrollView]];
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleWindowDidBecomeMainNotification:) 
-                                                 name: NSWindowDidBecomeMainNotification object: nil];
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleWindowDidResignMainNotification:) 
-                                                 name: NSWindowDidResignMainNotification object: nil];
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePDFDocumentInfoDidChangeNotification:) 
-                                                 name: PDFDocumentDidUnlockNotification object: nil];
-//    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handlePDFDocumentInfoDidChangeNotification:)
-//                                                 name: SKPDFPageBoundsDidChangeNotification object: nil];
-//    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleDocumentFileURLDidChangeNotification:)
-//                                                 name: SKDocumentFileURLDidChangeNotification object: nil];
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleWindowWillCloseNotification:)
-                                                 name: NSWindowWillCloseNotification object: nil];
-    
-    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(km_handleWindowDidBecomeMainNotification:)
-                                                 name: kKMWindowDidBecomeMainNotificationName object: nil];
-}
-
-- (void)showWindow:(id)sender {
-    [super showWindow:nil];
-    [self.editDictionary removeAllObjects];
-    [self.attributesTableView reloadData];
-}
-
-#define BYTE_FACTOR 1024
-#define BYTE_FACTOR_F 1024.0f
-#define BYTE_SHIFT 10
-
-static NSString *SKFileSizeStringForFileURL(NSURL *fileURL, unsigned long long *physicalSizePtr, unsigned long long *logicalSizePtr) {
-    if (fileURL == nil)
-        return @"";
-    
-    FSRef fileRef;
-    FSCatalogInfo catalogInfo;
-    unsigned long long size, logicalSize = 0;
-    BOOL gotSize = NO, isDir = NO;
-    NSMutableString *string = [NSMutableString string];
-    
-    Boolean gotRef = CFURLGetFSRef((CFURLRef)fileURL, &fileRef);
-    if (gotRef && noErr == FSGetCatalogInfo(&fileRef, kFSCatInfoDataSizes | kFSCatInfoRsrcSizes | kFSCatInfoNodeFlags, &catalogInfo, NULL, NULL, NULL)) {
-        size = catalogInfo.dataPhysicalSize + catalogInfo.rsrcPhysicalSize;
-        logicalSize = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
-        isDir = (catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) != 0;
-        gotSize = YES;
-    }
-    
-    if (gotSize == NO) {
-        // this seems to give the logical size
-        NSDictionary *fileAttrs = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:NULL];
-        logicalSize = size = [[fileAttrs objectForKey:NSFileSize] unsignedLongLongValue];
-        isDir = [[fileAttrs fileType] isEqualToString:NSFileTypeDirectory];
-    }
-    
-    if (isDir) {
-        NSString *path = [fileURL path];
-        unsigned long long componentSize;
-        unsigned long long logicalComponentSize;
-        for (NSString *file in [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:path error:NULL]) {
-            SKFileSizeStringForFileURL([NSURL fileURLWithPath:[path stringByAppendingPathComponent:file]], &componentSize, &logicalComponentSize);
-            size += componentSize;
-            logicalSize += logicalComponentSize;
-        }
-    }
-    
-    if (physicalSizePtr)
-        *physicalSizePtr = size;
-    if (logicalSizePtr)
-        *logicalSizePtr = logicalSize;
-    
-    if (size < BYTE_FACTOR) {
-        [string appendFormat:@"%qu %@", size, NSLocalizedString(@"bytes", @"size unit")];
-    } else {
-        #define numUnits 6
-        NSString *units[numUnits] = {NSLocalizedString(@"kB", @"size unit"), NSLocalizedString(@"MB", @"size unit"), NSLocalizedString(@"GB", @"size unit"), NSLocalizedString(@"TB", @"size unit"), NSLocalizedString(@"PB", @"size unit"), NSLocalizedString(@"EB", @"size unit")};
-        NSUInteger i;
-        for (i = 0; i < numUnits; i++, size >>= BYTE_SHIFT) {
-            if ((size >> BYTE_SHIFT) < BYTE_FACTOR || i == numUnits - 1) {
-                [string appendFormat:@"%.1f %@", size / BYTE_FACTOR_F, units[i]];
-                break;
-            }
-        }
-    }
-    
-    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
-    
-    [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
-    [formatter setNumberStyle:NSNumberFormatterDecimalStyle];
-    [string appendFormat:@" (%@ %@)", [formatter stringFromNumber:[NSNumber numberWithUnsignedLongLong:logicalSize]], NSLocalizedString(@"bytes", @"size unit")];
-    
-    return string;
-}
-
-#define CM_PER_POINT 0.035277778
-#define INCH_PER_POINT 0.013888889
-
-static inline 
-NSString *SKSizeString(NSSize size, NSSize altSize) {
-    BOOL useMetric = [[[NSLocale currentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue];
-    NSString *units = useMetric ? NSLocalizedString(@"cm", @"size unit") : NSLocalizedString(@"in", @"size unit");
-    CGFloat factor = useMetric ? CM_PER_POINT : INCH_PER_POINT;
-    if (NSEqualSizes(size, altSize))
-        return [NSString stringWithFormat:@"%.2f x %.2f %@", size.width * factor, size.height * factor, units];
-    else
-        return [NSString stringWithFormat:@"%.2f x %.2f %@  (%.2f x %.2f %@)", size.width * factor, size.height * factor, units, altSize.width * factor, altSize.height * factor, units];
-}
-
-- (NSDictionary *)infoForDocument:(NSDocument *)doc {
-    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
-    unsigned long long logicalSize = 0, physicalSize = 0;
-    
-    if ([doc isKindOfClass:KMMainDocument.class]) {
-        CPDFDocument *pdfDoc = ((KMMainDocument *)doc).mainViewController.document;
-        if (pdfDoc != nil) {
-            [dictionary addEntriesFromDictionary:[pdfDoc documentAttributes]];
-            [dictionary setValue:[NSString stringWithFormat: @"%ld.%ld", (long)[pdfDoc majorVersion], (long)[pdfDoc minorVersion]] forKey:SKInfoVersionKey];
-            [dictionary setValue:[NSNumber numberWithInteger:[pdfDoc pageCount]] forKey:SKInfoPageCountKey];
-            if ([pdfDoc pageCount]) {
-                NSSize cropSize = [[pdfDoc pageAtIndex:0] boundsForBox:CPDFDisplayCropBox].size;
-                NSSize mediaSize = [[pdfDoc pageAtIndex:0] boundsForBox:CPDFDisplayMediaBox].size;
-                [dictionary setValue:SKSizeString(cropSize, mediaSize) forKey:SKInfoPageSizeKey];
-                [dictionary setValue:[NSNumber numberWithDouble:cropSize.width] forKey:SKInfoPageWidthKey];
-                [dictionary setValue:[NSNumber numberWithDouble:cropSize.height] forKey:SKInfoPageHeightKey];
-            }
-            NSArray *keyworks = [dictionary valueForKey:CPDFDocumentKeywordsAttribute];
-            if ([keyworks isKindOfClass:[NSArray class]]) {
-                [dictionary setValue:[[dictionary valueForKey:CPDFDocumentKeywordsAttribute] componentsJoinedByString:@"\n"] forKey:SKInfoKeywordsStringKey];
-            }
-            
-            [dictionary setValue:[NSNumber numberWithBool:[pdfDoc isEncrypted]] forKey:SKInfoEncryptedKey];
-            [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsPrinting]] forKey:SKInfoAllowsPrintingKey];
-            [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsCopying]] forKey:SKInfoAllowsCopyingKey];
-            
-            if (@available(macOS 10.13, *)) {
-//                [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsContentAccessibility]] forKey:SKInfoAllowsContentAccessibilityKey];
-                [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsCommenting]] forKey:SKInfoAllowsCommentingKey];
-                [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsDocumentAssembly]] forKey:SKInfoAllowsDocumentAssemblyKey];
-                [dictionary setValue:[NSNumber numberWithBool:[pdfDoc allowsFormFieldEntry]] forKey:SKInfoAllowsFormFieldEntryKey];
-            }
-        }
-    }
-    [dictionary setValue:[[[doc fileURL] path] lastPathComponent] forKey:SKInfoFileNameKey];
-    [dictionary setValue:SKFileSizeStringForFileURL([doc fileURL], &physicalSize, &logicalSize) forKey:SKInfoFileSizeKey];
-    [dictionary setValue:[NSNumber numberWithUnsignedLongLong:physicalSize] forKey:SKInfoPhysicalSizeKey];
-    [dictionary setValue:[NSNumber numberWithUnsignedLongLong:logicalSize] forKey:SKInfoLogicalSizeKey];
-//    if ([doc respondsToSelector:@selector(tags)])
-//        [dictionary setValue:[(KMMainDocument *)doc tags] ?: [NSArray array] forKey:SKInfoTagsKey];
-//    if ([doc respondsToSelector:@selector(rating)])
-//        [dictionary setValue:[NSNumber numberWithDouble:[(KMMainDocument *)doc rating]] forKey:SKInfoRatingKey];
-    
-    return dictionary;
-}
-
-- (NSArray *)keys {
-    return [attributesKeys arrayByAddingObjectsFromArray:summaryKeys];
-}
-
-- (void)handleWindowWillCloseNotification:(NSNotification *)notification {
-    id object = [notification object];
-    if ([object isEqual:self.window]) {
-        if (self.editDictionary.count > 0) {
-            NSWindowController *windowController = [[NSApp mainWindow] windowController];
-            if ([windowController isKindOfClass:[KMBrowserWindowController class]]) {
-                KMMainDocument *document = (KMMainDocument *)[(KMBrowserWindowController *)windowController document];
-                NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:[document.mainViewController.document documentAttributes]];
-                BOOL isSave = NO;
-                for (NSString *key in self.editDictionary) {
-                    if ([key isEqualToString:SKInfoKeywordsStringKey]) {
-                        NSString *string = self.editDictionary[key];
-//                        NSArray *array = [string componentsSeparatedByString:@"\n"];
-//                        if (array && ![dic[PDFDocumentKeywordsAttribute] isEqual:array]) {
-//                            isSave = YES;
-//                            [dic setObject:array forKey:PDFDocumentKeywordsAttribute];
-//                        }
-                        if (string && string.length > 0 && ![string isEqualToString:dic[PDFDocumentKeywordsAttribute]]) {
-                            isSave = YES;
-                            [dic setObject:string forKey:CPDFDocumentKeywordsAttribute];
-                        }
-                    } else {
-                        if (![dic[key] isEqualToString:self.editDictionary[key]]) {
-                            isSave = YES;
-                            [dic setObject:self.editDictionary[key] forKey:key];
-                        }
-                    }
-                }
-                if (isSave) {
-                    [document.mainViewController.document setDocumentAttributes:dic];
-                    [document saveDocument:nil];
-                }
-            }
-        }
-        [self.editDictionary removeAllObjects];
-    }
-}
-
-- (void)handleViewFrameDidChangeNotification:(NSNotification *)notification {
-    [attributesTableView noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndex:[attributesKeys count] - 1]];
-}
-
-- (void)handleWindowDidBecomeMainNotification:(NSNotification *)notification {
-    [self.editDictionary removeAllObjects];
-    [self updateForDocument:[[[notification object] windowController] document]];
-}
-
-- (void)km_handleWindowDidBecomeMainNotification:(NSNotification *)notification {
-    [self.editDictionary removeAllObjects];
-    [self updateForDocument:notification.object];
-}
-
-- (void)handleWindowDidResignMainNotification:(NSNotification *)notification {
-    [self.editDictionary removeAllObjects];
-    [self updateForDocument:nil];
-}
-
-- (void)handlePDFDocumentInfoDidChangeNotification:(NSNotification *)notification {
-    [self.editDictionary removeAllObjects];
-    NSDocument *doc = [[[NSApp mainWindow] windowController] document];
-    if ([doc isKindOfClass:[KMMainDocument class]]) {
-        CPDFDocument *pdfDocument = ((KMMainDocument *)doc).mainViewController.document;
-        if ([pdfDocument isEqual:notification.object]) {
-            [self updateForDocument:doc];
-        }
-    }
-}
-
-- (void)handleDocumentFileURLDidChangeNotification:(NSNotification *)notification {
-    [self.editDictionary removeAllObjects];
-    NSDocument *doc = [[[NSApp mainWindow] windowController] document];
-    if ([doc isEqual:[notification object]])
-        [self updateForDocument:doc];
-}
-
-- (NSInteger)numberOfRowsInTableView:(NSTableView *)tv {
-    NSArray *keys = nil;
-    if ([tv isEqual:summaryTableView])
-        keys = summaryKeys;
-    else if ([tv isEqual:attributesTableView])
-        keys = attributesKeys;
-    return [keys count];
-}
-
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
-    static NSDateFormatter *shortDateFormatter = nil;
-    if(shortDateFormatter == nil) {
-        shortDateFormatter = [[NSDateFormatter alloc] init];
-        [shortDateFormatter setDateStyle:NSDateFormatterShortStyle];
-        [shortDateFormatter setTimeStyle:NSDateFormatterNoStyle];
-    }
-    NSArray *keys = nil;
-    if ([tableView isEqual:summaryTableView]) {
-        keys = summaryKeys;
-    } else if ([tableView isEqual:attributesTableView]) {
-        keys = attributesKeys;
-    }
-    NSString *key = [keys objectAtIndex:row];
-    NSString *tcID = [tableColumn identifier];
-    id value = nil;
-    if ([key length]) {
-        if ([tcID isEqualToString:LABEL_COLUMN_ID]) {
-            value = [labels objectForKey:key] ?: [key stringByAppendingString:@":"];
-        } else if ([tcID isEqualToString:VALUE_COLUMN_ID]) {
-            value = [info objectForKey:key];
-            if (value == nil)
-                value = @"-";
-            else if ([value isKindOfClass:[NSDate class]])
-                value = [shortDateFormatter stringFromDate:value];
-            else if ([value isKindOfClass:[NSNumber class]]){
-                if ([key isEqualToString:SKInfoEncryptedKey]) {
-                    value = [value boolValue] ? NSLocalizedString(@"Yes", @"") : NSLocalizedString(@"No", @"");
-                } else {
-                    value = ([key isEqualToString:SKInfoPageCountKey] ? [value stringValue] : ([value boolValue] ? NSLocalizedString(@"Allowed", @"") : NSLocalizedString(@"Not Allowed", @"")));
-                }
-            }
-        }
-    } else {
-        value = @"";
-    }
-    NSTableCellView *cellView = [tableView makeViewWithIdentifier:tcID owner:self];
-    cellView.textField.stringValue = value;
-    if ([tableView isEqual:attributesTableView] && [[tableColumn identifier] isEqualToString:VALUE_COLUMN_ID]) {
-        if (row == 0 || row == 1 || row == 2 || row == 3 || row == 7) {
-            cellView.textField.bezelStyle = NSTextFieldSquareBezel;
-            cellView.textField.editable = YES;
-            cellView.textField.selectable = YES;
-            cellView.textField.bordered = YES;
-            cellView.textField.bezeled = YES;
-            cellView.textField.drawsBackground = YES;
-            cellView.textField.delegate = self;
-            
-            if (row == 1) {
-                NSTableCellView *cell = [tableView viewAtColumn:1 row:0 makeIfNecessary:YES];
-                cell.textField.nextKeyView = cellView.textField;
-            } else if (row == 2) {
-                NSTableCellView *cell = [tableView viewAtColumn:1 row:1 makeIfNecessary:NO];
-                cell.textField.nextKeyView = cellView.textField;
-            } else if (row == 3) {
-                NSTableCellView *cell = [tableView viewAtColumn:1 row:2 makeIfNecessary:NO];
-                cell.textField.nextKeyView = cellView.textField;
-            } else if (row == 7) {
-                NSTableCellView *cell = [tableView viewAtColumn:1 row:3 makeIfNecessary:NO];
-                cell.textField.nextKeyView = cellView.textField;
-            }
-        } else {
-            cellView.textField.editable = NO;
-            cellView.textField.selectable = NO;
-            cellView.textField.bordered = NO;
-            cellView.textField.bezeled = NO;
-            cellView.textField.drawsBackground = NO;
-            cellView.textField.delegate = nil;
-        }
-        cellView.textField.tag = row;
-    }
-    
-    return cellView;
-}
-
-- (id)tableView:(NSTableView *)tv objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
-    static NSDateFormatter *shortDateFormatter = nil;
-    if(shortDateFormatter == nil) {
-        shortDateFormatter = [[NSDateFormatter alloc] init];
-        [shortDateFormatter setDateStyle:NSDateFormatterShortStyle];
-        [shortDateFormatter setTimeStyle:NSDateFormatterNoStyle];
-    }
-    NSArray *keys = nil;
-    if ([tv isEqual:summaryTableView])
-        keys = summaryKeys;
-    else if ([tv isEqual:attributesTableView])
-        keys = attributesKeys;
-    NSString *key = [keys objectAtIndex:row];
-    NSString *tcID = [tableColumn identifier];
-    id value = nil;
-    if ([key length]) {
-        if ([tcID isEqualToString:LABEL_COLUMN_ID]) {
-            value = [labels objectForKey:key] ?: [key stringByAppendingString:@":"];
-        } else if ([tcID isEqualToString:VALUE_COLUMN_ID]) {
-            value = [info objectForKey:key];
-            if (value == nil)
-                value = @"-";
-            else if ([value isKindOfClass:[NSDate class]])
-                value = [shortDateFormatter stringFromDate:value];
-            else if ([value isKindOfClass:[NSNumber class]]){
-                if ([key isEqualToString:SKInfoEncryptedKey]) {
-                    value = [value boolValue] ? NSLocalizedString(@"Yes", @"") : NSLocalizedString(@"No", @"");
-                } else {
-                    value = ([key isEqualToString:SKInfoPageCountKey] ? [value stringValue] : ([value boolValue] ? NSLocalizedString(@"Allowed", @"") : NSLocalizedString(@"Not Allowed", @"")));
-                }
-            }
-        }
-    }
-    return value;
-}
-
-- (void)tableView:(NSTableView *)tv willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
-    if ([tv isEqual:attributesTableView] && [[tableColumn identifier] isEqualToString:LABEL_COLUMN_ID])
-        [cell setLineBreakMode:row == [tv numberOfRows] - 1 ? NSLineBreakByWordWrapping : NSLineBreakByTruncatingTail];
-}
-
-- (CGFloat)tableView:(NSTableView *)tv heightOfRow:(NSInteger)row {
-    CGFloat rowHeight = [tv rowHeight];
-    if ([tv isEqual:attributesTableView] && row == [tv numberOfRows] - 1)
-        rowHeight = fmax(rowHeight, NSHeight([[tv enclosingScrollView] bounds]) - [tv numberOfRows] * (rowHeight + [tv intercellSpacing].height) + rowHeight);
-    return rowHeight;
-}
-
-- (BOOL)tableView:(NSTableView *)tv shouldSelectRow:(NSInteger)row {
-    return YES;
-}
-
-- (void)tabView:(NSTabView *)tabView willSelectTabViewItem:(nullable NSTabViewItem *)tabViewItem
-{
-    if ([tabView indexOfTabViewItem:tabViewItem] == 1) {
-        if (self.currentDocument) {
-            NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:[self infoForDocument:self.currentDocument]];
-            for (NSString *key in self.editDictionary.allKeys) {
-                [dic setObject:self.editDictionary[key] forKey:key];
-            }
-            [self setInfo:dic];
-        }
-        
-        [self.attributesTableView reloadData];
-    } else {
-        [self.summaryTableView reloadData];
-    }
-}
-
-#pragma mark - NSTextFieldDelegate
-- (void)controlTextDidChange:(NSNotification *)obj {
-    NSTextField *textField = (NSTextField*)[obj object];
-    if (textField.tag == 0) {
-        [self.editDictionary setObject:textField.stringValue forKey:PDFDocumentTitleAttribute];
-    } else if (textField.tag == 1) {
-        [self.editDictionary setObject:textField.stringValue forKey:PDFDocumentAuthorAttribute];
-    } else if (textField.tag == 2) {
-        [self.editDictionary setObject:textField.stringValue forKey:PDFDocumentSubjectAttribute];
-    } else if (textField.tag == 3) {
-        [self.editDictionary setObject:textField.stringValue forKey:PDFDocumentCreatorAttribute];
-    } else if (textField.tag == 7) {
-        [self.editDictionary setObject:textField.stringValue forKey:SKInfoKeywordsStringKey];
-    }
-}
-
-@end

+ 0 - 43
PDF Office/PDF Master/Class/Common/OC/Property/SKWindowController.h

@@ -1,43 +0,0 @@
-//
-//  SKWindowController.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 3/13/10.
-/*
- This software is Copyright (c) 2010-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface SKWindowController : NSWindowController
-@end

+ 0 - 50
PDF Office/PDF Master/Class/Common/OC/Property/SKWindowController.m

@@ -1,50 +0,0 @@
-//
-//  SKWindowController.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 3/13/10.
-/*
- This software is Copyright (c) 2010-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKWindowController.h"
-#import "SKLocalization.h"
-
-
-@implementation SKWindowController
-
-- (void)loadWindow {
-    [super loadWindow];
-    [[self window] localizeStringsFromTable:[self windowNibName]];
-}
-
-@end

+ 0 - 40
PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.h

@@ -1,40 +0,0 @@
-//
-//  KMTools_OC.h
-//  PDF Master
-//
-//  Created by tangchao on 2023/3/27.
-//
-
-#import <Foundation/Foundation.h>
-
-typedef NS_ENUM(NSUInteger, KMAppTarget) {
-    KMAppTargetFree = 0,
-    KMAppTargetPro = 1,
-    KMAppTargetDMG = 2
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KMTools_OC : NSObject
-
-+ (BOOL)isDefaultRoleHandlerForContentType:(NSString*)fileExtension;
-+ (BOOL) setPreviewAsDefaultApplicationForFileExtension:(NSString *) fileExtension;
-+ (BOOL)setMyselfAsDefaultApplicationForFileExtension:(NSString *) fileExtension;
-
-+ (KMAppTarget)getAppTarget;
-
-@end
-
-@interface KMTools_OC (Testing)
-
-+ (NSData *)getPDFData;
-
-@end
-
-@interface KMPageSizeTool : NSObject
-
-+ (NSString *)conversionWithUnit:(NSString *)unit value:(CGFloat)value;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 119
PDF Office/PDF Master/Class/Common/OC/Tools/KMTools_OC.m

@@ -1,119 +0,0 @@
-//
-//  KMTools_OC.m
-//  PDF Master
-//
-//  Created by tangchao on 2023/3/27.
-//
-
-#import "KMTools_OC.h"
-#import <AppKit/AppKit.h>
-
-@implementation KMTools_OC
-
-+ (BOOL)isDefaultRoleHandlerForContentType:(NSString*)fileExtension {
-    NSString *app = (NSString*)CFBridgingRelease(LSCopyDefaultRoleHandlerForContentType((CFStringRef)CFBridgingRetain([self UTIforFileExtension:fileExtension]),
-                                                                                        kLSRolesAll));
-    if ([app isEqualToString:[[NSBundle mainBundle] bundleIdentifier]]) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (BOOL)setMyselfAsDefaultApplicationForFileExtension:(NSString *) fileExtension {
-    OSStatus returnStatus = LSSetDefaultRoleHandlerForContentType ((CFStringRef)CFBridgingRetain([self UTIforFileExtension:fileExtension]),
-                                                                   kLSRolesAll,
-                                                                   (CFStringRef) CFBridgingRetain([[NSBundle mainBundle] bundleIdentifier]));
-    if (returnStatus != 0) {
-        return NO;
-    }
-
-    return YES;
-}
-
-+ (BOOL) setPreviewAsDefaultApplicationForFileExtension:(NSString *) fileExtension {
-    OSStatus returnStatus = LSSetDefaultRoleHandlerForContentType ((CFStringRef)CFBridgingRetain([self UTIforFileExtension:fileExtension]),
-                                                                   kLSRolesAll,
-                                                                   (CFStringRef)@"com.apple.Preview");
-    if (returnStatus != 0) {
-        return NO;
-    }
-
-    return YES;
-}
-
-#pragma mark --SetDefaultRoleHandlerForContentType
-+ (NSString *)UTIforFileExtension:(NSString *) extension {
-    NSString * UTIString = (NSString *)CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
-                                                                                               (CFStringRef)CFBridgingRetain(extension),
-                                                                                               NULL));
-    
-    return UTIString;
-}
-
-+ (KMAppTarget)getAppTarget {
-    // VERSION_DMG=1
-    // VERSION_FREE=1
-    // VERSION_PRO=1
-#if VERSION_FREE
-    return KMAppTargetFree;
-#endif
-#if VERSION_PRO
-    return KMAppTargetPro;
-#endif
-#if VERSION_DMG
-    return KMAppTargetDMG;
-#endif
-    return KMAppTargetFree;
-}
-
-@end
-
-@implementation KMTools_OC (Testing)
-
-+ (NSData *)getPDFData {
-    NSMutableData *pdfData = [[NSMutableData alloc] init];
-    CGDataConsumerRef consumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)pdfData);
-    CFMutableDictionaryRef myDictionary = CFDictionaryCreateMutable(NULL,
-                                                                    0,
-                                                                    &kCFTypeDictionaryKeyCallBacks,
-                                                                    &kCFTypeDictionaryValueCallBacks);
-    CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("PDF Master"));
-    CGRect mediaBox = CGRectMake(0, 0, 595, 842);
-    CGContextRef pdfContext = CGPDFContextCreate(consumer, &mediaBox, myDictionary);
-    CGContextSetRGBFillColor(pdfContext, 1.0, 0.0, 0.0, 0.0);
-    CGContextSetTextDrawingMode(pdfContext, kCGTextFill);
-    CFRelease(myDictionary);
-    CGContextBeginPage(pdfContext, &mediaBox);
-    CGContextEndPage(pdfContext);
-    CGPDFContextClose(pdfContext);
-    CGContextRelease (pdfContext);
-    CGDataConsumerRelease(consumer);
-    
-    return pdfData;
-}
-
-@end
-
-@implementation KMPageSizeTool
-
-+ (NSString *)conversionWithUnit:(NSString *)unit value:(CGFloat)value
-{
-    CGFloat f = value;
-    if ([unit isEqualToString:@"cm"]) {
-        f =  value/10.0;
-    } else if([unit isEqualToString:@"in"]){
-        f = value/25.4;
-    } else {
-        f = value;
-    }
-
-    if (fmodf(f, 1)==0) {//如果有一位小数点
-        return [NSString stringWithFormat:@"%.0f",f];
-    } else if (fmodf(value*10, 1)==0) {//如果有两位小数点
-        return [NSString stringWithFormat:@"%.1f",f];
-    } else {
-        return [NSString stringWithFormat:@"%.2f",f];
-    }
-}
-
-@end

+ 29 - 0
PDF Office/PDF Master/Class/Common/Tools/KMPageSizeTool.swift

@@ -0,0 +1,29 @@
+//
+//  KMPageSizeTool.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/9/26.
+//
+
+import Cocoa
+
+class KMPageSizeTool: NSObject {
+    class func conversion(withUnit: String, value: CGFloat) -> String {
+        var f = value
+        if (withUnit == "cm") {
+            f = value / 10.0
+        } else if (withUnit == "in") {
+            f = value / 25.4
+        } else {
+            f = value
+        }
+        
+        if (fmod(f, 1) == 0) { //如果有一位小数点
+            return String(format: "%.0f", f)
+        } else if (fmod(value * 10, 1) == 0) { //如果有两位小数点
+            return String(format: "%.1f", f)
+        } else {
+            return String(format: "%.2f", f)
+        }
+    }
+}

+ 3 - 9
PDF Office/PDF Master/Class/Common/Tools/KMTools.swift

@@ -343,15 +343,9 @@ extension KMTools {
     }
     
     @objc class func getAppName() -> String {
-        let appTarget = KMTools_OC.getAppTarget()
-        if (appTarget == .free) {
-            return "PDF Master"
-        } else if (appTarget == .pro) {
-            return "PDF Master Pro"
-        } else if (appTarget == .DMG) {
-//            return "PDF Master DMG"
-            return "PDF Master"
-        }
+        #if VERSION_PRO
+        return "PDF Master Pro"
+        #endif
         return "PDF Master"
     }
     

+ 1 - 1
PDF Office/PDF Master/Class/Home/Category/NSColor+KMExtensions.swift

@@ -81,7 +81,7 @@ public extension NSColor {
 //        }
 //        self.init(red: components.R, green: components.G, blue: components.B, alpha: components.a)
 //    }
-    
+    @objc(toHexString:)
     func toHex(alpha: Bool = false) -> String? {
         guard let components = cgColor.components, components.count >= 3 else {
             return nil

+ 1 - 1
PDF Office/PDF Master/Class/Home/View/KMBox.swift

@@ -14,7 +14,7 @@ typealias mouseRightDownCallback = (_ downEntered: Bool, _ mouseBox: KMBox, _ ev
 
 @objcMembers class KMBox: NSBox {
     var moveCallback: mouseMoveCallback?
-    var downCallback: mouseDownCallback?
+    var downCallback: ((_ downEntered: Bool, _ mouseBox: KMBox, _ event: NSEvent) -> Void)?
     var doubleCallback: doubleClickCallback?
     var rightDownCallback: mouseRightDownCallback?
     var hoverColor : NSColor? // 悬浮颜色

+ 34 - 0
PDF Office/PDF Master/Class/Home/View/KMComboBox.swift

@@ -37,6 +37,8 @@ class KMComboBox: NSComboBox {
         }
     }
     
+    // MARK: Private Methods
+    
     var type: KMComboBoxType {
         get {
             return _type
@@ -57,3 +59,35 @@ class KMComboBox: NSComboBox {
         }
     }
 }
+
+class KMComboBoxCell: NSComboBoxCell {
+    private func adjustedFrameToVerticallyCenterText(_ frame: NSRect) -> NSRect {
+        let offset = floor((frame.size.height / 2 - (font!.ascender + font!.descender)))
+        let rect = NSRect(x: 8, y: 0, width: frame.size.width, height: frame.size.height)
+        return NSInsetRect(rect, 0.0, offset)
+    }
+    
+    override func edit(withFrame aRect: NSRect, in controlView: NSView, editor textObj: NSText, delegate anObject: Any?, event: NSEvent?) {
+        super.edit(withFrame: adjustedFrameToVerticallyCenterText(aRect), in: controlView, editor: textObj, delegate: anObject, event: event)
+    }
+    
+    override func select(withFrame aRect: NSRect, in controlView: NSView, editor textObj: NSText, delegate anObject: Any?, start selStart: Int, length selLength: Int) {
+        super.select(withFrame: adjustedFrameToVerticallyCenterText(aRect), in: controlView, editor: textObj, delegate: anObject, start: selStart, length: selLength)
+    }
+    
+    override func drawInterior(withFrame frame: NSRect, in controlView: NSView) {
+        super.drawInterior(withFrame: adjustedFrameToVerticallyCenterText(frame), in: controlView)
+    }
+}
+
+class KMStampComboBoxCell: NSComboBoxCell {
+    override func drawInterior(withFrame cellFrame: NSRect, in controlView: NSView) {
+        self.backgroundColor = NSColor.white
+        super.drawInterior(withFrame: adjustedFrameToVerticallyCenterText(cellFrame), in: controlView)
+    }
+    
+    func adjustedFrameToVerticallyCenterText(_ frame: NSRect) -> NSRect {
+        let offset = floor((NSHeight(frame) / 2 - (font!.ascender + font!.descender)))
+        return frame.insetBy(dx: 0.0, dy: offset)
+    }
+}

+ 14 - 14
PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.swift

@@ -140,7 +140,7 @@ class KMAIOpenPDFFilesVC: NSViewController {
         let filePath = url.path
         
         let fileName: NSString = url.lastPathComponent as NSString
-        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath()).deletingLastPathComponent
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String).deletingLastPathComponent
 
         let imageName = NSString(string: NSString(string: filePath).lastPathComponent).deletingPathExtension
         
@@ -194,21 +194,21 @@ class KMAIOpenPDFFilesVC: NSViewController {
         let folderPath = "convertToPDF.pdf"
         let savePath = folderPath.kUrlToPDFFolderPath()
         
-        if (!FileManager.default.fileExists(atPath: savePath!.deletingLastPathComponent as String)) {
-            try?FileManager.default.createDirectory(atPath: savePath!.deletingLastPathComponent as String, withIntermediateDirectories: true, attributes: nil)
+        if (!FileManager.default.fileExists(atPath: savePath.deletingLastPathComponent as String)) {
+            try?FileManager.default.createDirectory(atPath: savePath.deletingLastPathComponent as String, withIntermediateDirectories: true, attributes: nil)
         }
         
-        if (!FileManager.default.fileExists(atPath: savePath! as String)) {
-            FileManager.default.createFile(atPath: savePath! as String, contents: nil)
+        if (!FileManager.default.fileExists(atPath: savePath as String)) {
+            FileManager.default.createFile(atPath: savePath as String, contents: nil)
         }
 
         if savePath == nil {
             return
         }
-        KMConvertPDFManagerOC.convertFile(filePath, savePath: savePath!) { success, errorDic in
-            if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
-                if FileManager.default.fileExists(atPath: savePath!) {
-                    try?FileManager.default.removeItem(atPath: savePath!)
+        KMConvertPDFManager.convertFile(filePath, savePath: savePath as String) { success, errorDic in
+            if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath as String) {
+                if FileManager.default.fileExists(atPath: savePath as String) {
+                    try?FileManager.default.removeItem(atPath: savePath as String)
                 }
                 let alert = NSAlert.init()
                 alert.alertStyle = .critical
@@ -225,14 +225,14 @@ class KMAIOpenPDFFilesVC: NSViewController {
                 return
             }
             
-            if !savePath!.isPDFValid() {
+            if !(savePath as String).isPDFValid() {
                 let alert = NSAlert()
                 alert.alertStyle = .critical
                 alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
                 alert.runModal()
                 return
             }
-            NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePath!), display: true) { document, documentWasAlreadyOpen, error in
+            NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePath as String), display: true) { document, documentWasAlreadyOpen, error in
                 if error != nil {
                     NSApp.presentError(error!)
                     return
@@ -328,7 +328,7 @@ class KMAIOpenPDFFilesVC: NSViewController {
                   (type == "pptx") ||
                   (type == "pptx") {
             let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
-            let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+            let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String)
             openOfficeFile(url: path)
         }
     }
@@ -413,7 +413,7 @@ class KMAIOpenPDFFilesVC: NSViewController {
         }
         NSPanel.km_open_multi_success(window!) { panel in
             var array: [String] = []
-            for fileType in KMConvertPDFManagerOC.supportFileType() {
+            for fileType in KMConvertPDFManager.supportFileType() {
                 if let string = fileType as? String {
                     array.append(string)
                 }
@@ -461,7 +461,7 @@ class KMAIOpenPDFFilesVC: NSViewController {
     
     @IBAction func openBlankPage(_ sender: Any) {
         let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
-        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String)
         if (!FileManager.default.fileExists(atPath: savePath.deletingLastPathComponent as String)) {
             try?FileManager.default.createDirectory(atPath: savePath.deletingLastPathComponent as String, withIntermediateDirectories: true, attributes: nil)
         }

+ 5 - 5
PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift

@@ -306,16 +306,16 @@ class KMAIRewritingVC: NSViewController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
+        progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
         if self.state == .AIRewriting {
             progress.message = NSLocalizedString("Rewriting...", comment: "")
         } else if self.state == . AIErrorCorrection {
             progress.message = NSLocalizedString("Error Correcting...", comment: "")
         }
-        progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
-        progress.window?.contentView?.wantsLayer = true
-        progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
-        progress.progressField.textColor = NSColor.white
-        
+
         progress.closeBlock = { [unowned self] in
             self.hiddenProgressWindow()
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift

@@ -402,12 +402,12 @@ class KMAITranslationVC: NSViewController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             self.hiddenProgressWindow()
         }

+ 1 - 1
PDF Office/PDF Master/Class/Home/ViewController/KMCloudDocumentsViewController.swift

@@ -122,7 +122,7 @@ class KMCloudDocumentsViewController: NSViewController {
     func initializeUI() -> Void {
         let menu = NSMenu()
         let item = NSMenuItem(title: NSLocalizedString("Delete", comment: ""), action: #selector(accountListTableView_itemClick), target: self)
-        menu.addItem(item!)
+        menu.addItem(item)
         self.accountListTableView.menu = menu
         self.accountListTableView.allowsEmptySelection = false
         

+ 10 - 10
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift

@@ -178,11 +178,11 @@ extension KMHomeViewController {
             window = NSApp.mainWindow
         }
         NSOpenPanel.km_open_multi(window!) { panel in
-            if let data = KMConvertPDFManagerOC.supportFileType() as? [String], !data.isEmpty {
-                panel.allowedFileTypes = KMTools.pdfExtensions + data
-            } else {
-                panel.allowedFileTypes = KMTools.pdfExtensions + KMTools.imageExtensions
-            }
+//            if let data = KMConvertPDFManager.supportFileType() as? [String], !data.isEmpty {
+            panel.allowedFileTypes = KMTools.pdfExtensions + KMConvertPDFManager.supportFileType()
+//            } else {
+//                panel.allowedFileTypes = KMTools.pdfExtensions + KMTools.imageExtensions
+//            }
         } completion: { [weak self] result , urls in
             if result == .OK {
                 var imageUrl: [URL] = []
@@ -455,7 +455,7 @@ extension KMHomeViewController {
                   (type == "pptx") ||
                   (type == "pptx") {
             let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
-            let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+            let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String)
             openOfficeFile(url: path)
         }
     }
@@ -464,7 +464,7 @@ extension KMHomeViewController {
         var filePath = url.path
         
         let fileName: NSString = url.lastPathComponent as NSString
-        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath()).deletingLastPathComponent
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String).deletingLastPathComponent
 
         let imageName = NSString(string: NSString(string: filePath).lastPathComponent).deletingPathExtension
         
@@ -539,7 +539,7 @@ extension KMHomeViewController {
     func openOfficeFile(url: URL) -> Void {
         let filePath = url.path
         let folderPath = "convertToPDF.pdf"
-        let savePath = folderPath.kUrlToPDFFolderPath()
+        let savePath: String? = folderPath.kUrlToPDFFolderPath() as String
         
         if (!FileManager.default.fileExists(atPath: savePath!.deletingLastPathComponent as String)) {
             try?FileManager.default.createDirectory(atPath: savePath!.deletingLastPathComponent as String, withIntermediateDirectories: true, attributes: nil)
@@ -552,7 +552,7 @@ extension KMHomeViewController {
         if savePath == nil {
             return
         }
-        KMConvertPDFManagerOC.convertFile(filePath, savePath: savePath!) { success, errorDic in
+        KMConvertPDFManager.convertFile(filePath, savePath: savePath!) { success, errorDic in
             if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
                 if FileManager.default.fileExists(atPath: savePath!) {
                     try?FileManager.default.removeItem(atPath: savePath!)
@@ -1236,7 +1236,7 @@ extension KMHomeViewController {
     
     @IBAction func openBlankPage(_ sender: Any) {
         let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
-        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath() as String)
         let pdfDocument = CPDFDocument()
         pdfDocument?.insertPage(CGSize(width: 595, height: 842), at: 0)
         pdfDocument?.write(to: URL(fileURLWithPath: savePath))

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -627,12 +627,12 @@ import KMAdvertisement
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             
         }

+ 2 - 2
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.swift

@@ -278,12 +278,12 @@ class KMAITranslationConfirmWindowController: NSWindowController {
 
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Translating...", comment: "")
+
         progress.closeBlock = { [unowned self] in
             self.hiddenProgressWindow()
         }

+ 1 - 1
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift

@@ -302,11 +302,11 @@ class KMAITranslationWindowController: NSWindowController {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Translating...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
+        progress.message = NSLocalizedString("Translating...", comment: "")
         
         progress.closeBlock = {
             self.hiddenProgressWindow()

+ 1 - 1
PDF Office/PDF Master/Class/Home/WindowController/KMURLToPDFWindowController.swift

@@ -188,7 +188,7 @@ class KMURLToPDFWindowController: NSWindowController {
 //        let append2 = searchPath!.stringByAppendingPathComponent("WebPage")
         let append1: NSString = "WebPage"
         let append2 = append1.kUrlToPDFFolderPath()
-        return append2!
+        return append2 as String
     }
     
     @objc func beginSheetModal(for window: NSWindow, completionHandler handler: ((_ filePath: String) -> Void)?) {

+ 0 - 24
PDF Office/PDF Master/Class/KMLightMember/Extension/NSObject+DeviceInfo/NSObject+DeviceInfo.h

@@ -1,24 +0,0 @@
-//
-//  NSObject+DeviceInfo.h
-//  Connect
-//
-//  Created by 朱东勇 on 2017/5/25.
-//  Copyright © 2017年 innovator. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <IOKit/IOKitLib.h>
-
-NSString *GetCurrentDeviceProductName(void);
-
-NSString *GetProductName(void);
-
-NSString *GetHardwareUUID(void);
-
-NSString *GetHardwareSerialNumber(void);
-
-NSString *GetCompatible(void);
-
-NSString *GetSystemVersion(void);
-
-NSString *GetDeviceName(void);

+ 0 - 122
PDF Office/PDF Master/Class/KMLightMember/Extension/NSObject+DeviceInfo/NSObject+DeviceInfo.m

@@ -1,122 +0,0 @@
-//
-//  NSObject+DeviceInfo.m
-//  Connect
-//
-//  Created by 朱东勇 on 2017/5/25.
-//  Copyright © 2017年 innovator. All rights reserved.
-//
-
-/**
- "compatible" = <"iMac9,1">
- "version" = <"1.0">
- "board-id" = <"Mac-F2218EA9">
- "IOInterruptSpecifiers" = (<0900000005000000>)
- "IOPolledInterface" = "SMCPolledInterface is not serializable"
- "serial-number" = <30544600000000000000000000313739343330303430544600000000000000000$
- "IOInterruptControllers" = ("io-apic-0")
- "IOPlatformUUID" = "D0XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXFB"
- "IOPlatformArgs" = <0060880280ffffff0010880280ffffff18de8c0280ffffff0000000000000000$
- "clock-frequency" = <005a6b3f>
- "manufacturer" = <"Apple Inc.">
- "IOConsoleSecurityInterest" = "IOCommand is not serializable"
- "IOPlatformSerialNumber" = "17XXXXXXXTF"
- "system-type" = <01>
- "product-name" = <"iMac9,1">
- "model" = <"iMac9,1">
- "name" = <"/">
- "IOBusyInterest" = "IOCommand is not serializable"
- */
-
-#import "NSObject+DeviceInfo.h"
-
-NSString* GetDeviceInfo(NSString *key) {
-    NSString *ret = nil;
-    io_service_t platformExpert ;
-    platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")) ;
-    
-    if (platformExpert) {
-        CFTypeRef serialNumberAsCFString ;
-        serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, (__bridge CFStringRef)(key), kCFAllocatorDefault, 0) ;
-        if (serialNumberAsCFString) {
-            ret = [(__bridge NSString *)(serialNumberAsCFString) copy];
-            CFRelease(serialNumberAsCFString);
-            serialNumberAsCFString = NULL;
-        }
-        IOObjectRelease(platformExpert);
-//        platformExpert = 0;
-    }
-    
-    return ret;
-}
-
-NSString *GetCurrentDeviceProductName(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"model");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetProductName(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"product-name");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetHardwareUUID(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"IOPlatformUUID");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetHardwareSerialNumber(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"IOPlatformSerialNumber");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetCompatible(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"compatible");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetDeviceName(void) {
-    NSData *data = (NSData*)GetDeviceInfo(@"name");
-    if ([data isKindOfClass:[NSString class]])
-        return (NSString*)data;
-    return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
-}
-
-NSString *GetSystemVersion(void) {
-    NSTask *task;
-    task = [[NSTask alloc] init];
-    [task setLaunchPath: @"/usr/bin/sw_vers"];
-    
-    NSArray *arguments;
-    arguments = [NSArray arrayWithObjects: @"-productVersion", nil];
-    [task setArguments: arguments];
-    
-    NSPipe *pipe;
-    pipe = [NSPipe pipe];
-    [task setStandardOutput: pipe];
-    
-    NSFileHandle *file;
-    file = [pipe fileHandleForReading];
-    
-    [task launch];
-    
-    NSData *data;
-    data = [file readDataToEndOfFile];
-    
-    NSString *string;
-    string = [[NSString alloc] initWithData: data
-                                   encoding: NSUTF8StringEncoding];
-//    NSLog (@"got\n%@", string);
-    string = [string stringByReplacingOccurrencesOfString:@"\r\0" withString:@""];
-    string = [string stringByReplacingOccurrencesOfString:@"\n" withString:@""];
-    return string;
-}

+ 0 - 15
PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.h

@@ -1,15 +0,0 @@
-//
-//  KMMailHelper.h
-//  PDF Reader
-//
-//  Created by HuFeng on 13-3-13.
-//  Copyright (c) 2013年 zhangjie. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <AppKit/AppKit.h>
-
-@interface KMMailHelper : NSObject
-+ (void)sendFileWithPaths:(NSArray *)paths;
-+ (void)newEmailWithContacts:(NSString*)contact andSubjects:(NSString*)subjects;
-@end

+ 0 - 71
PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.m

@@ -1,71 +0,0 @@
-//
-//  KMMailHelper.m
-//  PDF Reader
-//
-//  Created by HuFeng on 13-3-13.
-//  Copyright (c) 2013年 zhangjie. All rights reserved.
-//
-
-#import "KMMailHelper.h"
-
-@implementation KMMailHelper
-
-+ (void)sendFileWithPaths:(NSArray *)paths {
-    
-    NSString *totalFileString = nil;
-    for (int i = 0; i < [paths count]; i++) {
-        NSString* filePath = [[paths objectAtIndex:i] lastPathComponent];
-        if (i == 0) {
-            totalFileString = [NSString stringWithFormat:@"%@",filePath];
-        }else{
-            totalFileString = [totalFileString stringByAppendingFormat:@"   %@",filePath];
-        }
-    }
-    NSString *emailString = [NSString stringWithFormat:@"\
-                             tell application \"Mail\"\n\
-                             set newMessage to make new outgoing message with properties {subject:\"%@\" & return} \n\
-                             tell newMessage\n\
-                             set visible to true\n\
-                             tell content\n\
-                             ",totalFileString];
-    //add attachments to script
-    for (NSString *file in paths) {
-        emailString = [emailString stringByAppendingFormat:@"make new attachment with properties {file name:\"%@\"} at before the first paragraph\n", file];
-    }
-    
-    NSDictionary *errorDictionary;
-    emailString = [emailString stringByAppendingFormat:@"end tell\n activate\n end tell\n end tell"];
-    NSAppleScript *emailScript = [[NSAppleScript alloc] initWithSource:emailString];
-    NSAppleEventDescriptor *eventDescriptor = [emailScript executeAndReturnError:&errorDictionary];
-    if (!eventDescriptor)
-    {
-        NSURL *url = [NSURL URLWithString:@"https://www.pdfreaderpro.com/contact"];
-        if(![[NSWorkspace sharedWorkspace] openURL:url])
-            NSLog(@"Failed to open url: %@",[url description]);
-    }
-}
-
-+ (void)newEmailWithContacts:(NSString*)contact andSubjects:(NSString*)subjects
-{
-    NSString *emailString = [NSString stringWithFormat:@"\
-                             tell application \"Mail\"\n\
-                             set newMessage to make new outgoing message with properties {subject:\"%@\" & return} \n\
-                             tell newMessage\n\
-                             set visible to true\n\
-                             make new to recipient at end of to recipients with properties {address:\"%@\"}\n\
-                             tell content\n\
-                             ",subjects,contact];
-    
-    NSDictionary *errorDictionary;
-    emailString = [emailString stringByAppendingFormat:@"end tell\n activate\n end tell\n end tell"];
-    NSAppleScript *emailScript = [[NSAppleScript alloc] initWithSource:emailString];
-    NSAppleEventDescriptor *eventDescriptor = [emailScript executeAndReturnError:&errorDictionary];
-    if (!eventDescriptor)
-    {
-        NSURL *url = [NSURL URLWithString:@"https://www.pdfreaderpro.com/contact"];
-        if(![[NSWorkspace sharedWorkspace] openURL:url])
-            NSLog(@"Failed to open url: %@",[url description]);
-    }
-}
-
-@end

+ 71 - 0
PDF Office/PDF Master/Class/KMLightMember/Tools/Email/KMMailHelper.swift

@@ -0,0 +1,71 @@
+//
+//  KMMailHelper.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/7.
+//
+
+import Cocoa
+
+@objc
+class KMMailHelper: NSObject {
+    static func sendFile(withPaths paths: [String]) {
+        var totalFileString: String?
+        for (index, path) in paths.enumerated() {
+            let filePath = URL(fileURLWithPath: path).lastPathComponent
+            if index == 0 {
+                totalFileString = filePath
+            } else {
+                totalFileString?.append("   \(filePath)")
+            }
+        }
+        
+        guard let totalFileString = totalFileString else {
+            return
+        }
+        
+        let emailString = """
+            tell application "Mail"
+                set newMessage to make new outgoing message with properties {subject:"\(totalFileString)" & return}
+                tell newMessage
+                    set visible to true
+                    tell content
+            """
+        
+        var attachmentScript = ""
+        for file in paths {
+            attachmentScript.append("make new attachment with properties {file name:\"\(file)\"} at before the first paragraph\n")
+        }
+        
+        let errorDictionary: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+        let emailScript = NSAppleScript(source: emailString + attachmentScript + "end tell\nactivate\nend tell\nend tell")
+        let eventDescriptor = emailScript?.executeAndReturnError(errorDictionary)
+        
+        if eventDescriptor == nil {
+            if let url = URL(string: "https://www.pdfreaderpro.com/contact"), !NSWorkspace.shared.open(url) {
+                NSLog("Failed to open url: \(url)")
+            }
+        }
+    }
+    
+    static func newEmail(withContacts contact: String, andSubjects subjects: String) {
+        let emailString = """
+            tell application "Mail"
+                set newMessage to make new outgoing message with properties {subject:"\(subjects)" & return}
+                tell newMessage
+                    set visible to true
+                    make new to recipient at end of to recipients with properties {address:"\(contact)"}
+                    tell content
+            """
+        
+        let errorDictionary: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+        let emailScript = NSAppleScript(source: emailString + "end tell\nactivate\nend tell\nend tell")
+        let eventDescriptor = emailScript?.executeAndReturnError(errorDictionary)
+        
+        if eventDescriptor == nil {
+            if let url = URL(string: "https://www.pdfreaderpro.com/contact"), !NSWorkspace.shared.open(url) {
+                NSLog("Failed to open url: \(url)")
+            }
+        }
+    }
+}

+ 179 - 0
PDF Office/PDF Master/Class/Merge/Model/KMFileAttribute.swift

@@ -0,0 +1,179 @@
+//
+//  KMFileAttribute.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/12.
+//
+
+import Cocoa
+
+@objcMembers class KMFileAttribute: NSObject {
+    var filePath: String?
+    var oriFilePath: String?
+    var myPDFDocument: PDFDocument?
+    var pdfDocument: CPDFDocument?
+    var bAllPage = true
+    private var _selectPages: [NSNumber] = []
+    var pagesString: String = ""
+    var isLocked = false
+    var password: String?
+    var pagesType: KMPageRange = .all
+    
+    /*
+     @property (nonatomic, assign) BOOL pageRangeError;
+     */
+    
+    func fetchSelectPages() -> [NSNumber] {
+        let _ = self.isInvalidString(self.pagesString)
+        if(!self.bAllPage) {
+            self.QuickSort(&self._selectPages, startIndex: 0, endIndex: self._selectPages.count-1)
+        }
+        return self._selectPages
+    }
+    
+    func isInvalidString(_ text: String) -> Bool {
+        var document: PDFDocument?
+        if (self.myPDFDocument != nil) {
+            document = self.myPDFDocument
+        } else {
+            document = PDFDocument(url: URL(fileURLWithPath: self.filePath ?? ""))
+        }
+        
+        if let data = document?.isLocked, data {
+            document?.unlock(withPassword: self.password ?? "")
+        }
+        let pageNumber = document?.pageCount ?? 1
+        if (self.bAllPage) {
+            self._selectPages = []
+            for i in 1 ... pageNumber {
+                self._selectPages.append(NSNumber(value: i))
+            }
+            return false
+        }
+        
+        var pageNumbers: [NSNumber] = []
+        var isInvalid = false
+        var c: unichar = 0
+        for c in text {
+            if (c != "0" && c != "1" && c != "2" && c != "3" && c != "4" && c != "5" && c != "6" && c != "7" && c != "8" && c != "9" && c != "," && c != "-") {
+                isInvalid = true
+                break
+            }else{
+                isInvalid = false
+            }
+        }
+        if (!isInvalid) {
+            let array = text.components(separatedBy: ",")
+            for s in array {
+                if s.isEmpty {
+                    isInvalid = true
+                    break
+                }else{
+                    let pages = s.components(separatedBy: "-")
+                    if (pages.count>2) {
+                        isInvalid = true
+                        break
+                    }else if(pages.count==1){
+                        let p = pages.first!
+                        if p.isEmpty || Int(p)! > pageNumber || Int(p) == 0 {
+                            isInvalid = true
+                            break
+                        }else{
+                            var isEqual = false
+                            for pageNumber in pageNumbers {
+                                if pageNumber.stringValue == p {
+                                    isEqual = true
+                                    isInvalid = true
+                                    break
+                                }
+                            }
+                            if (!isEqual) {
+                                pageNumbers.append(NSNumber(value: Int(p)!))
+                            }
+                        }
+                    }else if(pages.count==2){
+                        let p1 = pages[0]
+                        let p2 = pages[1]
+                        if p1.isEmpty || p2.isEmpty || Int(p1)! >= Int(p2)! || Int(p2)! > pageNumber || Int(p1) == 0 {
+                            isInvalid = true
+                            break
+                        }else{
+                            var isEqual = false
+                            for i in Int(p1)! ... Int(p2)! {
+                                for pageNumber in pageNumbers {
+                                    if pageNumber.intValue == i {
+                                        isEqual = true
+                                        isInvalid = true
+                                        break
+                                    }
+                                }
+                            }
+                            if (!isEqual) {
+                                for i in Int(p1)! ... Int(p2)! {
+                                    pageNumbers.append(NSNumber(value: i))
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+            if (text.isEmpty) {
+            isInvalid = true
+        }
+        if (isInvalid) {
+            self._selectPages = []
+        }else{
+            self._selectPages = pageNumbers
+        }
+        return isInvalid
+    }
+    
+    func QuickSort(_ list: inout [NSNumber],startIndex: Int, endIndex: Int) {
+        if(startIndex >= endIndex) {
+            return
+        }
+        
+        let temp = list[startIndex]
+        var tempIndex = startIndex
+        
+        for i in startIndex+1 ... endIndex {
+            let t = list[i]
+            if (temp.intValue > t.intValue) {
+                tempIndex = tempIndex + 1
+                
+                let tmp = list[tempIndex]
+                list[tempIndex] = list[i]
+                list[i] = tmp
+            }
+        }
+        
+        let tmp = list[tempIndex]
+        list[tempIndex] = list[startIndex]
+        list[startIndex] = tmp
+        
+        self.QuickSort(&list, startIndex: startIndex, endIndex: tempIndex-1)
+        self.QuickSort(&list, startIndex: tempIndex+1, endIndex: endIndex)
+    }
+    
+    /*
+
+     /* give our representation to the image browser */
+     - (id)imageRepresentation
+     {
+         return self.filePath;
+     }
+
+     /* use the absolute filepath as identifier */
+     - (NSString *)imageUID
+     {
+         return self.filePath;
+     }
+
+     - (NSString*)imageTitle
+     {
+         return [[self.filePath lastPathComponent] stringByDeletingPathExtension];
+     }
+
+     */
+}

+ 0 - 19
PDF Office/PDF Master/Class/Merge/OCPart/Category/PDFPage_SKExtensions.h

@@ -1,19 +0,0 @@
-//
-//  PDFPage_SKExtensions.h
-//  PDF Reader
-//
-//  Created by wangshuai on 13-10-31.
-//  Copyright (c) 2013年 zhangjie. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import <Quartz/Quartz.h>
-
-@interface PDFPage (SKExtensions)
-
-- (NSImage *)pageImage;
-- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box;
-- (NSImage *)thumbnailWithSize:(CGFloat)size forBox:(PDFDisplayBox)box shadowBlurRadius:(CGFloat)shadowBlurRadius shadowOffset:(NSSize)shadowOffset;
-- (NSRect)foregroundBox;
-- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box shadowBlurRadius:(CGFloat)shadowBlurRadius;
-@end

+ 0 - 220
PDF Office/PDF Master/Class/Merge/OCPart/Category/PDFPage_SKExtensions.m

@@ -1,220 +0,0 @@
-//
-//  PDFPage_SKExtensions.m
-//  PDF Reader
-//
-//  Created by wangshuai on 13-10-31.
-//  Copyright (c) 2013年 zhangjie. All rights reserved.
-//
-
-#import "PDFPage_SKExtensions.h"
-#import "NSBitmapImageRep_SKExtensions.h"
-#import "NSGeometry_SKExtensions.h"
-
-@implementation PDFPage (SKExtensions) 
-
-- (NSImage *)pageImage {
-    return [self thumbnailWithSize:0.0 forBox:kPDFDisplayBoxCropBox shadowBlurRadius:0.0 shadowOffset:NSZeroSize];
-}
-
-- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box{
-    CGFloat shadowBlurRadius = round(aSize / 32.0);
-    CGFloat shadowOffset = - ceil(shadowBlurRadius * 0.75);
-    return  [self thumbnailWithSize:aSize forBox:box shadowBlurRadius:shadowBlurRadius shadowOffset:NSMakeSize(0.0, shadowOffset)];
-}
-
-- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box shadowBlurRadius:(CGFloat)shadowBlurRadius shadowOffset:(NSSize)shadowOffset{
-    NSRect bounds = [self boundsForBox:box];
-    NSSize pageSize = bounds.size;
-    BOOL isScaled = aSize > 0.0;
-    BOOL hasShadow = shadowBlurRadius > 0.0;
-    CGFloat scale = 1.0;
-    NSSize thumbnailSize;
-    NSRect pageRect = NSZeroRect;
-    NSImage *image;
-    NSImage *pageImage = nil;
-    
-    if ([self rotation] % 180 == 90)
-        pageSize = NSMakeSize(pageSize.height, pageSize.width);
-    
-    if (isScaled) {
-        if (pageSize.height > pageSize.width)
-            thumbnailSize = NSMakeSize(round((aSize - 2.0 * shadowBlurRadius) * pageSize.width / pageSize.height + 2.0 * shadowBlurRadius), aSize);
-        else
-            thumbnailSize = NSMakeSize(aSize, round((aSize - 2.0 * shadowBlurRadius) * pageSize.height / pageSize.width + 2.0 * shadowBlurRadius));
-        scale = fmax((thumbnailSize.width - 2.0 * shadowBlurRadius) / pageSize.width, (thumbnailSize.height - 2.0 * shadowBlurRadius) / pageSize.height);
-    } else {
-        thumbnailSize = NSMakeSize(pageSize.width + 2.0 * shadowBlurRadius, pageSize.height + 2.0 * shadowBlurRadius);
-    }
-    
-    if (!(thumbnailSize.width > 0 && thumbnailSize.height > 0)) {
-        return nil;
-    }
-    image = [[NSImage alloc] initWithSize:thumbnailSize];
-    [image lockFocus];
-    
-    [NSGraphicsContext saveGraphicsState];
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
-    [[NSColor whiteColor] set];
-    if (hasShadow) {
-        NSShadow *aShadow = [[NSShadow alloc] init];
-        [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.5]];
-        [aShadow setShadowBlurRadius:shadowBlurRadius];
-        [aShadow setShadowOffset:shadowOffset];
-        [aShadow set];
-//        [aShadow release];
-    }
-    pageRect.size = thumbnailSize;
-    pageRect = NSInsetRect(pageRect, shadowBlurRadius, shadowBlurRadius);
-    pageRect.origin.x -= shadowOffset.width;
-    pageRect.origin.y -= shadowOffset.height;
-    NSRectFill(pageRect);
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault];
-    [NSGraphicsContext restoreGraphicsState];
-    
-    if (isScaled || hasShadow) {
-        NSAffineTransform *transform = [NSAffineTransform transform];
-        if (hasShadow)
-            [transform translateXBy:shadowBlurRadius - shadowOffset.width yBy:shadowBlurRadius - shadowOffset.height];
-        if (isScaled)
-            [transform scaleBy:scale];
-        [transform concat];
-    }
-    
-    if (isScaled) {
-        // drawing the page with an active transform can sometimes lead to a deadlock in CG, rdar://problem/5447966
-        pageImage = [[NSImage alloc] initWithSize:pageSize];
-        [pageImage lockFocus];
-    }
-    [self drawWithBox:box]; 
-    if (isScaled) {
-        [pageImage unlockFocus];
-        [pageImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
-//        [pageImage release];
-    }
-    
-    [image unlockFocus];
-    
-    return image;
-}
-
-- (NSImage *)thumbnailWithSize:(CGFloat)aSize forBox:(PDFDisplayBox)box shadowBlurRadius:(CGFloat)shadowBlurRadius
-{
-    NSRect bounds = [self boundsForBox:box];
-    NSSize pageSize = bounds.size;
-    CGFloat scale = 1.0;
-    NSSize thumbnailSize;
-    CGFloat shadowOffset = shadowBlurRadius > 0.0 ? - ceil(shadowBlurRadius * 0.75) : 0.0;
-    NSRect pageRect = NSZeroRect;
-    NSImage *image;
-    
-    if ([self rotation] % 180 == 90)
-        pageSize = NSMakeSize(pageSize.height, pageSize.width);
-    
-    if (aSize > 0.0) {
-        if (pageSize.height > pageSize.width)
-            thumbnailSize = NSMakeSize(round((aSize - 2.0 * shadowBlurRadius) * pageSize.width / pageSize.height + 2.0 * shadowBlurRadius), aSize);
-        else
-            thumbnailSize = NSMakeSize(aSize, round((aSize - 2.0 * shadowBlurRadius) * pageSize.height / pageSize.width + 2.0 * shadowBlurRadius));
-        scale = fmax((thumbnailSize.width - 2.0 * shadowBlurRadius) / pageSize.width, (thumbnailSize.height - 2.0 * shadowBlurRadius) / pageSize.height);
-    } else {
-        thumbnailSize = NSMakeSize(pageSize.width + 2.0 * shadowBlurRadius, pageSize.height + 2.0 * shadowBlurRadius);
-    }
-    
-    pageRect.size = thumbnailSize;
-    
-    if (shadowBlurRadius > 0.0) {
-        pageRect = NSInsetRect(pageRect, shadowBlurRadius, shadowBlurRadius);
-        pageRect.origin.y -= shadowOffset;
-    }
-    
-    image = [[NSImage alloc] initWithSize:thumbnailSize];
-    
-    [image lockFocus];
-    
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
-    
-    [NSGraphicsContext saveGraphicsState];
-    [[NSColor whiteColor] setFill];
-    if (shadowBlurRadius > 0.0){
-        NSShadow *aShadow = [[NSShadow alloc] init];
-        [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.5]];
-        [aShadow setShadowBlurRadius:shadowBlurRadius];
-        [aShadow setShadowOffset:NSMakeSize(0.0, shadowOffset)];
-        [aShadow set];
-    }
-    NSRectFill(pageRect);
-    [NSGraphicsContext restoreGraphicsState];
-    
-    if (fabs(scale - 1.0) > 0.0 || shadowBlurRadius > 0.0) {
-        NSAffineTransform *transform = [NSAffineTransform transform];
-        if (shadowBlurRadius > 0.0)
-            [transform translateXBy:NSMinX(pageRect) yBy:NSMinY(pageRect)];
-        [transform scaleBy:scale];
-        [transform concat];
-    }
-    
-    [self drawWithBox:box];
-        
-    [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault];
-    
-    [image unlockFocus];
-    
-    return image;
-}
-
-- (NSRect)foregroundBox {
-    CGFloat marginWidth = 10;
-    CGFloat marginHeight = 10;
-    NSBitmapImageRep *imageRep = [self newBitmapImageRepForBox:kPDFDisplayBoxMediaBox];
-    NSRect bounds = [self boundsForBox:kPDFDisplayBoxMediaBox];
-    NSRect foregroundBox = [imageRep foregroundRect];
-    if (imageRep == nil) {
-        foregroundBox = bounds;
-    } else if (NSIsEmptyRect(foregroundBox)) {
-//        foregroundBox.origin = SKIntegralPoint(SKCenterPoint(bounds));
-        foregroundBox.size = NSZeroSize;
-    } else {
-//        foregroundBox.origin = SKAddPoints(foregroundBox.origin, bounds.origin);
-    }
-    
-    return NSIntersectionRect(NSInsetRect(foregroundBox, -marginWidth, -marginHeight), bounds);
-}
-
-- (NSBitmapImageRep *)newBitmapImageRepForBox:(PDFDisplayBox)box {
-    NSRect bounds = [self boundsForBox:box];
-    NSBitmapImageRep *imageRep;
-    imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                       pixelsWide:NSWidth(bounds)
-                                                       pixelsHigh:NSHeight(bounds)
-                                                    bitsPerSample:8
-                                                  samplesPerPixel:4
-                                                         hasAlpha:YES
-                                                         isPlanar:NO
-                                                   colorSpaceName:NSCalibratedRGBColorSpace
-                                                     bitmapFormat:0
-                                                      bytesPerRow:0
-                                                     bitsPerPixel:32];
-    if (imageRep) {
-        [NSGraphicsContext saveGraphicsState];
-        [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep]];
-        [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationNone];
-        [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-        if ([self rotation]) {
-            NSAffineTransform *transform = [NSAffineTransform transform];
-            switch ([self rotation]) {
-                case 90:  [transform translateXBy:NSWidth(bounds) yBy:0.0]; break;
-                case 180: [transform translateXBy:NSHeight(bounds) yBy:NSWidth(bounds)]; break;
-                case 270: [transform translateXBy:0.0 yBy:NSHeight(bounds)]; break;
-            }
-            [transform rotateByDegrees:[self rotation]];
-            [transform concat];
-        }
-        [self drawWithBox:box];
-        [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationDefault];
-        [NSGraphicsContext restoreGraphicsState];
-    }
-    return imageRep;
-}
-
-
-@end

+ 0 - 18
PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.h

@@ -1,18 +0,0 @@
-//
-//  KMBatchTableRowView.h
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/11/2.
-//
-
-#import "KMTableRowView.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KMBatchTableRowView : KMTableRowView
-
-@property (nonatomic, strong, readonly) NSView *backgroundView;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 97
PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.m

@@ -1,97 +0,0 @@
-//
-//  KMBatchTableRowView.m
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/11/2.
-//
-
-#import "KMBatchTableRowView.h"
-
-@interface KMBatchTableRowView ()
-
-@property (nonatomic, strong) NSView *backgroundView;
-
-@end
-
-@implementation KMBatchTableRowView
-
-- (instancetype)initWithFrame:(NSRect)frameRect {
-    if (self = [super initWithFrame:frameRect]) {
-        [self addSubview:self.backgroundView];
-        
-        self.backgroundView.hidden = YES;
-    }
-    return self;
-}
-
-- (void)layout {
-    [super layout];
-    
-    self.backgroundView.frame = NSMakeRect(self.selectionInset.left, self.selectionInset.top, NSWidth(self.bounds)-self.selectionInset.left-self.selectionInset.right, NSHeight(self.bounds)-self.selectionInset.top-self.selectionInset.bottom);
-}
-
-- (void)setSelectionInset:(NSEdgeInsets)selectionInset {
-    [super setSelectionInset:selectionInset];
-    
-    [self setNeedsLayout:YES];
-}
-
-- (void)setSelected:(BOOL)selected {
-    [super setSelected:selected];
-    
-    if (selected) {
-        self.backgroundView.hidden = YES;
-    }
-}
-
-#pragma mark - Mouse Event
-
-- (void)mouseExited:(NSEvent *)event {
-    [super mouseExited:event];
-    
-    self.backgroundView.hidden = YES;
-    for (NSUInteger i = 0; i < self.subviews.count; i++) {
-        NSView *v = [self.subviews objectAtIndex:i];
-        for (NSUInteger j = 0; j < v.subviews.count; j++) {
-            NSView *sub = [v.subviews objectAtIndex:j];
-            if ([sub isKindOfClass:[NSButton class]]) {
-                sub.hidden = YES;
-            }
-        }
-    }
-}
-
-- (void)mouseEntered:(NSEvent *)event {
-    [super mouseEntered:event];
-    
-    if (self.isSelected) {
-        self.backgroundView.hidden = YES;
-    } else {
-        self.backgroundView.hidden = NO;
-    }
-    
-    for (NSUInteger i = 0; i < self.subviews.count; i++) {
-        NSView *v = [self.subviews objectAtIndex:i];
-        for (NSUInteger j = 0; j < v.subviews.count; j++) {
-            NSView *sub = [v.subviews objectAtIndex:j];
-            if ([sub isKindOfClass:[NSButton class]]) {
-                sub.hidden = NO;
-            }
-        }
-    }
-}
-
-
-#pragma mark -
-#pragma mark - Getting
-
-- (NSView *)backgroundView {
-    if (!_backgroundView) {
-        _backgroundView = [[NSView alloc] init];
-        _backgroundView.wantsLayer = YES;
-        _backgroundView.layer.backgroundColor = [NSColor clearColor].CGColor;
-    }
-    return _backgroundView;
-}
-
-@end

+ 95 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMBatchTableRowView.swift

@@ -0,0 +1,95 @@
+//
+//  KMBatchTableRowView.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/8.
+//
+
+import Cocoa
+
+@objcMembers
+class KMBatchTableRowView: KMTableRowView {
+
+    private var _backgroundView: NSView?
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        
+        self.addSubview(self.backgroundView ?? NSView())
+        self.backgroundView?.isHidden = true
+    }
+    
+    required init?(coder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    override func layout() {
+        super.layout()
+        
+        self.backgroundView?.frame = NSMakeRect(selectionInset.left, selectionInset.top, bounds.width - selectionInset.left - selectionInset.right, bounds.height - selectionInset.top - selectionInset.bottom)
+    }
+    
+    override var selectionInset: NSEdgeInsets {
+        didSet {
+            needsLayout = true
+        }
+    }
+    
+    override var isSelected: Bool {
+        didSet {
+            if isSelected {
+                backgroundView!.isHidden = true
+            }
+        }
+    }
+    
+    //MARK: Mouse Event
+    
+    override func mouseExited(with event: NSEvent) {
+        super.mouseExited(with: event)
+        
+        self.backgroundView?.isHidden = true
+        for view in subviews {
+            if let v = view as? NSView {
+                for subview in v.subviews {
+                    if let button = subview as? NSButton {
+                        button.isHidden = true
+                    }
+                }
+            }
+        }
+    }
+    
+    override func mouseEntered(with event: NSEvent) {
+        super.mouseEntered(with: event)
+        
+        if isSelected {
+            backgroundView!.isHidden = true
+        } else {
+            backgroundView!.isHidden = false
+        }
+        
+        for view in subviews {
+            if let v = view as? NSView {
+                for subview in v.subviews {
+                    if let button = subview as? NSButton {
+                        button.isHidden = false
+                    }
+                }
+            }
+        }
+    }
+    
+    //MARK: Get、Set
+    
+    var backgroundView: NSView? {
+        get {
+            if _backgroundView == nil {
+                _backgroundView = NSView()
+                _backgroundView?.wantsLayer = true
+                _backgroundView?.layer?.backgroundColor = NSColor.clear.cgColor
+            }
+            return _backgroundView
+        }
+    }
+}

+ 0 - 35
PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.h

@@ -1,35 +0,0 @@
-//
-//  KMBlankView.h
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/12/23.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "KMPDFEditAppendCustomView.h"
-
-typedef NS_ENUM(NSUInteger, KMBlankViewMouseEventType) {
-    KMBlankViewMouseEventType_MouseEnter,
-    KMBlankViewMouseEventType_MouseExit,
-    KMBlankViewMouseEventType_MouseDown,
-    KMBlankViewMouseEventType_MouseUp
-};
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef void(^DragSuccessCallBack)(NSMutableArray *fileNames);
-@interface KMBlankView : NSView
-
-@property (nonatomic,assign) IBOutlet NSTextField *titleLabel;
-@property (nonatomic,assign) IBOutlet NSTextField *secondTitleLabel;
-@property (nonatomic,assign) IBOutlet NSImageView *imageView;
-@property (assign) IBOutlet KMPDFEditAppendCustomView *customView;
-
-@property (nonatomic, strong) NSArray *allowedFileTypes;
-
-@property (nonatomic, copy) void(^mouseActionCallBack)(KMBlankViewMouseEventType mouseType);
-@property(nonatomic , copy) DragSuccessCallBack dragSuccessBlock;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 146
PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.m

@@ -1,146 +0,0 @@
-//
-//  KMBlankView.m
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/12/23.
-//
-
-#import "KMBlankView.h"
-
-@interface KMBlankView ()
-
-@property (nonatomic, strong) NSButton *button;
-
-@end
-
-@implementation KMBlankView
-
--(void)awakeFromNib {
-    [super awakeFromNib];
-    self.titleLabel.font = [NSFont systemFontOfSize:14 weight:NSFontWeightSemibold];
-    self.secondTitleLabel.font = [NSFont systemFontOfSize:14];
-    
-    self.titleLabel.stringValue = @"";
-    self.secondTitleLabel.stringValue = @"";
-    [self addTrackingArea];
-    self.wantsLayer = YES;
-    
-    [self.customView addSubview:self.button];
-    
-    [self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
-}
-
-- (void)layout {
-    [super layout];
-    
-    self.button.frame = self.imageView.frame;
-}
-
-#pragma mark -
-#pragma mark - Drag
-
-
-- (void)draggingExited:(nullable id <NSDraggingInfo>)sender {}
-
-- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
-    NSPasteboard *pboard = [sender draggingPasteboard];
-    BOOL isCanDrag = NO;
-    NSDragOperation result = NSDragOperationNone;
-    if ([pboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]])
-    {
-        NSArray *fileNames = [pboard propertyListForType:NSFilenamesPboardType];
-        for (NSString* path in fileNames) {
-            if ([self.allowedFileTypes containsObject:path.pathExtension.lowercaseString]) {
-                isCanDrag = YES;
-            } else {
-                isCanDrag = NO;
-                break;
-            }
-        }
-    }
-    self.layer.borderColor = [NSColor clearColor].CGColor;
-
-    if (isCanDrag) {
-        
-        result = NSDragOperationCopy;
-    }
-    return result;
-}
-
-- (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)sender
-{
-    NSPasteboard *pboard = [sender draggingPasteboard];
-    if ([pboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]]) {
-        NSMutableArray *fileNames = [pboard propertyListForType:NSFilenamesPboardType];
-        if (self.dragSuccessBlock) {
-            self.dragSuccessBlock(fileNames);
-        }
-    }
-    return YES;
-}
-
-#pragma mark -
-#pragma mark - mouse Methods
-
-- (void)addTrackingArea {
-    NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:self.imageView.bounds options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways owner:self userInfo:nil];
-    [self.imageView addTrackingArea:trackingArea];
-}
-
-- (void)mouseEntered:(NSEvent *)event {
-    [super mouseEntered:event];
-    if (self.mouseActionCallBack) {
-        self.mouseActionCallBack(KMBlankViewMouseEventType_MouseEnter);
-    }
-}
-
-- (void)mouseExited:(NSEvent *)event {
-    [super mouseExited:event];
-    
-    if (self.mouseActionCallBack) {
-        self.mouseActionCallBack(KMBlankViewMouseEventType_MouseExit);
-    }
-}
-
-//- (void)mouseDown:(NSEvent *)event {
-//    [super mouseDown:event];
-//    NSPoint point = [event locationInWindow];
-//    point = [self convertPoint:point toView:self.imageView];
-//    if (self.mouseActionCallBack && CGRectContainsPoint(self.imageView.bounds, point)) {
-//        self.mouseActionCallBack(KMBlankViewMouseEventType_MouseDown);
-//    }
-//}
-
-- (void)mouseUp:(NSEvent *)event {
-    [super mouseUp:event];
-    NSPoint point = [event locationInWindow];
-    point = [self convertPoint:point toView:self.imageView];
-    if (self.mouseActionCallBack && CGRectContainsPoint(self.imageView.bounds, point)) {
-        self.mouseActionCallBack(KMBlankViewMouseEventType_MouseUp);
-    }
-}
-
-#pragma mark -
-#pragma mark - User Actions
-
-- (void)buttonDidClick {
-    if (self.mouseActionCallBack) {
-        self.mouseActionCallBack(KMBlankViewMouseEventType_MouseDown);
-    }
-}
-
-#pragma mark -
-#pragma mark - Getting
-
-- (NSButton *)button {
-    if (!_button) {
-        _button = [[NSButton alloc] init];
-        _button.bordered = false;
-        _button.title = @"";
-        _button.target = self;
-        _button.action = @selector(buttonDidClick);
-    }
-    return _button;
-}
-
-@end

+ 176 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMBlankView.swift

@@ -0,0 +1,176 @@
+//
+//  KMBlankView.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/8.
+//
+
+import Cocoa
+
+
+@objc enum KMBlankViewMouseEventType: UInt {
+    case mouseEnter
+    case mouseExit
+    case mouseDown
+    case mouseUp
+}
+
+typealias DragSuccessCallBack = ([String]) -> Void
+
+@objcMembers
+class KMBlankView: NSView {
+
+    @IBOutlet var titleLabel: NSTextField!
+    @IBOutlet var secondTitleLabel: NSTextField!
+    @IBOutlet var imageView: NSImageView!
+    @IBOutlet var customView: KMPDFEditAppendCustomView!
+
+    var allowedFileTypes: [String]?
+
+    var mouseActionCallBack: ((KMBlankViewMouseEventType) -> Void)?
+    var dragSuccessBlock: DragSuccessCallBack?
+    
+    private var _button: NSButton?
+
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        titleLabel.font = NSFont.systemFont(ofSize: 14, weight: .semibold)
+        secondTitleLabel.font = NSFont.systemFont(ofSize: 14)
+        
+        titleLabel.stringValue = ""
+        secondTitleLabel.stringValue = ""
+        addTrackingArea()
+        self.wantsLayer = true
+        
+        customView.addSubview(button!)
+        
+        registerForDraggedTypes([.fileURL])
+    }
+    
+    override func layout() {
+        super.layout()
+        
+        button!.frame = imageView.frame
+    }
+    
+    //MARK: Drag
+    
+    override func draggingExited(_ sender: NSDraggingInfo?) {
+        
+    }
+    
+    override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation {
+        let pboard = sender.draggingPasteboard
+        var isCanDrag = false
+        var result: NSDragOperation = []
+        
+        if pboard.availableType(from: [NSPasteboard.PasteboardType.fileURL]) != nil {
+            if let fileURLs = pboard.readObjects(forClasses: [NSURL.self], options: nil) as? [URL] {
+                for fileURL in fileURLs {
+                    if allowedFileTypes!.contains(fileURL.pathExtension.lowercased()) {
+                        isCanDrag = true
+                    } else {
+                        isCanDrag = false
+                        break
+                    }
+                }
+            }
+        }
+        
+        layer?.borderColor = NSColor.clear.cgColor
+        
+        if isCanDrag {
+            result = [.copy]
+        }
+        
+        return result
+    }
+    
+    override func prepareForDragOperation(_ sender: NSDraggingInfo) -> Bool {
+        let pboard = sender.draggingPasteboard
+        if (pboard.pasteboardItems == nil) {
+            return true
+        }
+        var files: [String] = []
+        for item in pboard.pasteboardItems! {
+            let fileURL = item.string(forType: .fileURL)
+            if (fileURL == nil) {
+                continue
+            }
+            let path = URL.init(string: fileURL!)
+            if (path == nil) {
+                continue
+            }
+            let filePath: String = path!.path
+            files.append(filePath)
+        }
+        if let successBlock = self.dragSuccessBlock {
+            successBlock(files)
+        }
+
+//        if let fileURL = pboard.availableType(from: [NSPasteboard.PasteboardType.fileURL]) {
+//            let fileNames: String = pboard.propertyList(forType: .fileURL) as! String
+//            let path = URL.init(string: fileNames)
+//            let filePath: String = path!.path
+//            if let successBlock = self.dragSuccessBlock {
+//                successBlock([filePath])
+//            }
+//        }
+        return true
+    }
+    
+    //MARK: mouse Methods
+    
+    func addTrackingArea() {
+        let trackingArea = NSTrackingArea(rect: self.imageView.bounds, options: [.mouseEnteredAndExited, .activeAlways], owner: self, userInfo: nil)
+        self.imageView.addTrackingArea(trackingArea)
+    }
+
+    override func mouseEntered(with event: NSEvent) {
+        super.mouseEntered(with: event)
+        if let mouseActionCallBack = self.mouseActionCallBack {
+            mouseActionCallBack(.mouseEnter)
+        }
+    }
+    
+    override func mouseExited(with event: NSEvent) {
+        super.mouseExited(with: event)
+        if let mouseActionCallBack = self.mouseActionCallBack {
+            mouseActionCallBack(.mouseExit)
+        }
+    }
+    
+    override func mouseUp(with event: NSEvent) {
+        super.mouseUp(with: event)
+        let point = event.locationInWindow
+        let pointInView = self.convert(point, to: self.imageView)
+        if let mouseActionCallBack = self.mouseActionCallBack, self.imageView.bounds.contains(pointInView) {
+            mouseActionCallBack(.mouseUp)
+        }
+    }
+    
+    //MARK: User Actions
+    
+    @objc func buttonDidClick() -> Void {
+        if let mouseActionCallBack = self.mouseActionCallBack {
+            mouseActionCallBack(.mouseDown)
+        }
+    }
+    
+    //MARK: Get、Set
+    
+    var button: NSButton? {
+        get {
+            if _button == nil {
+                _button = NSButton()
+                _button?.isBordered = false
+                _button?.title = ""
+                _button?.target = self
+                _button?.action = #selector(buttonDidClick)
+            }
+            return _button
+        }
+    }
+
+}

+ 0 - 42
PDF Office/PDF Master/Class/Merge/OCPart/KMFileAttribute.h

@@ -1,42 +0,0 @@
-//
-//  KMFileAttribute.h
-//  PDF to Word
-//
-//  Created by wangshuai on 13-8-14.
-//  Copyright (c) 2013年 kdanmobile. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-#import <Quartz/Quartz.h>
-#import <ComPDFKit/ComPDFKit.h>
-
-typedef NS_OPTIONS(NSUInteger, KMPDFSelectPageStringType) {
-    KMPDFSeleectPageType_AllPages   = 0 ,
-    KMPDFSeleectPageType_OnlyOdd,
-    KMPDFSeleectPageType_OnlyEven,
-    KMPDFSeleectPageType_PagesString,
-};
-
-@interface KMFileAttribute : NSObject{
-    NSString        *_filePath;
-    BOOL            _bAllPage;
-    NSMutableArray  *_selectPages;
-    NSString        *_pagesString;
-    
-    BOOL            _isLocked;
-    NSString        *_password;
-}
-@property (nonatomic,retain) NSString *filePath;
-@property (nonatomic, retain) NSString *oriFilePath;
-@property (nonatomic,retain) PDFDocument *myPDFDocument;
-@property (nonatomic,retain) CPDFDocument *pdfDocument;
-@property (nonatomic) BOOL bAllPage;
-@property (nonatomic,retain) NSMutableArray *selectPages;
-@property (nonatomic,retain) NSString *pagesString;
-@property (nonatomic) BOOL isLocked;
-@property (nonatomic,retain) NSString *password;
-@property (nonatomic,assign) KMPDFSelectPageStringType pagesType;
-
-@property (nonatomic, assign) BOOL pageRangeError;
-
-@end

+ 0 - 183
PDF Office/PDF Master/Class/Merge/OCPart/KMFileAttribute.m

@@ -1,183 +0,0 @@
-//
-//  KMFileAttribute.m
-//  PDF to Word
-//
-//  Created by wangshuai on 13-8-14.
-//  Copyright (c) 2013年 kdanmobile. All rights reserved.
-//
-
-#import "KMFileAttribute.h"
-#import <Quartz/Quartz.h>
-
-@implementation KMFileAttribute
-@synthesize filePath = _filePath;
-@synthesize bAllPage = _bAllPage;
-@synthesize selectPages = _selectPages;
-@synthesize pagesString = _pagesString;
-@synthesize isLocked = _isLocked;
-@synthesize password = _password;
-
-- (id)init
-{
-    self = [super init];
-    if (self) {
-        _bAllPage = YES;
-        _isLocked = NO;
-        _password = nil;
-        _pagesString = @"";
-    }
-    return self;
-}
-
-- (void)dealloc {}
-
-- (NSMutableArray*)selectPages
-{
-    [self isInvalidString:_pagesString];
-    if (!_bAllPage) {
-        [self QuickSort:_selectPages StartIndex:0 EndIndex:[_selectPages count]-1];
-    }
-    return _selectPages;
-}
-
-- (BOOL)isInvalidString:(NSString*)text
-{
-    PDFDocument * document;
-    if (_myPDFDocument) {
-        document = self.myPDFDocument;
-    } else {
-       document = [[PDFDocument alloc] initWithURL:[NSURL fileURLWithPath:self.filePath]];
-    }
-    
-    NSInteger pageNumber = [document pageCount];
-    if (_bAllPage) {
-        _selectPages = [[NSMutableArray alloc] init];
-        for (int i=1; i<=pageNumber; i++) {
-            [_selectPages addObject:[NSNumber numberWithInteger:i]];
-        }
-        return NO;
-    }
-    NSMutableArray *pageNumbers = [[NSMutableArray alloc] init];
-    BOOL isInvalid = NO;
-    unichar c;
-    for (int i=0; i<[text length]; i++) {
-        c = [text characterAtIndex:i];
-        if (c!='0'&&c!='1'&&c!='2'&&c!='3'&&c!='4'&&c!='5'&&c!='6'&&c!='7'&&c!='8'&&c!='9'&&c!=','&&c!='-') {
-            isInvalid = YES;
-            break;
-        }else{
-            isInvalid = NO;
-        }
-    }
-    if (!isInvalid) {
-        NSArray *array = [text componentsSeparatedByString:@","];
-        for(NSString *s in array){
-            if ([s isEqualToString:@""]) {
-                isInvalid = YES;
-                break;
-            }else{
-                NSArray *pages = [s componentsSeparatedByString:@"-"];
-                if ([pages count]>2) {
-                    isInvalid = YES;
-                    break;
-                }else if([pages count]==1){
-                    NSString *p = [pages objectAtIndex:0];
-                    if ([p isEqualToString:@""]||[p intValue]>pageNumber||[p integerValue]==0) {
-                        isInvalid = YES;
-                        break;
-                    }else{
-                        BOOL isEqual = NO;
-                        for(NSNumber *pageNumber in pageNumbers){
-                            if ([pageNumber integerValue]==[p integerValue]) {
-                                isEqual = YES;
-                                isInvalid = YES;
-                                break;
-                            }
-                        }
-                        if (!isEqual) {
-                            [pageNumbers addObject:[NSNumber numberWithInteger:[p integerValue]]];
-                        }
-                    }
-                }else if([pages count]==2){
-                    NSString *p1 = [pages objectAtIndex:0];
-                    NSString *p2 = [pages objectAtIndex:1];
-                    if ([p1 isEqualToString:@""]||[p2 isEqualToString:@""]||
-                        [p1 intValue]>=[p2 intValue]||[p2 intValue]>pageNumber||[p1 integerValue]==0) {
-                        isInvalid = YES;
-                        break;
-                    }else{
-                        BOOL isEqual = NO;
-                        for (int i=[p1 intValue]; i<=[p2 intValue]; i++) {
-                            for(NSNumber *pageNumber in pageNumbers){
-                                if ([pageNumber integerValue]==i) {
-                                    isEqual = YES;
-                                    isInvalid = YES;
-                                    break;
-                                }
-                            }
-                        }
-                        if (!isEqual) {
-                            for (int i=[p1 intValue]; i<=[p2 intValue]; i++) {
-                                [pageNumbers addObject:[NSNumber numberWithInteger:i]];
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-    if ([text length]==0) {
-        isInvalid = YES;
-    }
-    if (isInvalid) {
-        _selectPages = nil;
-    }else{
-        _selectPages = pageNumbers;
-    }
-    return isInvalid;
-}
-
--(void)QuickSort:(NSMutableArray *)list StartIndex:(NSInteger)startIndex EndIndex:(NSInteger)endIndex{
-    
-    if(startIndex >= endIndex)return;
-    
-    NSNumber * temp = [list objectAtIndex:startIndex];
-    NSInteger tempIndex = startIndex;
-    
-    for(NSInteger i = startIndex + 1 ; i <= endIndex ; i++){
-        
-        NSNumber *t = [list objectAtIndex:i];
-        
-        if([temp intValue] > [t intValue]){
-            
-            tempIndex = tempIndex + 1;
-            
-            [list exchangeObjectAtIndex:tempIndex withObjectAtIndex:i];
-            
-        }
-        
-    }
-    
-    [list exchangeObjectAtIndex:tempIndex withObjectAtIndex:startIndex];
-    [self QuickSort:list StartIndex:startIndex EndIndex:tempIndex-1];
-    [self QuickSort:list StartIndex:tempIndex+1 EndIndex:endIndex];
-}
-
-/* give our representation to the image browser */
-- (id)imageRepresentation
-{
-	return self.filePath;
-}
-
-/* use the absolute filepath as identifier */
-- (NSString *)imageUID
-{
-    return self.filePath;
-}
-
-- (NSString*)imageTitle
-{
-    return [[self.filePath lastPathComponent] stringByDeletingPathExtension];
-}
-
-@end

+ 0 - 13
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.h

@@ -1,13 +0,0 @@
-//
-//  KMPDFEditAppendCustomView.h
-//  PDF Reader Pro Edition
-//
-//  Created by wanjun on 2021/5/13.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface KMPDFEditAppendCustomView : NSView
-
-@end
-

+ 0 - 12
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.m

@@ -1,12 +0,0 @@
-//
-//  KMPDFEditAppendCustomView.m
-//  PDF Reader Pro Edition
-//
-//  Created by wanjun on 2021/5/13.
-//
-
-#import "KMPDFEditAppendCustomView.h"
-
-@implementation KMPDFEditAppendCustomView
-
-@end

+ 18 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendCustomView.swift

@@ -0,0 +1,18 @@
+//
+//  KMPDFEditAppendCustomView.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/10.
+//
+
+import Cocoa
+
+class KMPDFEditAppendCustomView: NSView {
+
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+
+        // Drawing code here.
+    }
+    
+}

+ 12 - 25
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -8,23 +8,10 @@
 
 #import "KMPDFEditAppendWindow.h"
 #import "PasswordWindowController.h"
-#import "KMFileAttribute.h"
 #import <Quartz/Quartz.h>
-#import "KMSavePanelAccessoryController.h"
-#import "KMBatchTableRowView.h"
-#import "KMBlankView.h"
 #import <Masonry/Masonry.h>
-#import "KMImageAccessoryController.h"
-#if VERSION_DMG
-#import <PDF_Master-Swift.h>
-#else
 #import <PDF_Master-Swift.h>
-#endif
 #import "CTBrowserWindowController.h"
-#import "NSButton+TitleColor.h"
-#import "KMPDFMergeFileNameTabelViewCell.h"
-#import "PDFPage_SKExtensions.h"
-#import "TextFieldFormatter.h"
 
 @interface KMPDFEditAppendTabelViewCell()
 
@@ -437,18 +424,18 @@ static KMPDFEditAppendWindow *windowController = nil;
     self.myBlankView.imageView.image = [NSImage imageNamed:@"KMImageNameEmptyAddNormal"];
     self.myBlankView.allowedFileTypes = [KMImageAccessoryController supportedImageTypes];
     self.myBlankView.mouseActionCallBack = ^(KMBlankViewMouseEventType mouseType) {
-        if (mouseType == KMBlankViewMouseEventType_MouseEnter) {
+        if (mouseType == KMBlankViewMouseEventTypeMouseEnter) {
             weakSelf.myBlankView.imageView.image = [NSImage imageNamed:@"KMImageNameEmptyAddHover"];
-        } else if (mouseType == KMBlankViewMouseEventType_MouseExit) {
+        } else if (mouseType == KMBlankViewMouseEventTypeMouseExit) {
             weakSelf.myBlankView.imageView.image = [NSImage imageNamed:@"KMImageNameEmptyAddNormal"];
-        } else if (mouseType == KMBlankViewMouseEventType_MouseDown) {
+        } else if (mouseType == KMBlankViewMouseEventTypeMouseDown) {
             weakSelf.myBlankView.imageView.image = [NSImage imageNamed:@"KMImageNameEmptyAddHover"];
             [weakSelf itemAddFileAction];
-        } else if (mouseType == KMBlankViewMouseEventType_MouseUp) {
+        } else if (mouseType == KMBlankViewMouseEventTypeMouseUp) {
             weakSelf.myBlankView.imageView.image = [NSImage imageNamed:@"KMImageNameEmptyAddHover"];
         }
     };
-    self.myBlankView.dragSuccessBlock = ^(NSMutableArray *fileNames) {
+    self.myBlankView.dragSuccessBlock = ^(NSArray<NSString *> * fileNames) {
         NSMutableArray *array = [NSMutableArray array];
         
         for(NSString *path in fileNames){
@@ -723,12 +710,12 @@ static KMPDFEditAppendWindow *windowController = nil;
     if (itemIndex == 0) {
         KMFileAttribute *currentFile  = [_files objectAtIndex:index];
         [currentFile setBAllPage:YES];
-        currentFile.pagesType = KMPDFSeleectPageType_AllPages;
+        currentFile.pagesType = KMPageRangeAll;
         
         [self.window makeFirstResponder:self];
     } else if (itemIndex == 1) {
         KMFileAttribute *currentFile = [_files objectAtIndex:index];
-        currentFile.pagesType = KMPDFSeleectPageType_OnlyOdd;
+        currentFile.pagesType = KMPageRangeOdd;
         [currentFile setBAllPage:NO];
         PDFDocument *tDocument = currentFile.myPDFDocument;
         if (tDocument == nil) {
@@ -754,7 +741,7 @@ static KMPDFEditAppendWindow *windowController = nil;
         [self.window makeFirstResponder:self];
     } else if (itemIndex == 2) {
         KMFileAttribute *currentFile = [_files objectAtIndex:index];
-        currentFile.pagesType = KMPDFSeleectPageType_OnlyEven;
+        currentFile.pagesType = KMPageRangeEven;
         [currentFile setBAllPage:NO];
         NSString *tPagesString = @"";
         PDFDocument *tDocument = currentFile.myPDFDocument;
@@ -779,7 +766,7 @@ static KMPDFEditAppendWindow *windowController = nil;
         [self.window makeFirstResponder:self];
     } else {
         KMFileAttribute *currentFile  = [_files objectAtIndex:index];
-        currentFile.pagesType = KMPDFSeleectPageType_PagesString;
+        currentFile.pagesType = KMPageRangeCustom;
         currentFile.pagesString = @"";
         [currentFile setBAllPage:NO];
     }
@@ -939,7 +926,7 @@ static KMPDFEditAppendWindow *windowController = nil;
             }
 
             KMFileAttribute *file = [weakSelf.files objectAtIndex:row];
-            if (!file.selectPages) {
+            if (!file.fetchSelectPages) {
 //                file.pageRangeError = YES;
                 if (weakSelf.alert) {
                     return;
@@ -1296,7 +1283,7 @@ static KMPDFEditAppendWindow *windowController = nil;
     
     BOOL allPage = YES;//只有是全部才支持大纲的合并
     for (KMFileAttribute *file in _files) {
-        if (!file.selectPages) {
+        if (!file.fetchSelectPages) {
             dispatch_async(dispatch_get_main_queue(), ^{
                 NSAlert *alert = [[NSAlert alloc] init];
                 [alert setAlertStyle:NSAlertStyleCritical];
@@ -1351,7 +1338,7 @@ static KMPDFEditAppendWindow *windowController = nil;
 //            [tOutline.destination.page dataRepresentation];
 //        }
         
-        for (NSNumber *number in file.selectPages) {
+        for (NSNumber *number in file.fetchSelectPages) {
             PDFPage *page = [tdocument pageAtIndex:[number integerValue]-1];
             [self.PDFDocument insertPage:page atIndex:[self.PDFDocument pageCount]];
 //            [self.PDFDocument insertPageObject:page atIndex:self.PDFDocument.pageCount];

+ 48 - 48
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.xib

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
         <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -50,11 +50,11 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="818" height="600"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="818" height="600"/>
             <value key="maxSize" type="size" width="818" height="600"/>
-            <view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
-                <rect key="frame" x="0.0" y="0.0" width="804" height="600"/>
+            <view key="contentView" wantsLayer="YES" misplaced="YES" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="818" height="600"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
                     <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="122" horizontalPageScroll="10" verticalLineScroll="122" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ggk-eO-LzC">
@@ -86,7 +86,7 @@
                                                     <rect key="frame" x="1" y="1" width="437" height="120"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PgT-U2-qfU">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PgT-U2-qfU">
                                                             <rect key="frame" x="18" y="52" width="24" height="16"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="20" id="Hwf-fT-ly0"/>
@@ -104,7 +104,7 @@
                                                             </constraints>
                                                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSAdvanced" id="Sd3-jX-Ogs"/>
                                                         </imageView>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eNU-Sm-LND">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eNU-Sm-LND">
                                                             <rect key="frame" x="138" y="84" width="85" height="16"/>
                                                             <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="FileName.pdf" id="Ylr-ds-9Tk">
                                                                 <font key="font" metaFont="system"/>
@@ -112,7 +112,7 @@
                                                                 <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                             </textFieldCell>
                                                         </textField>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="398-sK-K5V">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="398-sK-K5V">
                                                             <rect key="frame" x="138" y="64" width="39" height="16"/>
                                                             <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="2.0M" id="oVW-8o-Cnt">
                                                                 <font key="font" metaFont="system"/>
@@ -120,8 +120,8 @@
                                                                 <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                                             </textFieldCell>
                                                         </textField>
-                                                        <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8V9-7o-ppF">
-                                                            <rect key="frame" x="140" y="10" width="280" height="25"/>
+                                                        <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8V9-7o-ppF">
+                                                            <rect key="frame" x="139" y="11" width="281" height="23"/>
                                                             <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="7AZ-7i-5XC">
                                                                 <font key="font" metaFont="system"/>
                                                                 <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -136,7 +136,7 @@
                                                         <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="RnQ-bh-CRD">
                                                             <rect key="frame" x="0.0" y="-2" width="437" height="5"/>
                                                         </box>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xwh-TX-M2m">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Xwh-TX-M2m">
                                                             <rect key="frame" x="203" y="64" width="61" height="16"/>
                                                             <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="23 Pages" id="5dj-sT-DqB">
                                                                 <font key="font" metaFont="system"/>
@@ -146,19 +146,19 @@
                                                         </textField>
                                                         <button translatesAutoresizingMaskIntoConstraints="NO" id="uvu-07-lWB">
                                                             <rect key="frame" x="409" y="84" width="16" height="16"/>
-                                                            <constraints>
-                                                                <constraint firstAttribute="width" constant="16" id="5d9-Mx-d6v"/>
-                                                                <constraint firstAttribute="height" constant="16" id="7hC-bG-sOG"/>
-                                                            </constraints>
                                                             <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnCloseNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="NIS-J9-zD9">
                                                                 <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                                                 <font key="font" metaFont="system"/>
                                                             </buttonCell>
+                                                            <constraints>
+                                                                <constraint firstAttribute="width" constant="16" id="5d9-Mx-d6v"/>
+                                                                <constraint firstAttribute="height" constant="16" id="7hC-bG-sOG"/>
+                                                            </constraints>
                                                             <connections>
                                                                 <action selector="buttonClicked_Remove:" target="kJM-8r-UtU" id="baP-ig-Qb8"/>
                                                             </connections>
                                                         </button>
-                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="u5l-4V-ll2">
+                                                        <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="u5l-4V-ll2">
                                                             <rect key="frame" x="138" y="38" width="77" height="16"/>
                                                             <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Page Range" id="3Io-PJ-v5k">
                                                                 <font key="font" metaFont="system"/>
@@ -227,7 +227,7 @@
                             <rect key="frame" x="0.0" y="0.0" width="803" height="32"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MiB-cx-nmS">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MiB-cx-nmS">
                                     <rect key="frame" x="48" y="8" width="414" height="16"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="410" id="xE4-A5-LKS"/>
@@ -241,7 +241,7 @@
                                 <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="eiO-1W-3yk">
                                     <rect key="frame" x="0.0" y="-2" width="803" height="5"/>
                                 </box>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P5F-ew-xgE">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="P5F-ew-xgE">
                                     <rect key="frame" x="474" y="8" width="164" height="16"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="160" id="o5v-Uf-L60"/>
@@ -252,7 +252,7 @@
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4NV-bt-MWP">
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4NV-bt-MWP">
                                     <rect key="frame" x="650" y="8" width="101" height="16"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="97" id="G5d-Mn-ipQ"/>
@@ -286,19 +286,19 @@
                     <box title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="SNg-B0-ys5">
                         <rect key="frame" x="800" y="-4" width="7" height="606"/>
                         <view key="contentView" id="0Wa-d4-jxC">
-                            <rect key="frame" x="3" y="3" width="1" height="600"/>
+                            <rect key="frame" x="4" y="5" width="0.0" height="598"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ypq-Dp-66v">
-                                    <rect key="frame" x="14" y="571" width="37" height="16"/>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ypq-Dp-66v">
+                                    <rect key="frame" x="14" y="569" width="37" height="16"/>
                                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="peH-6j-hGv">
                                         <font key="font" metaFont="system"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="h32-rZ-jac">
-                                    <rect key="frame" x="28" y="354" width="64" height="24"/>
+                                <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="h32-rZ-jac">
+                                    <rect key="frame" x="28" y="352" width="64" height="24"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="64" id="Hww-Pm-Z4F"/>
                                         <constraint firstAttribute="height" constant="24" id="lXW-K7-g2y"/>
@@ -309,16 +309,16 @@
                                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="buB-SK-8mO">
-                                    <rect key="frame" x="98" y="358" width="11" height="16"/>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="buB-SK-8mO">
+                                    <rect key="frame" x="98" y="356" width="11" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="x" id="4gU-Us-N60">
                                         <font key="font" metaFont="system"/>
                                         <color key="textColor" name="KM_242424_Color40"/>
                                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                     </textFieldCell>
                                 </textField>
-                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1M5-tW-MRF">
-                                    <rect key="frame" x="115" y="354" width="64" height="24"/>
+                                <textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1M5-tW-MRF">
+                                    <rect key="frame" x="115" y="352" width="64" height="24"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="64" id="NNi-a8-ugp"/>
                                         <constraint firstAttribute="height" constant="24" id="UIu-wF-ft6"/>
@@ -330,69 +330,69 @@
                                     </textFieldCell>
                                 </textField>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="cQk-Jd-o6w">
-                                    <rect key="frame" x="16" y="536" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="534" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="5bY-aF-fW3"/>
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="5nS-LC-t5H" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
-                                    <rect key="frame" x="16" y="506" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="504" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="iSV-P3-W8x"/>
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="85P-Ad-bEf" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
-                                    <rect key="frame" x="16" y="476" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="474" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="Ubd-is-gcz"/>
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="PNC-MR-g6W" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
-                                    <rect key="frame" x="16" y="446" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="444" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="cMH-MX-phe"/>
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZDa-uQ-GtJ" customClass="KMImageTitleButton" customModule="PDF_Master" customModuleProvider="target">
-                                    <rect key="frame" x="16" y="416" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="414" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="o0Q-lr-IX5"/>
                                     </constraints>
                                 </customView>
                                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="QI0-GW-5Ii" customClass="KMImageTitleButton">
-                                    <rect key="frame" x="16" y="386" width="45" height="22"/>
+                                    <rect key="frame" x="16" y="384" width="45" height="22"/>
                                     <constraints>
                                         <constraint firstAttribute="height" constant="22" id="dL3-LB-For"/>
                                     </constraints>
                                 </customView>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="K0f-tn-KEz">
                                     <rect key="frame" x="16" y="58" width="45" height="32"/>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="32" id="V6d-tr-cK9"/>
-                                    </constraints>
                                     <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Add-ub-2Ib">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="system"/>
                                     </buttonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="32" id="V6d-tr-cK9"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonItemClicked_Append:" target="-2" id="cyh-kP-B0a"/>
                                     </connections>
                                 </button>
                                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="y69-3G-4ES">
                                     <rect key="frame" x="16" y="16" width="45" height="32"/>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="32" id="q50-vx-VcS"/>
-                                    </constraints>
                                     <buttonCell key="cell" type="bevel" title="Button" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Z1A-FV-RXN">
                                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                         <font key="font" metaFont="system"/>
                                     </buttonCell>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="32" id="q50-vx-VcS"/>
+                                    </constraints>
                                     <connections>
                                         <action selector="buttonItemClicked_Cancel:" target="-2" id="KQ9-E2-dFz"/>
                                     </connections>
                                 </button>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="m7b-I1-lQz">
-                                    <rect key="frame" x="185" y="358" width="27" height="16"/>
+                                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="m7b-I1-lQz">
+                                    <rect key="frame" x="185" y="356" width="27" height="16"/>
                                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="mm" id="xDF-xV-HvN">
                                         <font key="font" metaFont="system"/>
                                         <color key="textColor" name="KM_242424_Color40"/>
@@ -500,7 +500,7 @@
                                 </constraints>
                                 <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameTipNormal" id="nPY-oN-wLt"/>
                             </imageView>
-                            <textField hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0bJ-0I-xhY">
+                            <textField hidden="YES" focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0bJ-0I-xhY">
                                 <rect key="frame" x="18" y="22" width="135" height="16"/>
                                 <textFieldCell key="cell" alignment="left" title="Merge 2 files for free." id="MSL-nN-D7Q">
                                     <font key="font" usesAppearanceFont="YES"/>
@@ -560,7 +560,7 @@
                     </constraints>
                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameEmptyFile" id="pVm-Ye-CAM"/>
                 </imageView>
-                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1dO-kv-PuF">
+                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1dO-kv-PuF">
                     <rect key="frame" x="-2" y="0.0" width="304" height="16"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="300" id="DGQ-Lx-g1U"/>
@@ -582,7 +582,7 @@
             </constraints>
             <point key="canvasLocation" x="87" y="-266"/>
         </customView>
-        <customView id="Bxz-CR-NgQ" customClass="KMBlankView">
+        <customView id="Bxz-CR-NgQ" customClass="KMBlankView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="770" height="419"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
@@ -597,7 +597,7 @@
                             </constraints>
                             <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameEmptyListNor" id="EWq-IE-D3x"/>
                         </imageView>
-                        <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="YH7-eM-Mb2">
+                        <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="YH7-eM-Mb2">
                             <rect key="frame" x="163" y="32" width="92" height="16"/>
                             <textFieldCell key="cell" title="Multiline Label" id="KRo-Gz-2n3">
                                 <font key="font" metaFont="system"/>
@@ -605,7 +605,7 @@
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                             </textFieldCell>
                         </textField>
-                        <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="loI-T9-Pz8">
+                        <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="loI-T9-Pz8">
                             <rect key="frame" x="161" y="8" width="96" height="16"/>
                             <textFieldCell key="cell" alignment="center" title="Multiline Label" id="PzF-HN-Jsi">
                                 <font key="font" metaFont="system"/>
@@ -613,7 +613,7 @@
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                             </textFieldCell>
                         </textField>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="yde-fB-mTL" customClass="KMPDFEditAppendCustomView">
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="yde-fB-mTL" customClass="KMPDFEditAppendCustomView" customModule="PDF_Master" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="0.0" width="418" height="188"/>
                         </customView>
                     </subviews>

+ 0 - 45
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.h

@@ -1,45 +0,0 @@
-//
-//  KMPDFMergeFileNameTabelViewCell.h
-//  PDF Master
-//
-//  Created by tangchao on 2023/2/23.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "KMFileAttribute.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KMPDFMergeFileNameTabelViewCell : NSTableCellView
-
-@property (nonatomic, strong, readonly) NSTextField *numberLabel;
-@property (nonatomic, strong, readonly) NSImageView *iconImageView;
-@property (nonatomic, strong, readonly) NSTextField *fileNameLabel;
-@property (nonatomic, strong, readonly) NSTextField *pageNumberLabel;
-
-@end
-
-@interface KMPDFMergePageRangeTabelViewCell : NSTableCellView
-
-@property (nonatomic, assign) NSInteger pageCount;
-
-@property (nonatomic, copy) void(^callback)(NSInteger index);
-@property (nonatomic, copy) void(^textDidChange)(NSString *string);
-@property (nonatomic, copy) void(^textDidEndEdit)(NSString *string, KMPDFMergePageRangeTabelViewCell *pageRangeCell);
-
-- (void)updatePageRange:(KMPDFSelectPageStringType)pageRange pageStrings:(NSString *)pageStrings;
-- (void)updatePageRange:(KMPDFSelectPageStringType)pageRange pageStrings:(NSString *)pageStrings isFirstResponser:(BOOL)isFirstResponser;
-- (void)updateRageRangeState:(NSInteger)state;
-
-@end
-
-@interface KMPDFMergeSizeTabelViewCell : NSTableCellView
-
-@property (nonatomic, strong, readonly) NSTextField *label;
-@property (nonatomic, strong, readonly) NSButton *button;
-
-@property (nonatomic, copy) void(^callback)(void);
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 303
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.m

@@ -1,303 +0,0 @@
-//
-//  KMPDFMergeFileNameTabelViewCell.m
-//  PDF Master
-//
-//  Created by tangchao on 2023/2/23.
-//
-
-#import "KMPDFMergeFileNameTabelViewCell.h"
-#if VERSION_DMG
-#import <PDF_Master-Swift.h>
-#else
-#import <PDF_Master-Swift.h>
-#endif
-
-@interface KMPDFMergeFileNameTabelViewCell ()
-
-@property (nonatomic, strong) NSTextField *numberLabel;
-@property (nonatomic, strong) NSImageView *iconImageView;
-@property (nonatomic, strong) NSTextField *fileNameLabel;
-@property (nonatomic, strong) NSTextField *pageNumberLabel;
-
-@end
-
-@implementation KMPDFMergeFileNameTabelViewCell
-
-- (instancetype)initWithFrame:(NSRect)frameRect {
-    if (self = [super initWithFrame:frameRect]) {
-        [self addSubview:self.numberLabel];
-        [self addSubview:self.iconImageView];
-        [self addSubview:self.fileNameLabel];
-        [self addSubview:self.pageNumberLabel];
-    }
-    return self;
-}
-
-- (BOOL)isFlipped {
-    return YES;
-}
-
-- (void)layout {
-    [super layout];
-    
-    CGFloat width = NSWidth(self.bounds);
-    CGFloat height = NSHeight(self.bounds);
-    
-    CGFloat labelH = 22;
-    self.numberLabel.frame = NSMakeRect(16, (height-labelH)*0.5, 30+16, labelH);
-    
-    CGFloat iconSize = 60;
-    self.iconImageView.frame = NSMakeRect(NSMaxX(self.numberLabel.frame)+6, (height-iconSize)*0.5, iconSize, iconSize);
-    
-    CGFloat fileNameX = NSMaxX(self.iconImageView.frame)+8;
-    self.fileNameLabel.frame = NSMakeRect(fileNameX, 13, width-fileNameX, labelH);
-    
-    self.pageNumberLabel.frame = NSMakeRect(fileNameX, NSMaxY(self.fileNameLabel.frame)+8, width-fileNameX, labelH);
-}
-
-#pragma mark - Getting
-
-- (NSTextField *)numberLabel {
-    if (!_numberLabel) {
-        _numberLabel = [NSTextField labelWithString:@""];
-        _numberLabel.textColor = [NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f];
-        _numberLabel.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
-        _numberLabel.alignment = NSTextAlignmentCenter;
-        _numberLabel.lineBreakMode = NSLineBreakByTruncatingTail;
-    }
-    return _numberLabel;
-}
-
-- (NSImageView *)iconImageView {
-    if (!_iconImageView) {
-        _iconImageView = [[NSImageView alloc] init];
-    }
-    return _iconImageView;
-}
-
-- (NSTextField *)fileNameLabel {
-    if (!_fileNameLabel) {
-        _fileNameLabel = [NSTextField labelWithString:@""];
-        _fileNameLabel.textColor = [NSColor colorWithRed:37/255.f green:38/255.f blue:41/255.f alpha:1.f];
-        _fileNameLabel.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
-        _fileNameLabel.lineBreakMode = NSLineBreakByTruncatingTail;
-    }
-    return _fileNameLabel;
-}
-
-- (NSTextField *)pageNumberLabel {
-    if (!_pageNumberLabel) {
-        _pageNumberLabel = [NSTextField labelWithString:@""];
-        _pageNumberLabel.textColor = [NSColor colorWithRed:148/255.f green:152/255.f blue:156/255.f alpha:1.f];
-        _pageNumberLabel.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
-    }
-    return _pageNumberLabel;
-}
-
-@end
-
-@interface KMPDFMergePageRangeTabelViewCell ()<KMSelectPopButtonDelegate>
-
-@property (nonatomic, strong) KMMergeSelect *comboBox;
-
-@end
-
-@implementation KMPDFMergePageRangeTabelViewCell
-
-- (instancetype)initWithFrame:(NSRect)frameRect {
-    if (self = [super initWithFrame:frameRect]) {
-        [self addSubview:self.comboBox.view];
-        
-        [self.comboBox removeAllItems];
-        [self.comboBox addItemsWithObjectValues:@[NSLocalizedString(@"All Pages", nil),NSLocalizedString(@"Odd Pages", nil),NSLocalizedString(@"Even Pages", nil),NSLocalizedString(@"Customized", nil)]];
-        
-        self.comboBox.stringValue = NSLocalizedString(@"All Pages", nil);
-        self.comboBox.editable = false;
-        self.comboBox.delete = self;
-        self.comboBox.placeholderString = NSLocalizedString(@"eg .1,3-5,10", nil);
-    }
-    return self;
-}
-
-- (BOOL)isFlipped {
-    return YES;
-}
-
-- (void)updatePageRange:(KMPDFSelectPageStringType)pageRange pageStrings:(nonnull NSString *)pageStrings {
-    [self updatePageRange:pageRange pageStrings:pageStrings isFirstResponser:YES];
-}
-
-- (void)updatePageRange:(KMPDFSelectPageStringType)pageRange pageStrings:(NSString *)pageStrings isFirstResponser:(BOOL)isFirstResponser {
-    if (pageRange == KMPDFSeleectPageType_AllPages) {
-        self.comboBox.stringValue = NSLocalizedString(@"All Pages", nil);
-        self.comboBox.editable = false;
-        self.comboBox.alert = NO;
-    } else if (pageRange == KMPDFSeleectPageType_OnlyOdd) {
-        self.comboBox.stringValue = NSLocalizedString(@"Odd Pages", nil);
-        self.comboBox.editable = false;
-        self.comboBox.alert = NO;
-    } else if (pageRange == KMPDFSeleectPageType_OnlyEven) {
-        self.comboBox.stringValue = NSLocalizedString(@"Even Pages", nil);
-        self.comboBox.editable = false;
-        self.comboBox.alert = NO;
-    } else {
-        self.comboBox.stringValue = pageStrings;
-        self.comboBox.editable = YES;
-        if ([pageStrings isEqual: @""]) {
-            self.comboBox.alert = YES;
-        } else {
-            self.comboBox.alert = NO;
-        }
-        if (isFirstResponser || [pageStrings isEqual: @""]) {
-            if (![self.window.firstResponder isEqual:self.comboBox.textField]) {
-                if ([NSThread isMainThread]) {
-                    [self.window makeFirstResponder:self.comboBox.textField];
-                } else {
-                    dispatch_async(dispatch_get_main_queue(), ^{
-                        [self.window makeFirstResponder:self.comboBox.textField];
-                    });
-                }
-            }
-        }
-    }
-}
-
-- (void)updateRageRangeState:(NSInteger)state {
-    if (state == 9) {
-        self.comboBox.state = KMDesignTokenStateError_def;
-    } else if (state == 10) {
-        self.comboBox.state = KMDesignTokenStateError_focus;
-    }
-}
-
-- (void)layout {
-    [super layout];
-    
-    CGFloat width = NSWidth(self.bounds);
-    CGFloat height = NSHeight(self.bounds);
-    
-    CGFloat comboBoxH = 26;
-    self.comboBox.view.frame = NSMakeRect(10, (height-comboBoxH)*0.5, width-10, comboBoxH);
-    
-}
-
-#pragma mark - KMSelectPopButtonDelegate
-
-- (void)km_comboBoxSelectionDidChange:(KMDesignSelect *)obj {
-    if (self.callback) {
-        NSInteger index = obj.indexOfSelectedItem;
-        if (index < 0) {
-            index = 0;
-        }
-        
-        if (index == self.comboBox.numberOfItems-1) {
-            self.comboBox.editable = true;
-            dispatch_async(dispatch_get_main_queue(), ^{
-                self.comboBox.stringValue = @"";
-            });
-            [self.window makeFirstResponder:self.comboBox.textField];
-        } else {
-            self.comboBox.editable = false;
-            self.comboBox.alert = false;
-        }
-        
-        self.callback(index);
-    }
-}
-
-- (void)km_controlTextDidChange:(KMDesignSelect *)obj {
-    if (self.textDidChange) {
-        self.textDidChange(obj.stringValue);
-    }
-}
-
-- (void)km_controlTextDidEndEditing:(KMDesignSelect *)obj {
-    if (self.textDidEndEdit) {
-        self.textDidEndEdit(obj.stringValue, self);
-    }
-}
-
-- (void)km_SelectPopoverWillShow:(KMDesignSelect *)obj {
-    if ([self.comboBox isEqual:obj]) {
-        NSMutableArray *disableItems = [NSMutableArray array];
-        if (self.pageCount <= 1) {
-            [disableItems addObject:NSLocalizedString(@"Even Pages", nil)];
-        }
-        self.comboBox.disItems = disableItems.copy;
-    }
-}
-
-#pragma mark - Getting
-
-- (KMDesignSelect *)comboBox {
-    if (!_comboBox) {
-        _comboBox = [[KMMergeSelect alloc] initWithType:1];
-    }
-    return _comboBox;
-}
-
-
-@end
-
-@interface KMPDFMergeSizeTabelViewCell ()
-
-@property (nonatomic, strong) NSTextField *label;
-@property (nonatomic, strong) NSButton *button;
-
-@end
-
-@implementation KMPDFMergeSizeTabelViewCell
-
-- (instancetype)initWithFrame:(NSRect)frameRect {
-    if (self = [super initWithFrame:frameRect]) {
-        [self addSubview:self.label];
-        [self addSubview:self.button];
-        
-        self.button.target = self;
-        self.button.action = @selector(buttonAction);
-    }
-    return self;
-}
-
-- (BOOL)isFlipped {
-    return YES;
-}
-
-- (void)layout {
-    [super layout];
-    
-    CGFloat height = NSHeight(self.bounds);
-    
-    CGFloat labelH = 22;
-    self.label.frame = NSMakeRect(16, (height-labelH)*0.5, 70, labelH);
-    CGFloat buttonSize = 20;
-    self.button.frame = NSMakeRect(NSMaxX(self.label.frame)+5, (height-buttonSize)*0.5, buttonSize, buttonSize);
-}
-
-- (void)buttonAction {
-    if (self.callback) {
-        self.callback();
-    }
-}
-
-#pragma mark - Getting
-
-- (NSTextField *)label {
-    if (!_label) {
-        _label = [NSTextField labelWithString:@""];
-        _label.textColor = [NSColor colorWithRed:148/255.f green:152/255.f blue:156/255.f alpha:1.f];
-        _label.font = [NSFont fontWithName:@"SFProText-Regular" size:14];
-    }
-    return _label;
-}
-
-- (NSButton *)button {
-    if (!_button) {
-        _button = [[NSButton alloc] init];
-        _button.bordered = false;
-        _button.image = [NSImage imageNamed:@"KMImageNameSecureClearIcon"];
-    }
-    return _button;
-}
-
-@end

+ 0 - 17
PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.h

@@ -1,17 +0,0 @@
-//
-//  KMSavePanelAccessoryController.h
-//  PDF Reader
-//
-//  Created by 蒋志鹏 on 2018/9/26.
-//  Copyright © 2018年 Kdan Mobile. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-@interface KMSavePanelAccessoryController : NSViewController
-
-@property (assign) IBOutlet NSButton *openAutomaticButton;
-
-@property (nonatomic, assign, readonly) BOOL needOpen;
-
-@end

+ 0 - 40
PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.m

@@ -1,40 +0,0 @@
-//
-//  KMSavePanelAccessoryController.m
-//  PDF Reader
-//
-//  Created by 蒋志鹏 on 2018/9/26.
-//  Copyright © 2018年 Kdan Mobile. All rights reserved.
-//
-
-#import "KMSavePanelAccessoryController.h"
-
-@interface KMSavePanelAccessoryController ()
-
-@property (nonatomic, assign) BOOL needOpen;
-
-@end
-
-@implementation KMSavePanelAccessoryController
-
--  (instancetype)init
-{
-    self = [super initWithNibName:@"KMSavePanelAccessoryController" bundle:nil];
-    if (self) {
-        
-    }
-    return self;
-    
-}
-
-- (void)awakeFromNib
-{
-    [super awakeFromNib];
-    self.openAutomaticButton.title = NSLocalizedString(@"Open the document after saving", nil);
-    self.openAutomaticButton.state = NSControlStateValueOff;
-}
-
-- (IBAction)buttonClicked_OpenAutomatic:(NSButton *)sender
-{
-    _needOpen = sender.state == NSControlStateValueOn;
-}
-@end

+ 40 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.swift

@@ -0,0 +1,40 @@
+//
+//  KMSavePanelAccessoryController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/10.
+//
+
+import Cocoa
+
+@objcMembers
+class KMSavePanelAccessoryController: NSViewController {
+
+    @IBOutlet weak var openAutomaticButton: NSButton!
+    var _needOpen: Bool = false
+    
+    override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) {
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+    }
+
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        openAutomaticButton.title = NSLocalizedString("Open the document after saving", comment: "")
+        openAutomaticButton.state = NSControl.StateValue.off
+    }
+
+    @IBAction func buttonClickedOpenAutomatic(_ sender: NSButton) {
+        _needOpen = sender.state == NSControl.StateValue.on
+    }
+    
+    //MARK: Get、Set
+    
+    var needOpen: Bool {
+        return _needOpen
+    }
+}

+ 6 - 6
PDF Office/PDF Master/Class/Merge/OCPart/KMSavePanelAccessoryController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMSavePanelAccessoryController">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMSavePanelAccessoryController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="openAutomaticButton" destination="NPu-wD-FJY" id="sB2-tM-cdd"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
@@ -15,17 +15,17 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="362" height="54"/>
+            <rect key="frame" x="0.0" y="0.0" width="362" height="56"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NPu-wD-FJY">
-                    <rect key="frame" x="122" y="18" width="119" height="18"/>
+                    <rect key="frame" x="119" y="19" width="123" height="18"/>
                     <buttonCell key="cell" type="check" title="Open automatic" bezelStyle="regularSquare" imagePosition="left" inset="2" id="gER-AG-REK">
                         <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
                     <connections>
-                        <action selector="buttonClicked_OpenAutomatic:" target="-2" id="cKP-VT-hpX"/>
+                        <action selector="buttonClickedOpenAutomatic:" target="-2" id="tSx-K7-wdw"/>
                     </connections>
                 </button>
             </subviews>

+ 0 - 23
PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.h

@@ -1,23 +0,0 @@
-//
-//  KMTableRowView.h
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/11/25.
-//
-
-#import <Cocoa/Cocoa.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface KMTableRowView : NSTableRowView
-
-@property (nonatomic, assign) BOOL hasBottomLine;
-@property (nonatomic, strong) NSColor *bottomLineColor;
-
-@property (nonatomic, assign) NSEdgeInsets selectionInset;
-@property (nonatomic, assign) CGFloat selectionRadius;
-@property (nonatomic, copy) NSColor *(^selectionBackgroundColorBlock)(void);
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 84
PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.m

@@ -1,84 +0,0 @@
-//
-//  KMTableRowView.m
-//  PDF Reader Pro Edition
-//
-//  Created by zhipeng jiang on 2020/11/25.
-//
-
-#import "KMTableRowView.h"
-
-@implementation KMTableRowView
-
-- (instancetype)init {
-    self = [super init];
-    if (self) {
-        [self addTrackingArea];
-        
-        self.selectionInset = NSEdgeInsetsZero;
-        self.selectionRadius = 0.f;
-    }
-    return self;
-}
-
-- (void)setHasBottomLine:(BOOL)hasBottomLine {
-    _hasBottomLine = hasBottomLine;
-    
-    [self setNeedsDisplay:YES];
-}
-
-- (void)setBottomLineColor:(NSColor *)bottomLineColor {
-    _bottomLineColor = bottomLineColor;
-    
-    [self setNeedsDisplay:YES];
-}
-
-#pragma mark - Private Methods
-
-- (void)addTrackingArea {
-    NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds options:NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect | NSTrackingActiveAlways |NSTrackingMouseMoved owner:self userInfo:nil];
-    [self addTrackingArea:trackingArea];
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
-    [super drawRect:dirtyRect];
-    
-    if (self.hasBottomLine) {
-        NSColor *color = self.bottomLineColor;
-        if (color == nil) {
-            color = [NSColor lightGrayColor];
-        }
-        [color setStroke];
-        [color setFill];
-        NSRect lineRect = NSMakeRect(0, NSHeight(self.bounds)-1, NSWidth(self.bounds), 1);
-        NSBezierPath *linePath = [NSBezierPath bezierPathWithRoundedRect:lineRect xRadius:0 yRadius:0];
-        [linePath fill];
-        [linePath stroke];
-    }
-}
-
-- (void)drawSelectionInRect:(NSRect)dirtyRect {
-    if (!self.selectionBackgroundColorBlock) {
-//        [super drawSelectionInRect:dirtyRect];
-        NSRect selectionRect = self.bounds;
-        [[NSColor lightGrayColor] setFill];
-        NSBezierPath *selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:0 yRadius:0];
-        [selectionPath fill];
-        return;
-    }
-
-//    NSRect selectionRect = NSInsetRect(self.bounds, 0, 0);
-    NSRect selectionRect = NSMakeRect(self.selectionInset.left, self.selectionInset.top, NSWidth(self.bounds)-self.selectionInset.left-self.selectionInset.right, NSHeight(self.bounds)-self.selectionInset.top-self.selectionInset.bottom);
-    NSColor *color = self.selectionBackgroundColorBlock();
-    [color setStroke];
-    [color setFill];
-    
-    NSBezierPath *selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:self.selectionRadius yRadius:self.selectionRadius];
-    [selectionPath fill];
-    [selectionPath stroke];
-}
-
-- (void)mouseEntered:(NSEvent *)event {
-    [super mouseEntered:event];
-}
-
-@end

+ 98 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMTableRowView.swift

@@ -0,0 +1,98 @@
+//
+//  KMTableRowView.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/10.
+//
+
+import Cocoa
+
+class KMTableRowView: NSTableRowView {
+    
+    var _hasBottomLine: Bool = false
+    var _bottomLineColor: NSColor?
+
+    var selectionInset: NSEdgeInsets = NSEdgeInsets()
+    @objc var selectionRadius: CGFloat = 0.0
+    @objc var selectionBackgroundColorBlock: (() -> NSColor)?
+
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        addTrackingArea()
+        selectionInset = NSEdgeInsetsZero
+        selectionRadius = 0.0
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+    }
+    
+    var hasBottomLine: Bool {
+        get {
+            return _hasBottomLine
+        }
+        set {
+            _hasBottomLine = newValue
+            self.needsDisplay = true
+        }
+    }
+    
+    var bottomLineColor: NSColor? {
+        get {
+            return _bottomLineColor
+        }
+        set {
+            _bottomLineColor = newValue
+            self.needsDisplay = true
+        }
+    }
+    
+    //MARK: Private Methods
+    
+    func addTrackingArea() {
+        let trackingArea = NSTrackingArea.init(rect: self.bounds, options: [.mouseEnteredAndExited, .inVisibleRect, .activeAlways, .mouseMoved], owner: self)
+        self.addTrackingArea(trackingArea)
+    }
+
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        
+        if self.hasBottomLine {
+            var color = self.bottomLineColor
+            if color == nil {
+                color = NSColor.lightGray
+            }
+            color!.setStroke()
+            color!.setFill()
+            
+            let lineRect = NSRect(x: 0, y: NSHeight(bounds) - 1, width: NSWidth(bounds), height: 1)
+            let linePath = NSBezierPath(roundedRect: lineRect, xRadius: 0, yRadius: 0)
+            linePath.fill()
+            linePath.stroke()
+        }
+    }
+
+    override func drawSelection(in dirtyRect: NSRect) {
+        if selectionBackgroundColorBlock == nil {
+            let selectionRect = NSRect(x: selectionInset.left, y: selectionInset.top, width: NSWidth(bounds) - selectionInset.left - selectionInset.right, height: NSHeight(bounds) - selectionInset.top - selectionInset.bottom)
+            NSColor.lightGray.setFill()
+            let selectionPath = NSBezierPath(roundedRect: selectionRect, xRadius: selectionRadius, yRadius: selectionRadius)
+            selectionPath.fill()
+            return
+        }
+
+        let selectionRect = NSRect(x: selectionInset.left, y: selectionInset.top, width: NSWidth(bounds) - selectionInset.left - selectionInset.right, height: NSHeight(bounds) - selectionInset.top - selectionInset.bottom)
+        let color = selectionBackgroundColorBlock!()
+        color.setStroke()
+        color.setFill()
+
+        let selectionPath = NSBezierPath(roundedRect: selectionRect, xRadius: selectionRadius, yRadius: selectionRadius)
+        selectionPath.fill()
+        selectionPath.stroke()
+    }
+
+    override func mouseEntered(with event: NSEvent) {
+        super.mouseEntered(with: event)
+    }
+
+}

+ 76 - 0
PDF Office/PDF Master/Class/Merge/View/KMPDFMergeFileNameTabelViewCell.swift

@@ -0,0 +1,76 @@
+//
+//  KMPDFMergeFileNameTabelViewCell.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/11.
+//
+
+import Cocoa
+
+@objcMembers class KMPDFMergeFileNameTabelViewCell: NSTableCellView {
+    var numberLabel: NSTextField?
+    var iconImageView: NSImageView?
+    var fileNameLabel: NSTextField?
+    var pageNumberLabel: NSTextField?
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        
+        self.initSubviews()
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+        
+        self.initSubviews()
+    }
+    
+    override var isFlipped: Bool {
+        return true
+    }
+    
+    func initSubviews() {
+        let numberLabel = NSTextField(labelWithString: "")
+        numberLabel.textColor = NSColor(red: 37.0/255.0, green: 38.0/255.0, blue: 41.0/255.0, alpha: 1.0)
+        numberLabel.font = .SFProTextRegularFont(14)
+        numberLabel.alignment = .center
+        numberLabel.lineBreakMode = .byTruncatingTail
+        self.addSubview(numberLabel)
+        self.numberLabel = numberLabel
+        
+        let iconImageView = NSImageView()
+        self.addSubview(iconImageView)
+        self.iconImageView = iconImageView
+        
+        let fileNameLabel = NSTextField(labelWithString: "")
+        fileNameLabel.textColor = NSColor(red: 37.0/255.0, green: 38.0/255.0, blue: 41.0/255.0, alpha: 1.0)
+        fileNameLabel.font = .SFProTextRegularFont(14)
+        fileNameLabel.lineBreakMode = .byTruncatingTail
+        self.addSubview(fileNameLabel)
+        self.fileNameLabel = fileNameLabel
+        
+        let pageNumberLabel = NSTextField(labelWithString: "")
+        pageNumberLabel.textColor = NSColor(red: 148.0/255.0, green: 152.0/255.0, blue: 156.0/255.0, alpha: 1.0)
+        pageNumberLabel.font = .SFProTextRegularFont(14)
+        self.addSubview(pageNumberLabel)
+        self.pageNumberLabel = pageNumberLabel
+    }
+    
+    override func layout() {
+        super.layout()
+        
+        let width = NSWidth(self.bounds)
+        let height = NSHeight(self.bounds)
+        
+        let labelH = 22.0
+        self.numberLabel?.frame = NSMakeRect(16, (height-labelH)*0.5, 30+16, labelH)
+        
+        let iconSize = 60.0
+        self.iconImageView?.frame = NSMakeRect(NSMaxX(self.numberLabel?.frame ?? NSZeroRect)+6, (height-iconSize)*0.5, iconSize, iconSize)
+        
+        let fileNameX = NSMaxX(self.iconImageView?.frame ?? NSZeroRect)+8
+        self.fileNameLabel?.frame = NSMakeRect(fileNameX, 13, width-fileNameX, labelH)
+        
+        self.pageNumberLabel?.frame = NSMakeRect(fileNameX, NSMaxY(self.fileNameLabel?.frame ?? NSZeroRect)+8, width-fileNameX, labelH)
+    }
+}

+ 155 - 0
PDF Office/PDF Master/Class/Merge/View/KMPDFMergePageRangeTabelViewCell.swift

@@ -0,0 +1,155 @@
+//
+//  KMPDFMergePageRangeTabelViewCell.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/11.
+//
+
+import Cocoa
+
+@objcMembers class KMPDFMergePageRangeTabelViewCell: NSTableCellView {
+    var pageCount: Int = 0
+    var callback: ((Int) -> Void)?
+    var textDidChange: ((String) -> Void)?
+    var textDidEndEdit: ((String, KMPDFMergePageRangeTabelViewCell) -> Void)?
+    
+    var comboBox: KMMergeSelect?
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        self.initSubviews()
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+        self.initSubviews()
+    }
+    
+    override var isFlipped: Bool {
+        return true
+    }
+    
+    func initSubviews() {
+        let comboBox = KMMergeSelect(withType: .Combox)
+        self.addSubview(comboBox.view)
+        self.comboBox = comboBox
+        
+        self.comboBox?.removeAllItems()
+        self.comboBox?.addItems(withObjectValues: [KMLocalizedString("All Pages", nil),KMLocalizedString("Odd Pages", nil),KMLocalizedString("Even Pages", nil),KMLocalizedString("Customized", nil)])
+        
+        self.comboBox?.stringValue = KMLocalizedString("All Pages", nil)
+        self.comboBox?.editable = false
+        self.comboBox?.delete = self
+        self.comboBox?.placeholderString = KMLocalizedString("eg .1,3-5,10", nil)
+        
+
+    }
+    
+    override func layout() {
+        super.layout()
+        
+        let width = NSWidth(self.bounds)
+        let height = NSHeight(self.bounds)
+        
+        let comboBoxH = 26.0
+        self.comboBox?.view.frame = NSMakeRect(10, (height-comboBoxH)*0.5, width-10, comboBoxH)
+        
+    }
+    
+    func updatePageRange(_ pageRange: KMPageRange, pageStrings: String, isFirstResponser: Bool = true) {
+        if (pageRange == .all) {
+            self.comboBox?.stringValue = KMLocalizedString("All Pages", nil)
+            self.comboBox?.editable = false
+            self.comboBox?.alert = false
+        } else if (pageRange == .odd) {
+            self.comboBox?.stringValue = KMLocalizedString("Odd Pages", nil)
+            self.comboBox?.editable = false
+            self.comboBox?.alert = false
+        } else if (pageRange == .even) {
+            self.comboBox?.stringValue = KMLocalizedString("Even Pages", nil)
+            self.comboBox?.editable = false
+            self.comboBox?.alert = false
+        } else {
+            self.comboBox?.stringValue = pageStrings
+            self.comboBox?.editable = true
+            if (pageStrings.isEmpty) {
+                self.comboBox?.alert = true
+            } else {
+                self.comboBox?.alert = false
+            }
+            if (isFirstResponser || pageStrings.isEmpty) {
+                if let data = self.window?.firstResponder, data.isEqual(to: self.comboBox?.textField) == false {
+                    if (Thread.isMainThread) {
+                        self.window?.makeFirstResponder(self.comboBox?.textField)
+                    } else {
+                        DispatchQueue.main.async {
+                            self.window?.makeFirstResponder(self.comboBox?.textField)
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    
+    
+/*
+ - (void)updateRageRangeState:(NSInteger)state {
+     if (state == 9) {
+         self.comboBox.state = KMDesignTokenStateError_def;
+     } else if (state == 10) {
+         self.comboBox.state = KMDesignTokenStateError_focus;
+     }
+ }
+ */
+    
+}
+
+extension KMPDFMergePageRangeTabelViewCell: KMSelectPopButtonDelegate {
+    func km_comboBoxSelectionDidChange(_ obj: KMDesignSelect) {
+        guard let data = self.callback else {
+            return
+        }
+        var index = obj.indexOfSelectedItem
+        if (index < 0) {
+           index = 0
+        }
+        
+        if (index == obj.numberOfItems-1) {
+            self.comboBox?.editable = true
+            DispatchQueue.main.async {
+                self.comboBox?.stringValue = ""
+            }
+            self.window?.makeFirstResponder(obj.textField)
+        } else {
+            self.comboBox?.editable = false
+            self.comboBox?.alert = false
+        }
+        
+        data(index)
+    }
+    
+    func km_controlTextDidChange(_ obj: KMDesignSelect) {
+        guard let data = self.textDidChange else {
+            return
+        }
+        data(obj.stringValue)
+    }
+    
+    func km_controlTextDidEndEditing(_ obj: KMDesignSelect) {
+        guard let data = self.textDidEndEdit else {
+            return
+        }
+        data(obj.stringValue, self)
+    }
+    
+    func km_SelectPopoverWillShow(_ obj: KMDesignSelect) {
+        if (obj.isEqual(to: self.comboBox)) {
+            var disableItems: [String] = []
+            if (self.pageCount <= 1) {
+                disableItems.append(KMLocalizedString("Even Pages", nil))
+            }
+            self.comboBox?.disItems = disableItems
+        }
+    }
+}

+ 63 - 0
PDF Office/PDF Master/Class/Merge/View/KMPDFMergeSizeTabelViewCell.swift

@@ -0,0 +1,63 @@
+//
+//  KMPDFMergeSizeTabelViewCell.swift
+//  PDF Master
+//
+//  Created by tangchao on 2023/10/12.
+//
+
+import Cocoa
+
+@objcMembers class KMPDFMergeSizeTabelViewCell: NSTableCellView {
+    var label: NSTextField?
+    var button: NSButton?
+    
+    var callback: KMEmptyBlock?
+    
+    override init(frame frameRect: NSRect) {
+        super.init(frame: frameRect)
+        self.initSubviews()
+    }
+    
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+        self.initSubviews()
+    }
+    
+    override var isFlipped: Bool {
+        return true
+    }
+    
+    func initSubviews() {
+        var label = NSTextField(labelWithString: "")
+        label.textColor = NSColor(red: 148.0/255.0, green: 152.0/255.0, blue: 156.0/255.0, alpha: 1.0)
+        label.font = .SFProTextRegularFont(14)
+        self.addSubview(label)
+        self.label = label
+        
+        var button = NSButton()
+        button.isBordered = false
+        button.image = NSImage(named: "KMImageNameSecureClearIcon")
+        self.addSubview(button)
+        self.button = button
+        self.button?.target = self
+        self.button?.action = #selector(buttonAction)
+    }
+    
+    override func layout() {
+        super.layout()
+        
+        let height = NSHeight(self.bounds)
+        
+        let labelH = 22.0
+        self.label?.frame = NSMakeRect(16, (height-labelH)*0.5, 70, labelH)
+        let buttonSize = 20.0
+        self.button?.frame = NSMakeRect(NSMaxX(self.label?.frame ?? NSZeroRect)+5, (height-buttonSize)*0.5, buttonSize, buttonSize)
+    }
+    
+    @objc func buttonAction() {
+        guard let data = self.callback else {
+            return
+        }
+        data()
+    }
+}

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Compress/Controller/KMCompressWindowController.swift

@@ -126,7 +126,7 @@ class KMCompressWindowController: NSWindowController {
         self.titleLabel.textColor = NSColor.titleColor()
         self.titleLabel.font = .SFProTextSemiboldFont(16)
         
-        self.batchButton.setTitleColor(NSColor.buttonTitleColor())
+        self.batchButton.setTitleColor(color: NSColor.buttonTitleColor())
         self.batchButton.layer?.borderColor = NSColor.buttonBorderColor().cgColor
         self.batchButton.font = .SFProTextRegularFont(14)
     }

+ 251 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManager.swift

@@ -64,5 +64,256 @@ class KMConvertPDFManager: NSObject {
             }
         }
     }
+    
+    class func supportFileType() -> [String] {
+        var supportArray = self.supportImages()
+        
+        if (self.isSupportConvertPages()) {
+            supportArray += self.supportPages()
+        } else if (self.isSupportConvertWord()) {
+            supportArray += self.supportWord()
+        }
+        
+        if (self.isSupportConvertKeynote()) {
+            supportArray += self.supportKeynote()
+        } else if (self.isSupportConvertPPTX()) {
+            supportArray += self.supportPPTX()
+        }
+        
+        if (self.isSupportConvertNumber()) {
+            supportArray += self.supportNumber()
+        } else if (self.isSupportConvertExcel()) {
+            /**
+             经测试(2011版 Excel)转档成功以后地址会存在问题,暂时建议不要用
+             **/
+            supportArray += self.supportExcel()
+        }
+        return supportArray
+    }
+    
+    class func convertFile(_ filePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        var tSavePath = savePath
+        if (tSavePath.substring(to: 1) == "/") {
+            tSavePath = tSavePath.substring(form: 1)
+        }
+        tSavePath = tSavePath.replacingOccurrences(of: "/", with: ":")
+         
+        var tFilePath = filePath
+        if (tFilePath.substring(to: 1) == "/") {
+            tFilePath = tFilePath.substring(form: 1)
+        }
+        tFilePath = tFilePath.replacingOccurrences(of: "/", with: ":")
+        
+        let exn = filePath.components(separatedBy: ".").last?.lowercased() ?? ""
+        if (self.supportPages().contains(exn)) {
+            if (self.supportWord().contains(exn)) {
+                self.convertWordPath(tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            } else {
+                self.convertApplicationName("Pages", filePath: tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            }
+        } else if (self.supportKeynote().contains(exn)) {
+            if (self.supportPPTX().contains(exn)) {
+                self.convertPPTXPath(tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            } else {
+                self.convertApplicationName("Keynote", filePath: tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            }
+        } else if (self.supportNumber().contains(exn)) {
+            if (self.supportExcel().contains(exn)) {
+                self.convertExcelPath(tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            } else {
+                self.convertApplicationName("Numbers", filePath: tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+            }
+        } else if (self.supportImages().contains(exn)) {
+            self.convertImagePath(tFilePath, savePath: tSavePath, completionHandler: completionHandler)
+        } else {
+            completionHandler(false, nil)
+        }
+    }
+    
+    class func supportImages() -> [String] {
+        return ["jpg","cur","bmp","jpeg","gif","png","tiff","tif",/*@"pic",*/"ico","icns","tga","psd","eps","hdr","jp2","jpc","pict","sgi"]
+    }
+    
+    class func convertImagePath(_ imagePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        guard let image = NSImage(contentsOfFile: imagePath) else {
+            completionHandler(false, nil)
+            return
+        }
+        
+        DispatchQueue.global().async {
+            let pdf = PDFDocument()
+            if let page = PDFPage(image: image) {
+                pdf.insert(page, at: 0)
+                
+                let isSucceed = pdf.write(toFile: savePath)
+                DispatchQueue.main.async {
+                    completionHandler(isSucceed, nil)
+                }
+            } else {
+                completionHandler(false, nil)
+            }
+        }
+    }
+    
+    // MARK: - convert Word
+    
+    class func isSupportConvertWord() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Microsoft Word") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportWord() -> [String] {
+        return ["docx","doc"]
+    }
+    
+    class func convertWordPath(_ filePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        DispatchQueue.global().async {
+            var convertString = String(format: "set filePath to\"%@\"\n", filePath)
+            convertString = convertString.appendingFormat("set savePath to \"%@\"\n", savePath)
+            convertString.append("tell application \"Microsoft Word\"\n")
+            convertString.append("set isRun to running\n")
+            convertString.append("open file filePath\n")
+            convertString.append("save as active document file format format PDF file name savePath\n")
+            convertString.append("close active document\n")
+            convertString.append("if not isRun then quit\n")
+            convertString.append("end tell\n")
 
+            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(dic)
+            DispatchQueue.main.async {
+                completionHandler(true, dic?.pointee)
+            }
+        }
+    }
+    
+    // MARK: - convert Pages
+    
+    class func isSupportConvertPages() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Pages") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportPages() -> [String] {
+        return ["pages","docx","doc","txt","rtf"]
+    }
+    
+    // MARK: - convert Keynote
+    class func isSupportConvertKeynote() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Keynote") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportKeynote() -> [String] {
+        return ["ppt","pptx","key"]
+    }
+    
+    // MARK: - convert PPTX
+    
+    class func isSupportConvertPPTX() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Microsoft PowerPoint") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportPPTX() -> [String] {
+        return ["ppt","pptx"]
+    }
+    
+    class func convertPPTXPath(_ filePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        DispatchQueue.global().async {
+            var convertString = "tell application \"Microsoft PowerPoint\"\n"
+            convertString.append("set isRun to running\n")
+            convertString = convertString.appendingFormat("set savePath to \"%@\"\n", savePath)
+            convertString = convertString.appendingFormat("set filePath to \"%@\"\n", filePath)
+            convertString.append("open file filePath\n")
+            convertString.append("save active presentation in savePath as save as PDF\n")
+            convertString.append("if not isRun then quit\n")
+            convertString.append("close active presentation\n")
+            convertString.append("end tell\n")
+
+            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(dic)
+            DispatchQueue.main.async {
+                completionHandler(true, dic?.pointee)
+            }
+        }
+    }
+    
+    // MARK: - convert Numbers
+    class func isSupportConvertNumber() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Numbers") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportNumber() -> [String] {
+        return ["xls","xlsx","numbers","csv"]
+    }
+    
+    // MARK: - convert Excel
+    
+    class func isSupportConvertExcel() -> Bool {
+        if let _ = NSWorkspace.shared.fullPath(forApplication: "Microsoft Excel") {
+            return true
+        }
+        return false
+    }
+    
+    class func supportExcel() -> [String] {
+        return ["xlsx","xls"]
+    }
+    
+    class func convertExcelPath(_ filePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        DispatchQueue.global().async {
+            var convertString = String(format: "set filePath to\"%@\"\n", filePath)
+            convertString = convertString.appendingFormat("set savePath to \"%@\"\n", savePath)
+            convertString.append("set tFile to (POSIX path of filePath) as POSIX file\n")
+            convertString.append("tell application \"Microsoft Excel\"\n")
+            convertString.append("set isRun to running\n")
+            convertString.append("set wkbk1 to open workbook workbook file name tFile\n")
+            convertString.append("alias savePath\n")
+            convertString.append("save workbook as wkbk1 filename savePath file format PDF file format with overwrite\n")
+            convertString.append("close wkbk1 saving no\n")
+            convertString.append("if not isRun then quit\n")
+            convertString.append("end tell\n")
+
+            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(dic)
+            DispatchQueue.main.async {
+                completionHandler(true, dic?.pointee)
+            }
+        }
+    }
+
+    class func convertApplicationName(_ appName: String, filePath: String, savePath: String, completionHandler: @escaping ((Bool, NSDictionary?) -> Void)) {
+        DispatchQueue.global().async {
+            var convertString = String(format: "tell application \"%@\"\n", appName)
+            convertString.append("set isRun to running\n")
+            convertString = convertString.appendingFormat("set in_file to \"%@\"\n", filePath)
+            convertString = convertString.appendingFormat("set out_file to \"%@\"\n", savePath)
+            convertString.append("set mydoc to open file in_file\n")
+            convertString.append("export mydoc to file out_file as PDF\n")
+            convertString.append("close mydoc saving no\n")
+            convertString.append("if not isRun then quit\n")
+            convertString.append("end tell")
+
+            let dic: AutoreleasingUnsafeMutablePointer<NSDictionary?>? = nil
+            let docScript = NSAppleScript(source: convertString)
+            docScript?.executeAndReturnError(dic)
+            DispatchQueue.main.async {
+                completionHandler(true, dic?.pointee)
+            }
+        }
+    }
 }

+ 0 - 19
PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManagerOC.h

@@ -1,19 +0,0 @@
-//
-//  KMConvertPDFManagerOC.h
-//  PDF Master
-//
-//  Created by wanjun on 2023/3/8.
-//
-
-#import <Foundation/Foundation.h>
-#import <Quartz/Quartz.h>
-
-@interface KMConvertPDFManagerOC : NSObject
-
-+ (NSArray *)supportFileType;
-
-+ (void)convertFile:(NSString *)filePath
-           savePath:(NSString *)savePath
-  completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet;
-
-@end

+ 0 - 303
PDF Office/PDF Master/Class/PDFTools/Convert/Common/KMConvertPDFManagerOC.m

@@ -1,303 +0,0 @@
-//
-//  KMConvertPDFManagerOC.m
-//  PDF Master
-//
-//  Created by wanjun on 2023/3/8.
-//
-
-#import "KMConvertPDFManagerOC.h"
-
-@implementation KMConvertPDFManagerOC
-
-#pragma mark - Public
-
-+ (NSArray *)supportFileType
-{
-    NSMutableArray *supportArray = [NSMutableArray array];
-    
-    [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportImages]];
-    
-    if ([KMConvertPDFManagerOC isSupportConvertPages]) {
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportPages]];
-    } else if ([KMConvertPDFManagerOC isSupportConvertWord]){
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportWord]];
-    }
-    
-    if ([KMConvertPDFManagerOC isSupportConvertKeynote]) {
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportKeynote]];
-    } else if ([KMConvertPDFManagerOC isSupportConvertPPTX]){
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportPPTX]];
-    }
-
-    if ([KMConvertPDFManagerOC isSupportConvertNumber]) {
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportNumber]];
-    } else if ([KMConvertPDFManagerOC isSupportConvertExcel]){
-        /**
-         经测试(2011版 Excel)转档成功以后地址会存在问题,暂时建议不要用
-         **/
-        [supportArray addObjectsFromArray:[KMConvertPDFManagerOC supportExcel]];
-    }
-
-    return supportArray;
-}
-
-+ (void)convertFile:(NSString *)filePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    NSString *tSavePath = savePath;
-    if ([[tSavePath substringToIndex:1] isEqualToString:@"/"]) {
-        tSavePath = [tSavePath substringFromIndex:1];
-    }
-    tSavePath = [tSavePath stringByReplacingOccurrencesOfString:@"/" withString:@":"];
-    
-    NSString *tFilePath = filePath;
-    if ([[tFilePath substringToIndex:1] isEqualToString:@"/"]) {
-        tFilePath = [tFilePath substringFromIndex:1];
-    }
-    tFilePath = [tFilePath stringByReplacingOccurrencesOfString:@"/" withString:@":"];
-
-    NSString * extension = [filePath.pathExtension lowercaseString];
-    
-    if ([[KMConvertPDFManagerOC supportPages] containsObject:extension]) {
-        if ([[KMConvertPDFManagerOC supportWord] containsObject:extension]){
-            [KMConvertPDFManagerOC convertWordPath:tFilePath savePath:tSavePath completionHandler:^(BOOL success,NSDictionary *errorDic){
-                complet(success,errorDic);
-            }];
-        } else {
-            [KMConvertPDFManagerOC convertApplicationName:@"Pages" filePath:tFilePath savePath:tSavePath completionHandler:^(BOOL success, NSDictionary *errorDic) {
-                complet(success,errorDic);
-            }];
-        }
-        
-    } else if ([[KMConvertPDFManagerOC supportKeynote] containsObject:extension]){
-        if ([[KMConvertPDFManagerOC supportPPTX] containsObject:extension]){
-            [KMConvertPDFManagerOC convertPPTXPath:tFilePath savePath:tSavePath completionHandler:^(BOOL success,NSDictionary *errorDic){
-                complet(success,errorDic);
-            }];
-        } else {
-            [KMConvertPDFManagerOC convertApplicationName:@"Keynote" filePath:tFilePath savePath:tSavePath completionHandler:^(BOOL success, NSDictionary *errorDic) {
-                complet(success,errorDic);
-            }];
-        }
-    } else if ([[KMConvertPDFManagerOC supportNumber] containsObject:extension]){
-        if ([[KMConvertPDFManagerOC supportExcel] containsObject:extension]){
-            [KMConvertPDFManagerOC convertExcelPath:tFilePath savePath:tSavePath completionHandler:^(BOOL success,NSDictionary *errorDic){
-                complet(success,errorDic);
-            }];
-        } else {
-            [KMConvertPDFManagerOC convertApplicationName:@"Numbers" filePath:tFilePath savePath:tSavePath completionHandler:^(BOOL success, NSDictionary *errorDic) {
-                complet(success,errorDic);
-            }];
-        }
-    } else if ([[KMConvertPDFManagerOC supportImages] containsObject:extension]){
-        [KMConvertPDFManagerOC convertImagePath:filePath savePath:savePath completionHandler:^(BOOL success, NSDictionary *errorDic) {
-            complet(success,errorDic);
-        }];
-    } else {
-        NSDictionary * dic = nil;
-        complet(NO,dic);
-    }
-}
-
-+ (NSArray *)supportImages
-{
-    return [NSArray arrayWithObjects:@"jpg",@"cur",@"bmp",@"jpeg",@"gif",@"png",@"tiff",@"tif",/*@"pic",*/@"ico",@"icns",@"tga",@"psd",@"eps",@"hdr",@"jp2",@"jpc",@"pict",@"sgi", nil];
-}
-
-#pragma mark - convert Word
-+ (BOOL)isSupportConvertWord
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Microsoft Word"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportWord
-{
-    return [NSArray arrayWithObjects:@"docx",@"doc",nil];
-}
-
-+ (void)convertWordPath:(NSString *)filePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-        NSString *  convertString = [NSString stringWithFormat:@"set filePath to\"%@\"\n",filePath];
-        convertString = [convertString stringByAppendingFormat:@"set savePath to \"%@\"\n",savePath];
-        convertString = [convertString stringByAppendingFormat:@"tell application \"Microsoft Word\"\n"];
-        convertString = [convertString stringByAppendingFormat:@"set isRun to running\n"];
-        convertString = [convertString stringByAppendingFormat:@"open file filePath\n"];
-        convertString = [convertString stringByAppendingFormat:@"save as active document file format format PDF file name savePath\n"];
-        convertString = [convertString stringByAppendingFormat:@"close active document\n"];
-        convertString = [convertString stringByAppendingFormat:@"if not isRun then quit\n"];
-        convertString = [convertString stringByAppendingFormat:@"end tell\n"];
-        
-        NSDictionary * dic = nil;
-        NSAppleScript *docScript = [[NSAppleScript alloc] initWithSource:convertString];
-        [docScript executeAndReturnError:&dic];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            complet(YES,dic);
-        });
-    });
-}
-
-#pragma mark - convert Numbers
-+ (BOOL)isSupportConvertNumber
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Numbers"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportNumber
-{
-    return [NSArray arrayWithObjects:@"xls",@"xlsx",@"numbers",@"csv",nil];
-}
-
-+ (void)convertApplicationName:(NSString *)appName filePath:(NSString *)filePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-        NSString * convertString = [NSString stringWithFormat:@"tell application \"%@\"\n",appName];
-        convertString = [convertString stringByAppendingFormat:@"set isRun to running\n"];
-        convertString = [convertString stringByAppendingFormat:@"set in_file to \"%@\"\n",filePath];
-        convertString = [convertString stringByAppendingFormat:@"set out_file to \"%@\"\n",savePath];
-        convertString = [convertString stringByAppendingFormat:@"set mydoc to open file in_file\n"];
-        convertString = [convertString stringByAppendingFormat:@"export mydoc to file out_file as PDF\n"];
-        convertString = [convertString stringByAppendingFormat:@"close mydoc saving no\n"];
-        convertString = [convertString stringByAppendingFormat:@"if not isRun then quit\n"];
-        convertString = [convertString stringByAppendingFormat:@"end tell"];
-        NSDictionary * dic = nil;
-        NSAppleScript *docScript = [[NSAppleScript alloc] initWithSource:convertString];
-        [docScript executeAndReturnError:&dic];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            complet(YES,dic);
-        });
-    });
-}
-
-#pragma mark - convert Keynote
-+ (BOOL)isSupportConvertKeynote
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Keynote"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportKeynote
-{
-    return [NSArray arrayWithObjects:@"ppt",@"pptx",@"key",nil];
-}
-
-#pragma mark - convert Pages
-+ (BOOL)isSupportConvertPages
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Pages"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportPages
-{
-    return [NSArray arrayWithObjects:@"pages",@"docx",@"doc",@"txt",@"rtf",nil];
-}
-
-#pragma mark - convert PPTX
-+ (BOOL)isSupportConvertPPTX
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Microsoft PowerPoint"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportPPTX
-{
-    return [NSArray arrayWithObjects:@"ppt",@"pptx",nil];
-}
-
-+ (void)convertPPTXPath:(NSString *)filePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-        NSString * convertString = [NSString stringWithFormat:@"tell application \"Microsoft PowerPoint\"\n"];
-        convertString = [convertString stringByAppendingFormat:@"set isRun to running\n"];
-        convertString = [convertString stringByAppendingFormat:@"set savePath to \"%@\"\n",savePath];
-        convertString = [convertString stringByAppendingFormat:@"set filePath to \"%@\"\n",filePath];
-        convertString = [convertString stringByAppendingFormat:@"open file filePath\n"];
-        convertString = [convertString stringByAppendingFormat:@"save active presentation in savePath as save as PDF\n"];
-        convertString = [convertString stringByAppendingFormat:@"if not isRun then quit\n"];
-        convertString = [convertString stringByAppendingFormat:@"close active presentation\n"];
-        convertString = [convertString stringByAppendingFormat:@"end tell\n"];
-        
-        NSDictionary * dic = nil;
-        NSAppleScript *docScript = [[NSAppleScript alloc] initWithSource:convertString];
-        [docScript executeAndReturnError:&dic];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            complet(YES,dic);
-        });
-    });
-}
-
-#pragma mark - convert Excel
-+ (BOOL)isSupportConvertExcel
-{
-    NSString * fullPath = [[NSWorkspace sharedWorkspace] fullPathForApplication:@"Microsoft Excel"];
-    if (fullPath) {
-        return YES;
-    }
-    return NO;
-}
-
-+ (NSArray *)supportExcel
-{
-    return [NSArray arrayWithObjects:@"xlsx",@"xls",nil];
-}
-
-+ (void)convertExcelPath:(NSString *)filePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-        NSString *  convertString = [NSString stringWithFormat:@"set filePath to\"%@\"\n",filePath];
-        convertString = [convertString stringByAppendingFormat:@"set savePath to \"%@\"\n",savePath];
-        convertString = [convertString stringByAppendingFormat:@"set tFile to (POSIX path of filePath) as POSIX file\n"];
-
-        convertString = [convertString stringByAppendingFormat:@"tell application \"Microsoft Excel\"\n"];
-        convertString = [convertString stringByAppendingFormat:@"set isRun to running\n"];
-        convertString = [convertString stringByAppendingFormat:@"set wkbk1 to open workbook workbook file name tFile\n"];
-        convertString = [convertString stringByAppendingFormat:@"alias savePath\n"];
-        convertString = [convertString stringByAppendingFormat:@"save workbook as wkbk1 filename savePath file format PDF file format with overwrite\n"];
-        convertString = [convertString stringByAppendingFormat:@"close wkbk1 saving no\n"];
-        convertString = [convertString stringByAppendingFormat:@"if not isRun then quit\n"];
-        convertString = [convertString stringByAppendingFormat:@"end tell\n"];
-        
-        NSDictionary * dic = nil;
-        NSAppleScript *docScript = [[NSAppleScript alloc] initWithSource:convertString];
-        [docScript executeAndReturnError:&dic];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            complet(YES,dic);
-        });
-    });
-}
-
-#pragma mark - convert Image
-+ (void)convertImagePath:(NSString *)imgaePath savePath:(NSString *)savePath completionHandler:(void (^)(BOOL success,NSDictionary *errorDic))complet
-{
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-        PDFDocument *pdf = [[PDFDocument alloc] init];
-        NSImage *imag = [[NSImage alloc] initWithContentsOfFile:imgaePath];
-        PDFPage *page = [[PDFPage alloc] initWithImage:imag];
-        [pdf insertPage:page atIndex: [pdf pageCount]];
-        
-        BOOL isSucceed = [pdf writeToFile:savePath];
-        dispatch_async(dispatch_get_main_queue(), ^{
-            NSDictionary * dic = nil;
-            complet(isSucceed,dic);
-        });
-    });
-}
-
-@end

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.swift

@@ -853,12 +853,12 @@ class KMConvertBaseWindowController: KMBaseWindowController {
         self.hiddenProgressWindow()
         
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Converting...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Converting...", comment: "")
+
         progress.closeBlock = { [weak self] in
             if let convert = self?.convert {
                 KMPDFConvertManager.defaultManager.cancel(convert: convert)

+ 7 - 7
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/ProgressSheet.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
         <deployment version="101300" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22154"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="SKProgressController">
+        <customObject id="-2" userLabel="File's Owner" customClass="SKProgressController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="progressBar" destination="7" id="10"/>
                 <outlet property="progressField" destination="8" id="11"/>
@@ -14,19 +14,19 @@
             </connections>
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" appearanceType="aqua" animationBehavior="default" id="5" userLabel="ProgressSheet" customClass="NSPanel">
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="302" y="374" width="226" height="58"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="300" height="87"/>
             <value key="maxSize" type="size" width="300" height="87"/>
             <view key="contentView" id="6">
                 <rect key="frame" x="0.0" y="0.0" width="226" height="58"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="262" translatesAutoresizingMaskIntoConstraints="NO" id="8">
+                    <textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" preferredMaxLayoutWidth="262" translatesAutoresizingMaskIntoConstraints="NO" id="8">
                         <rect key="frame" x="16" y="32" width="125" height="17"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="14">
@@ -35,7 +35,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator">
+                    <progressIndicator verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="7" customClass="SKProgressController_ProgressIndicator" customModule="PDF_Master" customModuleProvider="target">
                         <rect key="frame" x="16" y="12" width="194" height="12"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </progressIndicator>

+ 0 - 61
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.h

@@ -1,61 +0,0 @@
-//
-//  SKProgressController.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 9/16/07.
-/*
- This software is Copyright (c) 2007-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Cocoa/Cocoa.h>
-
-
-@interface SKProgressController : NSWindowController {
-    NSProgressIndicator *progressBar;
-    NSTextField *progressField;
-}
-
-@property (nonatomic, retain) IBOutlet NSProgressIndicator *progressBar;
-@property (nonatomic, retain) IBOutlet NSTextField *progressField;
-@property (nonatomic, retain) NSString *message;
-@property (nonatomic, getter=isIndeterminate) BOOL indeterminate;
-@property (nonatomic) double maxValue, doubleValue;
-
-// 是否显示关闭按钮 [默认是显示]
-@property (nonatomic, assign) BOOL showClose;
-@property (nonatomic, copy) void(^closeBlock)(void);
-
-- (void)incrementBy:(double)delta;
-
-- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler;
-
-@end

+ 0 - 191
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.m

@@ -1,191 +0,0 @@
-//
-//  SKProgressController.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 9/16/07.
-/*
- This software is Copyright (c) 2007-2018
- Christiaan Hofman. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
- - Neither the name of Christiaan Hofman nor the names of any
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "SKProgressController.h"
-
-@interface SKProgressController_ProgressIndicator : NSProgressIndicator
-
-@end
-
-@implementation SKProgressController_ProgressIndicator
-
-- (instancetype)init {
-    if (self = [super init]) {
-        
-    }
-    return self;
-}
-
-- (void)drawRect:(NSRect)dirtyRect {
-    NSColor *color = [NSColor colorWithRed:206/255.f green:208/255.f blue:212/255.f alpha:1.f];
-    [color setStroke];
-    [color setFill];
-    NSRect lineRect = NSMakeRect(1.5, (NSHeight(self.bounds)-2.4)*0.5, NSWidth(self.bounds)-2, 2.4);
-    NSBezierPath *linePath = [NSBezierPath bezierPathWithRoundedRect:lineRect xRadius:0 yRadius:0];
-    [linePath fill];
-    [linePath stroke];
-    
-    [super drawRect:dirtyRect];
-}
-
-@end
-
-
-@implementation SKProgressController
-
-@synthesize progressBar, progressField;
-@dynamic message, indeterminate, maxValue, doubleValue;
-
-- (void)dealloc {}
-
-- (NSString *)windowNibName { 
-    return @"ProgressSheet";
-}
-
-- (instancetype)init {
-    if (self = [super init]) {
-        self.showClose = YES;
-    }
-    return self;
-}
-
-- (void)windowDidLoad {
-    [progressBar setUsesThreadedAnimation:YES];
-    
-    self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
-    
-    NSButton *button = [[NSButton alloc] init];
-    [self.window.contentView addSubview:button];
-    
-    CGFloat width = NSWidth(self.window.contentView.frame);
-    CGFloat height = NSWidth(self.window.contentView.frame);
-    CGSize size = CGSizeMake(20, 20);
-    CGFloat buttonY = 28;
-    CGFloat buttonX = width-size.width-10;
-    button.frame = NSMakeRect(buttonX, buttonY, size.width, size.height);
-    button.autoresizingMask = NSViewMinXMargin | NSViewMaxYMargin;
-    button.bordered = NO;
-    button.image = [NSImage imageNamed:@"KMImageNameWhiteClose"];
-    button.target = self;
-    button.action = @selector(buttonAction:);
-    
-    button.hidden = !self.showClose;
-}
-
-- (NSProgressIndicator *)progressBar {
-    [self window];
-    return progressBar;
-}
-
-- (NSString *)message {
-    [self window];
-    return [progressField stringValue];
-}
-
-- (void)setMessage:(NSString *)newMessage {
-    [self window];
-    [progressField setStringValue:newMessage];
-    [[self window] setTitle:newMessage];
-}
-
-- (BOOL)isIndeterminate {
-    return [[self progressBar] isIndeterminate];
-}
-
-- (void)setIndeterminate:(BOOL)flag {
-    [[self progressBar] setIndeterminate:flag];
-}
-
-- (double)maxValue {
-    return [[self progressBar] maxValue];
-}
-
-- (void)setMaxValue:(double)newMaximum {
-    [[self progressBar] setMaxValue:newMaximum];
-    [[self progressBar] setDoubleValue:0.0];
-}
-
-- (double)doubleValue {
-    return [[self progressBar] doubleValue];
-}
-
-- (void)setDoubleValue:(double)doubleValue {
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[self progressBar] setDoubleValue:doubleValue];
-        [[self progressBar] displayIfNeeded];
-    });
-}
-
-- (void)incrementBy:(double)delta {
-    [[self progressBar] incrementBy:delta];
-    [[self progressBar] displayIfNeeded];
-}
-
-- (void)buttonAction:(NSButton *)sender {
-    if (self.closeBlock) {
-        self.closeBlock();
-    }
-    
-    [self dismissSheet:nil];
-}
-
-- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void (^)(NSInteger result))handler {
-    [[self progressBar] startAnimation:self];
-//    [(SKApplication *)NSApp setUserAttentionDisabled:YES];
-//    [super beginSheetModalForWindow:window completionHandler:handler];
-    [NSApp beginSheet:[self window]
-       modalForWindow:window
-        modalDelegate:self
-       didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
-          contextInfo:handler ? CFBridgingRetain(handler) : NULL];
-    
-//    [(SKApplication *)NSApp setUserAttentionDisabled:NO];
-}
-
-- (IBAction)dismissSheet:(id)sender {
-    [[self progressBar] stopAnimation:self];
-//    [super dismissSheet:sender];
-    if (@available(macOS 10.13, *)) {
-        [NSApp endSheet:[self window] returnCode:[sender tag]];
-    } else {
-        [NSApp endSheet:[self window]];
-    }
-    [[self window] orderOut:self];
-}
-
-@end

+ 151 - 0
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/OC/SKProgressController.swift

@@ -0,0 +1,151 @@
+//
+//  SKProgressController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/10/7.
+//
+
+import Cocoa
+
+class SKProgressController_ProgressIndicator: NSProgressIndicator {
+    override func draw(_ dirtyRect: NSRect) {
+        let color = NSColor(red: 206/255.0, green: 208/255.0, blue: 212/255.0, alpha: 1.0)
+        color.setStroke()
+        color.setFill()
+        
+        let lineRect = NSRect(x: 1.5, y: (self.bounds.height - 2.4) * 0.5, width: self.bounds.width - 2, height: 2.4)
+        let linePath = NSBezierPath(roundedRect: lineRect, xRadius: 0, yRadius: 0)
+        
+        linePath.fill()
+        linePath.stroke()
+        
+        super.draw(dirtyRect)
+    }
+}
+
+class SKProgressController: NSWindowController {
+
+    @IBOutlet var progressBar: NSProgressIndicator!
+    @IBOutlet var progressField: NSTextField!
+
+    var _message: String?
+    var _indeterminate: Bool = false
+    var _maxValue: Double = 100.0
+    var _doubleValue: Double = 0.0
+
+    // 是否显示关闭按钮 [默认是显示]
+    var showClose: Bool = true
+    var closeBlock: (() -> Void)?
+    
+    override var windowNibName: NSNib.Name? {
+        return NSNib.Name("ProgressSheet")
+    }
+    
+    override func windowDidLoad() {
+        super.windowDidLoad()
+    
+        // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+        
+        progressBar.usesThreadedAnimation = true
+        
+        self.window?.appearance = NSAppearance(named: .aqua)
+        
+        let button = NSButton()
+        self.window?.contentView?.addSubview(button)
+        
+        let width = self.window?.contentView?.frame.width ?? 0
+        let height = self.window?.contentView?.frame.height ?? 0
+        let size = CGSize(width: 20, height: 20)
+        let buttonY: CGFloat = 28
+        let buttonX = width - size.width - 10
+        button.frame = NSRect(x: buttonX, y: buttonY, width: size.width, height: size.height)
+        button.autoresizingMask = [.minXMargin, .maxYMargin]
+        button.isBordered = false
+        button.image = NSImage(named: "KMImageNameWhiteClose")
+        button.target = self
+        button.action = #selector(buttonAction(_:))
+        
+        button.isHidden = !self.showClose
+    }
+    
+//MARK: Get & Set
+    var message: String? {
+        get {
+            return progressField?.stringValue ?? ""
+        }
+        set {
+            progressField.stringValue = newValue!
+            self.window?.title = newValue!
+        }
+    }
+    
+    var indeterminate: Bool {
+        get {
+            return self.progressBar.isIndeterminate
+        }
+        set {
+            self.progressBar.isIndeterminate = newValue
+        }
+    }
+    
+    var maxValue: Double {
+        get {
+            return self.progressBar.maxValue
+        }
+        set {
+            self.progressBar.maxValue = newValue
+            self.progressBar.doubleValue = 0.0
+        }
+    }
+    
+    var doubleValue: Double {
+        get {
+            return self.progressBar.doubleValue
+        }
+        set {
+            DispatchQueue.main.async {
+                self.progressBar.doubleValue = newValue
+                self.progressBar.displayIfNeeded()
+            }
+        }
+    }
+    
+    func increment(by delta: Double) {
+        self.progressBar.increment(by: delta)
+        self.progressBar.displayIfNeeded()
+    }
+
+    
+    //MARK: Action
+    
+    @objc func buttonAction(_ sender: NSButton) {
+        // Your button action code here
+        if let closeBlock = self.closeBlock {
+            closeBlock()
+        }
+        
+        self.dismissSheet(sender)
+    }
+    //didEndSheet(returnCode:contextInfo:)
+//    func beginSheetModal(for window: NSWindow, completionHandler handler: ((NSInteger) -> Void)?) {
+//        progressBar.startAnimation(self)
+//        
+//        NSApp.beginSheet(window,
+//                         modalFor: window,
+//                         modalDelegate: self,
+//                         didEnd: #selector(didEndSheet(returnCode:contextInfo:)),
+//                         contextInfo: handler != nil ? Unmanaged.passRetained(handler as AnyObject).toOpaque() : nil)
+//    }
+    
+    @IBAction func dismissSheet(_ sender: Any) {
+        self.progressBar.stopAnimation(self)
+        
+        if #available(macOS 10.13, *) {
+            NSApp.endSheet(self.window!, returnCode: (sender as AnyObject).tag)
+        } else {
+            NSApp.endSheet(self.window!)
+        }
+        
+        self.window!.orderOut(self)
+    }
+}

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Convert/View/KMConvertCSVSettingView.swift

@@ -34,7 +34,7 @@ class KMConvertCSVSettingView: KMConvertSettingView {
         
         self.oneFileForPageComboBox.title = NSLocalizedString("Excel Worksheet Settings", comment: "")
         self.oneFileForPageComboBox.font = .SFProTextSemiboldFont(12)
-        self.oneFileForPageComboBox.setTitleColor(NSColor.km_init(hex: "#616469"))
+        self.oneFileForPageComboBox.setTitleColor(color: NSColor.km_init(hex: "#616469"))
         
         self.onlyGetTableVC = KMDesignButton.init(withType: .CheckBox)
         self.onlyGetTableBox.contentView = self.onlyGetTableVC!.view

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Convert/View/KMConvertOCRSettingItemView.swift

@@ -158,12 +158,12 @@ class KMConvertOCRSettingItemView: KMConvertBaseView {
     
     func showProgressWindow() {
         let progress = SKProgressController()
-        progress.message = NSLocalizedString("Download...", comment: "")
         progress.window?.backgroundColor = NSColor.km_init(hex: "#36383B")
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        
+        progress.message = NSLocalizedString("Download...", comment: "")
+
         progress.closeBlock = { [unowned self] in
 #if VERSION_DMG
             KMResourceDownloadManager.manager.cancelDownload()

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/Crop/Controller/KMCropPreviewController.swift

@@ -309,7 +309,7 @@ class KMCropPreviewController: KMWatermarkAdjectivePreViewBaseController {
                     if (pageSize.width == 0 && pageSize.height == 0) {
                         
                     } else {
-                        let tiffData = page.pdfListViewTIFFData(for: rect)
+                        let tiffData = page.PDFListViewTIFFData(for: rect)
                         let index: UInt = (page.pageIndex())
 //                        let newPage: CPDFPage = CPDFPage(image: NSImage(data: tiffData!))
                         
@@ -424,8 +424,8 @@ class KMCropPreviewController: KMWatermarkAdjectivePreViewBaseController {
         let titles = ["裁剪当前页面 - 白边距", "裁剪所有页面 - 自动", "自定义裁剪区域"]
         for title in titles {
             let item = NSMenuItem(title: title, action: #selector(itemAction), target: self)
-            item?.tag = titles.firstIndex(of: title)!
-            menu.addItem(item!)
+            item.tag = titles.firstIndex(of: title)!
+            menu.addItem(item)
         }
         
         menu.popUp(positioning: nil, at: NSPoint(x: self.topBarView.frame.midX-100, y: 0), in: self.topBarView)
@@ -480,7 +480,7 @@ class KMCropPreviewController: KMWatermarkAdjectivePreViewBaseController {
             rect = getPageForegroundBox(page!)
         }
         
-        let tiffData = page!.pdfListViewTIFFData(for: rect)
+        let tiffData = page!.PDFListViewTIFFData(for: rect)
         
         let index: UInt = (page?.pageIndex())!
         

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/OCR/KMDocumentAIPDFView.m

@@ -6,9 +6,9 @@
 //
 
 #import "KMDocumentAIPDFView.h"
-#import "NSEvent+PDFListView.h"
 #import "NSGeometry+PDFListView.h"
 #import "KMDocumentAIPopViewController.h"
+#import <PDF_Master-Swift.h>
 
 #define DOCUMENT_SIZE 30.0
 

+ 4 - 10
PDF Office/PDF Master/Class/PDFTools/OCR/KMDocumentAIViewController.m

@@ -8,14 +8,8 @@
 #import "KMDocumentAIViewController.h"
 #import "KMOCRBox.h"
 #import "KMDocumentAIManager.h"
-#import "KMFileAttribute.h"
 #import "KMOCRComboBox.h"
-#import "NSButton+TitleColor.h"
-#if VERSION_DMG
 #import <PDF_Master-Swift.h>
-#else
-#import <PDF_Master-Swift.h>
-#endif
 #import <Masonry/Masonry.h>
 
 #define kIndicatorWidth  32.0
@@ -232,7 +226,7 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
     self.OCRButton.layer.backgroundColor = [NSColor blueColor].CGColor;
     self.OCRButton.layer.cornerRadius = 4;
     [self.OCRButton setTitle:NSLocalizedString(@"OCR", nil)];
-    [self.OCRButton setTitleColor:[NSColor whiteColor]];
+    [self.OCRButton setTitleColorWithColor:[NSColor whiteColor] font:nil];
     self.OCRButton.enabled = NO;
     
     self.ocrTipView.hidden = YES;
@@ -371,7 +365,7 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
         fileAttribute.bAllPage = NO;
         fileAttribute.pagesString = _pageRangePopButton.stringValue;
         
-        if (!fileAttribute.selectPages) {
+        if (!fileAttribute.fetchSelectPages) {
             NSAlert *alert = [[NSAlert alloc] init];
             [alert setAlertStyle:NSAlertStyleCritical];
             [alert setMessageText:[NSString stringWithFormat:@"%@ %@",[fileAttribute.filePath lastPathComponent],NSLocalizedString(@"Invalid page range or the page number is out of range. Please try again.", nil)]];
@@ -379,7 +373,7 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
             
             return;
         }
-        for (NSNumber * num in fileAttribute.selectPages) {
+        for (NSNumber * num in fileAttribute.fetchSelectPages) {
             [pages addObject:@(num.integerValue)];
         }
     }
@@ -507,7 +501,7 @@ static inline NSFont * FontWithSize(NSString *strChar, CGSize size) {
     fileAttribute.bAllPage = NO;
     fileAttribute.pagesString = self.pageRangePopButton.stringValue;
     
-    if (!fileAttribute.selectPages) {
+    if (!fileAttribute.fetchSelectPages) {
         return NO;
     }
     return YES;

+ 8 - 8
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -124,11 +124,11 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         self.thumbnailView.collectionView.backgroundColor(NSColor.km_init(hex: "#CED0D4"))
         
         var allowedFileTypes: [String] = []
-        if let _types = KMConvertPDFManagerOC.supportFileType() as? [String] {
-            allowedFileTypes = KMTools.pdfExtensions + _types
-        } else {
-            allowedFileTypes = KMTools.pdfExtensions + KMTools.imageExtensions
-        }
+//        if let _types = KMConvertPDFManager.supportFileType()  {
+        allowedFileTypes = KMTools.pdfExtensions + KMConvertPDFManager.supportFileType()
+//        } else {
+//            allowedFileTypes = KMTools.pdfExtensions + KMTools.imageExtensions
+//        }
         self.thumbnailView.kmAllowedFileTypes = allowedFileTypes
         
         let toolBar = self.toolBar
@@ -268,7 +268,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     
     override func cutAction() {
         if (self.thumbnailView.selectionIndexPaths.count == (self.listView?.document.pageCount)!) {
-            let _ = CustomAlertView(message: NSLocalizedString("Unable to delete all pages", comment: ""), from: self.thumbnailView, with: .blue)
+            let _ = CustomAlertView.alertView(message: NSLocalizedString("Unable to delete all pages", comment: ""), fromView: self.thumbnailView, withStyle: .blue)
             return
         }
         super.cutAction()
@@ -294,7 +294,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             return
         }
         if (indexpaths.count == pageCount) {
-            let _ = CustomAlertView(message: NSLocalizedString("Unable to delete all pages", comment: ""), from: self.thumbnailView, with: .blue)
+            let _ = CustomAlertView.alertView(message: NSLocalizedString("Unable to delete all pages", comment: ""), fromView: self.thumbnailView, withStyle: .blue)
             return
         }
         
@@ -785,7 +785,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
     @objc func reverseMenuAction(sender: AnyObject?) {
         let selectedIndexs = self.thumbnailView.selectionIndexPaths
         if (selectedIndexs.count < 2 ) {
-            let alertView = CustomAlertView(message: NSLocalizedString("Please select at least two pages for editing first", comment: ""), from: self.thumbnailView, with: .blue)
+            let alertView = CustomAlertView.alertView(message: NSLocalizedString("Please select at least two pages for editing first", comment: ""), fromView: self.thumbnailView, withStyle: .blue)
             alertView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
             alertView?.layer?.cornerRadius = 4
             return

+ 0 - 30
PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.h

@@ -1,30 +0,0 @@
-//
-//  CustomAlertView.h
-//  NoteLedge for Mac
-//
-//  Created by LiuZhiXun on 16/4/27.
-//  Copyright © 2016年 kdanmobile. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-
-typedef NS_ENUM(NSUInteger, KMCustomAlertStyle) {
-    KMCustomAlertStyle_Black,
-    KMCustomAlertStyle_Blue,
-};
-
-@interface CustomAlertView : NSView
-
-//+ (CustomAlertView *)alertViewWithMessage:(NSString *)message
-//                                 fromView:(NSView *)supverView;
-
-+ (CustomAlertView *)alertViewWithMessage:(NSString *)message
-                                fromView:(NSView *)supverView
-                                withStyle:(KMCustomAlertStyle)style;
-
-+ (CustomAlertView *)alertViewWithMessage:(NSString *)message
-                                fromView:(NSView *)supverView
-                                withStyle:(KMCustomAlertStyle)style
-                          backgroundColor:(NSColor *)color;
-
-@end

+ 0 - 125
PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.m

@@ -1,125 +0,0 @@
-//
-//  CustomAlertView.m
-//  NoteLedge for Mac
-//
-//  Created by LiuZhiXun on 16/4/27.
-//  Copyright © 2016年 kdanmobile. All rights reserved.
-//
-
-#import "CustomAlertView.h"
-#import <Quartz/Quartz.h>
-
-@implementation CustomAlertView
-
-- (void)drawRect:(NSRect)dirtyRect {
-    [super drawRect:dirtyRect];
-    
-    // Drawing code here.
-}
-
-+ (CustomAlertView *)alertViewWithMessage:(NSString *)message
-                                fromView:(NSView *)supverView
-                                withStyle:(KMCustomAlertStyle)alertStyle
-                          backgroundColor:(NSColor *)color {
-    if (alertStyle != KMCustomAlertStyle_Black && alertStyle != KMCustomAlertStyle_Blue) {
-        return nil;
-    }
-    
-    CustomAlertView *view = [[CustomAlertView alloc] init];
-    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
-    [style setLineBreakMode:NSLineBreakByWordWrapping];
-    
-    CGFloat fontSize = 0;
-    CGSize offsetSize = CGSizeZero;
-    if (alertStyle == KMCustomAlertStyle_Black) {
-        fontSize = 16;
-    } else {
-        fontSize = 12;
-    }
-  NSDictionary * attribute = @{NSFontAttributeName:[NSFont systemFontOfSize:fontSize],
-                                NSParagraphStyleAttributeName:style};
-    NSSize size = [message boundingRectWithSize:NSMakeSize(MIN(supverView.frame.size.width-80,500), supverView.frame.size.height-40) options:(NSStringDrawingTruncatesLastVisibleLine |                                                                             NSStringDrawingUsesLineFragmentOrigin |                                                                              NSStringDrawingUsesFontLeading) attributes:attribute].size;
-    size.width = ceil(size.width);
-    size.height = ceil(size.height);
-    if (alertStyle == KMCustomAlertStyle_Black) {
-         offsetSize = NSMakeSize(size.width+60, size.height+30);
-        view.frame = NSMakeRect((supverView.frame.size.width-offsetSize.width)/2,
-                                (supverView.frame.size.height-offsetSize.height)/2,
-                                offsetSize.width,offsetSize.height);
-
-    } else {
-        offsetSize = NSMakeSize(size.width + size.height + 14 + 10, size.height+14);
-        view.frame = NSMakeRect((supverView.frame.size.width-offsetSize.width)/2,
-                                (supverView.frame.size.height-offsetSize.height) - 10,
-                                offsetSize.width,offsetSize.height);
-    }
-    [supverView addSubview:view];
-    view.wantsLayer = YES;
-    
-    NSTextField *messageLabel = nil;
-    if (alertStyle == KMCustomAlertStyle_Black) {
-        view.layer.cornerRadius = 8;
-        if (color) {
-            view.layer.backgroundColor = color.CGColor;
-        } else {
-            view.layer.backgroundColor = [[NSColor blackColor] colorWithAlphaComponent:0.7].CGColor;
-        }
-        messageLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(15, 15, size.width+30., size.height)];
-    } else {
-        view.layer.cornerRadius = view.frame.size.height/2;
-        if (color) {
-            view.layer.backgroundColor = color.CGColor;
-        } else {
-            view.layer.backgroundColor = [NSColor colorWithRed:78/255.0 green:163/255.0 blue:255/255.0 alpha:1].CGColor;
-        }
-        messageLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(view.frame.size.height/2, 7, size.width + 10, size.height)];
-    }
-    messageLabel.font = [NSFont systemFontOfSize:fontSize];
-    messageLabel.textColor = [NSColor whiteColor];
-    messageLabel.backgroundColor = [NSColor clearColor];
-    messageLabel.bordered = NO;
-    messageLabel.editable = NO;
-    if ([messageLabel respondsToSelector:@selector(setLineBreakMode:)]) {
-        messageLabel.lineBreakMode = NSLineBreakByWordWrapping;
-    }
-    
-    messageLabel.alignment = NSTextAlignmentCenter;
-    messageLabel.stringValue = message;
-    [view addSubview:messageLabel];
-    [view alphaAnimationFrom:0
-                          to:1.
-                    duration:0.3
-               finishedBlock:^
-     {
-         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-             [view alphaAnimationFrom:1.0 to:0. duration:0.3
-                        finishedBlock:^{
-                            [view removeFromSuperview];
-                        }];
-         });
-     }];
-    
-    return view;
-}
-
-+ (CustomAlertView *)alertViewWithMessage:(NSString *)message fromView:(NSView *)supverView withStyle:(KMCustomAlertStyle)alertStyle {
-    return [CustomAlertView alertViewWithMessage:message fromView:supverView withStyle:alertStyle backgroundColor:nil];
-}
-
-
-- (void)alphaAnimationFrom:(float)fromValue
-                        to:(float)toValue
-                  duration:(float)duration
-             finishedBlock:(void (^)(void))block {
-    CABasicAnimation  *flash = [CABasicAnimation animationWithKeyPath:@"opacity"];
-    flash.fromValue = [NSNumber numberWithFloat:fromValue];
-    flash.toValue = [NSNumber numberWithFloat:toValue];
-    flash.duration = 0.5;        // 1 second
-    [self.layer addAnimation:flash forKey:@"flashAnimation"];
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        block();
-    });
-}
-
-
-@end

+ 0 - 0
PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.swift


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.