Browse Source

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

liujiajie 1 year ago
parent
commit
f081166745
24 changed files with 686 additions and 460 deletions
  1. 38 0
      PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFOutline+KMExtension.swift
  2. 25 0
      PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFPage+KMExtension.swift
  3. 3 0
      PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFView+KMExtension.swift
  4. 12 0
      PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift
  5. 1 0
      PDF Office/PDF Master/Class/Common/Category/NSView+KMExtension.swift
  6. 7 0
      PDF Office/PDF Master/Class/Common/KMCommonDefine.swift
  7. 3 0
      PDF Office/PDF Master/Class/PDFTools/PageEdit/OCPart/CustomAlertView.swift
  8. 3 3
      PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift
  9. 7 7
      PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.xib
  10. 22 1
      PDF Office/PDF Master/Class/PDFTools/Print/Model/KMPrintDrawPage.swift
  11. 78 48
      PDF Office/PDF Master/Class/PDFTools/Print/Presenter/KMPrintPresenter.swift
  12. 2 2
      PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.swift
  13. 12 0
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFDocumentExtensions/CPDFDocument+KMExtension.swift
  14. 9 32
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Action.swift
  15. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift
  16. 64 18
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Outline.swift
  17. 28 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Search.swift
  18. 191 238
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  19. 92 94
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/View/KMCustomOutlineView.swift
  20. 12 13
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/View/KMTocOutlineView.swift
  21. 0 1
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift
  22. 28 2
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  23. 16 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj
  24. 32 0
      PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

+ 38 - 0
PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFOutline+KMExtension.swift

@@ -0,0 +1,38 @@
+//
+//  CPDFOutline+KMExtension.swift
+//  PDF Reader Pro
+//
+//  Created by tangchao on 2024/1/29.
+//
+
+import Foundation
+
+@objc extension CPDFOutline {
+    var km_page: CPDFPage? {
+        get {
+            var dest = self.destination
+            if dest == nil && self.action.responds(to: NSSelectorFromString("destination")) {
+                dest = (self.action as? CPDFGoToAction)?.destination()
+            }
+            return dest?.page()
+        }
+    }
+    
+    var km_pageIndex: UInt {
+        get {
+            return self.km_page?.pageIndex() ?? UInt(NSNotFound)
+        }
+    }
+    
+    var km_pageLabel: String? {
+        get {
+            let page = self.km_page
+            if page != nil {
+                return page?.km_displayLabel
+            } else if self.action.responds(to: NSSelectorFromString("pageIndex")) {
+//                return [NSString stringWithFormat:@"%lu", (unsigned long)([(PDFActionRemoteGoTo *)[self action] pageIndex] + 1)];
+            }
+            return nil
+        }
+    }
+}

+ 25 - 0
PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFPage+KMExtension.swift

@@ -0,0 +1,25 @@
+//
+//  CPDFPage+KMExtension.swift
+//  PDF Reader Pro
+//
+//  Created by tangchao on 2024/1/29.
+//
+
+import Foundation
+
+@objc extension CPDFPage {
+    @objc var km_displayLabel: String {
+        get {
+            var label: String?
+//            if ([[self class] usesSequentialPageNumbering] == NO)
+//                label = [self label];
+            return label != nil ? label! : self.km_sequentialLabel
+        }
+    }
+    
+    @objc var km_sequentialLabel: String {
+        get {
+            return "\(self.pageIndex() + 1)"
+        }
+    }
+}

+ 3 - 0
PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFView+KMExtension.swift

@@ -23,5 +23,8 @@ import Foundation
         return self.document?.insertPage(pageSize, at: UInt(index)) ?? false
     }
 
+    @objc func allowsNotes() -> Bool {
+        return self.document?.allowsNotes() ?? false
+    }
     
 }

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

@@ -681,6 +681,14 @@ extension NSOutlineView {
         return self.item(atRow: row)
     }
     
+    func selectedItem() -> Any? {
+        let row = self.selectedRow
+        if row < 0 {
+            return nil
+        }
+        return self.item(atRow: row)
+    }
+    
     func km_selectRow(_ row: Int, byExtendingSelection extend: Bool = true) {
         self.selectRowIndexes(IndexSet(integer: row), byExtendingSelection: extend)
     }
@@ -698,6 +706,10 @@ extension KM where Base: NSOutlineView {
     public func clickedItem<T>() -> T {
         return base.clickedItem() as! T
     }
+    
+    public func selectedItem<T>() -> T {
+        return base.selectedItem() as! T
+    }
 }
 
 // MARK: - NSParagraphStyle

+ 1 - 0
PDF Office/PDF Master/Class/Common/Category/NSView+KMExtension.swift

@@ -120,6 +120,7 @@ extension NSView {
 // MARK: - KMExtension
 
 extension NSView {
+    //: 是否为长辈视图(父类,父类的父类......)
     func isElderView(to sv: NSView?) -> Bool {
         guard let _sv = sv else {
             return false

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

@@ -52,6 +52,13 @@ let kCommandString  = "⌘"
 let kOptionString   = "⌥"
 let kShiftString    = "⇧"
 
+// ColumnID
+
+let kPageColumnId = NSUserInterfaceItemIdentifier(rawValue: "page")
+let kLabelColumnId = NSUserInterfaceItemIdentifier(rawValue: "label")
+
+let kResultsColumnId = NSUserInterfaceItemIdentifier(rawValue: "results")
+
 // MARK: - 特定的Block
 
 typealias KMBatchActionBlock = (_ controller: NSWindowController, _ files: [KMFileAttribute]) -> Void

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

@@ -87,6 +87,9 @@ class CustomAlertView: NSView {
         messageLabel.backgroundColor = NSColor.clear
         messageLabel.isBordered = false
         messageLabel.isEditable = false
+        messageLabel.lineBreakMode = .byWordWrapping
+        messageLabel.usesSingleLineMode = false
+        messageLabel.cell?.wraps = true
         if #available(OSX 10.11, *) {
             messageLabel.lineBreakMode = .byWordWrapping
         }

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift

@@ -74,7 +74,7 @@ class KMPrintWindowController: KMBaseWindowController, NetServiceBrowserDelegate
 //            self.chooseView.inputData = URL(string: "")
             
             if pdfDocument != nil {
-                self.preview.pdfDocument = pdfDocument
+                self.preview.pdfDocument = PDFDocument(url: pdfDocument!.documentURL)
                 self.presenter.initPresenter(delegate: self, data: self.chooseData, document: pdfDocument!)
             }
         }
@@ -472,11 +472,11 @@ extension KMPrintWindowController: KMPrintChooseViewDelegate {
 }
 
 extension KMPrintWindowController: KMPrintPresenterDeleage {
-    func showData(presenter: KMPrintPresenter, document: CPDFDocument) {
+    func showData(presenter: KMPrintPresenter, document: PDFDocument) {
         
         self.preview.model = self.chooseData
         if isPrintPreView && self.preview.model?.page.operation.type == .poster {
-            self.preview.pdfDocument = pdfDocument
+//            self.preview.pdfDocument = pdfDocument
         } else {
             self.preview.pdfDocument = document
         }

+ 7 - 7
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22155" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22155"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMPrintWindowController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMPrintWindowController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="bottomView" destination="hxi-EY-Feh" id="aVW-vl-lrU"/>
                 <outlet property="chooseView" destination="Poy-5w-166" id="Hdi-D7-rcw"/>
@@ -27,22 +27,22 @@
                 <rect key="frame" x="0.0" y="0.0" width="600" height="500"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Zdp-be-ySe" customClass="KMPrintPreviewView" customModule="PDF_Master">
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Zdp-be-ySe" customClass="KMPrintPreviewView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="48" width="228" height="402"/>
                         <constraints>
                             <constraint firstAttribute="width" constant="228" id="mvR-zb-2ve"/>
                         </constraints>
                     </customView>
-                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="hxi-EY-Feh" customClass="KMPrintBottomView" customModule="PDF_Master" customModuleProvider="target">
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="hxi-EY-Feh" customClass="KMPrintBottomView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="0.0" y="0.0" width="600" height="48"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="48" id="Iml-W7-xkW"/>
                         </constraints>
                     </customView>
-                    <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-5w-166" customClass="KMPrintChooseView" customModule="PDF_Master" customModuleProvider="target">
+                    <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Poy-5w-166" customClass="KMPrintChooseView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="228" y="48" width="372" height="402"/>
                     </customView>
-                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Q4X-Su-GRe" customClass="KMPrintSettingView" customModule="PDF_Master" customModuleProvider="target">
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="Q4X-Su-GRe" customClass="KMPrintSettingView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                         <rect key="frame" x="228" y="48" width="372" height="452"/>
                     </customView>
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="MIW-E0-38q">

+ 22 - 1
PDF Office/PDF Master/Class/PDFTools/Print/Model/KMPrintDrawPage.swift

@@ -7,10 +7,31 @@
 
 import Cocoa
 
-class KMPrintDrawPage: NSObject {
+//typealias KMPrintDrawPageBlock = (_ box: CPDFDisplayBox, _ context: CGContext, _ pages: [KMPrintDrawPage]) -> Void
+
+typealias KMPrintDrawPageBlock = (_ box: PDFDisplayBox, _ context: CGContext, _ pages: [KMPrintDrawPage]) -> Void
+
+
+class KMPrintDrawPage: PDFPage {
+//    var page: CPDFPage = CPDFPage()
     var page: PDFPage = PDFPage()
+    var pages: [KMPrintDrawPage] = []
+    
     var cropRect: CGRect = NSZeroRect
     var showRect: CGRect = NSZeroRect
     
     var point: CGPoint = NSMakePoint(1, 1)
+    
+    var drawPageBlock: KMPrintDrawPageBlock?
+    
+    
+    override func draw(with box: PDFDisplayBox, to context: CGContext) {
+        super.draw(with: box, to: context)
+        self.drawPageBlock?(box, context, pages)
+    }
+//    override func draw(with box: CPDFDisplayBox, to context: CGContext!) {
+//        super.draw(with: box, to: context)
+//        
+//        self.drawPageBlock?(box, context, pages)
+//    }
 }

+ 78 - 48
PDF Office/PDF Master/Class/PDFTools/Print/Presenter/KMPrintPresenter.swift

@@ -51,7 +51,7 @@ class KMPrintPresenter: NSObject {
 }
 
 protocol KMPrintPresenterDeleage: NSObject {
-    func showData(presenter: KMPrintPresenter, document: CPDFDocument)
+    func showData(presenter: KMPrintPresenter, document: PDFDocument)
 }
 
 protocol KMPrintPresenterDocument: NSObject {}
@@ -62,20 +62,20 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      @param data 数据
      @retrun document
      */
-    func updatePrintDocument(documentURL: URL, data: KMPrintModel) -> CPDFDocument {
+    func updatePrintDocument(documentURL: URL, data: KMPrintModel) -> PDFDocument {
         // 获取基本参数
         let printModel: KMPrintModel = data
         //获取总page
         let pages = self.fetchPages(documentURL, printModel.page)
         //绘制PDF
-        let filePath = self.drawPages(nil, printModel, pages)
+        let result = self.drawPages(nil, printModel, pages)
         
-        let result = CPDFDocument(url: URL(fileURLWithPath: filePath))!
+//        let result = CPDFDocument(url: URL(fileURLWithPath: filePath))!
         
         if self.delegate != nil {
             self.delegate?.showData(presenter: self, document: result)
         }
-        KMPrint("保存地址" + filePath)
+//        KMPrint("保存地址" + filePath)
         return result
      }
     
@@ -87,7 +87,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      */
     func drawPages(_ toFilePath: String?,
                    _ printModel: KMPrintModel,
-                   _ pages: [KMPrintDrawPage]) -> String {
+                   _ pages: [KMPrintDrawPage]) -> PDFDocument {
         /**
          参数
          */
@@ -98,23 +98,45 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
         //每页page数
         let pageOfPaperCount: Int = self.fetchPageOfPaper(printModel.page)
         //获取每张纸的page
-        let drawPages: [[KMPrintDrawPage]] = self.fetchDrawPages(paperSize, printModel.page, paperCount, pageOfPaperCount, pages)
+        let drawPages: [KMPrintDrawPage] = self.fetchDrawPages(paperSize, printModel.page, paperCount, pageOfPaperCount, pages)
         //导出地址
         let filePath = KMPrintPresenter.fetchSaveFilePath(toFilePath)
         
+        
+        //方法一
+        let tempDocument = PDFDocument()
+        for i in 0..<drawPages.count {
+            let page = drawPages[i]
+            page.drawPageBlock = { [unowned self] box, context, pages in
+                self.drawPageToContext(context, page, printModel)
+            }
+            tempDocument.insert(page, at: i)
+        }
+        
+        return tempDocument
+//        let isSuccess = tempDocument.write(toFile: filePath)
+//        if isSuccess {
+//            print("保存成功")
+//        } else {
+//            print("保存失败")
+//        }
+        
         /**
-         绘制每张纸的内容
+         //方法二
+         /**
+          绘制每张纸的内容
+          */
+         //创建画布
+         let context: CGContext = self.createContext(filePath, paperSize)
+         for drawPage in drawPages {
+             context.beginPDFPage(nil)
+             self.drawPageToContext(context, drawPage, printModel)
+             context.endPDFPage()
+         }
+         context.closePDF()
          */
-        //创建画布
-        let context: CGContext = self.createContext(filePath, paperSize)
-        for drawPage in drawPages {
-            context.beginPDFPage(nil)
-            self.drawPageToContext(context, drawPage, printModel)
-            context.endPDFPage()
-        }
-        context.closePDF()
         
-        return filePath
+//        return filePath
     }
     
     
@@ -125,7 +147,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      @param pageOfPaperCount 每张纸的page数量
      @param pages 所有page数量
      */
-    func fetchDrawPages(_ paperSize: CGSize, _ pageModel: KMPrintPageModel,_ paperCount: Int, _ pageOfPaperCount: Int, _ pages: [KMPrintDrawPage]) -> [[KMPrintDrawPage]] {
+    func fetchDrawPages(_ paperSize: CGSize, _ pageModel: KMPrintPageModel,_ paperCount: Int, _ pageOfPaperCount: Int, _ pages: [KMPrintDrawPage]) -> [KMPrintDrawPage] {
         guard pages.count != 0 else {
             return []
         }
@@ -140,7 +162,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
             }
         }
         
-        var drawPages:[[KMPrintDrawPage]] = []
+        var drawPages:[KMPrintDrawPage] = []
         for i in 0..<paperCount {
             //获取多页page
             var tempPags: [KMPrintDrawPage] = []
@@ -200,7 +222,9 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
                 page2.showRect = pageShowRect2
                 tempPags.append(page2)
                 
-                drawPages.append(tempPags)
+                let drawPage = KMPrintDrawPage()
+                drawPage.pages = tempPags
+                drawPages.append(drawPage)
             } else {
                 for j in 0..<pageOfPaperCount {
                     let pageIndex = i / pageRepetitionCount
@@ -222,7 +246,9 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
                         tempPags.append(drawPage)
                     }
                 }
-                drawPages.append(tempPags)
+                let drawPage = KMPrintDrawPage()
+                drawPage.pages = tempPags
+                drawPages.append(drawPage)
             }
         }
         
@@ -259,15 +285,15 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      @param selectPages 当type 为custom时  传入选中page的下标
      */
     static func creatDocument(_ url: URL) -> CPDFDocument {
-        if FileManager.default.fileExists(atPath: NSTemporaryDirectory() + "/PDFReaderProTest") {
-            try?FileManager.default.createDirectory(atPath: NSTemporaryDirectory() + "/PDFReaderProTest", withIntermediateDirectories: true)
+        if !FileManager.default.fileExists(atPath: url.path) {
+            FileManager.default.createFile(atPath: url.path, contents: nil)
         }
         
         
         let document = CPDFDocument(url: url)!
 //        document.importPages(IndexSet(integer: 0), from: document, at: 0)
         let count = document.pageCount
-        for _ in 0...(count - 1) {
+        for _ in 0..<count {
             document.removePage(at: 0)
         }
         return document
@@ -281,6 +307,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      @param selectPages 当type 为custom时  传入选中page的下标
      */
     func fetchPages(_ documentURL: URL, _ pageModel: KMPrintPageModel) -> [KMPrintDrawPage] {
+//        let document = CPDFDocument.init(url: documentURL)!
         let document = PDFDocument.init(url: documentURL)!
         document.unlock(withPassword: password)
         var pageIndexs: [Int] = []
@@ -291,20 +318,20 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
         switch range.type {
         case .allPage:
             for index in 0...document.pageCount - 1 {
-                pageIndexs.append(index)
+                pageIndexs.append(Int(index))
             }
     
         case .evenPage:
             for index in 0...document.pageCount - 1 {
                 if index % 2 == 0 {
-                    pageIndexs.append(index)
+                    pageIndexs.append(Int(index))
                 }
             }
             
         case .oddPage:
             for index in 0...document.pageCount - 1 {
                 if index % 2 != 0 {
-                    pageIndexs.append(index)
+                    pageIndexs.append(Int(index))
                 }
             }
             
@@ -341,6 +368,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      */
     func dealPageContent (_ contentType: KMPrintContentType, _ pages: [KMPrintDrawPage]) -> Void {
         for page in pages {
+//            let annoations: [CPDFAnnotation] = page.page.annotations
             let annoations: [PDFAnnotation] = page.page.annotations
             //内容处理
             switch contentType {
@@ -389,7 +417,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
      @param context
      @pages page数组 [CPDFPage]
      */
-    func drawPageToContext(_ context: CGContext, _ pages: [KMPrintDrawPage], _ data: KMPrintModel, _ drawPageRect: CGRect = NSZeroRect) {
+    func drawPageToContext(_ context: CGContext, _ drawPage: KMPrintDrawPage, _ data: KMPrintModel, _ drawPageRect: CGRect = NSZeroRect) {
         //左下角有坐标系原点
         /**
          paper
@@ -415,9 +443,9 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
         for i in 0..<Int(columnAndRow.x) {
             for j in 0..<(Int(columnAndRow.y)) {
                 let index = j + i * Int(columnAndRow.y)
-                if index < pages.count {
+                if index < drawPage.pages.count {
                     //参数
-                    let page: KMPrintDrawPage = pages[index]
+                    let page: KMPrintDrawPage = drawPage.pages[index]
                     let rect = page.showRect
                     //裁剪当前Page
                     page.page.setBounds(page.cropRect, for: .cropBox)
@@ -474,6 +502,8 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
                     //缩放
                     context.scaleBy(x: CGFloat(scale), y: CGFloat(scale))
                     
+//                    page.page.draw(with: CPDFDisplayBox.cropBox, to: context)
+//                    page.page.transform(context, for: CPDFDisplayBox.cropBox)
                     page.page.draw(with: PDFDisplayBox.cropBox, to: context)
                     page.page.transform(context, for: PDFDisplayBox.cropBox)
                     if border {
@@ -1135,13 +1165,13 @@ protocol KMPrintPresenterProtocol: NSObject {
 //MARK: 渲染单页
 extension KMPrintPresenter {
     static func drawPage(context: CGContext, page: PDFPage, model: KMPrintModel) {
-        let drawPage = KMPrintDrawPage()
-        drawPage.page = page
-        drawPage.cropRect = page.bounds(for: .cropBox)
-        drawPage.showRect = page.bounds(for: .cropBox)
-        let prinsenter = KMPrintPresenter()
-        prinsenter.printData = model
-        prinsenter.drawTestPage(context, model, [drawPage])
+//        let drawPage = KMPrintDrawPage()
+//        drawPage.page = page
+//        drawPage.cropRect = page.bounds(for: .cropBox)
+//        drawPage.showRect = page.bounds(for: .cropBox)
+//        let prinsenter = KMPrintPresenter()
+//        prinsenter.printData = model
+//        prinsenter.drawTestPage(context, model, [drawPage])
     }
     
     func drawTestPage(_ context: CGContext,
@@ -1150,16 +1180,16 @@ extension KMPrintPresenter {
         /**
          参数
          */
-        //纸张大小
-        let paperSize: CGSize = self.fetchPaperSize(printModel.paper)
-        //总页数
-        let paperCount: Int = self.fetchTotalPaperCount(paperSize, pages, printModel.page)
-        //每页page数
-        let pageOfPaperCount: Int = self.fetchPageOfPaper(printModel.page)
-        //获取每张纸的page
-        let drawPages: [[KMPrintDrawPage]] = self.fetchDrawPages(paperSize, printModel.page, paperCount, pageOfPaperCount, pages)
-        
-        
-        self.drawPageToContext(context, drawPages.first!, printModel)
+//        //纸张大小
+//        let paperSize: CGSize = self.fetchPaperSize(printModel.paper)
+//        //总页数
+//        let paperCount: Int = self.fetchTotalPaperCount(paperSize, pages, printModel.page)
+//        //每页page数
+//        let pageOfPaperCount: Int = self.fetchPageOfPaper(printModel.page)
+//        //获取每张纸的page
+//        let drawPages: [[KMPrintDrawPage]] = self.fetchDrawPages(paperSize, printModel.page, paperCount, pageOfPaperCount, pages)
+//        
+//        
+//        self.drawPageToContext(context, drawPages.first!, printModel)
     }
 }

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.swift

@@ -31,9 +31,9 @@ class KMPrintPreviewView: KMBaseXibView {
     }
     
     private lazy var presenter: KMPrintPreviewPresenter = KMPrintPreviewPresenter()
-    var pdfDocument: CPDFDocument? {
+    var pdfDocument: PDFDocument? {
         didSet {
-            self.previewView.document = PDFDocument(url: pdfDocument!.documentURL)
+            self.previewView.document = pdfDocument //PDFDocument(url: pdfDocument!.documentURL)
             self.previewView.document?.unlock(withPassword: password)
             self.previewView.autoScales = true
             self.previewView.displayMode = .singlePage

+ 12 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFDocumentExtensions/CPDFDocument+KMExtension.swift

@@ -171,4 +171,16 @@ extension CPDFDocument {
          
          */
     }
+    
+    func allowsNotes() -> Bool {
+//        return [self isLocked] == NO &&
+//        ([self respondsToSelector:@selector(allowsCommenting)] == NO || [self allowsCommenting]);
+        if self.isLocked {
+            return false
+        }
+        if self.allowsCommenting {
+            return true
+        }
+        return false
+    }
 }

+ 9 - 32
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Action.swift

@@ -192,6 +192,9 @@ extension KMLeftSideViewController {
     }
     
     @IBAction func search(_ sender: NSSearchField) {
+        if sender.stringValue.isEmpty {
+            self.applySearchTableHeader("")
+        }
         self.delegate?.searchAction?(searchString: sender.stringValue, isCase: self.mwcFlags.caseInsensitiveSearch == 1)
     }
 }
@@ -331,8 +334,7 @@ extension KMLeftSideViewController: NSMenuDelegate {
                         selections.append(data.selection)
                     }
                 }
-//                if ([pdfView hideNotes] == NO && [[self pdfDocument] allowsNotes]) {
-                if self.listView.hideNotes == false {
+                if self.listView.hideNotes == false && self.listView.allowsNotes() {
                     item = menu.addItem(withTitle: KMLocalizedString("Add New Circle", "Menu item title"), action: #selector(addAnnotationsForSelections), target: self, tag: CAnnotationType.circle.rawValue)
                     item?.representedObject = selections
                     item = menu.addItem(withTitle: KMLocalizedString("Add New Rectangle", "Menu item title"), action: #selector(addAnnotationsForSelections), target: self, tag: CAnnotationType.square.rawValue)
@@ -365,8 +367,7 @@ extension KMLeftSideViewController: NSMenuDelegate {
                 item = menu.addItem(title: KMLocalizedString("Select", "Menu item title"), action: #selector(selectSelections), target: self)
                 item?.representedObject = selections
                 menu.addItem(.separator())
-//                if ([pdfView hideNotes] == NO && [[self pdfDocument] allowsNotes]) {
-                if self.listView.hideNotes == false {
+                if self.listView.hideNotes == false && self.listView.allowsNotes() {
                     item = menu.addItem(withTitle: KMLocalizedString("Add New Circle", "Menu item title"), action: #selector(addAnnotationsForSelections), target: self, tag: CAnnotationType.circle.rawValue)
                     item?.representedObject = selections
                     item = menu.addItem(withTitle: KMLocalizedString("Add New Rectangle", "Menu item title"), action: #selector(addAnnotationsForSelections), target: self, tag: CAnnotationType.square.rawValue)
@@ -452,8 +453,7 @@ extension KMLeftSideViewController: NSMenuDelegate {
                 item?.representedObject = items
                 
                 menu.addItem(.separator())
-                if self.listView.hideNotes == false {
-                    //                                if ([pdfView hideNotes] == NO && [items count] == 1) {
+                if self.listView.hideNotes == false && (items?.count ?? 0) == 1 {
                     let annotation = self.noteItems(items!).lastObject as? CPDFAnnotation
                     if let data = annotation?.isEditable(), data {
                         if annotation?.type == nil {
@@ -643,18 +643,6 @@ extension KMLeftSideViewController: NSMenuItemValidation {
         //            return [self interactionMode] != SKPresentationMode && [[self pdfDocument] isLocked] == NO && [pdfView toolMode] == SKSelectToolMode;
         //        } else if (action == @selector(takeSnapshot:)) {
         //            return [[self pdfDocument] isLocked] == NO;
-        //        } else if (action == @selector(toggleLeftSidePane:)) {
-        //            if ([self leftSidePaneIsOpen])
-        //                [menuItem setTitle:NSLocalizedString(@"Hide Panel", @"Menu item title")];
-        //            else
-        //                [menuItem setTitle:NSLocalizedString(@"Show Panel", @"Menu item title")];
-        //            return YES;
-        //        } else if (action == @selector(toggleRightSidePane:)) {
-        //            if ([self rightSidePaneIsOpen])
-        //                [menuItem setTitle:NSLocalizedString(@"Hide Notes Pane", @"Menu item title")];
-        //            else
-        //                [menuItem setTitle:NSLocalizedString(@"Show Notes Pane", @"Menu item title")];
-        //            return [self interactionMode] != SKPresentationMode;
         //        } else if (action == @selector(changeLeftSidePaneState:)) {
         //            [menuItem setState:mwcFlags.leftSidePaneState == (SKLeftSidePaneState)[menuItem tag] ? (([leftSideController.findTableView window] || [leftSideController.groupedFindTableView window]) ? NSMixedState : NSOnState) : NSOffState];
         //            return (SKLeftSidePaneState)[menuItem tag] == SKSidePaneStateThumbnail || [[pdfView document] outlineRoot];
@@ -713,7 +701,8 @@ extension KMLeftSideViewController: NSMenuItemValidation {
         //            return [[self pdfDocument] pageCount] > 1;
         //        } else
         if (action == #selector(toggleCaseInsensitiveSearch)) {
-            menuItem.state = self.mwcFlags.caseInsensitiveSearch == 1 ? .on : .off
+            let state = UserDefaults.standard.integer(forKey: SKCaseInsensitiveSearchKey)
+            menuItem.state = state == 1 ? .on : .off
             return true
         } else if (action == #selector(toggleWholeWordSearch)) {
             menuItem.state = self.mwcFlags.wholeWordSearch == 1 ? .on : .off
@@ -753,9 +742,6 @@ extension KMLeftSideViewController: NSMenuItemValidation {
         //            return ([self.pdfView toolMode] == SKTextToolMode || [self.pdfView toolMode] == SKNoteToolMode) && [self.pdfView hideNotes] == NO && [self.pdfView.document isLocked] == NO && [[self.pdfView currentSelection] hasCharacters];
         //        } else if (action == @selector(deletePage:)) {
         //            return self.pdfView.document.pageCount > 1 ? YES : NO;
-        //        } else if (action == @selector(toggleAutoFlow:)) {
-        //            [menuItem setState:[self.pdfView isAutoFlow] ? NSOnState : NSOffState];
-        //            return YES;
         //        } else if (action == @selector(themesColor:)){
         //            if (KMPDFViewModeNormal== self.pdfView.viewMode) {
         //                [menuItem setState:(menuItem.tag == 0)?NSOnState:NSOffState];
@@ -794,15 +780,6 @@ extension KMLeftSideViewController: NSMenuItemValidation {
         //                return YES;
         //            }
         //        } else
-        //        if (action == @selector(splitViewAction:)){
-        //            if (KMPDFViewSplitModeHorizontal == self.pdfView.viewSplitMode) {
-        //                [menuItem setState:(menuItem.tag == 0)?NSOnState:NSOffState];
-        //            } else if (KMPDFViewSplitModeVertical == self.pdfView.viewSplitMode) {
-        //                [menuItem setState:(menuItem.tag == 1)?NSOnState:NSOffState];
-        //            } else if (KMPDFViewSplitModeDisable == self.pdfView.viewSplitMode) {
-        //                [menuItem setState:(menuItem.tag == 2)?NSOnState:NSOffState];
-        //            }
-        //        } else
         if (action == #selector(outlineContextMenuItemClicked_AddEntry) ||
             action == #selector(outlineContextMenuItemClicked_AddChildEntry) ||
             action == #selector(outlineContextMenuItemClicked_AddAuntEntry) ||
@@ -1087,7 +1064,7 @@ extension KMLeftSideViewController: NSTextFieldDelegate {
                     }
                 }
                 self.renamePDFOutline(editPDFOutline, label: textField.stringValue)
-//                [self updateSelectRowHeight];
+                self.updateSelectRowHeight()
                 self.tocOutlineView.reloadData()
             }
         }

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -72,7 +72,7 @@ extension KMLeftSideViewController {
         self.noteOutlineView.noteDelegate = self
         self.noteOutlineView.menu = NSMenu()
         self.noteOutlineView.menu?.delegate = self
-//        [noteOutlineView setTypeSelectHelper:[SKTypeSelectHelper typeSelectHelperWithMatchOption:SKSubstringMatch]];
+        self.noteOutlineView.typeSelectHelper = SKTypeSelectHelper(matchOption: .SKSubstringMatch)
         
         self.noteOutlineView.registerForDraggedTypes(NSColor.readableTypes(for: NSPasteboard(name: .drag)))
         self.noteOutlineView.target = self

+ 64 - 18
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Outline.swift

@@ -86,11 +86,10 @@ extension KMLeftSideViewController {
     }
     
     func updateOutlineSelection() {
-//        if ([[pdfView document] outlineRoot] == nil || mwcFlags.updatingOutlineSelection)
-        if self.listView.document.outlineRoot() == nil {
+        if self.listView.document.outlineRoot() == nil || self.updatingOutlineSelection {
             return
         }
-//        mwcFlags.updatingOutlineSelection = YES;
+        self.updatingOutlineSelection = true
         let numRows = self.tocOutlineView.numberOfRows
         
         var arr = NSMutableArray()
@@ -125,7 +124,7 @@ extension KMLeftSideViewController {
         if (!hasExistInOutlineView) {
             self.tocOutlineView.deselectRow(self.tocOutlineView.selectedRow)
         }
-//        mwcFlags.updatingOutlineSelection = NO;
+        self.updatingOutlineSelection = false
     }
      
     func newAddOutlineEntryEditingMode(_ index: Int) {
@@ -330,6 +329,48 @@ extension KMLeftSideViewController {
             self.tocOutlineView.reloadData()
         }
     }
+    
+    func updateSelectRowHeight() {
+        var rowHeight: CGFloat = 0
+        let outline: CPDFOutline? = self.tocOutlineView.km.selectedItem()
+        if outline == nil {
+            return
+        }
+        var attributedString = NSMutableAttributedString()
+        var dictAttr1 = [NSAttributedString.Key.font : KMAppearance.Layout.h0Color()]
+        var attr1 = NSAttributedString(string: outline!.label, attributes: dictAttr1)
+        attributedString.append(attr1)
+
+        let row = self.tocOutlineView.selectedRow
+        let viewS = self.tocOutlineView.view(atColumn: 0, row: row, makeIfNecessary: true)
+        let tableColumn = self.tocOutlineView.tableColumn(withIdentifier: kLabelColumnId)
+//    //    id cell = [tableColumn dataCell];
+        let cell = tableColumn?.dataCell(forRow: row)
+        (cell as? NSCell)?.objectValue = attributedString
+//        CGFloat w = leftSideController.view.frame.size.width - 86;//[tableColumn width] > 260 ? [tableColumn width] : 260;
+        let w = self.view.frame.size.width-86
+
+        let num = self.getNum(outline)
+        let gap = self.tocOutlineView.indentationPerLevel
+        rowHeight = ((cell as? NSCell)?.cellSize(forBounds: NSMakeRect(0, 0, w - (num > 0 ? 16 : 0) - gap * num.cgFloat, CGFLOAT_MAX)).height) ?? 0
+        rowHeight = fmax(rowHeight, self.tocOutlineView.rowHeight) + 25
+//        [rowHeights setFloat:rowHeight forKey:outline];
+        var fram = viewS?.frame ?? .zero
+        viewS?.frame = NSMakeRect(fram.origin.x, fram.origin.y, fram.size.width, rowHeight)
+        self.tocOutlineView.reloadData()
+    }
+    
+    func getNum(_ ol: CPDFOutline?) -> Int {
+        var num = 0
+        var outline = ol?.parent
+        repeat {
+            outline = outline?.parent
+            if outline != nil {
+                num += 1
+            }
+        } while outline != nil
+        return num
+    }
 }
 
 // MARK: - Undo & Redo
@@ -632,20 +673,25 @@ extension KMLeftSideViewController {
 // MARK: - KMTocOutlineViewDelegate
 
 extension KMLeftSideViewController: KMTocOutlineViewDelegate {
-//    func outlineView(_ anOutlineView: NSOutlineView, highlightLevelForRow row: Int) -> Int {
-//        if ([ov isEqual:leftSideController.tocOutlineView]) {
-//            NSInteger numRows = [ov numberOfRows];
-//            NSUInteger firstPage = [[[ov itemAtRow:row] page] pageIndex];
-//            NSUInteger lastPage = row + 1 < numRows ? [[[ov itemAtRow:row + 1] page] pageIndex] : [[self pdfDocument] pageCount];
-//            NSRange range = NSMakeRange(firstPage, MAX(1LU, lastPage - firstPage));
-//            NSUInteger i, iMax = [lastViewedPages count];
-//            for (i = 0; i < iMax; i++) {
-//                if (NSLocationInRange((NSUInteger)[lastViewedPages pointerAtIndex:i], range))
-//                    return i;
-//            }
-//        }
-//        return NSNotFound;
-//    }
+    func outlineView(_ anOutlineView: NSOutlineView, highlightLevelForRow row: Int) -> Int {
+        if self.tocOutlineView.isEqual(to: anOutlineView) {
+            let numRows = anOutlineView.numberOfRows
+            if let outline = anOutlineView.item(atRow: row) as? CPDFOutline {
+                let firstPage = outline.km_pageIndex
+                var lastPage = self.listView.document.pageCount
+                if row + 1 < numRows {
+                    lastPage = (anOutlineView.item(atRow: row + 1) as? CPDFOutline)?.km_pageIndex ?? UInt(NSNotFound)
+                }
+                //            NSRange range = NSMakeRange(firstPage, MAX(1LU, lastPage - firstPage));
+                //            NSUInteger i, iMax = [lastViewedPages count];
+                //            for (i = 0; i < iMax; i++) {
+                //                if (NSLocationInRange((NSUInteger)[lastViewedPages pointerAtIndex:i], range))
+                //                    return i;
+                //            }
+            }
+        }
+        return NSNotFound
+    }
     
     func outlineView(_ anOutlineView: NSOutlineView, imageContextForItem item: Any?) -> AnyObject? {
         if anOutlineView.isEqual(to: self.tocOutlineView) {

+ 28 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Search.swift

@@ -7,6 +7,30 @@
 
 import Foundation
 
+private let _kRelevanceColumnId = NSUserInterfaceItemIdentifier(rawValue: "relevance")
+
+// MARK: - Methods
+
+extension KMLeftSideViewController {
+    func applySearchTableHeader(_ message: String) {
+        self.findTableView.tableColumn(withIdentifier: kResultsColumnId)?.headerCell.stringValue = message
+        self.findTableView.headerView?.needsDisplay = true
+        self.groupedFindTableView.tableColumn(withIdentifier: _kRelevanceColumnId)?.headerCell.stringValue = message
+        self.groupedFindTableView.headerView?.needsDisplay = true
+    }
+    
+    func documentDidBeginFind() {
+//        [leftSideController applySearchTableHeader:[NSLocalizedString(@"Searching", @"Message in search table header") stringByAppendingEllipsis]];
+        self.applySearchTableHeader(KMLocalizedString("Searching", "Message in search table header"))
+        self.searchResults = []
+        self.groupSearchResults = []
+    }
+    
+    func documentDidEndFind() {
+        self.applySearchTableHeader(KMLocalizedString("\(self.searchResults.count) Results", "Message in search table header"))
+    }
+}
+
 // MARK: - Actions
 
 extension KMLeftSideViewController {
@@ -41,6 +65,10 @@ extension KMLeftSideViewController {
     func search_initDefalutValue() {
         self.findTableView.backgroundColor = KMAppearance.Layout.l0Color()
         self.groupedFindTableView.backgroundColor = KMAppearance.Layout.l0Color()
+        
+        self.findTableView.tableColumn(withIdentifier: kPageColumnId)?.headerCell.title = KMLocalizedString("Page", "Table header title")
+        self.groupedFindTableView.tableColumn(withIdentifier: kPageColumnId)?.headerCell.title = KMLocalizedString("Page", "Table header title")
+        (self.groupedFindTableView.tableColumn(withIdentifier: _kRelevanceColumnId)?.dataCell as? NSCell)?.isEnabled = false
     }
 }
 

+ 191 - 238
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -33,6 +33,9 @@ class KMLeftSideViewController: KMSideViewController {
     var selectPages: [Int]?
     open weak var delegate: KMLeftSideViewControllerDelegate?
     
+    let noteColumnId = NSUserInterfaceItemIdentifier(rawValue: "note")
+    let authorColumnId = NSUserInterfaceItemIdentifier(rawValue: "author")
+    
     deinit {
         KMPrint("KMLeftSideViewController deinit.")
         
@@ -88,7 +91,6 @@ class KMLeftSideViewController: KMSideViewController {
          NSArrayController *findArrayController;
          NSArrayController *groupedFindArrayController;
      }
-     - (void)applySearchTableHeader:(NSString *)message;
      */
     
     @IBOutlet var segmentedControl: KMSegmentedControl!
@@ -257,6 +259,8 @@ class KMLeftSideViewController: KMSideViewController {
     
     private var _dragPDFOutline: CPDFOutline?
     
+    var updatingOutlineSelection = false
+    
     override func loadView() {
         super.loadView()
         
@@ -362,11 +366,6 @@ class KMLeftSideViewController: KMSideViewController {
 //        //支持拖拽的文字类型
 
 //        [tocOutlineView setTypeSelectHelper:[SKTypeSelectHelper typeSelectHelperWithMatchOption:SKSubstringMatch]];
-        
-//        [[[findTableView tableColumnWithIdentifier:PAGE_COLUMNID] headerCell] setTitle:NSLocalizedString(@"Page", @"Table header title")];
-//        [[[groupedFindTableView tableColumnWithIdentifier:PAGE_COLUMNID] headerCell] setTitle:NSLocalizedString(@"Page", @"Table header title")];
-//        [[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] dataCell] setEnabled:NO];
-        
 //        NSSortDescriptor *countDescriptor = [[[NSSortDescriptor alloc] initWithKey:SKGroupedSearchResultCountKey ascending:NO] autorelease];
 //        [groupedFindArrayController setSortDescriptors:[NSArray arrayWithObjects:countDescriptor, nil]];
         
@@ -571,10 +570,10 @@ class KMLeftSideViewController: KMSideViewController {
         frame.size.height = self.snapshotTableView.enclosingScrollView?.superview?.frame.size.height ?? 0
         self.snapshotTableView.enclosingScrollView?.frame = frame
         
-//        frame = rightSideController.noteOutlineView.enclosingScrollView.frame;
-//        frame.origin.y = 0;
-//        frame.size.height = rightSideController.noteOutlineView.enclosingScrollView.superview.frame.size.height;
-//        rightSideController.noteOutlineView.enclosingScrollView.frame = frame;
+        frame = self.noteOutlineView.enclosingScrollView?.frame ?? .zero
+        frame.origin.y = 0
+        frame.size.height = self.noteOutlineView.enclosingScrollView?.superview?.frame.size.height ?? 0
+        self.noteOutlineView.enclosingScrollView?.frame = frame
         
         frame = self.tocOutlineView.enclosingScrollView?.frame ?? .zero
         frame.origin.y = 0
@@ -671,15 +670,6 @@ class KMLeftSideViewController: KMSideViewController {
         self.snapshotSearchField.delegate = self
     }
     
-    /*
-     - (void)applySearchTableHeader:(NSString *)message {
-         [[[findTableView tableColumnWithIdentifier:RESULTS_COLUMNID] headerCell] setStringValue:message];
-         [[findTableView headerView] setNeedsDisplay:YES];
-         [[[groupedFindTableView tableColumnWithIdentifier:RELEVANCE_COLUMNID] headerCell] setStringValue:message];
-         [[groupedFindTableView headerView] setNeedsDisplay:YES];
-     }
-     */
-    
     func resetThumbnails() {
 //        [self willChangeValueForKey:THUMBNAILS_KEY];
 //        self.thumbnailCacheSize = 160
@@ -1249,10 +1239,10 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
         } else if (tableView.isEqual(to: self.findTableView)) {
             let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMFindTableviewCell"), owner: self) as! KMFindTableviewCell
              let selection = searchResults[row]
-            if let data = tableColumn?.identifier.rawValue, data == "results" {
+            if let data = tableColumn?.identifier.rawValue, data == kResultsColumnId.rawValue {
                 cell.resultLabel.attributedStringValue = selection.attributedString
                 cell.resultLabel.textColor = KMAppearance.Layout.h0Color()
-            } else if let data = tableColumn?.identifier.rawValue, data == "page" {
+            } else if let data = tableColumn?.identifier.rawValue, data == kPageColumnId.rawValue {
                 cell.resultLabel.stringValue = "\(Int(selection.selection.page?.pageIndex() ?? 0) + 1)"
                 cell.resultLabel.textColor = KMAppearance.Layout.h2Color()
             }
@@ -1375,13 +1365,11 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
         
     }
     func tableViewSelectionDidChange(_ notification: Notification) {
-//        if ([[aNotification object] isEqual:leftSideController.findTableView] || [[aNotification object] isEqual:leftSideController.groupedFindTableView]) {
-//            [self updateFindResultHighlightsForDirection:NSDirectSelection];
-//
-//            if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
-//                [self hideLeftSideWindow];
-//        } else
         if self.findTableView.isEqual(to: notification.object) {
+            //            [self updateFindResultHighlightsForDirection:NSDirectSelection];
+            //
+            //            if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
+            //                [self hideLeftSideWindow];
             let row = self.findTableView.selectedRow
             if row >= 0 {
                 let model = self.searchResults[row]
@@ -1391,6 +1379,11 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                     self.listView.setNeedsDisplayAnnotationViewForVisiblePages()
                 }
             }
+        } else if self.groupedFindTableView.isEqual(to: notification.object) {
+            //            [self updateFindResultHighlightsForDirection:NSDirectSelection];
+            //
+            //            if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
+            //                [self hideLeftSideWindow];
         } else if self.thumbnailTableView.isEqual(to: notification.object) {
 //            if (mwcFlags.updatingThumbnailSelection == 0) {
             let row = self.thumbnailTableView.selectedRow
@@ -1754,42 +1747,40 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                         self._copysPages.append(page)
                     }
                 }
-    //            NSData *tiffData = [page TIFFDataForRect:[page boundsForBox:[pdfView displayBox]]];
-    //            NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-    //            NSPasteboardItem *pboardItem = [[[NSPasteboardItem alloc] init] autorelease];
-    //            if ([[pdfView document] allowsPrinting])
-    //                [pboardItem setData:[page dataRepresentation] forType:NSPasteboardTypePDF];
-    //            [pboardItem setData:tiffData forType:NSPasteboardTypeTIFF];
-    //            [pboard clearContents];
-    //            [pboard writeObjects:[NSArray arrayWithObjects:pboardItem, nil]];
-            }
-        }
-//        else if ([tv isEqual:leftSideController.findTableView]) {
-//            NSMutableString *string = [NSMutableString string];
-//            [rowIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
-//                PDFSelection *match = [searchResults objectAtIndex:idx];
-//                [string appendString:@"* "];
+            }
+        } else if aTableView.isEqual(to: self.findTableView) {
+            var string = ""
+            for idx in rowIndexes {
+                let match = self.searchResults[idx].selection
+                string.append("* ")
 //                [string appendFormat:NSLocalizedString(@"Page %@", @""), [match firstPageLabel]];
-//                [string appendFormat:@": %@\n", [[match contextString] string]];
-//            }];
-//            NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-//            [pboard clearContents];
-//            [pboard writeObjects:[NSArray arrayWithObjects:string, nil]];
-//        } else if ([tv isEqual:leftSideController.groupedFindTableView]) {
-//            NSMutableString *string = [NSMutableString string];
-//            [rowIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
-//                SKGroupedSearchResult *result = [groupedSearchResults objectAtIndex:idx];
-//                NSArray *matches = [result matches];
-//                [string appendString:@"* "];
-//                [string appendFormat:NSLocalizedString(@"Page %@", @""), [[result page] displayLabel]];
-//                [string appendString:@": "];
-//                [string appendFormat:NSLocalizedString(@"%ld Results", @""), (long)[matches count]];
+                string = string.appendingFormat(KMLocalizedString("Page %@", ""), "\(match.safeFirstPage()?.pageIndex() ?? 0)")
+//                [string appendFormat:@"", [[match contextString] string]];
+                string = string.appendingFormat(": %@\n", match.string() ?? "")
+            }
+            let pboard = NSPasteboard.general
+            pboard.clearContents()
+            pboard.writeObjects([string as NSPasteboardWriting])
+        } else if aTableView.isEqual(to: self.groupedFindTableView) {
+            var string = ""
+            for idx in rowIndexes {
+                let result = self.groupSearchResults[idx]
+                let matches = result.datas
+                string.append("* ")
+                string = string.appendingFormat(KMLocalizedString("Page %@", ""), "\(result.selectionPageIndex)")
+                string.append(": ")
+                string = string.appendingFormat(KMLocalizedString("%ld Results", ""), matches.count)
 //                [string appendFormat:@":\n\t%@\n", [[matches valueForKeyPath:@"contextString.string"] componentsJoinedByString:@"\n\t"]];
-//            }];
-//            NSPasteboard *pboard = [NSPasteboard generalPasteboard];
-//            [pboard clearContents];
-//            [pboard writeObjects:[NSArray arrayWithObjects:string, nil]];
-//        }
+                var tmpString = ""
+                for model in matches {
+                    tmpString.append("\(model.selection.string() ?? "")")
+                }
+                string = string.appendingFormat(":\n\t%@\n", tmpString)
+            }
+            let pboard = NSPasteboard.general
+            pboard.clearContents()
+            pboard.writeObjects([string as NSPasteboardWriting])
+        }
     }
     
     func tableView(_ tableView: NSTableView, namesOfPromisedFilesDroppedAtDestination dropDestination: URL, forDraggedRowsWith indexSet: IndexSet) -> [String] {
@@ -1863,15 +1854,13 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
         }
     }
     
+    func tableView(_ tableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor]) {
+        if tableView.isEqual(to: self.groupedFindTableView) {
+//            [leftSideController.groupedFindArrayController setSortDescriptors:[tv sortDescriptors]];
+        }
+    }
+    
     /*
-     #pragma mark dragging
-
-     - (void)tableView:(NSTableView *)tv sortDescriptorsDidChange:(NSArray *)oldDescriptors {
-         if ([tv isEqual:leftSideController.groupedFindTableView]) {
-             [leftSideController.groupedFindArrayController setSortDescriptors:[tv sortDescriptors]];
-         }
-     }
-
      #pragma mark NSTableView delegate protocol
 
      - (void)tableView:(NSTableView *)tv shareRowsWithIndexes:(NSIndexSet *)rowIndexes {
@@ -2800,13 +2789,15 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
     }
     
     func outlineViewSelectionDidChange(_ notification: Notification) {
+        
         if self.tocOutlineView.isEqual(to: notification.object) {
-//        if ([[notification object] isEqual:leftSideController.tocOutlineView] && (mwcFlags.updatingOutlineSelection == 0)){
-//            mwcFlags.updatingOutlineSelection = 1;
-            self.goToSelectedOutlineItem(nil)
-//            mwcFlags.updatingOutlineSelection = 0;
-//            if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
-//                [self hideLeftSideWindow];
+            if self.updatingOutlineSelection == false {
+                self.updatingOutlineSelection = true
+                self.goToSelectedOutlineItem(nil)
+                self.updatingOutlineSelection = false
+                //            if ([self interactionMode] == SKPresentationMode && [[NSUserDefaults standardUserDefaults] boolForKey:SKAutoHidePresentationContentsKey])
+                //                [self hideLeftSideWindow];
+            }
         }
     }
     
@@ -2827,9 +2818,6 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
         if outlineView.isEqual(to: self.noteOutlineView) {
             let pboard = info.draggingPasteboard
             if pboard.canReadObject(forClasses: [NSColor.self], options: [:]) && index == NSOutlineViewDropOnItemIndex {
-                //            if ([pboard canReadObjectForClasses:[NSArray arrayWithObject:[NSColor class]] options:[NSDictionary dictionary]] &&
-                //                anIndex == NSOutlineViewDropOnItemIndex && [(PDFAnnotation *)item type] != nil)
-                //                dragOp = NSDragOperationEvery;
                 if let note = item as? CPDFAnnotation, note.type != nil {
                     dragOp = .every
                 }
@@ -2941,61 +2929,85 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
         return false
     }
     
+    func outlineView(_ outlineView: NSOutlineView, willDisplayOutlineCell cell: Any, for tableColumn: NSTableColumn?, item: Any) {
+        if outlineView.isEqual(to: self.tocOutlineView) {
+            if outlineView.selectionHighlightStyle == .regular && outlineView.isRowSelected(outlineView.row(forItem: item)) {
+                (cell as? NSCell)?.backgroundStyle = .lowered
+            }
+        }
+    }
+    
+    func outlineView(_ outlineView: NSOutlineView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, byItem item: Any?) {
+        if outlineView.isEqual(to: self.noteOutlineView) {
+//            PDFAnnotation *note = item;
+            var note = item as? CPDFAnnotation
+            if note == nil && note is KMBOTAAnnotationItem {
+                note = (note as? KMBOTAAnnotationItem)?.annotation
+            }
+            if let data = note?.type, data.isEmpty == false {
+                if tableColumn?.identifier.rawValue == self.noteColumnId.rawValue {
+                    let string1 = (object as? String) ?? ""
+                    let string2 = note?.string() ?? ""
+                    if string1 != string2 {
+                        note?.setString(string1)
+                    }
+                } else if tableColumn?.identifier.rawValue == self.authorColumnId.rawValue {
+                    let string1 = (object as? String) ?? ""
+                    let string2 = note?.userName() ?? ""
+                    if string1 != string2 {
+                        note?.setUserName(string1)
+                    }
+                }
+            }
+        }
+    }
+    
+    func outlineView(_ outlineView: NSOutlineView, dataCellFor tableColumn: NSTableColumn?, item: Any) -> NSCell? {
+        if self.noteOutlineView.isEqual(to: outlineView) {
+            if tableColumn == nil {
+                if let anno = item as? CPDFAnnotation, anno.type == nil {
+                    return outlineView.tableColumn(withIdentifier: self.noteColumnId)?.dataCell(forRow: outlineView.row(forItem: item)) as? NSCell
+                }
+            }
+        }
+        return tableColumn?.dataCell(forRow: outlineView.row(forItem: item)) as? NSCell
+    }
+    
+    func outlineView(_ outlineView: NSOutlineView, shouldEdit tableColumn: NSTableColumn?, item: Any) -> Bool {
+        if outlineView.isEqual(to: self.noteOutlineView) {
+            if (tableColumn == nil) {
+                if self.listView.hideNotes == false {
+                    if let anno = item as? CPDFAnnotation, anno.isNote() {
+                        //                if ([pdfView hideNotes] == NO && [[(SKNoteText *)item note] isNote]) {
+                        //                    PDFAnnotation *annotation = [(SKNoteText *)item note];
+                        self.listView.scrollAnnotationToVisible(anno)
+                        self.listView.updateActiveAnnotations([anno])
+                        //                    [self showNote:annotation];
+                        //                    SKNoteWindowController *noteController = (SKNoteWindowController *)[self windowControllerForNote:annotation];
+                        //                    [[noteController window] makeFirstResponder:[noteController textView]];
+                        //                    [[noteController textView] selectAll:nil];
+                    }
+                }
+                return false
+            } else if tableColumn?.identifier.rawValue == self.noteColumnId.rawValue || tableColumn?.identifier.rawValue == self.authorColumnId.rawValue {
+                return true
+            }
+        }
+        return false
+    }
+    
+    func outlineView(_ outlineView: NSOutlineView, toolTipFor cell: NSCell, rect: NSRectPointer, tableColumn: NSTableColumn?, item: Any, mouseLocation: NSPoint) -> String {
+        if outlineView.isEqual(to: self.noteOutlineView) {
+            if tableColumn == nil || tableColumn?.identifier.rawValue == self.noteColumnId.rawValue {
+                return (item as? CPDFAnnotation)?.string() ?? ""
+            }
+        }
+        return ""
+    }
+    
     /*
-     #pragma mark NSOutlineView datasource protocol
-
-     - (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item{
-         if ([ov isEqual:rightSideController.noteOutlineView]) {
-             PDFAnnotation *note = item;
-             if ([note type]) {
-                 if ([[tableColumn identifier] isEqualToString:NOTE_COLUMNID]) {
-                     if ([(object ?: @"") isEqualToString:([note string] ?: @"")] == NO)
-                         [note setString:object];
-                 } else if ([[tableColumn identifier] isEqualToString:AUTHOR_COLUMNID]) {
-                     if ([(object ?: @"") isEqualToString:([note userName] ?: @"")] == NO)
-                         [note setUserName:object];
-                 }
-             }
-         }
-     }
 
      #pragma mark NSOutlineView delegate protocol
-
-     - (NSCell *)outlineView:(NSOutlineView *)ov dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
-         if ([ov isEqual:rightSideController.noteOutlineView] && tableColumn == nil && [(PDFAnnotation *)item type] == nil) {
-             return [[ov tableColumnWithIdentifier:NOTE_COLUMNID] dataCellForRow:[ov rowForItem:item]];
-         }
-         return [tableColumn dataCellForRow:[ov rowForItem:item]];
-     }
-
-     - (void)outlineView:(NSOutlineView *)ov willDisplayOutlineCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
-         if ([ov isEqual:leftSideController.tocOutlineView] &&
-             [ov selectionHighlightStyle] == NSTableViewSelectionHighlightStyleRegular &&
-             [ov isRowSelected:[ov rowForItem:item]]) {
-             [cell setBackgroundStyle:NSBackgroundStyleLowered];
-         }
-     }
-
-     - (BOOL)outlineView:(NSOutlineView *)ov shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item{
-         if ([ov isEqual:rightSideController.noteOutlineView]) {
-             if (tableColumn == nil) {
-                 if ([pdfView hideNotes] == NO && [[(SKNoteText *)item note] isNote]) {
-                     PDFAnnotation *annotation = [(SKNoteText *)item note];
-                     [pdfView scrollAnnotationToVisible:annotation];
-                     [pdfView setActiveAnnotation:annotation];
-                     [self showNote:annotation];
-                     SKNoteWindowController *noteController = (SKNoteWindowController *)[self windowControllerForNote:annotation];
-                     [[noteController window] makeFirstResponder:[noteController textView]];
-                     [[noteController textView] selectAll:nil];
-                 }
-                 return NO;
-             } else if ([[tableColumn identifier] isEqualToString:NOTE_COLUMNID] || [[tableColumn identifier] isEqualToString:AUTHOR_COLUMNID]) {
-                 return YES;
-             }
-         }
-         return NO;
-     }
-
      - (void)outlineView:(NSOutlineView *)ov didClickTableColumn:(NSTableColumn *)tableColumn {
          if ([ov isEqual:rightSideController.noteOutlineView]) {
              NSTableColumn *oldTableColumn = [ov highlightedTableColumn];
@@ -3034,16 +3046,6 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
          }
      }
 
-     - (NSString *)outlineView:(NSOutlineView *)ov toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation {
-         if ([ov isEqual:rightSideController.noteOutlineView] &&
-             (tableColumn == nil || [[tableColumn identifier] isEqualToString:NOTE_COLUMNID])) {
-             return [item string];
-         }
-         return @"";
-     }
-
-
-
      - (void)outlineViewColumnDidResize:(NSNotification *)notification{
          if (mwcFlags.autoResizeNoteRows &&
              [[notification object] isEqual:rightSideController.noteOutlineView] &&
@@ -3054,53 +3056,6 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
          }
      }
 
-     - (void)updateSelectRowHeight{
-         CGFloat rowHeight = 0;
-         PDFOutline *outline = [leftSideController.tocOutlineView itemAtRow:leftSideController.tocOutlineView.selectedRow];
-         if (!outline){
-             return;
-         }
-         NSMutableAttributedString *attributedString = [[[NSMutableAttributedString alloc]init] autorelease];
-         NSDictionary *dictAttr1 = @{NSForegroundColorAttributeName:[KMAppearance KMColor_Layout_H0]};
-         NSAttributedString *attr1 = [[NSAttributedString alloc]initWithString:outline.label attributes:dictAttr1];
-         [attributedString appendAttributedString:attr1];
-         
-         NSInteger *row = [leftSideController.tocOutlineView selectedRow];
-         NSTableCellView *viewS = [leftSideController.tocOutlineView viewAtColumn:0 row:row  makeIfNecessary:YES];
-         NSTableColumn *tableColumn = [leftSideController.tocOutlineView tableColumnWithIdentifier:LABEL_COLUMNID];
-     //    id cell = [tableColumn dataCell];
-         id cell = [tableColumn dataCellForRow:row];
-         [cell setObjectValue:attributedString];
-         CGFloat w = leftSideController.view.frame.size.width - 86;//[tableColumn width] > 260 ? [tableColumn width] : 260;
-         
-         NSInteger num = [self getNum:outline];
-         CGFloat gap = [leftSideController.tocOutlineView indentationPerLevel];
-         rowHeight = [cell cellSizeForBounds:NSMakeRect(0.0, 0.0, w - (num > 0?16:0) - gap*num, CGFLOAT_MAX)].height;
-         rowHeight = fmax(rowHeight, [leftSideController.tocOutlineView rowHeight]) + 25;
-         [rowHeights setFloat:rowHeight forKey:outline];
-         
-         if (@available(macOS 10.13, *)) {
-             
-         } else {
-             rowHeight = 40.0;
-         }
-         CGRect fram = viewS.frame;
-         viewS.frame = CGRectMake(fram.origin.x, fram.origin.y, fram.size.width, rowHeight);
-         [leftSideController.tocOutlineView reloadData];
-     }
-
-     - (NSInteger)getNum:(PDFOutline *)ol{
-         NSInteger num = 0;
-         PDFOutline *outLine = [ol parent];
-         do {
-             outLine = [outLine parent];
-             if (outLine){
-                 num ++;
-             }
-         } while (outLine);
-         return num;
-     }
-
      - (void)sizeOutlineViewToContents:(NSOutlineView*) outlineView;
      {
          NSInteger rowCount = [outlineView numberOfRows];
@@ -3155,56 +3110,6 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
          }
          return noteItems
      }
-    /*
-
-     - (NSArray *)outlineView:(NSOutlineView *)ov typeSelectHelperSelectionStrings:(SKTypeSelectHelper *)typeSelectHelper {
-         if ([ov isEqual:rightSideController.noteOutlineView]) {
-             NSInteger i, count = [rightSideController.noteOutlineView numberOfRows];
-             NSMutableArray *texts = [NSMutableArray arrayWithCapacity:count];
-             for (i = 0; i < count; i++) {
-                 id item = [rightSideController.noteOutlineView itemAtRow:i];
-                 NSString *string = [item string];
-                 [texts addObject:string ?: @""];
-             }
-             return texts;
-         } else if ([ov isEqual:leftSideController.tocOutlineView]) {
-             NSInteger i, count = [leftSideController.tocOutlineView numberOfRows];
-             NSMutableArray *array = [NSMutableArray arrayWithCapacity:count];
-             for (i = 0; i < count; i++)
-                 [array addObject:[[(PDFOutline *)[leftSideController.tocOutlineView itemAtRow:i] label] lossyStringUsingEncoding:NSASCIIStringEncoding]];
-             return array;
-         }
-         return nil;
-     }
-
-     - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString {
-         if ([ov isEqual:rightSideController.noteOutlineView]) {
-             [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]];
-         } else if ([ov isEqual:leftSideController.tocOutlineView]) {
-             [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]];
-         }
-     }
-
-     - (void)outlineView:(NSOutlineView *)ov typeSelectHelper:(SKTypeSelectHelper *)typeSelectHelper updateSearchString:(NSString *)searchString {
-         if ([typeSelectHelper isEqual:[leftSideController.thumbnailTableView typeSelectHelper]] || [typeSelectHelper isEqual:[pdfView typeSelectHelper]]) {
-             if (searchString)
-                 [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Go to page: %@", @"Status message"), searchString]];
-             else
-                 [self updateLeftStatus];
-         } else if ([typeSelectHelper isEqual:[rightSideController.noteOutlineView typeSelectHelper]]) {
-             if (searchString)
-                 [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]];
-             else
-                 [self updateRightStatus];
-         } else if ([typeSelectHelper isEqual:[leftSideController.tocOutlineView typeSelectHelper]]) {
-             if (searchString)
-                 [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]];
-             else
-                 [self updateLeftStatus];
-         }
-     }
-
-     */
 }
 
 // MARK: - KMCustomOutlineViewDelegate, KMCustomOutlineViewDataSource
@@ -3287,9 +3192,57 @@ extension KMLeftSideViewController: KMCustomOutlineViewDelegate, KMCustomOutline
         }
     }
 
+    func outlineView(_ anOutlineView: NSOutlineView, typeSelectHelperSelectionStrings aTypeSelectHelper: SKTypeSelectHelper) -> NSArray {
+        if self.noteOutlineView.isEqual(to: anOutlineView) {
+            let count = self.noteOutlineView.numberOfRows
+            var texts = NSMutableArray(capacity: count)
+            for i in 0 ..< count {
+                let item = self.noteOutlineView.item(atRow: i)
+                let string = (item as? CPDFAnnotation)?.string() ?? ""
+                texts.add(string)
+            }
+            return texts
+        } else if self.tocOutlineView.isEqual(to: anOutlineView) {
+            let count = self.tocOutlineView.numberOfRows
+            var array = NSMutableArray(capacity: count)
+            for i in 0 ..< count {
+                //                [array addObject:[[(PDFOutline *)[leftSideController.tocOutlineView itemAtRow:i] label] lossyStringUsingEncoding:NSASCIIStringEncoding]];
+                let item = self.tocOutlineView.item(atRow: i) as? CPDFOutline
+                array.add(item?.label ?? "")
+            }
+            return array
+        }
+        return NSArray()
+    }
+    
+    func outlineView(_ anOutlineView: NSOutlineView, typeSelectHelper aTypeSelectHelper: SKTypeSelectHelper, didFailToFindMatchForSearchString searchString: String) {
+//        if ([ov isEqual:rightSideController.noteOutlineView]) {
+//            [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]];
+//        } else if ([ov isEqual:leftSideController.tocOutlineView]) {
+//            [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"No match: \"%@\"", @"Status message"), searchString]];
+//        }
+    }
+    
+    func tableView(_ aTableView: NSTableView, typeSelectHelper aTypeSelectHelper: SKTypeSelectHelper, updateSearchString searchString: String) {
+//        if ([typeSelectHelper isEqual:[leftSideController.thumbnailTableView typeSelectHelper]] || [typeSelectHelper isEqual:[pdfView typeSelectHelper]]) {
+//            if (searchString)
+//                [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Go to page: %@", @"Status message"), searchString]];
+//            else
+//                [self updateLeftStatus];
+//        } else if ([typeSelectHelper isEqual:[rightSideController.noteOutlineView typeSelectHelper]]) {
+//            if (searchString)
+//                [statusBar setRightStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding note: \"%@\"", @"Status message"), searchString]];
+//            else
+//                [self updateRightStatus];
+//        } else if ([typeSelectHelper isEqual:[leftSideController.tocOutlineView typeSelectHelper]]) {
+//            if (searchString)
+//                [statusBar setLeftStringValue:[NSString stringWithFormat:NSLocalizedString(@"Finding: \"%@\"", @"Status message"), searchString]];
+//            else
+//                [self updateLeftStatus];
+//        }
+    }
 }
 
-
 // MARK: - Other
 
 extension KMLeftSideViewController {

+ 92 - 94
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/View/KMCustomOutlineView.swift

@@ -17,9 +17,9 @@ import Cocoa
     @objc optional func outlineView(_ anOutlineView: NSOutlineView, pasteFromPasteboard pboard: NSPasteboard)
     @objc optional func outlineView(_ anOutlineView: NSOutlineView, canPasteFromPasteboard pboard: NSPasteboard) -> Bool
     
-//    - (NSArray *)outlineView:(NSOutlineView *)anOutlineView typeSelectHelperSelectionStrings:(SKTypeSelectHelper *)aTypeSelectHelper;
-//    - (void)outlineView:(NSOutlineView *)anOutlineView typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString;
-//    - (void)outlineView:(NSOutlineView *)anOutlineView typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper updateSearchString:(NSString *)searchString;
+    @objc optional func outlineView(_ anOutlineView: NSOutlineView, typeSelectHelperSelectionStrings aTypeSelectHelper: SKTypeSelectHelper) -> NSArray
+    @objc optional func outlineView(_ anOutlineView: NSOutlineView, typeSelectHelper aTypeSelectHelper: SKTypeSelectHelper, didFailToFindMatchForSearchString searchString: String)
+    @objc optional func outlineView(_ anOutlineView: NSOutlineView, typeSelectHelper aTypeSelectHelper: SKTypeSelectHelper, updateSearchString searchString: String)
 }
 
 @objc protocol KMCustomOutlineViewDataSource: NSOutlineViewDataSource {
@@ -27,14 +27,22 @@ import Cocoa
 }
 
 class KMCustomOutlineView: NSOutlineView {
-    /*
-     @interface SKOutlineView : NSOutlineView <SKTypeSelectDelegate> {
-         SKTypeSelectHelper *typeSelectHelper;
-         BOOL supportsQuickLook;
-     }
-     @property (nonatomic) BOOL supportsQuickLook;
-     @property (nonatomic, retain) SKTypeSelectHelper *typeSelectHelper;
-     */
+    var supportsQuickLook = false
+    private var _typeSelectHelper: SKTypeSelectHelper?
+    var typeSelectHelper: SKTypeSelectHelper? {
+        get {
+            return self._typeSelectHelper
+        }
+        set {
+            if self._typeSelectHelper != newValue {
+                if self.isEqual(to: self._typeSelectHelper?.delegate) {
+                    self._typeSelectHelper?.delegate = nil
+                }
+                self._typeSelectHelper = newValue
+                self._typeSelectHelper?.delegate = self
+            }
+        }
+    }
     
     weak var botaDelegate: KMCustomOutlineViewDelegate?
     weak var botaDataSource: KMCustomOutlineViewDataSource?
@@ -45,61 +53,58 @@ class KMCustomOutlineView: NSOutlineView {
         // Drawing code here.
     }
     
-    /*
-
-     - (void)setTypeSelectHelper:(SKTypeSelectHelper *)newTypeSelectHelper {
-         if (typeSelectHelper != newTypeSelectHelper) {
-             if ([typeSelectHelper delegate] == self)
-                 [typeSelectHelper setDelegate:nil];
-             [typeSelectHelper release];
-             typeSelectHelper = [newTypeSelectHelper retain];
-             [typeSelectHelper setDelegate:self];
-         }
-     }
-
-     - (void)expandItem:(id)item expandChildren:(BOOL)collapseChildren {
-         [super expandItem:item expandChildren:collapseChildren];
-         [typeSelectHelper rebuildTypeSelectSearchCache];
-     }
-
-     - (void)collapseItem:(id)item collapseChildren:(BOOL)collapseChildren {
-         [super collapseItem:item collapseChildren:collapseChildren];
-         [typeSelectHelper rebuildTypeSelectSearchCache];
-     }
-
-     - (void)reloadData{
-         [super reloadData];
-         [typeSelectHelper rebuildTypeSelectSearchCache];
-     }
+    override func expandItem(_ item: Any?, expandChildren: Bool) {
+        super.expandItem(item, expandChildren: expandChildren)
+        
+        self.typeSelectHelper?.rebuildTypeSelectSearchCache()
+    }
+    
+    override func collapseItem(_ item: Any?, collapseChildren: Bool) {
+        super.collapseItem(item, collapseChildren: collapseChildren)
+        
+        self.typeSelectHelper?.rebuildTypeSelectSearchCache()
+    }
+    
+    override func reloadData() {
+        super.reloadData()
+        
+        self.typeSelectHelper?.rebuildTypeSelectSearchCache()
+    }
+    
+    override func keyDown(with event: NSEvent) {
+        let eventChar = event.firstCharacter()
+        let modifierFlags = event.deviceIndependentModifierFlags()
 
-     - (void)keyDown:(NSEvent *)theEvent {
-         unichar eventChar = [theEvent firstCharacter];
-         NSUInteger modifierFlags = [theEvent deviceIndependentModifierFlags];
-         
-         if ((eventChar == NSNewlineCharacter || eventChar == NSEnterCharacter || eventChar == NSCarriageReturnCharacter) && modifierFlags == 0) {
-             if ([self doubleAction] == NULL || [self sendAction:[self doubleAction] to:[self target]] == NO)
-                 NSBeep();
-         } else if ((eventChar == SKSpaceCharacter) && modifierFlags == 0) {
-             if (supportsQuickLook == NO)
-                 [[self enclosingScrollView] pageDown:nil];
-             else if ([QLPreviewPanel sharedPreviewPanelExists] && [[QLPreviewPanel sharedPreviewPanel] isVisible])
-                 [[QLPreviewPanel sharedPreviewPanel] orderOut:nil];
-             else
-                 [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
-         } else if ((eventChar == SKSpaceCharacter) && modifierFlags == NSShiftKeyMask) {
-             if (supportsQuickLook == NO)
-                 [[self enclosingScrollView] pageUp:nil];
-         } else if (eventChar == NSHomeFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) {
-             [self scrollToBeginningOfDocument:nil];
-         } else if (eventChar == NSEndFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) {
-             [self scrollToEndOfDocument:nil];
-         } else if ((eventChar == NSDeleteCharacter || eventChar == NSDeleteFunctionKey) && modifierFlags == 0 && [self canDelete]) {
-             [self delete:self];
-         } else if ([typeSelectHelper handleEvent:theEvent] == NO) {
-             [super keyDown:theEvent];
-         }
-     }
+        if ((eventChar == NSNewlineCharacter || eventChar == NSEnterCharacter || eventChar == NSCarriageReturnCharacter) && modifierFlags == 0) {
+            if self.doubleValue == nil || self.sendAction(self.doubleAction, to: self.target) == false {
+                NSSound.beep()
+            }
+        } else if ((eventChar == SKSpaceCharacter) && modifierFlags == 0) {
+            if self.supportsQuickLook == false {
+                self.enclosingScrollView?.pageDown(nil)
+            } else if QLPreviewPanel.sharedPreviewPanelExists() && QLPreviewPanel.shared().isVisible {
+                    QLPreviewPanel.shared().orderOut(nil)
+            } else {
+                QLPreviewPanel.shared().makeKeyAndOrderFront(nil)
+            }
+        } else if ((eventChar == SKSpaceCharacter) && modifierFlags == NSEvent.ModifierFlags.shift.rawValue) {
+            if self.supportsQuickLook == false {
+                self.enclosingScrollView?.pageUp(nil)
+            }
+        }
+//            else if (eventChar == NSHomeFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) {
+//            [self scrollToBeginningOfDocument:nil];
+//        } else if (eventChar == NSEndFunctionKey && (modifierFlags & ~NSFunctionKeyMask) == 0) {
+//            [self scrollToEndOfDocument:nil];
+//        }
+        else if ((eventChar == NSDeleteCharacter || eventChar == NSDeleteFunctionKey) && modifierFlags == 0 && self.canDelete()) {
+            self.delete(self)
+        } else if let data = self.typeSelectHelper?.handleEvent(event), data == false {
+            super.keyDown(with: event)
+        }
+    }
 
+    /*
      - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation {
          if ([[SKOutlineView superclass] instancesRespondToSelector:_cmd])
              [super draggedImage:anImage endedAt:aPoint operation:operation];
@@ -138,36 +143,6 @@ class KMCustomOutlineView: NSOutlineView {
         }
     }
     
-    /*
-
-     #pragma mark SKTypeSelectHelper datasource protocol
-
-     - (NSArray *)typeSelectHelperSelectionStrings:(SKTypeSelectHelper *)aTypeSelectHelper {
-         if ([[self delegate] respondsToSelector:@selector(outlineView:typeSelectHelperSelectionStrings:)])
-             return [[self delegate] outlineView:self typeSelectHelperSelectionStrings:aTypeSelectHelper];
-         return nil;
-     }
-
-     - (NSUInteger)typeSelectHelperCurrentlySelectedIndex:(SKTypeSelectHelper *)aTypeSelectHelper {
-         return [[self selectedRowIndexes] lastIndex];
-     }
-
-     - (void)typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper selectItemAtIndex:(NSUInteger)itemIndex {
-         [self selectRowIndexes:[NSIndexSet indexSetWithIndex:itemIndex] byExtendingSelection:NO];
-         [self scrollRowToVisible:itemIndex];
-     }
-
-     - (void)typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper didFailToFindMatchForSearchString:(NSString *)searchString {
-         if ([[self delegate] respondsToSelector:@selector(outlineView:typeSelectHelper:didFailToFindMatchForSearchString:)])
-             [[self delegate] outlineView:self typeSelectHelper:aTypeSelectHelper didFailToFindMatchForSearchString:searchString];
-     }
-
-     - (void)typeSelectHelper:(SKTypeSelectHelper *)aTypeSelectHelper updateSearchString:(NSString *)searchString {
-         if ([[self delegate] respondsToSelector:@selector(outlineView:typeSelectHelper:updateSearchString:)])
-             [[self delegate] outlineView:self typeSelectHelper:aTypeSelectHelper updateSearchString:searchString];
-     }
-     */
-    
     func scrollToBeginningOfDocument(_ sender: AnyObject?) {
         if self.numberOfRows > 0 {
             self.scrollRowToVisible(0)
@@ -252,3 +227,26 @@ extension KMCustomOutlineView: NSMenuItemValidation {
         return true
     }
 }
+
+extension KMCustomOutlineView: SKTypeSelectHelperDelegate {
+    func typeSelectHelperSelectionStrings(_ typeSelectHelper: SKTypeSelectHelper) -> NSArray {
+        return self.botaDelegate?.outlineView?(self, typeSelectHelperSelectionStrings: typeSelectHelper) ?? NSArray()
+    }
+    
+    func typeSelectHelperCurrentlySelectedIndex(_ typeSelectHelper: SKTypeSelectHelper) -> Int {
+        return self.selectedRowIndexes.last ?? NSNotFound
+    }
+    
+    func typeSelectHelper(_ typeSelectHelper: SKTypeSelectHelper, selectItemAtIndex itemIndex: Int) {
+        self.selectRowIndexes(NSIndexSet(index: itemIndex) as IndexSet, byExtendingSelection: false)
+        self.scrollRowToVisible(itemIndex)
+    }
+    
+    func typeSelectHelper(_ typeSelectHelper: SKTypeSelectHelper, didFailToFindMatchForSearchString searchString: String) {
+        self.botaDelegate?.outlineView?(self, typeSelectHelper: typeSelectHelper, didFailToFindMatchForSearchString: searchString)
+    }
+    
+    func typeSelectHelper(_ typeSelectHelper: SKTypeSelectHelper, updateSearchString searchString: String) {
+        self.botaDelegate?.outlineView?(self, typeSelectHelper: typeSelectHelper, updateSearchString: searchString)
+    }
+}

+ 12 - 13
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/View/KMTocOutlineView.swift

@@ -167,19 +167,18 @@ class KMTocOutlineView: KMCustomOutlineView {
         super.viewWillMove(toWindow: newWindow)
     }
     
-    /*
-     - (void)keyDown:(NSEvent *)theEvent {
-         unichar eventChar = [theEvent firstCharacter];
-         NSUInteger modifiers = [theEvent standardModifierFlags];
-         
-         if (eventChar == NSLeftArrowFunctionKey && modifiers == (NSEventModifierFlagCommand | NSEventModifierFlagOption))
-             [self collapseItem:nil collapseChildren:YES];
-         else if (eventChar == NSRightArrowFunctionKey && modifiers == (NSEventModifierFlagCommand | NSEventModifierFlagOption))
-             [self expandItem:nil expandChildren:YES];
-         else
-             [super keyDown:theEvent];
-     }
-     */
+    override func keyDown(with event: NSEvent) {
+        let eventChar = event.firstCharacter()
+        let modifiers = event.standardPDFListViewModifierFlags()
+        
+        if (eventChar == NSLeftArrowFunctionKey && modifiers == (NSEvent.ModifierFlags.command.rawValue + NSEvent.ModifierFlags.option.rawValue)) {
+            self.collapseItem(nil, collapseChildren: true)
+        } else if (eventChar == NSRightArrowFunctionKey && modifiers == (NSEvent.ModifierFlags.command.rawValue + NSEvent.ModifierFlags.option.rawValue)) {
+            self.expandItem(nil, expandChildren: true)
+        } else {
+            super.keyDown(with: event)
+        }
+    }
     
     override func mouseEntered(with event: NSEvent) {
         if (self._kmTrackingAreas == nil) {

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -439,7 +439,6 @@ extension KMMainViewController {
     }
     
     @IBAction func toggleAutoFlow(_ sender: Any?) {
-        KMPrint("toggleAutoFlow")
         if (self.listView.isAutoFlow()) {
             self.listView.stopAutoFlow()
         } else {

+ 28 - 2
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -226,7 +226,7 @@ let LOCKED_KEY  = "locked"
 //            } else {
                 listView.document = document
 //            }
-            //            listView.document.delegate = self
+                listView.document.delegate = self
             let autoScale = listView.autoScales
             if !autoScale {
                 listView.scaleFactor = 1.0
@@ -599,7 +599,7 @@ let LOCKED_KEY  = "locked"
                 document = newValue
             }
             listView.document = document
-            //            listView.document.delegate = self
+            listView.document.delegate = self
             self.listView.layoutDocumentView()
         }
     }
@@ -2805,6 +2805,32 @@ let LOCKED_KEY  = "locked"
     }
 }
 
+// MARK: - CPDFDocumentDelegate
+
+extension KMMainViewController: CPDFDocumentDelegate {
+    func documentDidBeginDocumentFind(_ document: CPDFDocument!) {
+        self.leftSideViewController.documentDidBeginFind()
+//        [statusBar setProgressIndicatorStyle:SKProgressIndicatorBarStyle];
+//        [[statusBar progressIndicator] setMaxValue:[[note object] pageCount]];
+//        [[statusBar progressIndicator] setDoubleValue:0.0];
+//        [statusBar startAnimation:self];
+//        [self willChangeValueForKey:SEARCHRESULTS_KEY];
+//        [self willChangeValueForKey:GROUPEDSEARCHRESULTS_KEY];
+    }
+    
+    func documentDidEndDocumentFind(_ document: CPDFDocument!) {
+        self.leftSideViewController.documentDidEndFind()
+//        [self didChangeValueForKey:GROUPEDSEARCHRESULTS_KEY];
+//        [self didChangeValueForKey:SEARCHRESULTS_KEY];
+//        [statusBar stopAnimation:self];
+//        [statusBar setProgressIndicatorStyle:SKProgressIndicatorNone];
+//        NSArray *highlights = [[NSArray alloc] initWithArray:searchResults copyItems:YES];
+//        [highlights setValue:[NSColor yellowColor] forKey:@"color"];
+//        [self.pdfView setHighlightedSelections:highlights];
+//        [highlights release];
+    }
+}
+
 extension KMMainViewController: KMEditImagePropertyViewControllerDelegate {
     func editImagePropertyViewControllerDidChanged(controller: KMEditImagePropertyViewController, type: KMEditImagePropertyViewControllerChangeType) {
         self.isPDFTextImageEdited = true

+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -3500,6 +3500,12 @@
 		BB6CA4CF298BB0D000A13864 /* KMPreferenceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6CA4CB298BB0D000A13864 /* KMPreferenceWindowController.xib */; };
 		BB6CA4D0298BB0D000A13864 /* KMPreferenceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6CA4CB298BB0D000A13864 /* KMPreferenceWindowController.xib */; };
 		BB6CA4D1298BB0D000A13864 /* KMPreferenceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB6CA4CB298BB0D000A13864 /* KMPreferenceWindowController.xib */; };
+		BB6D2DA72B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DA62B674A6300624C24 /* CPDFOutline+KMExtension.swift */; };
+		BB6D2DA82B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DA62B674A6300624C24 /* CPDFOutline+KMExtension.swift */; };
+		BB6D2DA92B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DA62B674A6300624C24 /* CPDFOutline+KMExtension.swift */; };
+		BB6D2DAB2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DAA2B674D7900624C24 /* CPDFPage+KMExtension.swift */; };
+		BB6D2DAC2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DAA2B674D7900624C24 /* CPDFPage+KMExtension.swift */; };
+		BB6D2DAD2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6D2DAA2B674D7900624C24 /* CPDFPage+KMExtension.swift */; };
 		BB6DD80C29347F77001F0544 /* KMSecureEncryptWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD80A29347F77001F0544 /* KMSecureEncryptWindowController.swift */; };
 		BB6DD80D29347F77001F0544 /* KMSecureEncryptWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD80A29347F77001F0544 /* KMSecureEncryptWindowController.swift */; };
 		BB6DD80E29347F77001F0544 /* KMSecureEncryptWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB6DD80A29347F77001F0544 /* KMSecureEncryptWindowController.swift */; };
@@ -6294,6 +6300,8 @@
 		BB6BA4C72B0B4A4100462CAE /* KMLeftSideEmptyFileViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMLeftSideEmptyFileViewController.xib; sourceTree = "<group>"; };
 		BB6CA4CA298BB0D000A13864 /* KMPreferenceWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPreferenceWindowController.swift; sourceTree = "<group>"; };
 		BB6CA4CB298BB0D000A13864 /* KMPreferenceWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMPreferenceWindowController.xib; sourceTree = "<group>"; };
+		BB6D2DA62B674A6300624C24 /* CPDFOutline+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFOutline+KMExtension.swift"; sourceTree = "<group>"; };
+		BB6D2DAA2B674D7900624C24 /* CPDFPage+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFPage+KMExtension.swift"; sourceTree = "<group>"; };
 		BB6DD80A29347F77001F0544 /* KMSecureEncryptWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptWindowController.swift; sourceTree = "<group>"; };
 		BB6DD80B29347F77001F0544 /* KMSecureEncryptWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMSecureEncryptWindowController.xib; sourceTree = "<group>"; };
 		BB6DD813293486FA001F0544 /* KMSecureEncryptPasswordCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSecureEncryptPasswordCellView.swift; sourceTree = "<group>"; };
@@ -10393,6 +10401,8 @@
 			isa = PBXGroup;
 			children = (
 				BB27BF3B2B33E85200A0BAAE /* CPDFView+KMExtension.swift */,
+				BB6D2DA62B674A6300624C24 /* CPDFOutline+KMExtension.swift */,
+				BB6D2DAA2B674D7900624C24 /* CPDFPage+KMExtension.swift */,
 			);
 			path = CPDFKit;
 			sourceTree = "<group>";
@@ -14654,6 +14664,7 @@
 				ADBC2D28299DCA76006280C8 /* NSTextField+Layer.swift in Sources */,
 				ADF6B8762A48155E0090CB78 /* KMComparativeViewCollectionItem.swift in Sources */,
 				BB49ECF1293F40F500C82CA2 /* KMConvertPageRangeSettingItemView.swift in Sources */,
+				BB6D2DA72B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */,
 				BBBF68802A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */,
 				ADDF832C2B391A5C00A81A4E /* NSEvent+PDFListView.m in Sources */,
 				9F0CB46F2967E63100007028 /* KMPropertiesPanelNameSubVC.swift in Sources */,
@@ -14951,6 +14962,7 @@
 				9FD0D2B32AD5265A00DA3FF8 /* CPDFListAnnotationNoteWindowController.swift in Sources */,
 				BB74DA7F2AC42959006EDFE7 /* NSButton+KMExtension.swift in Sources */,
 				BBF38A62294F53FD0086D025 /* KMWatermarkFileView.swift in Sources */,
+				BB6D2DAB2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */,
 				BB88107C2B4F7A1F00AFA63E /* KMActivityALertViewController.m in Sources */,
 				BBC3482E29559E12008D2CD1 /* KMBackgroundModel.swift in Sources */,
 				BBCE57182A72723600508EFC /* NSResponder+KMExtension.swift in Sources */,
@@ -16115,6 +16127,7 @@
 				ADBC2D38299F0A5A006280C8 /* KMPrintHelpViewController.swift in Sources */,
 				9FBC48C0299E23B100CA39D7 /* NSViewController+DesignToken.swift in Sources */,
 				AD3AAD422B0B7B6C00DE5FE7 /* KMCompareManager.swift in Sources */,
+				BB6D2DAC2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */,
 				BB853CAB2AF8FA46009C20C1 /* KMHeaderFooterManagerWindowController.swift in Sources */,
 				ADB2D6E7294740F30029D2B3 /* KMPrintPaperSetWindowController.swift in Sources */,
 				9F53D5542AD683A700CCF9D8 /* KMAnnotationPropertyBaseController.swift in Sources */,
@@ -16305,6 +16318,7 @@
 				BB8F456E295AC1220037EA22 /* KMHeaderFooterAdjectiveModel.swift in Sources */,
 				F3599174292B62F5000D25DE /* CStringConstants.m in Sources */,
 				BBC8A7692B05EB8000FA9377 /* KMThumbnailTableviewCell.swift in Sources */,
+				BB6D2DA82B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */,
 				89752DEB293875FC003FF08E /* KMMainToolbarController.swift in Sources */,
 				ADFA8F122B60E01C002595A4 /* KMSecureAlertView.swift in Sources */,
 				BB147012299DC0D100784A6A /* OIDError.m in Sources */,
@@ -16711,6 +16725,7 @@
 				9F8539E029470A0700DF644E /* KMTabStripView.swift in Sources */,
 				BBA8B7AC2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */,
 				BB146FDD299DC0D100784A6A /* GTLRDriveService.m in Sources */,
+				BB6D2DA92B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */,
 				AD8810AB29A8463600178CA1 /* KMAccountInfoWindowController.swift in Sources */,
 				BBC3480E29558DC1008D2CD1 /* KMBackgroundController.swift in Sources */,
 				BBF62C722B0347AF007B7E86 /* SplitWindowController.swift in Sources */,
@@ -16750,6 +16765,7 @@
 				BB8810AB2B4F7D7500AFA63E /* KMVerificationViewController.m in Sources */,
 				BBE78F1D2B36F69F0071AC1A /* KMLeftSideViewController+Note.swift in Sources */,
 				BBCE571A2A72723600508EFC /* NSResponder+KMExtension.swift in Sources */,
+				BB6D2DAD2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */,
 				BB67EE252B54FFEF00573BF0 /* ASIInputStream.m in Sources */,
 				BB146FDA299DC0D100784A6A /* GTLRFramework.m in Sources */,
 				AD85D1A02AEF927D000F4D28 /* KMQucikToolsModel.swift in Sources */,

+ 32 - 0
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -148,5 +148,37 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "626C3F4D-DF1F-4EBD-94F6-70057CB49AB5"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Search.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "30"
+            endingLineNumber = "30"
+            landmarkName = "documentDidEndFind()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "08F2A3A1-F16A-4A42-BB22-79F6F62DA04F"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Search.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "26"
+            endingLineNumber = "26"
+            landmarkName = "documentDidBeginFind()"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>