|
@@ -21,6 +21,8 @@ using ComPDFKit.Tool;
|
|
|
using PasswordBoxPlus.Helper;
|
|
|
using ComPDFKit.NativeMethod;
|
|
|
using ComPDFKit.PDFPage;
|
|
|
+using ComPDFKitViewer.Widget;
|
|
|
+using ComPDFKit.Tool.Help;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
@@ -31,6 +33,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
public PDFViewControl PDFViewControl;
|
|
|
public CPDFAnnotationControl PDFAnnotationControl = null;
|
|
|
private CPDFDisplaySettingsControl displaySettingsControl = null;
|
|
|
+ public FromPropertyControl FromPropertyControl = new FromPropertyControl();
|
|
|
|
|
|
private PanelState panelState = PanelState.GetInstance();
|
|
|
|
|
@@ -141,6 +144,11 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
this.displaySettingsControl = displaySettingsControl;
|
|
|
}
|
|
|
|
|
|
+ public void SetPropertyContainer(UIElement uiElement)
|
|
|
+ {
|
|
|
+ PropertyContainer.Child = uiElement;
|
|
|
+ }
|
|
|
+
|
|
|
public void ClearAllToolState()
|
|
|
{
|
|
|
this.AnnotationBarControl.ClearAllToolState();
|
|
@@ -159,9 +167,31 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
PDFViewControl.MouseRightButtonDownHandler -= PDFViewControl_MouseRightButtonDownHandler;
|
|
|
PDFViewControl.MouseRightButtonDownHandler += PDFViewControl_MouseRightButtonDownHandler;
|
|
|
+
|
|
|
InitialPDFViewControl(PDFViewControl);
|
|
|
}
|
|
|
|
|
|
+ private void PDFToolManager_MouseLeftButtonDownHandler(object sender, MouseEventObject e)
|
|
|
+ {
|
|
|
+ if (e.annotType == C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET)
|
|
|
+ {
|
|
|
+ BaseWidget baseWidget = PDFViewControl.GetCacheHitTestWidget();
|
|
|
+ if (baseWidget != null)
|
|
|
+ {
|
|
|
+ AnnotParam annotParam = ParamConverter.CPDFDataConverterToAnnotParam(
|
|
|
+PDFViewControl.PDFViewTool.GetCPDFViewer().GetDocument(),
|
|
|
+baseWidget.GetAnnotData().PageIndex,
|
|
|
+baseWidget.GetAnnotData().Annot);
|
|
|
+ if ((annotParam as WidgetParm).WidgetType == C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS)
|
|
|
+ {
|
|
|
+ CPDFSignatureUI signatureProperty = new CPDFSignatureUI();
|
|
|
+ signatureProperty.SetFormProperty(annotParam, PDFViewControl, baseWidget.GetAnnotData().Annot);
|
|
|
+ PropertyContainer.Child = signatureProperty;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
PDFViewControl.MouseRightButtonDownHandler -= PDFViewControl_MouseRightButtonDownHandler;
|
|
@@ -203,7 +233,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
//PDFViewControl.PDFView.AnnotActiveHandler -= PDFView_AnnotActiveHandler;
|
|
|
//PDFViewControl.PDFView.AnnotActiveHandler += PDFView_AnnotActiveHandler;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
//PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
|
|
|
//PDFViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
|
|
|
}
|
|
@@ -262,7 +292,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void CreateSelectImageContextMenu(object sender, ref ContextMenu menu)
|
|
|
{
|
|
|
if (menu == null)
|
|
@@ -279,14 +309,14 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
extractImage.Click += ExtractImage_Click;
|
|
|
menu.Items.Add(extractImage);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
private void ExtractImage_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
|
|
|
if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
{
|
|
|
var image = PDFViewControl.FocusPDFViewTool.GetSelectImage();
|
|
|
- if(image == null)
|
|
|
+ if (image == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -304,7 +334,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
private void CopyImage_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
var image = PDFViewControl.FocusPDFViewTool.GetSelectImage();
|
|
|
- if(image == null)
|
|
|
+ if (image == null)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
@@ -320,7 +350,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
imageData = new BitmapImage();
|
|
|
imageData.BeginInit();
|
|
|
imageData.StreamSource = ms;
|
|
|
-
|
|
|
+
|
|
|
imageData.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
imageData.EndInit();
|
|
|
imageData.Freeze();
|
|
@@ -495,14 +525,14 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
}
|
|
|
|
|
|
private void AnnotationBarControl_AnnotationPropertyChanged(object sender, CPDFAnnotationType e)
|
|
|
- {
|
|
|
+ {
|
|
|
PDFAnnotationControl.LoadAnnotationPanel(e);
|
|
|
if (e != CPDFAnnotationType.Audio && e != CPDFAnnotationType.Image)
|
|
|
{
|
|
|
panelState.RightPanel = PanelState.RightPanelState.PropertyPanel;
|
|
|
}
|
|
|
|
|
|
- if(e == CPDFAnnotationType.Link)
|
|
|
+ if (e == CPDFAnnotationType.Link)
|
|
|
{
|
|
|
PDFViewControl.PDFViewTool.GetCPDFViewer().SetLinkHighlight(true);
|
|
|
}
|