12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // KMNBotaAnnotationModel.swift
- // PDF Reader Pro
- //
- // Created by User-Tangchao on 2024/12/6.
- //
- import Cocoa
- class KMNBotaAnnotationSectionModel: NSObject {
- var isExpand = false
- var items: [KMNBotaAnnotationModel] = []
- var titleText: String = "" //头部显示文字,目前是时间或者页面
- var viewH: CGFloat = 44 //头部高度
- }
- class KMNBotaAnnotationModel: NSObject {
- weak var annotation: CPDFAnnotation? {
- didSet {
- if annotation?.isMarkup() == true {
- if let markAnnotation = annotation as? CPDFMarkupAnnotation {
- privateContentText = markAnnotation.markupText()
- }
- } else {
- privateContentText = annotation?.contents ?? ""
- }
-
- privateAuthorText = annotation?.userName() ?? ""
-
- let ans = annotation?.replyAnnotations
- let tReplys:[KMNReplysAnnotationModel] = []
- for i in 0 ..< (ans?.count ?? 0) {
- let annotationModel = KMNReplysAnnotationModel()
- annotationModel.annotation = ans?[i]
- }
- replys = tReplys
-
- modificationDate = annotation?.modificationDate() as NSDate?
- }
- }
- var isExpand = false
-
- private var privateContentText:String = ""
- var contentText: String {
- return privateContentText
- }
-
- private var privateAuthorText:String = ""
- var authorText: String {
- return privateAuthorText
- }
-
- private var replys: [KMNReplysAnnotationModel] = []
- var replyAnnotations: [KMNReplysAnnotationModel] {
- return replys
- }
-
- private var modificationDate: NSDate?
- var annotationDate: NSDate {
- return modificationDate ?? NSDate()
- }
- }
- class KMNReplysAnnotationModel: NSObject {
- weak var annotation: CPDFAnnotation? {
- didSet {
- privateContentText = annotation?.contents ?? ""
- privateAuthorText = annotation?.userName() ?? ""
- modificationDate = annotation?.modificationDate() as NSDate?
- }
- }
-
- var isEnterEdit = false
- private var privateContentText:String = ""
- var contentText: String {
- return privateContentText
- }
-
- private var privateAuthorText:String = ""
- var authorText: String {
- return privateAuthorText
- }
-
- private var replys: [KMNReplysAnnotationModel] = []
- var replyAnnotations: [KMNReplysAnnotationModel] {
- return replys
- }
-
- private var modificationDate: NSDate?
- var annotationDate: NSDate {
- return modificationDate ?? NSDate()
- }
- }
|