|
@@ -9,6 +9,8 @@ using ComPDFKit.PDFPage.Edit;
|
|
using ComPDFKit.Tool.SettingParam;
|
|
using ComPDFKit.Tool.SettingParam;
|
|
using ComPDFKit.Tool.UndoManger;
|
|
using ComPDFKit.Tool.UndoManger;
|
|
using ComPDFKit.Viewer.Helper;
|
|
using ComPDFKit.Viewer.Helper;
|
|
|
|
+using ComPDFKitViewer.Helper;
|
|
|
|
+using ComPDFKitViewer;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
@@ -169,12 +171,39 @@ namespace ComPDFKit.Tool.Help
|
|
return annotHistory;
|
|
return annotHistory;
|
|
}
|
|
}
|
|
|
|
|
|
- public static bool RemovePageAnnot(Dictionary<int, List<int>> removeAnnots, CPDFDocument cPDFDocument)
|
|
|
|
|
|
+ public static bool RemovePageAnnot(Dictionary<int, List<int>> removeAnnots, CPDFViewer cPDFViewer)
|
|
{
|
|
{
|
|
|
|
+ CPDFDocument cPDFDocument = cPDFViewer.GetDocument();
|
|
if (cPDFDocument == null || removeAnnots.Count <= 0)
|
|
if (cPDFDocument == null || removeAnnots.Count <= 0)
|
|
{
|
|
{
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ GroupHistory historyGroup = new GroupHistory();
|
|
|
|
+ foreach (int pageIndex in removeAnnots.Keys)
|
|
|
|
+ {
|
|
|
|
+ CPDFPage pageCore = cPDFDocument.PageAtIndex(pageIndex);
|
|
|
|
+ List<CPDFAnnotation> cPDFAnnotations = pageCore.GetAnnotations();
|
|
|
|
+ foreach (int annotIndex in removeAnnots[pageIndex])
|
|
|
|
+ {
|
|
|
|
+ CPDFAnnotation cPDFAnnotation = cPDFAnnotations.ElementAtOrDefault(annotIndex);
|
|
|
|
+ if (cPDFAnnotation != null)
|
|
|
|
+ {
|
|
|
|
+ AnnotParam annotParam = CPDFDataConverterToAnnotParam(cPDFDocument, pageIndex, cPDFAnnotation);
|
|
|
|
+ AnnotHistory annotHistory = CreateHistory(cPDFAnnotation);
|
|
|
|
+ annotHistory.CurrentParam = annotParam;
|
|
|
|
+ annotHistory.PDFDoc = cPDFDocument;
|
|
|
|
+ annotHistory.Action = HistoryAction.Remove;
|
|
|
|
+ historyGroup.Histories.Add(annotHistory);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (historyGroup.Histories.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ cPDFViewer.UndoManager.AddHistory(historyGroup);
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach (int pageIndex in removeAnnots.Keys)
|
|
foreach (int pageIndex in removeAnnots.Keys)
|
|
{
|
|
{
|
|
CPDFPage pageCore = cPDFDocument.PageAtIndex(pageIndex);
|
|
CPDFPage pageCore = cPDFDocument.PageAtIndex(pageIndex);
|
|
@@ -188,7 +217,8 @@ namespace ComPDFKit.Tool.Help
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
|
|
+
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
public static FormField ConverterWidgetFormFlags(int Flags, bool IsHidden)
|
|
public static FormField ConverterWidgetFormFlags(int Flags, bool IsHidden)
|