|
@@ -10,8 +10,6 @@ using ComPDFKitViewer.Layer;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
-using System.Text;
|
|
|
|
-using System.Threading.Tasks;
|
|
|
|
using System.Windows.Input;
|
|
using System.Windows.Input;
|
|
using System.Windows;
|
|
using System.Windows;
|
|
using ComPDFKit.Import;
|
|
using ComPDFKit.Import;
|
|
@@ -20,12 +18,9 @@ using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media;
|
|
using static ComPDFKit.PDFAnnotation.CTextAttribute.CFontNameHelper;
|
|
using static ComPDFKit.PDFAnnotation.CTextAttribute.CFontNameHelper;
|
|
using ComPDFKitViewer.Helper;
|
|
using ComPDFKitViewer.Helper;
|
|
-using Microsoft.SqlServer.Server;
|
|
|
|
using ComPDFKit.Tool.Help;
|
|
using ComPDFKit.Tool.Help;
|
|
-using System.Xml.Linq;
|
|
|
|
using ComPDFKit.Tool.SettingParam;
|
|
using ComPDFKit.Tool.SettingParam;
|
|
using ComPDFKit.Tool.UndoManger;
|
|
using ComPDFKit.Tool.UndoManger;
|
|
-using System.Windows.Controls.Primitives;
|
|
|
|
using ComPDFKit.Measure;
|
|
using ComPDFKit.Measure;
|
|
using System.Dynamic;
|
|
using System.Dynamic;
|
|
|
|
|
|
@@ -53,13 +48,14 @@ namespace ComPDFKit.Tool
|
|
BaseAnnot caheMoveAnnot;
|
|
BaseAnnot caheMoveAnnot;
|
|
BaseAnnot cacheHitTestAnnot;
|
|
BaseAnnot cacheHitTestAnnot;
|
|
bool isCacheRedaction = false;
|
|
bool isCacheRedaction = false;
|
|
- int createAnnotTag = -1;
|
|
|
|
int selectedPageIndex = -1;
|
|
int selectedPageIndex = -1;
|
|
int selectedAnnotIndex = -1;
|
|
int selectedAnnotIndex = -1;
|
|
bool canSave = true;
|
|
bool canSave = true;
|
|
bool isHitTestLink = false;
|
|
bool isHitTestLink = false;
|
|
bool isHitTestRedact = false;
|
|
bool isHitTestRedact = false;
|
|
|
|
+
|
|
public event EventHandler<MeasureEventArgs> MeasureChanged;
|
|
public event EventHandler<MeasureEventArgs> MeasureChanged;
|
|
|
|
+ internal int CreateAnnotTag { get; private set; } = -1;
|
|
|
|
|
|
public void InvokeMeasureChangeEvent(object sender, MeasureEventArgs e)
|
|
public void InvokeMeasureChangeEvent(object sender, MeasureEventArgs e)
|
|
{
|
|
{
|
|
@@ -127,7 +123,7 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
protected bool AnnotHitTest()
|
|
protected bool AnnotHitTest()
|
|
{
|
|
{
|
|
- BaseAnnot baseAnnot = PDFViewer.AnnotHitTest(true);
|
|
|
|
|
|
+ BaseAnnot baseAnnot = PDFViewer.AnnotHitTest();
|
|
if (baseAnnot != null)
|
|
if (baseAnnot != null)
|
|
{
|
|
{
|
|
if ((baseAnnot as BaseWidget) != null)
|
|
if ((baseAnnot as BaseWidget) != null)
|
|
@@ -135,11 +131,15 @@ namespace ComPDFKit.Tool
|
|
cacheHitTestAnnot = null;
|
|
cacheHitTestAnnot = null;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
cacheHitTestAnnot = baseAnnot;
|
|
cacheHitTestAnnot = baseAnnot;
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- cacheHitTestAnnot = baseAnnot;
|
|
|
|
- return false;
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ cacheHitTestAnnot = null;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public void SelectedAnnotForIndex(int pageIndex, int annotIndex)
|
|
public void SelectedAnnotForIndex(int pageIndex, int annotIndex)
|
|
@@ -166,7 +166,7 @@ namespace ComPDFKit.Tool
|
|
CreateAnnotTool createAnnotTool = new CreateAnnotTool(GetMeasureSetting(), GetDefaultDrawParam(), GetDefaultSettingParam());
|
|
CreateAnnotTool createAnnotTool = new CreateAnnotTool(GetMeasureSetting(), GetDefaultDrawParam(), GetDefaultSettingParam());
|
|
int annotViewindex = PDFViewer.GetMaxViewIndex();
|
|
int annotViewindex = PDFViewer.GetMaxViewIndex();
|
|
PDFViewer.InsertView(annotViewindex, createAnnotTool);
|
|
PDFViewer.InsertView(annotViewindex, createAnnotTool);
|
|
- createAnnotTag = createAnnotTool.GetResTag();
|
|
|
|
|
|
+ CreateAnnotTag = createAnnotTool.GetResTag();
|
|
createAnnotTool.UpdateAnnotHandler += CreateAnnotTool_UpdateAnnotHandler;
|
|
createAnnotTool.UpdateAnnotHandler += CreateAnnotTool_UpdateAnnotHandler;
|
|
createAnnotTool.CreateFreetextCanceled += CreateAnnotTool_CreateFreetextCanceled;
|
|
createAnnotTool.CreateFreetextCanceled += CreateAnnotTool_CreateFreetextCanceled;
|
|
createAnnotTool.MeasureChanged += CreateAnnotTool_MeasureChanged;
|
|
createAnnotTool.MeasureChanged += CreateAnnotTool_MeasureChanged;
|
|
@@ -206,7 +206,7 @@ namespace ComPDFKit.Tool
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
(baseLayer as CreateAnnotTool).SetIsProportionalScaling(isProportionalScaling);
|
|
(baseLayer as CreateAnnotTool).SetIsProportionalScaling(isProportionalScaling);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -216,7 +216,7 @@ namespace ComPDFKit.Tool
|
|
{
|
|
{
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetMoveLength();
|
|
return (baseLayer as CreateAnnotTool).GetMoveLength();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -228,7 +228,7 @@ namespace ComPDFKit.Tool
|
|
}
|
|
}
|
|
|
|
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
if (index < 0)
|
|
if (index < 0)
|
|
{
|
|
{
|
|
@@ -271,7 +271,7 @@ namespace ComPDFKit.Tool
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
PDFViewer.GetPointPageInfo(point, out int index, out Rect paintRect, out Rect pageBound);
|
|
if (index < 0)
|
|
if (index < 0)
|
|
{
|
|
{
|
|
@@ -309,7 +309,7 @@ namespace ComPDFKit.Tool
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
(baseLayer as CreateAnnotTool).MoveDraw(point, PDFViewer.GetZoom());
|
|
(baseLayer as CreateAnnotTool).MoveDraw(point, PDFViewer.GetZoom());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -320,7 +320,7 @@ namespace ComPDFKit.Tool
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
(baseLayer as CreateAnnotTool).CreateTextBox();
|
|
(baseLayer as CreateAnnotTool).CreateTextBox();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -330,7 +330,7 @@ namespace ComPDFKit.Tool
|
|
{
|
|
{
|
|
return new Rect();
|
|
return new Rect();
|
|
}
|
|
}
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).EndDraw();
|
|
return (baseLayer as CreateAnnotTool).EndDraw();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -539,25 +539,25 @@ namespace ComPDFKit.Tool
|
|
|
|
|
|
public Point GetStartPoint()
|
|
public Point GetStartPoint()
|
|
{
|
|
{
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetStartPoint();
|
|
return (baseLayer as CreateAnnotTool).GetStartPoint();
|
|
}
|
|
}
|
|
|
|
|
|
public Point GetEndPoint()
|
|
public Point GetEndPoint()
|
|
{
|
|
{
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetEndPoint();
|
|
return (baseLayer as CreateAnnotTool).GetEndPoint();
|
|
}
|
|
}
|
|
|
|
|
|
public List<Point> GetInkDrawPoints()
|
|
public List<Point> GetInkDrawPoints()
|
|
{
|
|
{
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetInkDrawPoints();
|
|
return (baseLayer as CreateAnnotTool).GetInkDrawPoints();
|
|
}
|
|
}
|
|
|
|
|
|
public List<Point> GetMeasureDrawPoints()
|
|
public List<Point> GetMeasureDrawPoints()
|
|
{
|
|
{
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetMeasureDrawPoints();
|
|
return (baseLayer as CreateAnnotTool).GetMeasureDrawPoints();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -568,7 +568,7 @@ namespace ComPDFKit.Tool
|
|
return new Rect();
|
|
return new Rect();
|
|
}
|
|
}
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
return (baseLayer as CreateAnnotTool).GetMaxRect();
|
|
return (baseLayer as CreateAnnotTool).GetMaxRect();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -579,7 +579,7 @@ namespace ComPDFKit.Tool
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
Point point = Mouse.GetPosition(this);
|
|
Point point = Mouse.GetPosition(this);
|
|
- BaseLayer baseLayer = PDFViewer.GetViewForTag(createAnnotTag);
|
|
|
|
|
|
+ BaseLayer baseLayer = PDFViewer.GetViewForTag(CreateAnnotTag);
|
|
(baseLayer as CreateAnnotTool).ClearDraw();
|
|
(baseLayer as CreateAnnotTool).ClearDraw();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -810,7 +810,7 @@ namespace ComPDFKit.Tool
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- BaseLayer createAnnotTool = PDFViewer?.GetView(createAnnotTag) as CreateAnnotTool;
|
|
|
|
|
|
+ BaseLayer createAnnotTool = PDFViewer?.GetView(CreateAnnotTag) as CreateAnnotTool;
|
|
if (createAnnotTool != null)
|
|
if (createAnnotTool != null)
|
|
{
|
|
{
|
|
createAnnotTool.Children.Add(textBorder);
|
|
createAnnotTool.Children.Add(textBorder);
|
|
@@ -931,7 +931,7 @@ namespace ComPDFKit.Tool
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- BaseLayer removeLayer = PDFViewer?.GetView(createAnnotTag) as CreateAnnotTool;
|
|
|
|
|
|
+ BaseLayer removeLayer = PDFViewer?.GetView(CreateAnnotTag) as CreateAnnotTool;
|
|
removeLayer.Children.Remove(textBorder);
|
|
removeLayer.Children.Remove(textBorder);
|
|
}
|
|
}
|
|
|
|
|