HtexGroupShape.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using HTEXLib.Helpers.ShapeHelpers;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace HTEXLib.Models.HTEX
  6. {
  7. public class HtexGroupShape : HtexElement
  8. {
  9. public HtexGroupShape(string id, double rot, double width, double height,
  10. double top, double left, bool invisible,
  11. bool animatable, int index, Inner.PPTGroupShape groupShape, PPTSlide slide, string partForm, string timingId)
  12. {
  13. base.sid = timingId;
  14. base.slide = slide;
  15. this.rot = rot;
  16. this.groupShape = groupShape;
  17. base.id = id;
  18. base.top = top;
  19. base.left = left;
  20. base.width = width;
  21. base.height = height;
  22. base.invisible = invisible;
  23. base.animatable = animatable;
  24. base.index = index;
  25. base.type = "Group";
  26. base.partForm = partForm;
  27. }
  28. public Inner.PPTGroupShape groupShape { get; set; }
  29. public override List<Item> DrawElement()
  30. {
  31. Position position = new Position { cx = width, cy = height, x = left, y = top, rot = rot };
  32. var ShapeStyle = PPTXHelper.DoShapeProperties(groupShape.element.GroupShapeProperties, slide, type, partForm);
  33. Group group = new Group() { sid = sid,id = this.id, type = type, index = index/*, animatable = animatable, invisible = invisible */};
  34. group.style.border = ShapeStyle.border;
  35. group.style.fill = ShapeStyle.fill;
  36. group.style.effect = ShapeStyle.effect;
  37. group.style.position = position;
  38. group.uid = groupShape.suid;
  39. //SlideColor slideColor = PPTXHelper.DoShapeStyle(groupShape.element.ShapeStyle, slide, type);
  40. HtexSlide htexSlide = new HtexSlide(slide, slide.slideIndex)
  41. {
  42. ContainerShape = groupShape.containerShape,
  43. FromGroup = true
  44. };
  45. var elements= htexSlide.DrawElement();
  46. if (elements != null) {
  47. group.shapes = elements;
  48. }
  49. if (group.style.fill.type == -1|| group.style.border.color.type == 0)
  50. {
  51. group.style.fill = null;
  52. }
  53. if (group.style.border != null && (group.style.border.color.type == -1|| group.style.border.color.type == 0))
  54. {
  55. group.style.border.color = null;
  56. }
  57. if (group.style.border != null && group.style.border.type == "none")
  58. {
  59. group.style.border = null;
  60. }
  61. return new List<Item>() { group };
  62. }
  63. }
  64. }