|
@@ -53,6 +53,7 @@ using Size = System.Windows.Size;
|
|
using System.Windows.Markup;
|
|
using System.Windows.Markup;
|
|
using Prism.Services.Dialogs;
|
|
using Prism.Services.Dialogs;
|
|
using PDF_Office.ViewModels.Tools.AnnotManager;
|
|
using PDF_Office.ViewModels.Tools.AnnotManager;
|
|
|
|
+using PDF_Office.Model.FillAndSign;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.FillAndSign
|
|
namespace PDF_Office.ViewModels.FillAndSign
|
|
{
|
|
{
|
|
@@ -61,15 +62,18 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
#region
|
|
#region
|
|
public CPDFViewer PDFViewer;
|
|
public CPDFViewer PDFViewer;
|
|
private AnnotTransfer propertyPanel = new AnnotTransfer();
|
|
private AnnotTransfer propertyPanel = new AnnotTransfer();
|
|
- private ViewContentViewModel viewContentViewModel;
|
|
|
|
|
|
+ public ViewContentViewModel viewContentViewModel;
|
|
private bool isRightMenuAddAnnot = false;
|
|
private bool isRightMenuAddAnnot = false;
|
|
private IEventAggregator events;
|
|
private IEventAggregator events;
|
|
public List<List<Point>> ShapePoints = new List<List<Point>>();
|
|
public List<List<Point>> ShapePoints = new List<List<Point>>();
|
|
- private string Shape = "HookShape";
|
|
|
|
|
|
+ public string Shape = "HookShape";
|
|
|
|
+ private bool IsFillAndSign { get;
|
|
|
|
+
|
|
|
|
+ set; } = true;
|
|
private PopMenu FreeHandAnnotPopMenu;
|
|
private PopMenu FreeHandAnnotPopMenu;
|
|
private PopMenu FreeTextAnnotPopMenu;
|
|
private PopMenu FreeTextAnnotPopMenu;
|
|
private PopMenu MultiAnnotPopMenu;
|
|
private PopMenu MultiAnnotPopMenu;
|
|
- public bool isFirst=true;
|
|
|
|
|
|
+ public bool isFirst = true;
|
|
private IRegionManager regions { get; set; }
|
|
private IRegionManager regions { get; set; }
|
|
private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
|
|
private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
|
|
public static bool IsEdit = false;
|
|
public static bool IsEdit = false;
|
|
@@ -109,7 +113,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
string Unicode = "";
|
|
string Unicode = "";
|
|
public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events) { }
|
|
public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events) { }
|
|
|
|
|
|
- public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events,IDialogService dialogService)
|
|
|
|
|
|
+ public FillAndSignContentViewModel(IRegionManager regionManager, IEventAggregator events, IDialogService dialogService)
|
|
{
|
|
{
|
|
dialogs = dialogService;
|
|
dialogs = dialogService;
|
|
regions = regionManager;
|
|
regions = regionManager;
|
|
@@ -136,29 +140,31 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
|
|
|
private void FromFillAndSign(FillAndSigntEventArgs obj)
|
|
private void FromFillAndSign(FillAndSigntEventArgs obj)
|
|
{
|
|
{
|
|
- if(obj != null)
|
|
|
|
|
|
+ if (obj != null)
|
|
{
|
|
{
|
|
- if(string.IsNullOrEmpty(obj.Unicode) == false)
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(obj.Action) == false)
|
|
{
|
|
{
|
|
- if(obj.Unicode == "Clear")
|
|
|
|
|
|
+ if (obj.Action == "Clear")
|
|
{
|
|
{
|
|
viewContentViewModel.FillAndSign.Clear();
|
|
viewContentViewModel.FillAndSign.Clear();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- if(obj.Annots != null && obj.Annots.Count > 0)
|
|
|
|
|
|
+ if (obj.Annots != null && obj.Annots.Count > 0)
|
|
{
|
|
{
|
|
if (obj.Annots[0].EventType == AnnotArgsType.AnnotFreehand)
|
|
if (obj.Annots[0].EventType == AnnotArgsType.AnnotFreehand)
|
|
{
|
|
{
|
|
|
|
+ IsFillAndSign = false;
|
|
GetFreehand(obj.Annots);
|
|
GetFreehand(obj.Annots);
|
|
|
|
+
|
|
}
|
|
}
|
|
- else if(obj.Annots[0].EventType == AnnotArgsType.AnnotFreeText)
|
|
|
|
|
|
+ else if (obj.Annots[0].EventType == AnnotArgsType.AnnotFreeText)
|
|
{
|
|
{
|
|
GetFreetext(obj.Annots);
|
|
GetFreetext(obj.Annots);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -381,7 +387,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType,string savaKey="")
|
|
|
|
|
|
+ private DefaultAnnotProperty GetAnnotDefault(AnnotArgsType annotArgsType, string savaKey = "")
|
|
{
|
|
{
|
|
var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, savaKey);
|
|
var Annot = SettingHelper.GetAnnotDefaultProperty(annotArgsType, savaKey);
|
|
if (Annot == null)
|
|
if (Annot == null)
|
|
@@ -394,13 +400,13 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
private void CheckedEvent(object e)
|
|
private void CheckedEvent(object e)
|
|
{
|
|
{
|
|
|
|
|
|
- var control = e as Control;
|
|
|
|
-
|
|
|
|
- IsEdit = false;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //NavigateToProperty(control.Name);
|
|
|
|
- //不创建注释,属于注释模板
|
|
|
|
|
|
+ var control = e as Control;
|
|
|
|
+
|
|
|
|
+ IsEdit = false;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //NavigateToProperty(control.Name);
|
|
|
|
+ //不创建注释,属于注释模板
|
|
bool isTemplateAnnot = false;
|
|
bool isTemplateAnnot = false;
|
|
bool isSnapshotEdit = false;
|
|
bool isSnapshotEdit = false;
|
|
AnnotHandlerEventArgs annotArgs = null;
|
|
AnnotHandlerEventArgs annotArgs = null;
|
|
@@ -457,7 +463,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
private void InitCheckedEvent(string e)
|
|
private void InitCheckedEvent(string e)
|
|
{
|
|
{
|
|
IsEdit = false;
|
|
IsEdit = false;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
//NavigateToProperty(control.Name);
|
|
//NavigateToProperty(control.Name);
|
|
//不创建注释,属于注释模板
|
|
//不创建注释,属于注释模板
|
|
@@ -507,19 +513,20 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
ShowPropertyPanel(true);
|
|
ShowPropertyPanel(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
//注释工具
|
|
//注释工具
|
|
private void FindAnnotTypeKey(string tag, ref AnnotHandlerEventArgs annotArgs, bool isRightMenuAdd = false)
|
|
private void FindAnnotTypeKey(string tag, ref AnnotHandlerEventArgs annotArgs, bool isRightMenuAdd = false)
|
|
{
|
|
{
|
|
LineWidthMultiple = 1;
|
|
LineWidthMultiple = 1;
|
|
IsSignPoint = false;
|
|
IsSignPoint = false;
|
|
|
|
+ Shape = "None";
|
|
switch (tag)
|
|
switch (tag)
|
|
{
|
|
{
|
|
|
|
|
|
- case "RbtnDate":
|
|
|
|
- DateOrText = "Freetext";
|
|
|
|
- annotArgs = GetFreetext();
|
|
|
|
|
|
+ case "RbtnDate":
|
|
|
|
+ DateOrText = "Freetext";
|
|
|
|
+ annotArgs = GetFreetext();
|
|
break;
|
|
break;
|
|
case "RbtnText"://文本
|
|
case "RbtnText"://文本
|
|
DateOrText = "";
|
|
DateOrText = "";
|
|
@@ -529,8 +536,9 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
annotArgs = GetFreetext();
|
|
annotArgs = GetFreetext();
|
|
break;
|
|
break;
|
|
case "RbtnSign"://签名
|
|
case "RbtnSign"://签名
|
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
annotArgs = GetSignature();
|
|
annotArgs = GetSignature();
|
|
- PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
|
|
|
|
|
|
+ //清空其他注释
|
|
break;
|
|
break;
|
|
case "RbtnTick"://勾
|
|
case "RbtnTick"://勾
|
|
Shape = "HookShape";
|
|
Shape = "HookShape";
|
|
@@ -599,7 +607,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
List<AnnotHandlerEventArgs> stampAnnotArgsList = new List<AnnotHandlerEventArgs>();
|
|
List<AnnotHandlerEventArgs> stampAnnotArgsList = new List<AnnotHandlerEventArgs>();
|
|
if (stampAnnotArgs != null)
|
|
if (stampAnnotArgs != null)
|
|
stampAnnotArgsList.Add(stampAnnotArgs);
|
|
stampAnnotArgsList.Add(stampAnnotArgs);
|
|
-
|
|
|
|
|
|
+
|
|
//if (selectedArgs != null) {
|
|
//if (selectedArgs != null) {
|
|
//var annot = selectedArgs[0];
|
|
//var annot = selectedArgs[0];
|
|
//if (annot != null)
|
|
//if (annot != null)
|
|
@@ -621,7 +629,10 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
public void SetStamp()
|
|
public void SetStamp()
|
|
{
|
|
{
|
|
StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
|
+ double lineWidthMultiple = LineWidthMultiple;
|
|
|
|
+ if (Shape == "DotShape") { LineWidthMultiple = 5; }
|
|
stampAnnotArgs.SetInkData(ShapePoints, LineWidth * LineWidthMultiple, (SelectColor as SolidColorBrush).Color);
|
|
stampAnnotArgs.SetInkData(ShapePoints, LineWidth * LineWidthMultiple, (SelectColor as SolidColorBrush).Color);
|
|
|
|
+ LineWidthMultiple = lineWidthMultiple;
|
|
//PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
//PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
//PDFViewer.SetToolParam(stampArgs);
|
|
//PDFViewer.SetToolParam(stampArgs);
|
|
//StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
//StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
@@ -649,7 +660,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
PDFViewer.SetToolParam(annotArgs);
|
|
PDFViewer.SetToolParam(annotArgs);
|
|
-
|
|
|
|
|
|
+
|
|
isRightMenuAddAnnot = false;
|
|
isRightMenuAddAnnot = false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -718,7 +729,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
//if (ListPoint((item as FreehandAnnotArgs).RawPointList, ShapePoints)){
|
|
//if (ListPoint((item as FreehandAnnotArgs).RawPointList, ShapePoints)){
|
|
foreach (var point in viewContentViewModel.FillAndSign)
|
|
foreach (var point in viewContentViewModel.FillAndSign)
|
|
{
|
|
{
|
|
- if ((item as FreehandAnnotArgs).PageIndex == point.Item1 && (item as FreehandAnnotArgs).AnnotIndex == point.Item2)
|
|
|
|
|
|
+ if ((item as FreehandAnnotArgs).PageIndex == point.PageIndex && (item as FreehandAnnotArgs).AnnotIndex == point.AnnotIndex)
|
|
{
|
|
{
|
|
|
|
|
|
newSelectedArgs.Add(item);
|
|
newSelectedArgs.Add(item);
|
|
@@ -866,8 +877,8 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
if (annots.Count > 1)
|
|
if (annots.Count > 1)
|
|
{
|
|
{
|
|
if (propertyPanel.AnnotEvents == null)
|
|
if (propertyPanel.AnnotEvents == null)
|
|
- propertyPanel.AnnotEvents = new List<AnnotAttribEvent>();
|
|
|
|
-
|
|
|
|
|
|
+ propertyPanel.AnnotEvents = new List<AnnotAttribEvent>();
|
|
|
|
+
|
|
propertyPanel.AnnotEvents.Clear();
|
|
propertyPanel.AnnotEvents.Clear();
|
|
|
|
|
|
foreach (var itemAnnot in annots)
|
|
foreach (var itemAnnot in annots)
|
|
@@ -901,9 +912,10 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
|
|
|
if (isUpData) { return; }
|
|
if (isUpData) { return; }
|
|
|
|
|
|
- if (viewContent == "ShapFillProperty") {
|
|
|
|
-
|
|
|
|
- NavigateToProperty(viewContent, propertyPanel); return; }
|
|
|
|
|
|
+ if (viewContent == "ShapFillProperty")
|
|
|
|
+ {
|
|
|
|
+ NavigateToProperty(viewContent, propertyPanel); return;
|
|
|
|
+ }
|
|
viewContentViewModel.SelectedPrpoertyPanel(viewContent, propertyPanel);
|
|
viewContentViewModel.SelectedPrpoertyPanel(viewContent, propertyPanel);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -914,6 +926,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
NavigationParameters values = new NavigationParameters();
|
|
NavigationParameters values = new NavigationParameters();
|
|
values.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
values.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
values.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
|
|
values.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
|
|
|
|
+ values.Add("IsFillAndSign", IsFillAndSign);
|
|
values.Add("Shape", Shape);
|
|
values.Add("Shape", Shape);
|
|
values.Add("FillAndSignContentViewModel", this);
|
|
values.Add("FillAndSignContentViewModel", this);
|
|
regions.RequestNavigate(RegionNames.PropertyRegionName, btnName, values);
|
|
regions.RequestNavigate(RegionNames.PropertyRegionName, btnName, values);
|
|
@@ -1164,9 +1177,9 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
|
|
|
case AnnotArgsType.AnnotFreehand:
|
|
case AnnotArgsType.AnnotFreehand:
|
|
e.PopupMenu = FreeHandAnnotPopMenu.OpenMenu(selectedAnnot, sender);
|
|
e.PopupMenu = FreeHandAnnotPopMenu.OpenMenu(selectedAnnot, sender);
|
|
- break;
|
|
|
|
- case AnnotArgsType.AnnotFreeText:
|
|
|
|
- e.PopupMenu= FreeTextAnnotPopMenu.OpenMenu(selectedAnnot, sender);
|
|
|
|
|
|
+ break;
|
|
|
|
+ case AnnotArgsType.AnnotFreeText:
|
|
|
|
+ e.PopupMenu = FreeTextAnnotPopMenu.OpenMenu(selectedAnnot, sender);
|
|
break;
|
|
break;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1480,13 +1493,29 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
for (int i = 0; i < e.Count; i++)
|
|
for (int i = 0; i < e.Count; i++)
|
|
{
|
|
{
|
|
AnnotEditEvent editEvent = e[i];
|
|
AnnotEditEvent editEvent = e[i];
|
|
|
|
+ int pageindex = editEvent.PageIndex;
|
|
|
|
+ int annotindex = editEvent.AnnotIndex;
|
|
switch (editEvent.EditAction)
|
|
switch (editEvent.EditAction)
|
|
{
|
|
{
|
|
case ActionType.Add:
|
|
case ActionType.Add:
|
|
- int pageindex = editEvent.PageIndex;
|
|
|
|
- int annotindex = editEvent.AnnotIndex;
|
|
|
|
- viewContentViewModel.FillAndSign.Add(new Tuple<int,int>(pageindex, annotindex));
|
|
|
|
- PDFViewer.SelectAnnotation(pageindex, annotindex);
|
|
|
|
|
|
+
|
|
|
|
+ if (Shape != "None") { viewContentViewModel.FillAndSign.Add(new FillAndSignIsShape(pageindex, annotindex, Shape)); }
|
|
|
|
+ PDFViewer.SelectAnnotation(pageindex, annotindex);
|
|
|
|
+ break;
|
|
|
|
+ case ActionType.Del:
|
|
|
|
+ if (Shape != "None")
|
|
|
|
+ {
|
|
|
|
+ for (int j = 0; j < viewContentViewModel.FillAndSign.Count; j++)
|
|
|
|
+ {
|
|
|
|
+ if (viewContentViewModel.FillAndSign[j].PageIndex == pageindex && viewContentViewModel.FillAndSign[j].AnnotIndex == annotindex)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ viewContentViewModel.FillAndSign.Remove(viewContentViewModel.FillAndSign[j]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1551,7 +1580,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
else
|
|
else
|
|
{
|
|
{
|
|
ShowPropertyPanel();
|
|
ShowPropertyPanel();
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1676,10 +1705,26 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
{
|
|
{
|
|
|
|
|
|
case AnnotArgsType.AnnotFreeText:
|
|
case AnnotArgsType.AnnotFreeText:
|
|
|
|
+
|
|
GetFreetext(e.AnnotItemsList);
|
|
GetFreetext(e.AnnotItemsList);
|
|
break;
|
|
break;
|
|
|
|
|
|
case AnnotArgsType.AnnotFreehand:
|
|
case AnnotArgsType.AnnotFreehand:
|
|
|
|
+ if (viewContentViewModel.FillAndSign.Count < 1) { viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return; }
|
|
|
|
+ bool isDifferen = false;
|
|
|
|
+ foreach (var point in viewContentViewModel.FillAndSign)
|
|
|
|
+ {
|
|
|
|
+ if (annot.PageIndex == point.PageIndex && annot.AnnotIndex == point.AnnotIndex)
|
|
|
|
+ {
|
|
|
|
+ isDifferen=true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ isDifferen = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!isDifferen) { viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return; }
|
|
GetFreehand(e.AnnotItemsList);
|
|
GetFreehand(e.AnnotItemsList);
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -1714,10 +1759,11 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
|
|
+ IsFillAndSign = true;
|
|
navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
|
|
navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
- BindingPDFViewerHandler();
|
|
|
|
- HookShapeIsCheck = true;
|
|
|
|
|
|
+ BindingPDFViewerHandler();
|
|
|
|
+ HookShapeIsCheck = true;
|
|
HookShapeIsCheck = false;
|
|
HookShapeIsCheck = false;
|
|
InitFillAndSignProperty();
|
|
InitFillAndSignProperty();
|
|
ShowPropertyPanel(false);
|
|
ShowPropertyPanel(false);
|