SelectedSVGObjects.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using FastReport.Design;
  2. using FastReport.SVG;
  3. using System.Collections.Generic;
  4. using System.Windows.Forms;
  5. #pragma warning disable
  6. namespace FastReport
  7. {
  8. class SelectedSVGObjects
  9. {
  10. private List<SVGObject> FList;
  11. private Designer FDesigner;
  12. public SVGObject First
  13. {
  14. get { return FList.Count > 0 ? FList[0] : null; }
  15. }
  16. public int Count
  17. {
  18. get { return FList.Count; }
  19. }
  20. public bool Enabled
  21. {
  22. get
  23. {
  24. return Count > 1 || (Count == 1 && CanModify(First));
  25. }
  26. }
  27. private List<SVGObject> ModifyList
  28. {
  29. get { return FList.FindAll(CanModify); }
  30. }
  31. private bool CanModify(PictureObjectBase c)
  32. {
  33. return !c.HasRestriction(Restrictions.DontModify);
  34. }
  35. public void Update()
  36. {
  37. FList.Clear();
  38. if (FDesigner.SelectedObjects != null)
  39. {
  40. foreach (Base c in FDesigner.SelectedObjects)
  41. {
  42. if (c is SVGObject)
  43. FList.Add(c as SVGObject);
  44. }
  45. }
  46. }
  47. public void SetSizeMode(PictureBoxSizeMode value)
  48. {
  49. foreach (SVGObject c in ModifyList)
  50. {
  51. c.SizeMode = value;
  52. }
  53. }
  54. public SelectedSVGObjects(Designer designer)
  55. {
  56. FDesigner = designer;
  57. FList = new List<SVGObject>();
  58. }
  59. }
  60. }
  61. #pragma warning restore