PDFContentEditControl.xaml.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using ComPDFKit.Tool;
  2. using Compdfkit_Tools.PDFControl;
  3. using System.Windows.Controls;
  4. namespace Compdfkit_Tools.Edit
  5. {
  6. public partial class PDFContentEditControl : UserControl
  7. {
  8. #region
  9. private PDFImageEditControl PDFImageEditControl = new PDFImageEditControl();
  10. private PDFTextEditControl PDFTextEditControl = new PDFTextEditControl();
  11. public PDFViewControl ViewControl { get; private set; }
  12. public PDFEditParam EditEvent { get; set; }
  13. #endregion
  14. public PDFContentEditControl()
  15. {
  16. InitializeComponent();
  17. }
  18. public void InitWithPDFViewer(PDFViewControl newPDFView)
  19. {
  20. ViewControl = newPDFView;
  21. PDFImageEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  22. PDFTextEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  23. }
  24. public void SetRotationText(float rotation)
  25. {
  26. PDFImageEditControl.SetRotationText(rotation);
  27. }
  28. public void SetPDFTextEditData(TextEditParam editEvent, bool isTemp = false)
  29. {
  30. if (!isTemp)
  31. {
  32. PDFTextEditControl.SetPDFTextEditData(editEvent);
  33. ContentEditContainer.Child = PDFTextEditControl;
  34. }
  35. else
  36. {
  37. PDFTextEditControl tempPDFTextEditControl = new PDFTextEditControl();
  38. tempPDFTextEditControl.InitWithPDFViewer(ViewControl.PDFViewTool);
  39. tempPDFTextEditControl.SetPDFTextEditData(editEvent);
  40. ContentEditContainer.Child = tempPDFTextEditControl;
  41. }
  42. }
  43. //public void SetPDFTextMultiEditData(List<PDFEditEvent> editEventList)
  44. //{
  45. // PDFTextEditControl.SetPDFTextMultiEditData(editEventList);
  46. // ContentEditContainer.Child = PDFTextEditControl;
  47. //}
  48. public void ClearContentControl()
  49. {
  50. ContentEditContainer.Child = null;
  51. }
  52. public void SetPDFImageEditData(ImageEditParam editEvent)
  53. {
  54. PDFImageEditControl.SetPDFImageEditData(editEvent);
  55. ContentEditContainer.Child = PDFImageEditControl;
  56. }
  57. //public void SetPDFImageMultiEditData(List<PDFEditEvent> editEventList)
  58. //{
  59. // PDFImageEditControl.SetPDFImageMultiEditData(editEventList);
  60. // ContentEditContainer.Child = PDFImageEditControl;
  61. //}
  62. public void RefreshThumb()
  63. {
  64. PDFImageEditControl?.SetImageThumb();
  65. }
  66. }
  67. }