|
@@ -21,6 +21,12 @@ using ComPDFKit.PDFDocument.Action;
|
|
|
using ComPDFKit.PDFDocument;
|
|
|
using System.Diagnostics;
|
|
|
using ComPDFKit.PDFAnnotation;
|
|
|
+using PDF_Office.ViewModels.BOTA;
|
|
|
+using PDF_Office.Views.BOTA;
|
|
|
+using System.Windows.Forms;
|
|
|
+using Control = System.Windows.Controls.Control;
|
|
|
+using Microsoft.Office.Interop.Word;
|
|
|
+using Point = System.Windows.Point;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.FillAndSign
|
|
|
{
|
|
@@ -30,11 +36,18 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
private CPDFViewer PDFViewer;
|
|
|
private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
|
|
|
private ViewContentViewModel viewContentViewModel;
|
|
|
- private bool isRightMenuAddAnnot = false;
|
|
|
+ private bool isRightMenuAddAnnot = false;
|
|
|
+ private List<List<Point>> ShapePoints = new List<List<Point>>();
|
|
|
+ private string Shape = "HookShape";
|
|
|
+
|
|
|
private IRegionManager regions { get; set; }
|
|
|
private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
|
|
|
- #endregion
|
|
|
|
|
|
+ public Brush SelectColor=new SolidColorBrush(Colors.GreenYellow);
|
|
|
+ public double FillOpacity = 1;
|
|
|
+ public double LineWidth = 1;
|
|
|
+ #endregion
|
|
|
+
|
|
|
#region Command
|
|
|
public DelegateCommand<RoutedEventArgs> CheckCommand { get; set; }
|
|
|
|
|
@@ -57,77 +70,100 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
{
|
|
|
var control = e.OriginalSource as Control;
|
|
|
|
|
|
- NavigateToProperty(control.Name);
|
|
|
+ //NavigateToProperty(control.Name);
|
|
|
//不创建注释,属于注释模板
|
|
|
- //bool isTemplateAnnot = false;
|
|
|
- //bool isSnapshotEdit = false;
|
|
|
- //AnnotHandlerEventArgs annotArgs = null;
|
|
|
-
|
|
|
-
|
|
|
- // var tag = control.Name;
|
|
|
- // if (control.Name == "RbtnSign") { FindAnnotTypeKey("Signature", ref annotArgs); isTemplateAnnot = true; }
|
|
|
- // if (control.Name == "RbtnText") { FindAnnotTypeKey("Freetext", ref annotArgs); }
|
|
|
- //if (control.Name == "RbtnDate") { FindAnnotTypeKey("Freetext", ref annotArgs); }
|
|
|
-
|
|
|
- // if (tag == "SnapshotEdit")
|
|
|
- // {
|
|
|
- // isSnapshotEdit = true;
|
|
|
- // }
|
|
|
- // else if (tag == "Signature" || tag == "Stamp")
|
|
|
- // {
|
|
|
- // isTemplateAnnot = true;
|
|
|
- // }
|
|
|
-
|
|
|
- // if (annotArgs != null)
|
|
|
- // {
|
|
|
- // annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
|
- // PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
- // PDFViewer.SetToolParam(annotArgs);
|
|
|
- // isRightMenuAddAnnot = false;
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- ////当不是注释模板,且无创建注释时,属性面板显示为空内容
|
|
|
- //if (isTemplateAnnot == false && annotArgs == null)
|
|
|
- //{
|
|
|
- // PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
- // viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- // if (isSnapshotEdit == true)
|
|
|
- // {
|
|
|
- // ShowPropertyPanel(false);
|
|
|
- // isSnapshotEdit = false;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // ShowPropertyPanel(true);
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
+ bool isTemplateAnnot = false;
|
|
|
+ bool isSnapshotEdit = false;
|
|
|
+ AnnotHandlerEventArgs annotArgs = null;
|
|
|
+
|
|
|
+
|
|
|
+ var tag = control.Name;
|
|
|
+ FindAnnotTypeKey(control.Name, ref annotArgs);
|
|
|
+ if (control.Name == "RbtnSign") { isTemplateAnnot = true; }
|
|
|
+
|
|
|
+
|
|
|
+ if (tag == "SnapshotEdit")
|
|
|
+ {
|
|
|
+ isSnapshotEdit = true;
|
|
|
+ }
|
|
|
+ else if (tag == "Signature" || tag == "Stamp")
|
|
|
+ {
|
|
|
+ isTemplateAnnot = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (annotArgs != null)
|
|
|
+ {
|
|
|
+ annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ isRightMenuAddAnnot = false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //当不是注释模板,且无创建注释时,属性面板显示为空内容
|
|
|
+ if (isTemplateAnnot == false && annotArgs == null)
|
|
|
+ {
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (isSnapshotEdit == true)
|
|
|
+ {
|
|
|
+ ShowPropertyPanel(false);
|
|
|
+ isSnapshotEdit = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShowPropertyPanel(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
//注释工具
|
|
|
private void FindAnnotTypeKey(string tag, ref AnnotHandlerEventArgs annotArgs, bool isRightMenuAdd = false)
|
|
|
{
|
|
|
switch (tag)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
+ {
|
|
|
+
|
|
|
+ case "RbtnDate":
|
|
|
+ case "RbtnText"://文本
|
|
|
+ annotArgs = GetFreetext();
|
|
|
+ break;
|
|
|
case "Freetext"://文本
|
|
|
annotArgs = GetFreetext();
|
|
|
break;
|
|
|
-
|
|
|
- case "Stamp"://图章
|
|
|
- annotArgs = GetStamp();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Signature"://签名
|
|
|
+ case "RbtnSign"://签名
|
|
|
annotArgs = GetSignature();
|
|
|
PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
|
|
|
+ break;
|
|
|
+ case "RbtnTick"://勾
|
|
|
+ Shape = "HookShape";
|
|
|
+ ShapePoints =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)} };
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+ case "RbtnFork"://叉
|
|
|
+ Shape = "ForkShape";
|
|
|
+ ShapePoints = 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) }};
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+ case "RbtnRectangle"://矩形
|
|
|
+ Shape = "RectShape";
|
|
|
+ ShapePoints = new List<List<Point>> { new List<Point> { new Point(0, 5), new Point(28, 5),new Point(28,27),new Point(0,27) , new Point(0, 5) } };
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+ case "RbtnLine"://下划线
|
|
|
+ Shape = "LineShape";
|
|
|
+ ShapePoints = new List<List<Point>> { new List<Point> { new Point(12, 10), new Point(36, 10) } };
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+ case "RbtnPoint":
|
|
|
+ Shape = "DotShape";
|
|
|
+ ShapePoints = new List<List<Point>> { new List<Point> { new Point(0, 0), new Point(2, 2) }, new List<Point> { new Point(2, 0), new Point(0,2 ) } };
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+ default://图章
|
|
|
break;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -147,21 +183,79 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
/// <returns></returns>
|
|
|
private AnnotHandlerEventArgs GetStamp()
|
|
|
{
|
|
|
- StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
- stampAnnotArgs.Opacity = 1;
|
|
|
- stampAnnotArgs.StampText = "APPROVED";
|
|
|
- stampAnnotArgs.Type = StampType.STANDARD_STAMP;
|
|
|
+ StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
+ stampAnnotArgs.SetInkData(ShapePoints, LineWidth, (SelectColor as SolidColorBrush).Color);
|
|
|
+ //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
+ //PDFViewer.SetToolParam(stampArgs);
|
|
|
+ //StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
+ //stampAnnotArgs.Opacity = 1;
|
|
|
+ //stampAnnotArgs.StampText = "APPROVED";
|
|
|
+ //stampAnnotArgs.Type = StampType.STANDARD_STAMP;
|
|
|
+ // stampAnnotArgs.Type = StampType.STANDARD_STAMP;
|
|
|
Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
|
|
|
annotAttribsList[AnnotAttrib.Transparency] = stampAnnotArgs.Opacity;
|
|
|
-
|
|
|
+ DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotStamp);
|
|
|
List<AnnotHandlerEventArgs> stampAnnotArgsList = new List<AnnotHandlerEventArgs>();
|
|
|
if (stampAnnotArgs != null)
|
|
|
stampAnnotArgsList.Add(stampAnnotArgs);
|
|
|
|
|
|
- AddToPropertyPanel("StampAnnotProperty", null, stampAnnotArgsList, annotAttribsList);
|
|
|
+ AddToPropertyPanel("ShapFillProperty", "", stampAnnotArgsList, annotAttribsList);
|
|
|
return stampAnnotArgs;
|
|
|
}
|
|
|
|
|
|
+ public void SetStamp()
|
|
|
+ {
|
|
|
+ StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
+ stampAnnotArgs.SetInkData(ShapePoints, LineWidth, (SelectColor as SolidColorBrush).Color);
|
|
|
+ //PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
+ //PDFViewer.SetToolParam(stampArgs);
|
|
|
+ //StampAnnotArgs stampAnnotArgs = new StampAnnotArgs();
|
|
|
+ //stampAnnotArgs.Opacity = 1;
|
|
|
+ //stampAnnotArgs.StampText = "APPROVED";
|
|
|
+ //stampAnnotArgs.Type = StampType.STANDARD_STAMP;
|
|
|
+ stampAnnotArgs.Opacity = FillOpacity;
|
|
|
+ Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
|
|
|
+ annotAttribsList[AnnotAttrib.Transparency] = stampAnnotArgs.Opacity;
|
|
|
+ DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotStamp);
|
|
|
+ List<AnnotHandlerEventArgs> stampAnnotArgsList = new List<AnnotHandlerEventArgs>();
|
|
|
+ if (stampAnnotArgs != null)
|
|
|
+ stampAnnotArgsList.Add(stampAnnotArgs);
|
|
|
+
|
|
|
+ AddToPropertyPanel("ShapFillProperty", "", stampAnnotArgsList, annotAttribsList);
|
|
|
+ bool isTemplateAnnot = false;
|
|
|
+ bool isSnapshotEdit = false;
|
|
|
+ AnnotHandlerEventArgs annotArgs = stampAnnotArgs;
|
|
|
+
|
|
|
+
|
|
|
+ if (annotArgs != null)
|
|
|
+ {
|
|
|
+ annotArgs.Author = Settings.Default.AppProperties.Description.Author;
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
+ PDFViewer.SetToolParam(annotArgs);
|
|
|
+ isRightMenuAddAnnot = false;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //当不是注释模板,且无创建注释时,属性面板显示为空内容
|
|
|
+ if (isTemplateAnnot == false && annotArgs == null)
|
|
|
+ {
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (isSnapshotEdit == true)
|
|
|
+ {
|
|
|
+ ShowPropertyPanel(false);
|
|
|
+ isSnapshotEdit = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShowPropertyPanel(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 文本
|
|
|
/// </summary>
|
|
@@ -246,7 +340,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
/// <param name="toolTag">导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线</param>
|
|
|
/// <param name="annot">注释</param>
|
|
|
/// <param name="annotAttribsList">更改注释属性的键值对,更改值后会自动记录undoRedo容器里</param>
|
|
|
- private void AddToPropertyPanel(string viewContent, string toolTag = null, List<AnnotHandlerEventArgs> annots = null, Dictionary<AnnotAttrib, object> annotAttribsList = null, AnnotAttribEvent annotAttribEvent = null)
|
|
|
+ private void AddToPropertyPanel(string viewContent, string toolTag = null, List<AnnotHandlerEventArgs> annots = null, Dictionary<AnnotAttrib, object> annotAttribsList = null, AnnotAttribEvent annotAttribEvent = null,bool isUpData=false)
|
|
|
{
|
|
|
|
|
|
if (annots != null)
|
|
@@ -282,18 +376,24 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
propertyPanel.AnnotEvent = annotAttribEvent;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (string.IsNullOrEmpty(viewContent) == false)
|
|
|
{
|
|
|
+ if (isUpData) { return; }
|
|
|
+ if (viewContent == "ShapFillProperty") { NavigateToProperty(viewContent, propertyPanel); return; }
|
|
|
viewContentViewModel.SelectedPrpoertyPanel(viewContent, propertyPanel);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private void NavigateToProperty(string btnName)
|
|
|
+ private void NavigateToProperty(string btnName, AnnotPropertyPanel annotPropertyPanel)
|
|
|
{
|
|
|
NavigationParameters values = new NavigationParameters();
|
|
|
values.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
|
- regions.RequestNavigate(RegionNames.PropertyRegionName,btnToProperty[btnName]);
|
|
|
+ values.Add(ParameterNames.PropertyPanelContentViewModel, annotPropertyPanel);
|
|
|
+ values.Add("Shape", Shape);
|
|
|
+ values.Add("FillAndSignContentViewModel", this);
|
|
|
+ regions.RequestNavigate(RegionNames.PropertyRegionName,btnName,values);
|
|
|
viewContentViewModel.IsPropertyOpen = true;
|
|
|
}
|
|
|
|
|
@@ -317,107 +417,177 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
{
|
|
|
//来自PDFViewer的响应事件
|
|
|
if (PDFViewer != null)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
|
|
|
- PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
|
|
|
-
|
|
|
-
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ //PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
|
|
|
+ //PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler;
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ private void UnBindingPDFViewerHandler()
|
|
|
+ {
|
|
|
+ if (PDFViewer != null)
|
|
|
+ { /*PDFViewer.AnnotActiveHandler += PDFViewer_AnnotActiveHandler; */}
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//选中和非选中注释,右键菜单
|
|
|
- private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
|
|
|
- {
|
|
|
- if (e != null)
|
|
|
- {
|
|
|
- var annot = e.AnnotItemsList[0];
|
|
|
- if (annot != null)
|
|
|
- {
|
|
|
- if (e.AnnotItemsList.Count == 1)
|
|
|
- {
|
|
|
- //IsAnnotCreateReset:是否为创建注释的状态
|
|
|
- if (e.IsAnnotCreateReset == false)
|
|
|
- {
|
|
|
- GetSelectedAnnots(e);
|
|
|
- //记录这次选中的注释,之后创建注释会跟随上次选中注释的属性值
|
|
|
- PDFViewer.SetToolParam(annot);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- //TODO: 设计已重新调整为(仅限高亮注释):修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
|
|
|
- if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotUnderline &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotHighlight &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotSquiggly &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotLink &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotFreehand &&
|
|
|
- annot.EventType != AnnotArgsType.AnnotSticky
|
|
|
- )
|
|
|
- {
|
|
|
- if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
|
|
|
- {
|
|
|
- foreach (var item in ToolExpandDict)
|
|
|
- {
|
|
|
- if (item.Value == e.AnnotItemsList[0].EventType)
|
|
|
- {
|
|
|
- annot = null;//新建注释时,回到默认值
|
|
|
- FindAnnotTypeKey(item.Key, ref annot);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //else
|
|
|
- PDFViewer.SetToolParam(annot);
|
|
|
- //设计重新调整,阅读页空白处,右键菜单,添加链接,和pro mac一样的效果,不显示属性栏
|
|
|
- if (isRightMenuAddAnnot)
|
|
|
- {
|
|
|
- ShowPropertyPanel(false);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ShowPropertyPanel();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- bool isDifferentAnnotTyle = false;
|
|
|
- var lastAnnot = annot;
|
|
|
- foreach (var item in e.AnnotItemsList)
|
|
|
- {
|
|
|
- if (lastAnnot.EventType != item.EventType)
|
|
|
- {
|
|
|
- if (isShapAnnot(annot) == true && isShapAnnot(item) == true)
|
|
|
- {
|
|
|
- lastAnnot = item;
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- lastAnnot = item;
|
|
|
- isDifferentAnnotTyle = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (isDifferentAnnotTyle)
|
|
|
- viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
- else
|
|
|
- GetSelectedAnnots(e);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
- }
|
|
|
- }
|
|
|
+ //private void PDFViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
|
|
|
+ //{
|
|
|
+ // if (e != null)
|
|
|
+ // {
|
|
|
+ // var annot = e.AnnotItemsList[0];
|
|
|
+ // if (annot != null)
|
|
|
+ // {
|
|
|
+ // if (e.AnnotItemsList.Count == 1)
|
|
|
+ // {
|
|
|
+ // //IsAnnotCreateReset:是否为创建注释的状态
|
|
|
+ // if (e.IsAnnotCreateReset == false)
|
|
|
+ // {
|
|
|
+ // GetSelectedAnnots(e);
|
|
|
+ // //记录这次选中的注释,之后创建注释会跟随上次选中注释的属性值
|
|
|
+ // PDFViewer.SetToolParam(annot);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+
|
|
|
+ // //TODO: 设计已重新调整为(仅限高亮注释):修改注释后,会作用到之后添加的注释中。因此先把此逻辑“创建注释后,会自动回到默认值”注释掉
|
|
|
+ // if (annot.EventType != AnnotArgsType.AnnotStrikeout &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotUnderline &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotHighlight &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotSquiggly &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotLink &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotFreehand &&
|
|
|
+ // annot.EventType != AnnotArgsType.AnnotSticky
|
|
|
+ // )
|
|
|
+ // {
|
|
|
+ // if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
|
|
|
+ // {
|
|
|
+ // foreach (var item in ToolExpandDict)
|
|
|
+ // {
|
|
|
+ // if (item.Value == e.AnnotItemsList[0].EventType)
|
|
|
+ // {
|
|
|
+ // annot = null;//新建注释时,回到默认值
|
|
|
+ // FindAnnotTypeKey(item.Key, ref annot);
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // //else
|
|
|
+ // //PDFViewer.SetToolParam(annot);
|
|
|
+ // //设计重新调整,阅读页空白处,右键菜单,添加链接,和pro mac一样的效果,不显示属性栏
|
|
|
+ // if (isRightMenuAddAnnot)
|
|
|
+ // {
|
|
|
+ // ShowPropertyPanel(false);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // ShowPropertyPanel();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // bool isDifferentAnnotTyle = false;
|
|
|
+ // var lastAnnot = annot;
|
|
|
+ // foreach (var item in e.AnnotItemsList)
|
|
|
+ // {
|
|
|
+ // if (lastAnnot.EventType != item.EventType)
|
|
|
+ // {
|
|
|
+ // if (isShapAnnot(annot) == true && isShapAnnot(item) == true)
|
|
|
+ // {
|
|
|
+ // lastAnnot = item;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // lastAnnot = item;
|
|
|
+ // isDifferentAnnotTyle = true;
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+ // if (isDifferentAnnotTyle)
|
|
|
+ // viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ // else
|
|
|
+ // GetSelectedAnnots(e);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
|
|
|
+ //{
|
|
|
+ // if (e != null && e.Count > 0)
|
|
|
+ // {
|
|
|
+ // for (int i = 0; i < e.Count; i++)
|
|
|
+ // {
|
|
|
+ // AnnotEditEvent editEvent = e[i];
|
|
|
+ // switch (editEvent.EditAction)
|
|
|
+ // {
|
|
|
+ // case ActionType.Add:
|
|
|
+
|
|
|
+ // // bool isTabItemAnnotation = IsBOTATabItemShow(out BOTAContentViewModel bOTAContentViewModel, out BOTAContent bOTAContent, "TabItemAnnotation");
|
|
|
+
|
|
|
+ // if (viewContentViewModel.OpenBOTA == true && isTabItemAnnotation == true)
|
|
|
+ // {
|
|
|
+ // AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
|
|
|
+
|
|
|
+ // if (viewModel != null)
|
|
|
+ // {
|
|
|
+ // int pageindex = editEvent.PageIndex;
|
|
|
+ // int annotindex = editEvent.AnnotIndex;
|
|
|
+ // viewModel.UpdateAddedAnnot(pageindex, annotindex);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // case ActionType.Del:
|
|
|
+ // //isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
|
|
|
+ // if (isTabItemAnnotation)
|
|
|
+ // {
|
|
|
+ // AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
|
|
|
+
|
|
|
+ // if (viewModel != null)
|
|
|
+ // {
|
|
|
+ // int pageindex = editEvent.PageIndex;
|
|
|
+ // int annotindex = editEvent.AnnotIndex;
|
|
|
+ // viewModel.UpdateModifiedAnnot(pageindex, annotindex, true);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // case ActionType.Modify:
|
|
|
+ // isTabItemAnnotation = IsBOTATabItemShow(out bOTAContentViewModel, out bOTAContent, "TabItemAnnotation");
|
|
|
+ // if (bOTAContent.TabItemAnnotation.IsSelected)
|
|
|
+ // {
|
|
|
+ // AnnotationContentViewModel viewModel = GetAnnotationContentViewModel(bOTAContentViewModel);
|
|
|
+
|
|
|
+ // if (viewModel != null)
|
|
|
+ // {
|
|
|
+ // int pageindex = editEvent.PageIndex;
|
|
|
+ // int annotindex = editEvent.AnnotIndex;
|
|
|
+ // viewModel.UpdateModifiedAnnot(pageindex, annotindex, false);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // case ActionType.TextEdit:
|
|
|
+ // break;
|
|
|
+
|
|
|
+ // default:
|
|
|
+ // break;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
private bool isShapAnnot(AnnotHandlerEventArgs annot)
|
|
|
{
|
|
|
if (annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
@@ -436,17 +606,17 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
{
|
|
|
var annot = e.AnnotItemsList[0];
|
|
|
switch (annot.EventType)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
case AnnotArgsType.AnnotFreeText:
|
|
|
GetFreetext(e.AnnotItemsList);
|
|
|
- break;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ break;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
private void ShowPropertyPanel(bool show = true)
|
|
@@ -463,7 +633,7 @@ namespace PDF_Office.ViewModels.FillAndSign
|
|
|
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
{
|
|
|
-
|
|
|
+ UnBindingPDFViewerHandler();
|
|
|
}
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|