|
@@ -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,21 @@ 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 +116,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;
|
|
@@ -126,6 +133,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
InitSelectFreeTextAnnotMenu();
|
|
InitSelectFreeTextAnnotMenu();
|
|
InitSelectMultiAnnotMenu();
|
|
InitSelectMultiAnnotMenu();
|
|
SubscribeEvent();
|
|
SubscribeEvent();
|
|
|
|
+ InitShapeList();
|
|
}
|
|
}
|
|
|
|
|
|
#region 事件聚合器(来自AnnotToolContentViewModel)
|
|
#region 事件聚合器(来自AnnotToolContentViewModel)
|
|
@@ -136,29 +144,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 +391,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 +404,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 +467,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 +517,30 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
ShowPropertyPanel(true);
|
|
ShowPropertyPanel(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private List<string> ShapeList = new List<string>();
|
|
|
|
+ private void InitShapeList()
|
|
|
|
+ {
|
|
|
|
+ ShapeList.Add("HookShape");
|
|
|
|
+ ShapeList.Add("ForkShape");
|
|
|
|
+ ShapeList.Add("RectShape");
|
|
|
|
+ ShapeList.Add("LineShape");
|
|
|
|
+ ShapeList.Add("DotShape");
|
|
|
|
+ ShapeList.Add("Sign");
|
|
}
|
|
}
|
|
//注释工具
|
|
//注释工具
|
|
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 +550,10 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
annotArgs = GetFreetext();
|
|
annotArgs = GetFreetext();
|
|
break;
|
|
break;
|
|
case "RbtnSign"://签名
|
|
case "RbtnSign"://签名
|
|
|
|
+ Shape = "Sign";
|
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
annotArgs = GetSignature();
|
|
annotArgs = GetSignature();
|
|
- PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
|
|
|
|
|
|
+ //清空其他注释
|
|
break;
|
|
break;
|
|
case "RbtnTick"://勾
|
|
case "RbtnTick"://勾
|
|
Shape = "HookShape";
|
|
Shape = "HookShape";
|
|
@@ -599,7 +622,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 +644,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 +675,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 +744,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);
|
|
@@ -726,10 +752,10 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- freehandArgs.RawPointList = ShapePoints;
|
|
|
|
- freehandArgs.InkColor = (SelectColor as SolidColorBrush).Color;
|
|
|
|
- freehandArgs.Transparency = 1;
|
|
|
|
- freehandArgs.LineWidth = LineWidth;
|
|
|
|
|
|
+ //freehandArgs.RawPointList = ShapePoints;
|
|
|
|
+ //freehandArgs.InkColor = (SelectColor as SolidColorBrush).Color;
|
|
|
|
+ //freehandArgs.Transparency = 1;
|
|
|
|
+ //freehandArgs.LineWidth = LineWidth;
|
|
annotAttribsList[AnnotAttrib.Color] = freehandArgs.InkColor;
|
|
annotAttribsList[AnnotAttrib.Color] = freehandArgs.InkColor;
|
|
annotAttribsList[AnnotAttrib.Transparency] = freehandArgs.Transparency;
|
|
annotAttribsList[AnnotAttrib.Transparency] = freehandArgs.Transparency;
|
|
annotAttribsList[AnnotAttrib.Thickness] = freehandArgs.LineWidth;
|
|
annotAttribsList[AnnotAttrib.Thickness] = freehandArgs.LineWidth;
|
|
@@ -866,19 +892,94 @@ 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)
|
|
- {
|
|
|
|
|
|
+ {
|
|
|
|
+ for (int j = 0; j < viewContentViewModel.FillAndSign.Count; j++)
|
|
|
|
+ {
|
|
|
|
+ //annotAttribsList = itemAnnot.GetAnnotAttrib();
|
|
|
|
+ //annotAttribsList[AnnotAttrib.Width] = (itemAnnot as FreehandAnnotArgs).Width;
|
|
|
|
+ //annotAttribsList[AnnotAttrib.Height] = (itemAnnot as FreehandAnnotArgs).Height;
|
|
|
|
+ if (viewContentViewModel.FillAndSign[j].PageIndex == itemAnnot.PageIndex && viewContentViewModel.FillAndSign[j].AnnotIndex == itemAnnot.AnnotIndex)
|
|
|
|
+ {
|
|
|
|
+ FreehandAnnotArgs freehandArgs = null;
|
|
|
|
+ freehandArgs = itemAnnot as FreehandAnnotArgs;
|
|
|
|
+ annotAttribsList = itemAnnot.GetAnnotAttrib();
|
|
|
|
+ annotAttribsList[AnnotAttrib.Color] = freehandArgs.InkColor;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Transparency] = freehandArgs.Transparency;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Thickness] = freehandArgs.LineWidth;
|
|
|
|
+ annotAttribsList[AnnotAttrib.NoteText] = freehandArgs.Content;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Path] = freehandArgs.RawPointList;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Width] = freehandArgs.Width;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Height] = freehandArgs.Height;
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[0])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[1])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List<Point> { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[2])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(5, 5), new Point(28, 5) }, new List<Point> { new Point(28, 5), new Point(28, 27) }, new List<Point> { new Point(28, 27), new Point(5, 27) }, new List<Point> { new Point(5, 27), new Point(5, 5) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[3])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(28, 3.20001) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[4])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
var eventitem = AnnotAttribEvent.GetAnnotAttribEvent(itemAnnot, annotAttribsList);
|
|
var eventitem = AnnotAttribEvent.GetAnnotAttribEvent(itemAnnot, annotAttribsList);
|
|
//PDFViewer.SelectAnnotation(itemAnnot.PageIndex, itemAnnot.AnnotIndex);
|
|
//PDFViewer.SelectAnnotation(itemAnnot.PageIndex, itemAnnot.AnnotIndex);
|
|
propertyPanel.AnnotEvents.Add(eventitem);
|
|
propertyPanel.AnnotEvents.Add(eventitem);
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ for (int j = 0; j < viewContentViewModel.FillAndSign.Count; j++)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ if (viewContentViewModel.FillAndSign[j].PageIndex == annots[0].PageIndex && viewContentViewModel.FillAndSign[j].AnnotIndex == annots[0].AnnotIndex)
|
|
|
|
+ {
|
|
|
|
+ FreehandAnnotArgs freehandArgs = null;
|
|
|
|
+ freehandArgs = annots[0] as FreehandAnnotArgs;
|
|
|
|
+ annotAttribsList = annots[0].GetAnnotAttrib();
|
|
|
|
+ annotAttribsList[AnnotAttrib.Color] = freehandArgs.InkColor;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Transparency] = freehandArgs.Transparency;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Thickness] = freehandArgs.LineWidth;
|
|
|
|
+ annotAttribsList[AnnotAttrib.NoteText] = freehandArgs.Content;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Path] = freehandArgs.RawPointList;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Width] = freehandArgs.Width;
|
|
|
|
+ annotAttribsList[AnnotAttrib.Height] = freehandArgs.Height;
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[0])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[1])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List<Point> { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[2])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(5, 5), new Point(28, 5) }, new List<Point> { new Point(28, 5), new Point(28, 27) }, new List<Point> { new Point(28, 27), new Point(5, 27) }, new List<Point> { new Point(5, 27), new Point(5, 5) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[3])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(28, 3.20001) } };
|
|
|
|
+ //}
|
|
|
|
+ //if (viewContentViewModel.FillAndSign[j].Shape == ShapeList[4])
|
|
|
|
+ //{
|
|
|
|
+ // annotAttribsList[AnnotAttrib.Path] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
propertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annots[0], annotAttribsList);
|
|
propertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annots[0], annotAttribsList);
|
|
if (annots[0] is LinkAnnotArgs && annotAttribEvent != null)
|
|
if (annots[0] is LinkAnnotArgs && annotAttribEvent != null)
|
|
{
|
|
{
|
|
@@ -901,9 +1002,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 +1016,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 +1267,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 +1583,36 @@ 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") { if (Shape == "Sign") { viewContentViewModel.AnnotSignatures.Add(new Tuple<int, int>(pageindex, annotindex)); } else { 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]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (int j = 0; j < viewContentViewModel.AnnotSignatures.Count; j++)
|
|
|
|
+ {
|
|
|
|
+ if (viewContentViewModel.AnnotSignatures[j].Item1 == pageindex && viewContentViewModel.AnnotSignatures[j].Item2 == annotindex)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ viewContentViewModel.AnnotSignatures.Remove(viewContentViewModel.AnnotSignatures[j]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1551,7 +1677,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
else
|
|
else
|
|
{
|
|
{
|
|
ShowPropertyPanel();
|
|
ShowPropertyPanel();
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1676,10 +1802,44 @@ 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:
|
|
|
|
+
|
|
|
|
+ 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)
|
|
|
|
+ {
|
|
|
|
+ foreach (var point in viewContentViewModel.AnnotSignatures)
|
|
|
|
+ {
|
|
|
|
+ if (annot.PageIndex == point.Item1 && annot.AnnotIndex == point.Item2)
|
|
|
|
+ {
|
|
|
|
+ isDifferen = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ isDifferen = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (isDifferen)
|
|
|
|
+ {
|
|
|
|
+ ShowPropertyPanel(true); AddToPropertyPanel("SignatureAnnotProperty"); return; }
|
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null); return;
|
|
|
|
+ }
|
|
GetFreehand(e.AnnotItemsList);
|
|
GetFreehand(e.AnnotItemsList);
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -1714,10 +1874,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);
|