Переглянути джерело

其他 - 替换注释列表部分功能,BotaBar等

zhuyi 1 рік тому
батько
коміт
3ef1369c14

+ 17 - 75
Demo/Examples/Compdfkit_Tools/Annotation/PDFAnnotationList/PDFAnnotationListControl/CPDFAnnotationListControl.xaml.cs

@@ -3,9 +3,12 @@ using ComPDFKit.PDFDocument;
 using ComPDFKit.PDFPage;
 using ComPDFKit.Tool;
 using ComPDFKit.Tool.Help;
+using ComPDFKitViewer;
+using ComPDFKitViewer.BaseObject;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
+using System.Windows.Annotations;
 using System.Windows.Controls;
 using static Compdfkit_Tools.PDFControlUI.CPDFAnnoationListUI;
 
@@ -13,7 +16,15 @@ namespace Compdfkit_Tools.PDFControl
 {
     public partial class CPDFAnnotationListControl : UserControl
     {
-        private List<C_ANNOTATION_TYPE> OmitList = new List<C_ANNOTATION_TYPE>();
+        private List<C_ANNOTATION_TYPE> OmitList = new List<C_ANNOTATION_TYPE> 
+        {
+            C_ANNOTATION_TYPE.C_ANNOTATION_UNKOWN,
+            C_ANNOTATION_TYPE.C_ANNOTATION_LINK,
+            C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET,
+            C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE,
+            C_ANNOTATION_TYPE.C_ANNOTATION_SOUND,
+            C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA
+        };
         /// <summary>
         /// PDFViewer
         /// </summary>
@@ -49,83 +60,14 @@ namespace Compdfkit_Tools.PDFControl
 
         private void PDFToolManager_MouseLeftButtonDownHandler(object sender, ComPDFKit.Tool.MouseEventObject e)
         {
-            switch (e.annotType)
-            {
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_NONE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_TEXT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_LINK:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_CARET:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_INK:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_POPUP:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_FILEATTACHMENT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_SCREEN:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_PRINTERMARK:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_TRAPNET:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_WATERMARK:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_3D:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_REDACT:
-                    break;
-                case ComPDFKit.PDFAnnotation.C_ANNOTATION_TYPE.C_ANNOTATION_INTERCHANGE:
-                    break;
-                default:
-                    break;
-            }
-        }
-
-        private void PdfViewer_AnnotActiveHandler(object sender, AnnotAttribEvent e)
-        {
-            if (e != null)
+            if (OmitList.Contains(e.annotType))
             {
-                //TODO SomeThing Need Change
-                int a = e.GetAnnotHandlerEventArgs(e.GetAnnotTypes())[0].AnnotIndex;
-                int b = e.GetAnnotHandlerEventArgs(e.GetAnnotTypes())[0].PageIndex;
-                AnnotationList.SelectAnnotationChanged(b, a);
+                AnnotationList.SelectAnnotationChanged(-1);
             }
             else
             {
-                AnnotationList.SelectAnnotationChanged(-1);
+                BaseAnnot baseAnnot= pdfViewer.PDFToolManager.GetCacheHitTestAnnot();
+                AnnotationList.SelectAnnotationChanged(baseAnnot.GetAnnotData().PageIndex,baseAnnot.GetAnnotData().AnnotIndex);
             }
         }
 
@@ -209,7 +151,7 @@ namespace Compdfkit_Tools.PDFControl
         private void AnnotationList_AnnotationSelectionChanged(object sender, object e)
         {
             var bindAnnotationResult = e as BindAnnotationResult;
-            pdfViewer.SelectAnnotation(bindAnnotationResult.PageIndex, bindAnnotationResult.AnnotIndex);
+            //pdfViewer.SelectAnnotation(bindAnnotationResult.PageIndex, bindAnnotationResult.AnnotIndex);
         }
     }
 }

+ 9 - 21
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFBOTABarControl.xaml.cs

@@ -1,20 +1,8 @@
-using ComPDFKit.PDFDocument;
-using Compdfkit_Tools.PDFControlUI;
-using ComPDFKitViewer.PdfViewer;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
 using System.Windows.Shapes;
 using Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl;
 using ComPDFKit.DigitalSign;
@@ -33,7 +21,7 @@ namespace Compdfkit_Tools.PDFControl
 
     public partial class CPDFBOTABarControl : UserControl
     {
-        private CPDFViewer pdfViewer;
+        private PDFViewControl pdfViewer;
 
         private ToggleButton bookmarkButton;
         private ToggleButton outlineButton;
@@ -57,7 +45,7 @@ namespace Compdfkit_Tools.PDFControl
             InitializeComponent();
         }
 
-        public void InitWithPDFViewer(CPDFViewer pdfViewer)
+        public void InitWithPDFViewer(PDFViewControl pdfViewer)
         {
             this.pdfViewer = pdfViewer;
             UIElement currentBotaTool = GetBotaTool();
@@ -329,7 +317,7 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 CPDFThumbnailControl thumbnailControl = new CPDFThumbnailControl();
 
-                                if (pdfViewer != null && pdfViewer.Document != null)
+                                if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                 {
                                     thumbnailControl.InitWithPDFViewer(pdfViewer);
                                     thumbnailControl.LoadThumb();
@@ -349,7 +337,7 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 CPDFOutlineControl outlineControl = new CPDFOutlineControl();
 
-                                if (pdfViewer != null && pdfViewer.Document != null)
+                                if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                 {
                                     outlineControl.InitWithPDFViewer(pdfViewer);
                                 }
@@ -367,7 +355,7 @@ namespace Compdfkit_Tools.PDFControl
                             if (botaTool == null || !(botaTool is CPDFBookmarkControl))
                             {
                                 CPDFBookmarkControl pdfBookmarkControl = new CPDFBookmarkControl();
-                                if (pdfViewer != null && pdfViewer.Document != null)
+                                if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                 {
                                     pdfBookmarkControl.InitWithPDFViewer(pdfViewer);
                                     pdfBookmarkControl.LoadBookmark(); 
@@ -390,7 +378,7 @@ namespace Compdfkit_Tools.PDFControl
                                 {
                                     searchControl = new CPDFSearchControl();
 
-                                    if (pdfViewer != null && pdfViewer.Document != null)
+                                    if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                     {
                                         searchControl.InitWithPDFViewer(pdfViewer);
                                     }
@@ -410,7 +398,7 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 CPDFAnnotationListControl annotationListControl = new CPDFAnnotationListControl();
 
-                                if (pdfViewer != null && pdfViewer.Document != null)
+                                if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                 {
                                     annotationListControl.InitWithPDFViewer(pdfViewer);
                                     annotationListControl.LoadAnnotationList();
@@ -430,7 +418,7 @@ namespace Compdfkit_Tools.PDFControl
                             {
                                 CPDFSignatureListControl signatureControl = new CPDFSignatureListControl();
 
-                                if (pdfViewer != null && pdfViewer.Document != null)
+                                if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
                                 {
                                     signatureControl.InitWithPDFViewer(pdfViewer);
                                     signatureControl.LoadSignatureList();

+ 1 - 10
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFPageEditBarControl.xaml.cs

@@ -1,20 +1,11 @@
-using ComPDFKitViewer.PdfViewer;
-using System;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
-using System.Linq;
 using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
 using System.Windows.Shapes;
 
 namespace Compdfkit_Tools.PDFControl

+ 1 - 14
Demo/Examples/Compdfkit_Tools/Common/BarControl/CPDFTitleBarControl.xaml.cs

@@ -1,19 +1,6 @@
-using Compdfkit_Tools.Helper;
-using ComPDFKitViewer.PdfViewer;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System;
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
 
 namespace Compdfkit_Tools.PDFControl
 {

+ 8 - 12
Demo/Examples/Compdfkit_Tools/DigitalSignature/CPDFSignatureListControl/CPDFSignatureListControl.xaml.cs

@@ -8,12 +8,8 @@ using System.Windows.Data;
 using System.Windows.Input;
 using Compdfkit_Tools.Helper;
 using Compdfkit_Tools.PDFControl;
-using Compdfkit_Tools.PDFControlUI;
 using ComPDFKit.DigitalSign;
 using ComPDFKit.Import;
-using ComPDFKit.PDFAnnotation;
-using ComPDFKit.PDFAnnotation.Form;
-using ComPDFKitViewer.PdfViewer;
 using ContextMenu = System.Windows.Controls.ContextMenu;
 using MenuItem = System.Windows.Controls.MenuItem;
 using MessageBox = System.Windows.MessageBox;
@@ -29,7 +25,7 @@ namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
     
     public partial class CPDFSignatureListControl : UserControl
     {
-        private CPDFViewer pdfViewer;
+        private PDFViewControl pdfViewer;
         private List<SignatureData> signatureDataList;
         private List<CPDFSignature> signatureList;
         private ContextMenu popContextMenu;
@@ -82,11 +78,11 @@ namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
             int index = SignatureList.SelectedIndex;
             if (index >= 0 && index < signatureList.Count)
             {
-                var widget = signatureList[index].GetSignatureWidget(pdfViewer.Document);
-                pdfViewer.Document.RemoveSignature(signatureList[index], true);
+                var widget = signatureList[index].GetSignatureWidget(pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument());
+                pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument().RemoveSignature(signatureList[index], true);
                 widget.ResetForm();
                 widget.SetIsLocked(false);
-                pdfViewer.ReloadVisibleAnnots();
+                pdfViewer.PDFViewTool.GetCPDFViewer().UpDataAnnotFrame();
                 DeleteSignatureEvent?.Invoke(this, null);
             }
         }
@@ -100,14 +96,14 @@ namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
             }
         }
 
-        public void InitWithPDFViewer(CPDFViewer newPDFView)
+        public void InitWithPDFViewer(PDFViewControl newPDFView)
         {
             pdfViewer = newPDFView;
         }
         
         public void LoadSignatureList()
         {
-            if (pdfViewer != null && pdfViewer.Document != null)
+            if (pdfViewer != null && pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument() != null)
             {
                 signatureList = SignatureHelper.SignatureList;
                 if (signatureList != null)
@@ -189,9 +185,9 @@ namespace Compdfkit_Tools.DigitalSignature.CPDFSignatureListControl
             int index = SignatureList.SelectedIndex;
             if (index >= 0 && index < signatureList.Count)
             {
-                CRect rect = signatureList[index].GetPageBound(pdfViewer.Document);
+                CRect rect = signatureList[index].GetPageBound(pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument());
                 Point point = new Point(rect.left, rect.top);
-                pdfViewer.GoToPage(signatureList[index].GetPageIndex(pdfViewer.Document),point);
+                pdfViewer.PDFViewTool.GetCPDFViewer().GoToPage(signatureList[index].GetPageIndex(pdfViewer.PDFViewTool.GetCPDFViewer().GetDocument()),point);
             }
         }
     }

+ 1 - 5
Demo/Examples/Compdfkit_Tools/DigitalSignature/DigitalSignatureControl/DigitalSignatureControl.xaml.cs

@@ -1,9 +1,5 @@
-using Compdfkit_Tools.PDFControl;
-using ComPDFKitViewer.AnnotEvent;
-using ComPDFKitViewer.PdfViewer;
-using System;
+using System;
 using System.ComponentModel;
-using System.Dynamic;
 using System.IO;
 using System.Linq;
 using System.Runtime.CompilerServices;