HtmlSmartArt.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using System.Text;
  3. namespace ClearSlideLibrary.HtmlController
  4. {
  5. internal class HtmlSmartArt : HtmlPresentationElement
  6. {
  7. public HtmlSmartArt(string id, int width, int height,
  8. int top, int left, bool invisible,
  9. bool animatable)
  10. // frameId, width, height, top, left, visible, animatable
  11. {
  12. base.id = id;
  13. base.top = top;
  14. base.left = left;
  15. base.width = width;
  16. base.height = height;
  17. base.invisible = invisible;
  18. base.animatable = animatable;
  19. }
  20. public override string DrawElement()
  21. {
  22. StringBuilder smartArtBuilder = new StringBuilder();
  23. string style = invisible ? "DC0" : "DC1";
  24. //the object has animation.
  25. if (animatable)
  26. {
  27. smartArtBuilder.Append("<div id=\"" + id + "\" style=\"top:"
  28. + top.ToString() + "px;left:" + left.ToString() + "px;height:"
  29. + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  30. smartArtBuilder.Append("<div class=\"" + style + "\" id=\"" + id + "c" + "\">");
  31. smartArtBuilder.Append("<img />");
  32. smartArtBuilder.Append("</div>");
  33. smartArtBuilder.Append("</div>");
  34. }
  35. else
  36. {
  37. smartArtBuilder.Append("<div id=\"" + id + "\" style=\"top:"
  38. + top.ToString() + "px;left:" + left.ToString() + "px;height:"
  39. + height.ToString() + "px;width:" + width.ToString() + "px;\">");
  40. smartArtBuilder.Append("<img/>");
  41. smartArtBuilder.Append("</div>");
  42. }
  43. return smartArtBuilder.ToString();
  44. }
  45. public override string ToString()
  46. {
  47. Console.WriteLine("The top is:" + top);
  48. Console.WriteLine("The left is:" + left);
  49. Console.WriteLine("The width is:" + width);
  50. Console.WriteLine("The height is:" + height);
  51. return string.Format("[{0}, {1}, {2}, {3}]", top, left, width, height);
  52. }
  53. }
  54. }