KMHeaderFooterAdjectiveModel.swift 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // KMHeaderFooterAdjectiveModel.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2022/12/27.
  6. //
  7. import Cocoa
  8. @objcMembers class KMHeaderFooterAdjectiveModel: KMWatermarkAdjectiveBaseModel {
  9. var leftMargin: CGFloat = 3.0
  10. var rightMargin: CGFloat = 3.0
  11. var bottomMargin: CGFloat = 3.0
  12. var topMargin: CGFloat = 3.0
  13. var topLeftString: String = ""
  14. var topCenterString: String = ""
  15. var topRightString: String = ""
  16. var bottomLeftString: String = ""
  17. var bottomCenterString: String = ""
  18. var bottomRightString: String = ""
  19. var startString: String = "1"
  20. var name: String = ""
  21. var cellHeight: CGFloat {
  22. get {
  23. var height: CGFloat = 12.0
  24. height += 40
  25. if (!self.topLeftString.isEmpty) {
  26. height += 26.0
  27. }
  28. if (!self.topCenterString.isEmpty) {
  29. height += 26.0
  30. }
  31. if (!self.topRightString.isEmpty) {
  32. height += 26.0
  33. }
  34. if (!self.bottomLeftString.isEmpty) {
  35. height += 26.0
  36. }
  37. if (!self.bottomCenterString.isEmpty) {
  38. height += 26.0
  39. }
  40. if (!self.bottomRightString.isEmpty) {
  41. height += 26.0
  42. }
  43. height += 25
  44. return height
  45. }
  46. }
  47. var hasVaild: Bool {
  48. get {
  49. for string in [self.topLeftString, self.topCenterString, self.topRightString,
  50. self.bottomLeftString, self.bottomCenterString, self.bottomRightString] {
  51. if (!string.isEmpty) {
  52. return true
  53. }
  54. }
  55. return false
  56. }
  57. }
  58. override init() {
  59. super.init()
  60. self.textFont = .font(name: "Helvetica", size: 10)
  61. self.textColor = .color(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)
  62. }
  63. }