|
@@ -658,7 +658,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
pdfLinkUI = new CPDFLinkUI();
|
|
|
}
|
|
|
- InkParam linkAnnotArgs = new InkParam();
|
|
|
+ LinkParam linkAnnotArgs = new LinkParam();
|
|
|
if (this.pdfViewerControl != null&& pdfViewerControl.PDFViewTool!=null && pdfViewerControl.PDFViewTool.GetCPDFViewer().GetDocument() != null)
|
|
|
{
|
|
|
pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
@@ -711,145 +711,145 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
|
|
|
private void PdfFreehandUI_EraseChangeHandler(object sender, double e)
|
|
|
{
|
|
|
- if (pdfViewerControl != null && eraseArgs != null)
|
|
|
- {
|
|
|
- eraseArgs.Thickness = e;
|
|
|
- }
|
|
|
+ //if (pdfViewerControl != null && eraseArgs != null)
|
|
|
+ //{
|
|
|
+ // eraseArgs.Thickness = e;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private void PdfFreehandUI_EraseClickHandler(object sender, bool e)
|
|
|
{
|
|
|
- if (pdfViewerControl != null)
|
|
|
- {
|
|
|
- CPDFFreehandUI freehandUI = sender as CPDFFreehandUI;
|
|
|
- if (e)
|
|
|
- {
|
|
|
- annotArgs = pdfViewerControl.ToolManager.CurrentAnnotArgs;
|
|
|
- eraseArgs = new EraseArgs();
|
|
|
- eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
|
|
|
- eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
|
|
|
-
|
|
|
- if (freehandUI != null)
|
|
|
- {
|
|
|
- eraseArgs.Thickness = freehandUI.GetEraseThickness();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- eraseArgs.Thickness = 1;
|
|
|
- }
|
|
|
-
|
|
|
- disableClean = true;
|
|
|
- pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
- pdfViewerControl.SetToolParam(eraseArgs);
|
|
|
- disableClean = false;
|
|
|
- EmptyMessage.Visibility = Visibility.Collapsed;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
- FreehandAnnotArgs freehandAnnotArgs = annotArgs as FreehandAnnotArgs;
|
|
|
- if (freehandAnnotArgs == null)
|
|
|
- {
|
|
|
- freehandAnnotArgs = new FreehandAnnotArgs();
|
|
|
-
|
|
|
- freehandAnnotArgs.InkColor = Colors.Red;
|
|
|
- freehandAnnotArgs.Transparency = 1;
|
|
|
- freehandAnnotArgs.LineWidth = 1;
|
|
|
- annotArgs = freehandAnnotArgs;
|
|
|
- }
|
|
|
-
|
|
|
- if (freehandUI != null)
|
|
|
- {
|
|
|
- freehandUI.PropertyChanged -= CPDFAnnotationControl_PropertyChanged;
|
|
|
- Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
|
|
|
- attribDict[AnnotAttrib.Color] = freehandAnnotArgs.InkColor;
|
|
|
- attribDict[AnnotAttrib.Transparency] = freehandAnnotArgs.Transparency;
|
|
|
- attribDict[AnnotAttrib.Thickness] = freehandAnnotArgs.LineWidth;
|
|
|
- attribDict[AnnotAttrib.NoteText] = freehandAnnotArgs.Content;
|
|
|
-
|
|
|
- AnnotAttribEvent annotEvent = AnnotAttribEvent.GetAnnotAttribEvent(freehandAnnotArgs, attribDict);
|
|
|
- freehandUI.SetPresentAnnotAttrib(annotEvent);
|
|
|
- freehandUI.PropertyChanged += CPDFAnnotationControl_PropertyChanged;
|
|
|
- freehandUI.ClearAnnotAttribEvent();
|
|
|
- }
|
|
|
- pdfViewerControl.SetToolParam(freehandAnnotArgs);
|
|
|
- }
|
|
|
- }
|
|
|
+ //if (pdfViewerControl != null)
|
|
|
+ //{
|
|
|
+ // CPDFFreehandUI freehandUI = sender as CPDFFreehandUI;
|
|
|
+ // if (e)
|
|
|
+ // {
|
|
|
+ // annotArgs = pdfViewerControl.ToolManager.CurrentAnnotArgs;
|
|
|
+ // eraseArgs = new EraseArgs();
|
|
|
+ // eraseArgs.UIBorderColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
|
|
|
+ // eraseArgs.UIFillColor = Color.FromArgb(0x1A, 0x00, 0x00, 0x00);
|
|
|
+
|
|
|
+ // if (freehandUI != null)
|
|
|
+ // {
|
|
|
+ // eraseArgs.Thickness = freehandUI.GetEraseThickness();
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // eraseArgs.Thickness = 1;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // disableClean = true;
|
|
|
+ // pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
+ // pdfViewerControl.SetToolParam(eraseArgs);
|
|
|
+ // disableClean = false;
|
|
|
+ // EmptyMessage.Visibility = Visibility.Collapsed;
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // pdfViewerControl.PDFToolManager.SetToolType(ToolType.CreateAnnot);
|
|
|
+ // FreehandAnnotArgs freehandAnnotArgs = annotArgs as FreehandAnnotArgs;
|
|
|
+ // if (freehandAnnotArgs == null)
|
|
|
+ // {
|
|
|
+ // freehandAnnotArgs = new FreehandAnnotArgs();
|
|
|
+
|
|
|
+ // freehandAnnotArgs.InkColor = Colors.Red;
|
|
|
+ // freehandAnnotArgs.Transparency = 1;
|
|
|
+ // freehandAnnotArgs.LineWidth = 1;
|
|
|
+ // annotArgs = freehandAnnotArgs;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // if (freehandUI != null)
|
|
|
+ // {
|
|
|
+ // freehandUI.PropertyChanged -= CPDFAnnotationControl_PropertyChanged;
|
|
|
+ // Dictionary<AnnotAttrib, object> attribDict = new Dictionary<AnnotAttrib, object>();
|
|
|
+ // attribDict[AnnotAttrib.Color] = freehandAnnotArgs.InkColor;
|
|
|
+ // attribDict[AnnotAttrib.Transparency] = freehandAnnotArgs.Transparency;
|
|
|
+ // attribDict[AnnotAttrib.Thickness] = freehandAnnotArgs.LineWidth;
|
|
|
+ // attribDict[AnnotAttrib.NoteText] = freehandAnnotArgs.Content;
|
|
|
+
|
|
|
+ // AnnotAttribEvent annotEvent = AnnotAttribEvent.GetAnnotAttribEvent(freehandAnnotArgs, attribDict);
|
|
|
+ // freehandUI.SetPresentAnnotAttrib(annotEvent);
|
|
|
+ // freehandUI.PropertyChanged += CPDFAnnotationControl_PropertyChanged;
|
|
|
+ // freehandUI.ClearAnnotAttribEvent();
|
|
|
+ // }
|
|
|
+ // pdfViewerControl.SetToolParam(freehandAnnotArgs);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
+ // (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;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
public void LoadAnnotationPanel(CPDFAnnotationType annotationType)
|