|
@@ -19,6 +19,8 @@ using ComPDFKit.Tool.Help;
|
|
|
using ComPDFKit.Tool.SettingParam;
|
|
|
using ComPDFKit.Import;
|
|
|
using ComPDFKitViewer.BaseObject;
|
|
|
+using ComPDFKitViewer.Widget;
|
|
|
+using ComPDFKit.PDFDocument;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
@@ -208,6 +210,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
CPDFAnnotationType annotationType = pdfAnnotationData.AnnotationType;
|
|
|
AnnotParam annotHandlerEventArgs = null;
|
|
|
+ pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
switch (annotationType)
|
|
|
{
|
|
|
case CPDFAnnotationType.Highlight:
|
|
@@ -659,7 +662,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
pdfLinkUI = new CPDFLinkUI();
|
|
|
}
|
|
|
LinkParam linkAnnotArgs = new LinkParam();
|
|
|
- if (this.pdfViewerControl != null&& pdfViewerControl.PDFViewTool!=null && pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument() != null)
|
|
|
+ if (this.pdfViewerControl != null && pdfViewerControl.PDFViewTool != null && pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument() != null)
|
|
|
{
|
|
|
pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
pdfViewerControl.PDFToolManager.SetCreateAnnotType(C_ANNOTATION_TYPE.C_ANNOTATION_LINK);
|
|
@@ -779,77 +782,150 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
public void CreatTempAnnotationPanel(BaseAnnot baseAnnot)
|
|
|
{
|
|
|
- //switch (baseAnnot.CurrentType)
|
|
|
- //{
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
|
|
|
- // tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Highlight);
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
|
|
|
- // tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Underline);
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT:
|
|
|
- // tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Strikeout);
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY:
|
|
|
- // tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Squiggly);
|
|
|
- // (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
-
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
|
|
|
- // tempAnnotationPanel = new CPDFShapeUI();
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Square);
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
|
|
|
- // tempAnnotationPanel = new CPDFShapeUI();
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Circle);
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
|
|
|
- // tempAnnotationPanel = new CPDFShapeUI();
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Line);
|
|
|
- // (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
-
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_INK:
|
|
|
- // CPDFFreehandUI tempFreehandPanel = new CPDFFreehandUI();
|
|
|
- // tempFreehandPanel.SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // tempFreehandPanel.EraseClickHandler += PdfFreehandUI_EraseClickHandler;
|
|
|
- // tempFreehandPanel.EraseChangeHandler += PdfFreehandUI_EraseChangeHandler;
|
|
|
- // tempAnnotationPanel = tempFreehandPanel;
|
|
|
- // break;
|
|
|
-
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT:
|
|
|
- // tempAnnotationPanel = new CPDFFreeTextUI();
|
|
|
- // (tempAnnotationPanel as CPDFFreeTextUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
-
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_TEXT:
|
|
|
- // tempAnnotationPanel = new CPDFNoteUI();
|
|
|
- // (tempAnnotationPanel as CPDFNoteUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
-
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
|
|
|
- // tempAnnotationPanel = new CPDFTempStampUI();
|
|
|
- // (tempAnnotationPanel as CPDFTempStampUI).SetPresentAnnotAttrib(annotAttribEvent);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_LINK:
|
|
|
- // tempAnnotationPanel = new CPDFLinkUI();
|
|
|
- // (tempAnnotationPanel as CPDFLinkUI).SetPresentAnnotAttrib(annotAttribEvent, pdfViewerControl.Document.PageCount);
|
|
|
- // break;
|
|
|
- // case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
|
|
|
- // tempAnnotationPanel = null;
|
|
|
- // break;
|
|
|
- // default:
|
|
|
- // break;
|
|
|
- //}
|
|
|
+ switch (baseAnnot.CurrentType)
|
|
|
+ {
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Highlight);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot as CPDFMarkupAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Underline);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot as CPDFMarkupAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Strikeout);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot as CPDFMarkupAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFMarkupUI();
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).InitWithAnnotationType(CPDFAnnotationType.Squiggly);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFMarkupUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot as CPDFMarkupAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFShapeUI();
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Square);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFShapeUI();
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Circle);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFShapeUI();
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).InitWithAnnotationType(CPDFAnnotationType.Line);
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFShapeUI).SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_INK:
|
|
|
+ {
|
|
|
+
|
|
|
+ CPDFFreehandUI tempFreehandPanel = new CPDFFreehandUI();
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ tempFreehandPanel.SetPresentAnnotAttrib(annotParam, baseAnnot.GetAnnotData().Annot, pdfViewerControl.PDFToolManager.GetDocument(), pdfViewerControl);
|
|
|
+ tempFreehandPanel.EraseClickHandler += PdfFreehandUI_EraseClickHandler;
|
|
|
+ tempFreehandPanel.EraseChangeHandler += PdfFreehandUI_EraseChangeHandler;
|
|
|
+ tempAnnotationPanel = tempFreehandPanel;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFFreeTextUI();
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFFreeTextUI).SetPresentAnnotAttrib(annotParam as FreeTextParam, baseAnnot.GetAnnotData().Annot as CPDFFreeTextAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_TEXT:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFNoteUI();
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFNoteUI).SetPresentAnnotAttrib(annotParam as StickyNoteParam, baseAnnot.GetAnnotData().Annot as CPDFTextAnnotation, pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFTempStampUI();
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFTempStampUI).SetPresentAnnotAttrib(annotParam as StampParam , baseAnnot.GetAnnotData().Annot as CPDFStampAnnotation , pdfViewerControl.PDFToolManager.GetDocument(), pdfViewerControl);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_LINK:
|
|
|
+ {
|
|
|
+ tempAnnotationPanel = new CPDFLinkUI();
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+ pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+ baseAnnot.GetAnnotData().PageIndex,
|
|
|
+ baseAnnot.GetAnnotData().Annot);
|
|
|
+ (tempAnnotationPanel as CPDFLinkUI).SetPresentAnnotAttrib(annotParam as LinkParam, baseAnnot.GetAnnotData().Annot as CPDFLinkAnnotation, pdfViewerControl, pdfViewerControl.PDFToolManager.GetDocument().PageCount);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
|
|
|
+ tempAnnotationPanel = null;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void LoadAnnotationPanel(CPDFAnnotationType annotationType)
|
|
@@ -906,7 +982,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
|
|
|
{
|
|
|
- SetAnnotEventData();
|
|
|
+ SetAnnotEventData();
|
|
|
}
|
|
|
|
|
|
public void ClearPanel()
|
|
@@ -920,7 +996,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
if (pdfViewerControl.PDFToolManager != null)
|
|
|
{
|
|
|
- if (pdfViewerControl.PDFToolManager.GetCacheHitTestAnnot()==null && isTempPanel)
|
|
|
+ if (pdfViewerControl.PDFToolManager.GetCacheHitTestAnnot() == null && isTempPanel)
|
|
|
{
|
|
|
ShowCurrentAnnotPanel();
|
|
|
isTempPanel = false;
|