PDFContentEditControl.xaml.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. private PDFImageEditControl PDFImageEditControl = new PDFImageEditControl();
  9. private PDFTextEditControl PDFTextEditControl = new PDFTextEditControl();
  10. public PDFViewControl ViewControl { get; private set; }
  11. public PDFEditParam EditEvent { get; set; }
  12. public PDFContentEditControl()
  13. {
  14. InitializeComponent();
  15. }
  16. public void InitWithPDFViewer(PDFViewControl newPDFView)
  17. {
  18. ViewControl = newPDFView;
  19. PDFImageEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  20. PDFTextEditControl.InitWithPDFViewer(newPDFView.PDFViewTool);
  21. }
  22. public void SetRotationText(float rotation)
  23. {
  24. PDFImageEditControl.SetRotationText(rotation);
  25. }
  26. public void SetPDFTextEditData(TextEditParam editEvent, bool isTemp = false)
  27. {
  28. if (!isTemp)
  29. {
  30. PDFTextEditControl.SetPDFTextEditData(editEvent);
  31. ContentEditContainer.Child = PDFTextEditControl;
  32. }
  33. else
  34. {
  35. PDFTextEditControl tempPDFTextEditControl = new PDFTextEditControl();
  36. tempPDFTextEditControl.InitWithPDFViewer(ViewControl.PDFViewTool);
  37. tempPDFTextEditControl.SetPDFTextEditData(editEvent);
  38. ContentEditContainer.Child = tempPDFTextEditControl;
  39. }
  40. }
  41. //public void SetPDFTextMultiEditData(List<PDFEditEvent> editEventList)
  42. //{
  43. // PDFTextEditControl.SetPDFTextMultiEditData(editEventList);
  44. // ContentEditContainer.Child = PDFTextEditControl;
  45. //}
  46. public void ClearContentControl()
  47. {
  48. ContentEditContainer.Child = null;
  49. }
  50. public void SetPDFImageEditData(ImageEditParam editEvent)
  51. {
  52. PDFImageEditControl.SetPDFImageEditData(editEvent);
  53. ContentEditContainer.Child = PDFImageEditControl;
  54. }
  55. //public void SetPDFImageMultiEditData(List<PDFEditEvent> editEventList)
  56. //{
  57. // PDFImageEditControl.SetPDFImageMultiEditData(editEventList);
  58. // ContentEditContainer.Child = PDFImageEditControl;
  59. //}
  60. public void RefreshThumb()
  61. {
  62. PDFImageEditControl?.SetImageThumb();
  63. }
  64. }
  65. }