|
@@ -39,8 +39,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
//比如在属性面板里更改注释颜色,会同时更新工具栏对应的工具颜色
|
|
|
propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
|
|
|
propertyPanel.DataChanged += AnnotPropertyPanel_DataChanged;
|
|
|
- propertyPanel.DefaultStored -= AnnotProperty_DefaultStored;
|
|
|
- propertyPanel.DefaultStored += AnnotProperty_DefaultStored;
|
|
|
propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
|
|
|
propertyPanel.AnnotTypeChanged += AnnotPropertyPanel_AnnotTypeChanged;
|
|
|
//快捷键
|
|
@@ -51,7 +49,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
private void UnBindingEvent()
|
|
|
{
|
|
|
propertyPanel.DataChanged -= AnnotPropertyPanel_DataChanged;
|
|
|
- propertyPanel.DefaultStored -= AnnotProperty_DefaultStored;
|
|
|
propertyPanel.AnnotTypeChanged -= AnnotPropertyPanel_AnnotTypeChanged;
|
|
|
//快捷盘解绑
|
|
|
KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
@@ -71,9 +68,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
|
|
|
PDFViewer.AnnotCommandHandler += PDFViewer_AnnotCommandHandler;
|
|
|
|
|
|
- PDFViewer.WidgetClickHander -= PDFViewer_WidgetClickHander;
|
|
|
- PDFViewer.WidgetClickHander += PDFViewer_WidgetClickHander;
|
|
|
-
|
|
|
PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
|
|
|
PDFViewer.SnapshotCommandHandler += PDFViewer_SnapshotCommandHandler;
|
|
|
|
|
@@ -87,45 +81,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void PDFViewer_PDFActionHandler(object sender, ComPDFKit.PDFDocument.Action.CPDFAction action)
|
|
|
- {
|
|
|
- if (action == null)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- switch (action.ActionType)
|
|
|
- {
|
|
|
- case C_ACTION_TYPE.ACTION_TYPE_GOTO:
|
|
|
- if (PDFViewer != null)
|
|
|
- {
|
|
|
- CPDFGoToAction gotoAction = action as CPDFGoToAction;
|
|
|
- CPDFDestination dest = gotoAction.GetDestination(PDFViewer.Document);
|
|
|
- if (dest != null)
|
|
|
- {
|
|
|
- PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(0, 0));
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- case C_ACTION_TYPE.ACTION_TYPE_URI:
|
|
|
- {
|
|
|
- CPDFUriAction uriAction = action as CPDFUriAction;
|
|
|
- string uri = uriAction.GetUri();
|
|
|
- try
|
|
|
- {
|
|
|
- if (!string.IsNullOrEmpty(uri))
|
|
|
- {
|
|
|
- Process.Start(uri);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- }
|
|
|
- }
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
private void UnBindingPDFViewerHandler()
|
|
|
{
|
|
|
if (PDFViewer != null)
|
|
@@ -133,7 +88,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
PDFViewer.AnnotEditHandler -= PDFViewer_AnnotEditHandler;
|
|
|
PDFViewer.AnnotActiveHandler -= PDFViewer_AnnotActiveHandler;
|
|
|
PDFViewer.AnnotCommandHandler -= PDFViewer_AnnotCommandHandler;
|
|
|
- PDFViewer.WidgetClickHander -= PDFViewer_WidgetClickHander;
|
|
|
PDFViewer.SnapshotCommandHandler -= PDFViewer_SnapshotCommandHandler;
|
|
|
PDFViewer.PDFActionHandler -= PDFViewer_PDFActionHandler;
|
|
|
PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
|
|
@@ -146,6 +100,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
|
|
|
#region 与触发事件调用相关的函数
|
|
|
|
|
|
+
|
|
|
//鼠标左键双击注释
|
|
|
private void PDFViewer_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
{
|
|
@@ -176,39 +131,45 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //是否为形状注释
|
|
|
- private bool isShapAnnot(AnnotHandlerEventArgs annot)
|
|
|
+ //超链接跳转
|
|
|
+ private void PDFViewer_PDFActionHandler(object sender, ComPDFKit.PDFDocument.Action.CPDFAction action)
|
|
|
{
|
|
|
- if (annot.EventType == AnnotArgsType.AnnotCircle ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotSquare ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotLine
|
|
|
- )
|
|
|
+ if (action == null)
|
|
|
{
|
|
|
- return true;
|
|
|
+ return;
|
|
|
}
|
|
|
- else
|
|
|
+ switch (action.ActionType)
|
|
|
{
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
+ case C_ACTION_TYPE.ACTION_TYPE_GOTO:
|
|
|
+ if (PDFViewer != null)
|
|
|
+ {
|
|
|
+ CPDFGoToAction gotoAction = action as CPDFGoToAction;
|
|
|
+ CPDFDestination dest = gotoAction.GetDestination(PDFViewer.Document);
|
|
|
+ if (dest != null)
|
|
|
+ {
|
|
|
+ PDFViewer.GoToPage(dest.PageIndex, new System.Windows.Point(0, 0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
|
|
|
- //是否为高亮注释
|
|
|
- private bool isHightAnnot(AnnotHandlerEventArgs annot)
|
|
|
- {
|
|
|
- if (annot.EventType == AnnotArgsType.AnnotUnderline ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotSquiggly ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotHighlight ||
|
|
|
- annot.EventType == AnnotArgsType.AnnotStrikeout
|
|
|
- )
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
+ case C_ACTION_TYPE.ACTION_TYPE_URI:
|
|
|
+ {
|
|
|
+ CPDFUriAction uriAction = action as CPDFUriAction;
|
|
|
+ string uri = uriAction.GetUri();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(uri))
|
|
|
+ {
|
|
|
+ Process.Start(uri);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
private void GetSelectedAnnots(AnnotAttribEvent e)
|
|
|
{
|
|
|
var annot = e.AnnotItemsList[0];
|
|
@@ -448,23 +409,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
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) || (isHightAnnot(annot) == true && isHightAnnot(item) == true))
|
|
|
- {
|
|
|
- lastAnnot = item;
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- lastAnnot = item;
|
|
|
- isDifferentAnnotTyle = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ bool isDifferentAnnotTyle = AnnotTransfer.IsDifferentTypeAnnots(e.AnnotItemsList);
|
|
|
|
|
|
if (isDifferentAnnotTyle)
|
|
|
viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
@@ -592,7 +537,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
bool isHigh = true;//是否为高亮
|
|
|
foreach (var item in e.AnnotEventArgsList)
|
|
|
{
|
|
|
- if (isHightAnnot(item) == false)
|
|
|
+ if (AnnotTransfer.IsHightAnnot(item) == false)
|
|
|
{
|
|
|
isHigh = false;
|
|
|
break;
|
|
@@ -601,7 +546,7 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
|
|
|
MultiAnnotPopMenu.SetVisual("MultiCopy", !isHigh);
|
|
|
MultiAnnotPopMenu.SetVisual("MultiCut", !isHigh);
|
|
|
- e.PopupMenu = MultiAnnotPopMenu.OpenMenu(e.AnnotEventArgsList, sender);//SelectMultiAnnotMenu(e.AnnotEventArgsList, isHigh);
|
|
|
+ e.PopupMenu = MultiAnnotPopMenu.OpenMenu(e.AnnotEventArgsList, sender);
|
|
|
}
|
|
|
}
|
|
|
if (e.PopupMenu != null)
|
|
@@ -924,9 +869,6 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void PDFViewer_WidgetClickHander(object sender, WidgetArgs e)
|
|
|
- {
|
|
|
- }
|
|
|
|
|
|
private void PDFViewer_AnnotHoverHandler(object sender, AnnotHoverData e)
|
|
|
{
|