|
@@ -1074,12 +1074,6 @@ let LOCKED_KEY = "locked"
|
|
|
}
|
|
|
controller.documentEditedCallback = { [weak self] params in
|
|
|
self?.recordIsPDFDocumentEdited()
|
|
|
-// self?.needSave = true
|
|
|
- if let data = params.first as? KMPageEditType {
|
|
|
- self?.recordSaveWatermarkFlag(type: data.toSubscribeWaterMarkType())
|
|
|
- } else {
|
|
|
- self?.recordSaveWatermarkFlag()
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
controller.selectionDidChange = { [weak self] selectedIndexs in
|
|
@@ -1431,37 +1425,6 @@ let LOCKED_KEY = "locked"
|
|
|
// MARR: 显示加密弹窗
|
|
|
|
|
|
public func showSecureWindow(_ url: URL) {
|
|
|
-// let windowController = KMSecureEncryptWindowController(windowNibName: "KMSecureEncryptWindowController")
|
|
|
-// windowController.documentURL = url
|
|
|
-// windowController.myDocument = self.listView.document
|
|
|
-// self.currentWindowController = windowController
|
|
|
-//
|
|
|
-// windowController.itemClick = { [weak self] index in
|
|
|
-// self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
-// self?.currentWindowController = nil
|
|
|
-// }
|
|
|
-//
|
|
|
-// windowController.resultCallback = { [weak self] result in
|
|
|
-// let windowController_secure = self?.currentWindowController as! KMSecureEncryptWindowController
|
|
|
-// self?.view.window?.endSheet((self?.currentWindowController.window)!)
|
|
|
-// self?.currentWindowController = nil
|
|
|
-//
|
|
|
-// self?._secureOptions = windowController_secure.options
|
|
|
-// self?.needSave = true
|
|
|
-// self?.recordIsPDFDocumentEdited(type: .setPassword)
|
|
|
-//
|
|
|
-// if (result) {
|
|
|
-// self?.showSecureSuccessTip()
|
|
|
-// self?.recordSaveWatermarkFlag(type: .setPassword)
|
|
|
-// } else {
|
|
|
-// let alert = NSAlert()
|
|
|
-// alert.messageText = NSLocalizedString("Failure", comment: "")
|
|
|
-// alert.runModal()
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// self.view.window?.beginSheet(windowController.window!)
|
|
|
-
|
|
|
let controller = KMSecurityWindowController(windowNibName: "KMSecurityWindowController")
|
|
|
controller.pdfDocument = self.document
|
|
|
self.currentWindowController = controller
|
|
@@ -1505,20 +1468,6 @@ let LOCKED_KEY = "locked"
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// self._secureOptions = options
|
|
|
-// self.documentAttribute = attribute
|
|
|
-// self.needSave = true
|
|
|
-// self.recordIsPDFDocumentEdited(type: .setPassword)
|
|
|
-//
|
|
|
-// if (options.count != 0) {
|
|
|
-// self.showSecureSuccessTip()
|
|
|
-// self.recordSaveWatermarkFlag(type: .setPassword)
|
|
|
-// } else {
|
|
|
-// let alert = NSAlert()
|
|
|
-// alert.messageText = NSLocalizedString("Failure", comment: "")
|
|
|
-// alert.runModal()
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
controller.cancelAction = { [unowned self] controller in
|
|
@@ -2076,7 +2025,7 @@ let LOCKED_KEY = "locked"
|
|
|
|
|
|
public func clearSecureOptions() {
|
|
|
self._secureOptions = nil
|
|
|
- self.documentAttribute
|
|
|
+ self.documentAttribute = nil
|
|
|
}
|
|
|
|
|
|
public func recordRemoveSecureFlag() {
|
|
@@ -2090,16 +2039,6 @@ let LOCKED_KEY = "locked"
|
|
|
self._removeSecureFlag = false
|
|
|
}
|
|
|
|
|
|
- public func recordSaveWatermarkFlag(type: KMSubscribeWaterMarkType = .none) {
|
|
|
-// km_synchronized(self) {
|
|
|
-// self._saveWatermarkFlag = true
|
|
|
-// }
|
|
|
-//
|
|
|
-// if let _document = self.myDocument as? KMMainDocument {
|
|
|
-// _document.recordTrackEvent(type: type)
|
|
|
-// }
|
|
|
- }
|
|
|
-
|
|
|
public func clearSaveWatermarkFlag() {
|
|
|
km_synchronized(self) {
|
|
|
self._saveWatermarkFlag = false
|
|
@@ -2439,8 +2378,6 @@ let LOCKED_KEY = "locked"
|
|
|
}
|
|
|
|
|
|
func pdfViewEditingSelectionDidChanged(_ pdfView: CPDFView!) {
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
-
|
|
|
if self.rightSideViewController != nil && self.rightSideViewController.subViewType == .EditPDFAddText {
|
|
|
self.rightSideViewController.eidtPDFTextProperty.reloadData()
|
|
|
self.rightSideViewController.eidtPDFTextProperty.updateTextTextPresuppositionState()
|
|
@@ -2553,8 +2490,6 @@ let LOCKED_KEY = "locked"
|
|
|
}
|
|
|
|
|
|
func pdfViewEditingCropBoundsDidChanged(_ pdfView: CPDFView!, editing editArea: CPDFEditArea!) {
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
-
|
|
|
if editArea != nil && (editArea is CPDFEditImageArea){
|
|
|
self.listView.cropAreas = editArea as? CPDFEditImageArea
|
|
|
}
|
|
@@ -2562,8 +2497,6 @@ let LOCKED_KEY = "locked"
|
|
|
|
|
|
//编辑PDF 创建图片区域回调
|
|
|
func pdfViewEditingAddImageArea(_ pdfView: CPDFView!, add page: CPDFPage!, add rect: CGRect) {
|
|
|
- self.recordSaveWatermarkFlag(type: .editImage)
|
|
|
-
|
|
|
if self.listView.isEditImage {
|
|
|
self.menuItemEditingClick_CropImage(sender: NSMenuItem())
|
|
|
} else {
|
|
@@ -2679,25 +2612,8 @@ let LOCKED_KEY = "locked"
|
|
|
// self.asyncSaveDocument { params in
|
|
|
//
|
|
|
// }
|
|
|
- self.recordSaveWatermarkFlag(type: .editText)
|
|
|
}
|
|
|
|
|
|
-// func pdfViewEditingDoubleClick(_ pdfView: CPDFView!, imageArea editArea: CPDFEditArea!) {
|
|
|
-// debugPrint("pdfViewEditingDoubleClick")
|
|
|
-// }
|
|
|
-
|
|
|
- func pdfViewEditingOperationDidChanged(_ pdfView: CPDFView!) {
|
|
|
- debugPrint("pdfViewEditingOperationDidChanged")
|
|
|
- if self.listView.isEdited() {
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-// func pdfListViewEditAnnotation(_ pdfListView: CPDFListView!, for anotation: CPDFAnnotation!) {
|
|
|
-// debugPrint("pdfListViewEditAnnotation")
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
func pdfListViewKeyDownIsContinue(_ pdfListView: CPDFListView!, theEvent: NSEvent!) -> Bool {
|
|
|
let command = theEvent.modifierFlags.contains(.command)
|
|
|
let control = theEvent.modifierFlags.contains(.control)
|
|
@@ -3148,25 +3064,10 @@ let LOCKED_KEY = "locked"
|
|
|
|
|
|
func pdfListViewAddAnnotations(_ pdfListView: CPDFListView!, forAdd annotations: [CPDFAnnotation]!, in pdfPage: CPDFPage!) {
|
|
|
var addRedact = false
|
|
|
- var saveWatermark = false
|
|
|
- var saveWatermarkType: KMSubscribeWaterMarkType = .none
|
|
|
for anno in annotations {
|
|
|
if (anno.isKind(of: CPDFRedactAnnotation.self)) {
|
|
|
addRedact = true
|
|
|
-// break
|
|
|
- } else if (anno.isKind(of: CPDFLinkAnnotation.self)) { // link 注释
|
|
|
- saveWatermark = true
|
|
|
- saveWatermarkType = .link
|
|
|
- } else if (anno.isKind(of: CPDFListStampAnnotation.self)) { // 图章注释
|
|
|
- saveWatermark = true
|
|
|
- saveWatermarkType = .stamp
|
|
|
- } else if (anno.isKind(of: CPDFListSignatureAnnotation.self)) { // 签名注释
|
|
|
- saveWatermark = true
|
|
|
- saveWatermarkType = .sign
|
|
|
- }
|
|
|
- }
|
|
|
- if (saveWatermark) {
|
|
|
- self.recordSaveWatermarkFlag(type: saveWatermarkType)
|
|
|
+ }
|
|
|
}
|
|
|
self.hasAddRedact = addRedact
|
|
|
if self.isReadMode || self.listView.toolMode == .moveToolMode {
|