123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- using ComPDFKit.PDFAnnotation;
- using compdfkit_tools.PDFControl;
- using ComPDFKitViewer.AnnotEvent;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- namespace compdfkit_tools.Data
- {
- public enum AnnotationType
- {
- None = 0,
- Highlight,
- Underline,
- Strikeout,
- Squiggly,
- Freetext,
- Note,
- Circle,
- Square,
- Arrow,
- Line,
- Stamp,
- Signature,
- Link,
- Sound
- }
- public static class CPDFAnnotationDictionary
- {
- public static Dictionary<string, AnnotationType> GetAnnotationFromTag = new Dictionary<string, AnnotationType>() {
- { "Highlight", AnnotationType.Highlight },
- { "Underline", AnnotationType.Underline },
- { "Strikeout", AnnotationType.Strikeout },
- { "Squiggly", AnnotationType.Squiggly },
- { "Square", AnnotationType.Square },
- { "Circle", AnnotationType.Circle },
- { "Line", AnnotationType.Line },
- { "Stamp", AnnotationType.Stamp },
- { "Arrow", AnnotationType.Arrow }
- };
- public static Dictionary<int, C_LINE_TYPE> GetLineTypeFromIndex = new Dictionary<int, C_LINE_TYPE>()
- {
- { 0, C_LINE_TYPE.LINETYPE_NONE },
- { 1, C_LINE_TYPE.LINETYPE_ARROW },
- { 2, C_LINE_TYPE.LINETYPE_CLOSEDARROW },
- { 3, C_LINE_TYPE.LINETYPE_SQUARE },
- { 4, C_LINE_TYPE.LINETYPE_CIRCLE },
- { 5, C_LINE_TYPE.LINETYPE_DIAMOND },
- { 6, C_LINE_TYPE.LINETYPE_BUTT },
- { 7, C_LINE_TYPE.LINETYPE_ROPENARROW },
- { 8, C_LINE_TYPE.LINETYPE_RCLOSEDARROW },
- { 9, C_LINE_TYPE.LINETYPE_SLASH }
- };
- }
- public class LineType
- {
- public C_LINE_TYPE HeadLineType;
- public C_LINE_TYPE TailLineType;
- }
- /// <summary>
- /// 用于换算的dash
- /// </summary>
- public class CPDFDash
- {
- public bool IsSolid = true;
- public int DashSpacing = 1;
- }
- public abstract class CPDFAnnotationData
- {
- public AnnotationType AnnotationType;
- public string Note = string.Empty;
- public string Author = "ComPDFKit";
- public bool IsLocked = false;
- }
- public class CPDFMarkupData : CPDFAnnotationData
- {
- public double Opacity = 1;
- public Color Color = Color.FromRgb(255, 0, 0);
- }
- public class CPDFShapeData : CPDFAnnotationData
- {
- public Color BorderColor = Color.FromRgb(255, 0, 0);
- public Color FillColor = Color.FromRgb(255, 255, 255);
- public double Opacity = 1;
- public double Thickness = 1;
- public DashStyle DashStyle = DashStyles.Solid;
- }
- public class CPDFLineShapeData : CPDFAnnotationData
- {
- public Color BorderColor = Color.FromRgb(255, 0, 0);
- public double Opacity = 1;
- public double Thickness = 1;
- public DashStyle DashStyle = DashStyles.Solid;
- public LineType LineType = new LineType() { HeadLineType = C_LINE_TYPE.LINETYPE_NONE, TailLineType = C_LINE_TYPE.LINETYPE_NONE };
- }
- public class CPDFStampData : CPDFAnnotationData, INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- public void RaisePropertyChanged(string PropertyName)
- {
- if (this.PropertyChanged != null)
- {
- this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(PropertyName));
- }
- }
- private string stampText;
- public string StampText
- {
- get { return stampText; }
- set
- {
- stampText=value;
- RaisePropertyChanged("StampText");
- }
- }
- private string sourcePath;
- public string SourcePath
- {
- get { return sourcePath; }
- set
- {
- sourcePath = value;
- RaisePropertyChanged("SourcePath");
- }
- }
- private int maxWidth;
- public int MaxWidth
- {
- get { return maxWidth; }
- set
- {
- maxWidth = value;
- RaisePropertyChanged("MaxWidth");
- }
- }
- private int maxHeight;
- public int MaxHeight
- {
- get { return maxHeight; }
- set
- {
- maxHeight = value;
- RaisePropertyChanged("MaxHeight");
- }
- }
- private StampType type = StampType.UNKNOWN_STAMP;
- public StampType Type
- {
- get { return type; }
- set
- {
- type = value;
- RaisePropertyChanged("Type");
- }
- }
- private double opacity;
- public double Opacity
- {
- get { return opacity; }
- set
- {
- opacity = value;
- RaisePropertyChanged("Opacity");
- }
- }
- private BitmapSource imageSource;
- public BitmapSource ImageSource
- {
- get { return imageSource; }
- set
- {
- imageSource = value;
- RaisePropertyChanged("ImageSource");
- }
- }
- public TextStampColor TextColor = TextStampColor.TEXTSTAMP_WHITE;
- public string StampTextDate = "";
- public TextStampSharp TextSharp = TextStampSharp.TEXTSTAMP_NONE;
- public bool IsCheckedDate=false;
- public bool IsCheckedTime=false;
- }
- public class CustomStampList : List<CPDFStampData>
- {
- }
- }
|