HtexText.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using HTEXLib.Models.Inner;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace HTEXLib.Models.HTEX
  6. {
  7. public class HtexText : HtexElement
  8. {
  9. public string id { get; set; }
  10. public string Text { get; set; }
  11. public bool PictureBullet { get; set; }
  12. public bool isBullet { get; set; }
  13. public int DefaultBulletSize { get; set; } = 12;
  14. public double bulletSize { get; set; }
  15. public bool bold { get; set; }
  16. public bool italic { get; set; }
  17. public string underline { get; set; }
  18. public int slideIndex { get; set; }
  19. public double width { get; set; }
  20. public double Rotate { get; set; }
  21. public void setLeft(double newLeft)
  22. {
  23. left = newLeft;
  24. }
  25. /// <summary>
  26. /// 处理字体
  27. /// </summary>
  28. /// <param name="left"></param>
  29. /// <param name="top"></param>
  30. /// <param name="fontFamily"></param>
  31. /// <param name="fontColor"></param>
  32. /// <param name="fontSize"></param>
  33. /// <param name="isBullet"></param>
  34. /// <param name="bold"></param>
  35. /// <param name="italic"></param>
  36. /// <param name="underline"></param>
  37. /// <param name="id"></param>
  38. /// <param name="slideIndex"></param>
  39. public HtexText(double left, double top, string fontFamily, string fontColor, double fontSize, bool isBullet,
  40. bool bold, bool italic, string underline, string id, int slideIndex)
  41. {
  42. base.fontSize = fontSize;
  43. base.left = left;
  44. base.top = top;
  45. base.fontFamily = fontFamily;
  46. // this.isBullet = isBullet;
  47. base.fontColor = fontColor;
  48. this.bold = bold;
  49. this.italic = italic;
  50. this.id = id;
  51. this.slideIndex = slideIndex;
  52. base.partForm = partForm;
  53. ///TODO 字体贯穿线
  54. ///var FontStrik = node.GetTextByPath("a:rPr/@strike");
  55. ///var strikethrough = FontStrik != null ? FontStrik.Value : "noStrike";
  56. if (underline != null)
  57. {
  58. // if (underline.Equals("None"))
  59. //{
  60. // this.underline = "none";
  61. //}
  62. //else {
  63. //}
  64. this.underline = underline;
  65. }
  66. else this.underline = "none";
  67. }
  68. public override List<Item> DrawElement()
  69. {
  70. if (id != null)
  71. {
  72. id = id.Substring(3);
  73. int tryParse = 0;
  74. if (int.TryParse(id, out tryParse))
  75. {
  76. if (PPTShape.effectShapes.Contains(slideIndex + "_" + tryParse))
  77. {
  78. return null;
  79. }
  80. }
  81. }
  82. return null;
  83. // return new List<Item>() { new Text() };
  84. }
  85. public bool sameProps(HtexText other)
  86. {
  87. if (other == null)
  88. {
  89. return false;
  90. }
  91. return this.top == other.top
  92. && this.fontSize == other.fontSize
  93. && this.fontColor == other.fontColor
  94. && this.italic == other.italic
  95. && this.bold == other.bold
  96. && this.underline == other.underline
  97. && this.fontFamily == other.fontFamily;
  98. }
  99. }
  100. }