12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- //
- // KMHeaderFooterObject.swift
- // PDF Reader Pro
- //
- // Created by tangchao on 2022/12/27.
- //
- import Cocoa
- class KMHeaderFooterObject: KMHeaderFooterAdjectiveModel, NSCopying {
-
- var dateFormatString: String = KMWatermarkAdjectiveTools.getDateFormats().first!
- var pageFormatString: String = KMWatermarkAdjectiveTools.getPageFormats().first!
- var batesPrefixString: String = ""
- var batesSuffixString: String = ""
- var batesDigits: Int = 1
- var isBates: Bool = false
-
- override init() {
- super.init()
-
- self.name = ""
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
-
- dateFormatString = coder.decodeObject(forKey: "dateFormatString") as? String ?? "m/d"
- pageFormatString = coder.decodeObject(forKey: "pageFormatString") as? String ?? "1"
- isBates = coder.decodeBool(forKey: "isBates")
- batesPrefixString = coder.decodeObject(forKey: "batesPrefixString") as? String ?? ""
- batesSuffixString = coder.decodeObject(forKey: "batesSuffixString") as? String ?? ""
- batesDigits = coder.decodeInteger(forKey: "batesDigits")
- }
-
- override func encode(with coder: NSCoder) {
- super.encode(with: coder)
-
- coder.encode(dateFormatString, forKey: "dateFormatString")
- coder.encode(pageFormatString, forKey: "pageFormatString")
- coder.encode(isBates, forKey: "isBates")
- coder.encode(batesPrefixString, forKey: "batesPrefixString")
- coder.encode(batesSuffixString, forKey: "batesSuffixString")
- coder.encode(batesDigits, forKey: "batesDigits")
- }
-
- func copy(with zone: NSZone? = nil) -> Any {
- let obj = KMHeaderFooterObject()
- obj.type = type
- obj.pageRangeType = pageRangeType
- obj.leftMargin = leftMargin
- obj.rightMargin = rightMargin
- obj.bottomMargin = bottomMargin
- obj.topMargin = topMargin
- obj.topLeftString = topLeftString
- obj.topCenterString = topCenterString
- obj.topRightString = topRightString
- obj.bottomLeftString = bottomLeftString
- obj.bottomCenterString = bottomCenterString
- obj.bottomRightString = bottomRightString
- obj.startString = startString
- obj.fontSize = fontSize
- obj.textColor = textColor
- // obj.hasHeader = hasHeader
- // obj.hasFooter = hasFooter
- // obj.cellHeight = cellHeight
- obj.id = id
- obj.pageCount = pageCount
- obj.pageRangeString = pageRangeString
-
- obj.dateFormatString = dateFormatString
- obj.pageFormatString = pageFormatString
- obj.isBates = isBates
- obj.batesPrefixString = batesPrefixString
- obj.batesSuffixString = batesSuffixString
- obj.batesDigits = batesDigits
- return obj
- }
- }
|