HtexGraphicFrame.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using DocumentFormat.OpenXml;
  2. using DocumentFormat.OpenXml.Drawing;
  3. using DocumentFormat.OpenXml.Drawing.Diagrams;
  4. using DocumentFormat.OpenXml.Packaging;
  5. using DocumentFormat.OpenXml.Presentation;
  6. using HTEXLib.Helpers.ShapeHelpers;
  7. using HTEXLib.Models.Inner;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. namespace HTEXLib.Models.HTEX
  14. {
  15. public class HtexGraphicFrame : HtexElement
  16. {
  17. public HtexGraphicFrame(string id, double rot, double width, double height,
  18. double top, double left, bool invisible,
  19. bool animatable, int index, Inner.PPTGraphicFrame graphicFrame, PPTSlide slide, string partForm, string timingId)
  20. // frameId, width, height, top, left, visible, animatable
  21. {
  22. base.sid = timingId;
  23. base.slide = slide;
  24. this.rot = rot;
  25. this.graphicFrame = graphicFrame;
  26. base.id = id;
  27. base.top = top;
  28. base.left = left;
  29. base.width = width;
  30. base.height = height;
  31. base.invisible = invisible;
  32. base.animatable = animatable;
  33. base.index = index;
  34. base.type = "GraphicFrame";
  35. base.partForm = partForm;
  36. }
  37. public Inner.PPTGraphicFrame graphicFrame { get; set; }
  38. public override List<Item> DrawElement()
  39. {
  40. List < Item > items= null;
  41. var GraphicDataChildren = graphicFrame.element.Graphic.GraphicData.ChildElements;
  42. foreach (var clild in GraphicDataChildren) {
  43. if (clild is DocumentFormat.OpenXml.Drawing.Table Table) {
  44. HtexTable table = new HtexTable(id,rot,width,height,top,left,invisible,animatable,index,Table,slide,partForm,sid);
  45. items= table.DrawElement();
  46. }
  47. if (clild is DocumentFormat.OpenXml.Drawing.Charts.ChartReference Chart)
  48. {
  49. HtexChart chart = new HtexChart(id, rot, width, height, top, left, invisible, animatable, index, Chart, slide, partForm,sid);
  50. items = chart.DrawElement();
  51. }
  52. if (clild is DocumentFormat.OpenXml.Drawing.Diagrams.RelationshipIds Diagram)
  53. {
  54. HtexDiagram diagram = new HtexDiagram(id, rot, width, height, top, left, invisible, animatable, index, Diagram, slide, partForm,sid);
  55. items = diagram.DrawElement();
  56. }
  57. if (items != null&& items.Count > 0)
  58. {
  59. items[0].uid = graphicFrame.suid;
  60. }
  61. }
  62. return items;
  63. }
  64. }
  65. }