using ComPDFKitViewer; using ComPDFKitViewer.AnnotEvent; using ComPDFKitViewer.PdfViewer; using PDF_Master.CustomControl; using PDF_Master.Helper; using PDF_Master.ViewModels.PropertyPanel.AnnotPanel; using PDF_Master.ViewModels.Tools.AnnotManager; using PDF_Master.Views.PropertyPanel.AnnotPanel; using PDFSettings; using Prism.Commands; using Prism.Events; using Prism.Regions; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.Windows.Media; namespace PDF_Master.ViewModels.Tools { public sealed partial class AnnotToolContentViewModel { #region 属性 #region 注释工具 //高亮 private Brush highLightColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush HighLightColor { get { return highLightColor; } set { SetProperty(ref highLightColor, value); } } // private double highLightOpacity = 1; public double HighLightOpacity { get { return highLightOpacity; } set { SetProperty(ref highLightOpacity, value); } } // private Brush underLine = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush UnderLineColor { get { return underLine; } set { SetProperty(ref underLine, value); } } // private double underLineOpacity = 1; public double UnderLineOpacity { get { return underLineOpacity; } set { SetProperty(ref underLineOpacity, value); } } // private Brush squigglyColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush SquigglyColor { get { return squigglyColor; } set { SetProperty(ref squigglyColor, value); } } // private double squigglyOpacity = 1; public double SquigglyOpacity { get { return squigglyOpacity; } set { SetProperty(ref squigglyOpacity, value); } } // private Brush strikeoutColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush StrikeoutColor { get { return strikeoutColor; } set { SetProperty(ref strikeoutColor, value); } } // private double strikeoutOpacity = 1; public double StrikeoutOpacity { get { return strikeoutOpacity; } set { SetProperty(ref strikeoutOpacity, value); } } private Brush freeHandColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush FreeHandColor { get { return freeHandColor; } set { SetProperty(ref freeHandColor, value); } } private Brush textAnnoteColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush TextAnnoteColor { get { return textAnnoteColor; } set { SetProperty(ref textAnnoteColor, value); } } private Brush rectangleBorderColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush RectangleBorderColor { get { return rectangleBorderColor; } set { SetProperty(ref rectangleBorderColor, value); } } private Brush rectangleFillColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush RectangleFillColor { get { return rectangleFillColor; } set { SetProperty(ref rectangleFillColor, value); } } private Brush circleBorderColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush CircleBorderColor { get { return circleBorderColor; } set { SetProperty(ref circleBorderColor, value); } } private Brush circleFillColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush CircleFillColor { get { return circleFillColor; } set { SetProperty(ref circleFillColor, value); } } private Brush lineColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush LineColor { get { return lineColor; } set { SetProperty(ref lineColor, value); } } private Brush arrowColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00)); public Brush ArrowColor { get { return arrowColor; } set { SetProperty(ref arrowColor, value); } } private bool btnSelecttoolIsChecked = false; public bool BtnSelecttoolIsChecked { get { return btnSelecttoolIsChecked; } set { SetProperty(ref btnSelecttoolIsChecked, value); } } private bool btnLinkIsChecked = false; public bool BtnLinkIsChecked { get { return btnLinkIsChecked; } set { SetProperty(ref btnLinkIsChecked, value); } } private bool btnHandIsChecked = false; public bool BtnHandIsChecked { get { return btnHandIsChecked; } set { SetProperty(ref btnHandIsChecked, value); } } private bool btnShowAnnotIsChecked = true; public bool BtnShowAnnotIsChecked { get { return btnShowAnnotIsChecked; } set { SetProperty(ref btnShowAnnotIsChecked, value); } } private string _strAnnotToolChecked = ""; public string StrAnnotToolChecked { get { return _strAnnotToolChecked; } set { SetProperty(ref _strAnnotToolChecked, value); } } #endregion 注释工具 #endregion 属性 // 填写与签名图案名字链表 private List ShapeNames = new List(); // 是否处于打印 private bool IsPasteShape = false; //判断注释是否在拖拉创建中 public bool IsCreateAnnot = false; //判断是否选中图片 public bool IsSelectImage = false; public string PropertyRegionName { get; set; } private IEventAggregator events; public IDialogService dialogs; public IRegionManager region; public OpenFileInfo OpenFileInfo = null; public CPDFViewer PDFViewer; public ViewContentViewModel ViewContentViewModel { get; set; } public AnnotTransfer PropertyPanel = new AnnotTransfer(); private Dictionary ToolExpandDict = new Dictionary(); private Dictionary ToolTipDict = new Dictionary(); private StickyNotePopup customStickyPopup; private string Unicode = ""; //private bool isHiddenAnnot = true; private bool isAddBookMark = true; /// /// 空白处-右键菜单-添加注释 /// private bool IsNoSelectMenu = false; private bool isRightMenuAddAnnot = false; private PopMenu HightAnnotPopMenu; private PopMenu FreeHandAnnotPopMenu; private PopMenu FreeTextAnnotPopMenu; private PopMenu StrickNoteAnnotPopMenu; private PopMenu ShapeAnnotPopMenu; private PopMenu LinkAnnotPopMenu; private PopMenu StampAnnotPopMenu; private PopMenu MultiAnnotPopMenu; #region 事件 public DelegateCommand ShowOrHiddenAnnotCommand { get; set; } public DelegateCommand MyToolsCommand { get; set; } private SnapshotEditMenuViewModel snapshotEditMenuViewModel = new SnapshotEditMenuViewModel(); public SnapshotEditMenuViewModel SnapshotEditMenuViewModel { get => snapshotEditMenuViewModel; set => snapshotEditMenuViewModel = value; } public DelegateCommand SetAddAnnotationCommand { get; set; } public DelegateCommand AddBookMarkCommand { get; set; } public DelegateCommand HandCommand { get; set; } #region 注释 - 右键菜单 //公共 public DelegateCommand AnnotDefaultValue_MenuCommand { get; set; } public DelegateCommand AnnotColorPalette_MenuCommand { get; set; } public DelegateCommand AnnotAddNoteText_MenuCommand { get; set; } //高亮、下划线、删除 public DelegateCommand HightAnnotCopyText_MenuCommand { get; set; } //手绘 public DelegateCommand FreeHandLineStyle_MenuCommand { get; set; } //文本 public DelegateCommand FreeTextFontFamily_MenuCommand { get; set; } public DelegateCommand FreeTextAglin_MenuCommand { get; set; } //便签 public DelegateCommand StrikeNoteEditStrike_MenuCommand { get; set; } //形状 public DelegateCommand ShapeLineStyle_MenuCommand { get; set; } public DelegateCommand ShapeLineDirect_MenuCommand { get; set; } //图章 public DelegateCommand StampExportPicture_MenuCommand { get; set; } //链接 public DelegateCommand Link_MenuCommand { get; set; } #endregion 注释 - 右键菜单 private void ViewContentViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "TabSelectedIndex") { //收起二级菜单栏时,退出注释工具,并清空属性面板 var viewmodel = sender as ViewContentViewModel; if (viewmodel != null && viewmodel.ToolRowHeight == 40) { ExitAnnotationTool(); //如果选中了内容选择工具时,需要单独取消选中(现有代码逻辑有问题) if (BtnSelecttoolIsChecked) { BtnSelecttoolIsChecked = false; } } } } #endregion 事件 /// /// 注释列表选中注释 /// private AnnotHandlerEventArgs selectedAnnotation = null; } public enum AddAnnotType { AnnotFreehand,//绘制 AnnotFreeText = 1,//文本 AnnotSticky,//便签 AnnotSquare,//矩形 AnnotCircle,//椭圆形 AnnotArrow,//箭头 AnnotLine,//直线 AnnotLink,//链接 AnnotStamp,//图章 AnnotAutograph //签名 } }