|
@@ -1,4 +1,5 @@
|
|
-using ComPDFKitViewer;
|
|
|
|
|
|
+using ComPDFKit.PDFPage;
|
|
|
|
+using ComPDFKitViewer;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using ComPDFKitViewer.PdfViewer;
|
|
using ComPDFKitViewer.PdfViewer;
|
|
using Microsoft.Win32;
|
|
using Microsoft.Win32;
|
|
@@ -7,6 +8,7 @@ using PDF_Master.Helper;
|
|
using PDF_Master.Model;
|
|
using PDF_Master.Model;
|
|
using PDF_Master.Model.AnnotPanel;
|
|
using PDF_Master.Model.AnnotPanel;
|
|
using PDF_Master.Model.PropertyPanel.AnnotPanel;
|
|
using PDF_Master.Model.PropertyPanel.AnnotPanel;
|
|
|
|
+using PDF_Master.Properties;
|
|
using PDF_Master.ViewModels.Tools.AnnotManager;
|
|
using PDF_Master.ViewModels.Tools.AnnotManager;
|
|
using PDFSettings;
|
|
using PDFSettings;
|
|
using Prism.Commands;
|
|
using Prism.Commands;
|
|
@@ -26,27 +28,31 @@ using static Dropbox.Api.Files.WriteMode;
|
|
|
|
|
|
namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
{
|
|
{
|
|
-
|
|
|
|
public class TextEditPropertyViewModel : PDFEditVM, INavigationAware
|
|
public class TextEditPropertyViewModel : PDFEditVM, INavigationAware
|
|
{
|
|
{
|
|
-
|
|
|
|
#region 属性
|
|
#region 属性
|
|
|
|
+
|
|
public event EventHandler ClearCheckedAglin;
|
|
public event EventHandler ClearCheckedAglin;
|
|
|
|
+
|
|
public TextEditPropertyViewModel()
|
|
public TextEditPropertyViewModel()
|
|
{
|
|
{
|
|
InitVariable();
|
|
InitVariable();
|
|
InitCommand();
|
|
InitCommand();
|
|
}
|
|
}
|
|
|
|
+
|
|
private void InitVariable()
|
|
private void InitVariable()
|
|
{
|
|
{
|
|
InitBaseVariable();
|
|
InitBaseVariable();
|
|
}
|
|
}
|
|
|
|
+
|
|
private bool isSelectedEmpty;
|
|
private bool isSelectedEmpty;
|
|
|
|
+
|
|
public bool IsSelectedEmpty
|
|
public bool IsSelectedEmpty
|
|
{
|
|
{
|
|
get { return isSelectedEmpty; }
|
|
get { return isSelectedEmpty; }
|
|
set { SetProperty(ref isSelectedEmpty, value); }
|
|
set { SetProperty(ref isSelectedEmpty, value); }
|
|
}
|
|
}
|
|
|
|
+
|
|
private string title;
|
|
private string title;
|
|
|
|
|
|
public string Title
|
|
public string Title
|
|
@@ -57,6 +63,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
SetProperty(ref title, value);
|
|
SetProperty(ref title, value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
private FontBoardVm _fontVm = new FontBoardVm(true);
|
|
private FontBoardVm _fontVm = new FontBoardVm(true);
|
|
|
|
|
|
public FontBoardVm FontVm
|
|
public FontBoardVm FontVm
|
|
@@ -65,17 +72,18 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
set { SetProperty(ref _fontVm, value); }
|
|
set { SetProperty(ref _fontVm, value); }
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
private ComPDFKit.PDFPage.Edit.TextAlignType _textAlign;
|
|
private ComPDFKit.PDFPage.Edit.TextAlignType _textAlign;
|
|
|
|
+
|
|
public ComPDFKit.PDFPage.Edit.TextAlignType TextAlign
|
|
public ComPDFKit.PDFPage.Edit.TextAlignType TextAlign
|
|
{
|
|
{
|
|
get { return _textAlign; }
|
|
get { return _textAlign; }
|
|
set { _textAlign = value; }
|
|
set { _textAlign = value; }
|
|
}
|
|
}
|
|
- #endregion
|
|
|
|
|
|
+
|
|
|
|
+ #endregion 属性
|
|
|
|
+
|
|
#region Command
|
|
#region Command
|
|
|
|
|
|
-
|
|
|
|
public DelegateCommand AddTextCommand { get; set; }
|
|
public DelegateCommand AddTextCommand { get; set; }
|
|
public DelegateCommand AddImgCommand { get; set; }
|
|
public DelegateCommand AddImgCommand { get; set; }
|
|
|
|
|
|
@@ -85,8 +93,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
public DelegateCommand<object> FontSizeChangedCommand { get; set; }
|
|
public DelegateCommand<object> FontSizeChangedCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
|
|
public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
|
|
|
|
+
|
|
//进入属性面板编辑
|
|
//进入属性面板编辑
|
|
public DelegateCommand EditTextModeCommand { get; set; }
|
|
public DelegateCommand EditTextModeCommand { get; set; }
|
|
|
|
+
|
|
public DelegateCommand FontFamilyChangedCommand { get; set; }
|
|
public DelegateCommand FontFamilyChangedCommand { get; set; }
|
|
public DelegateCommand CustomFontStyleCommand { get; set; }
|
|
public DelegateCommand CustomFontStyleCommand { get; set; }
|
|
public DelegateCommand FontStyleWeightChangedCommand { get; set; }
|
|
public DelegateCommand FontStyleWeightChangedCommand { get; set; }
|
|
@@ -94,14 +104,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
|
|
|
//重定义
|
|
//重定义
|
|
public DelegateCommand ReDefineFontStyleCommand { get; set; }
|
|
public DelegateCommand ReDefineFontStyleCommand { get; set; }
|
|
|
|
+
|
|
public DelegateCommand RestoreDefaultStyleCommand { get; set; }
|
|
public DelegateCommand RestoreDefaultStyleCommand { get; set; }
|
|
public DelegateCommand<object> LayoutAlignCheckedCommand { get; set; }
|
|
public DelegateCommand<object> LayoutAlignCheckedCommand { get; set; }
|
|
-
|
|
|
|
|
|
|
|
- #endregion
|
|
|
|
|
|
+ #endregion Command
|
|
|
|
|
|
#region 初始化
|
|
#region 初始化
|
|
-
|
|
|
|
|
|
|
|
private void InitCommand()
|
|
private void InitCommand()
|
|
{
|
|
{
|
|
@@ -135,7 +144,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
LayoutAlignCheckedCommand = new DelegateCommand<object>(LayoutAlignChecked);
|
|
LayoutAlignCheckedCommand = new DelegateCommand<object>(LayoutAlignChecked);
|
|
}
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
|
|
|
+ #endregion 初始化
|
|
|
|
|
|
#region 文本处理逻辑
|
|
#region 文本处理逻辑
|
|
|
|
|
|
@@ -152,8 +161,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
|
|
|
private void EditTextMode()
|
|
private void EditTextMode()
|
|
{
|
|
{
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 从预设样式设置文本
|
|
/// 从预设样式设置文本
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -189,7 +198,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
/// </summary>
|
|
/// </summary>
|
|
private void CustomFontStyle()
|
|
private void CustomFontStyle()
|
|
{
|
|
{
|
|
-
|
|
|
|
if (CurrentPresetFont != null)
|
|
if (CurrentPresetFont != null)
|
|
{
|
|
{
|
|
ContextMenu menu;
|
|
ContextMenu menu;
|
|
@@ -205,7 +213,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
if (currentItem.mTag != "Custom")
|
|
if (currentItem.mTag != "Custom")
|
|
{
|
|
{
|
|
-
|
|
|
|
if (FontWeightItem != defaulItem.mFontWeight ||
|
|
if (FontWeightItem != defaulItem.mFontWeight ||
|
|
FontStyleItem != defaulItem.mFontStyle ||
|
|
FontStyleItem != defaulItem.mFontStyle ||
|
|
CurrentFontSize.Value != defaulItem.mFontSize ||
|
|
CurrentFontSize.Value != defaulItem.mFontSize ||
|
|
@@ -221,8 +228,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
menu.IsOpen = true;
|
|
menu.IsOpen = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//设置字体样式
|
|
//设置字体样式
|
|
@@ -344,7 +349,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
/// </summary>
|
|
/// </summary>
|
|
private void ReDefineFontStyle()
|
|
private void ReDefineFontStyle()
|
|
{
|
|
{
|
|
-
|
|
|
|
var item = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
var item = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
if (item == null) return;
|
|
if (item == null) return;
|
|
|
|
|
|
@@ -377,7 +381,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
//SelectedPresetFont();
|
|
//SelectedPresetFont();
|
|
//更改后 保存到本地缓存
|
|
//更改后 保存到本地缓存
|
|
TextFont.SavePresetFontList(PresetFontList);
|
|
TextFont.SavePresetFontList(PresetFontList);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//重置定义
|
|
//重置定义
|
|
@@ -386,7 +389,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
var defaultlists = TextFont.GetPresetFontStyle();
|
|
var defaultlists = TextFont.GetPresetFontStyle();
|
|
if (CurrentPresetFont.ValueStr != "Custom")
|
|
if (CurrentPresetFont.ValueStr != "Custom")
|
|
{
|
|
{
|
|
- var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag ==CurrentPresetFont.ValueStr);
|
|
|
|
|
|
+ var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
if (defaulItem != null)
|
|
if (defaulItem != null)
|
|
{
|
|
{
|
|
var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
var currentItem = PresetFontList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
@@ -398,7 +401,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
currentItem.mFontFamily = defaulItem.mFontFamily;
|
|
currentItem.mFontFamily = defaulItem.mFontFamily;
|
|
currentItem.mFontSize = defaulItem.mFontSize;
|
|
currentItem.mFontSize = defaulItem.mFontSize;
|
|
GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
|
|
GetCurrentFontFamily(currentItem.mFontFamily.ToString(), currentItem.mFontFamily.ToString());
|
|
- GetCurrentFontSize(currentItem.mFontSize);
|
|
|
|
|
|
+ GetCurrentFontSize(currentItem.mFontSize);
|
|
GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
|
|
GetFontWeights_Style(currentItem.mFontStyle, currentItem.mFontWeight);
|
|
CurrentPresetFont = new ComboDataItem(defaulItem.mTag, defaulItem.mTagContent);
|
|
CurrentPresetFont = new ComboDataItem(defaulItem.mTag, defaulItem.mTagContent);
|
|
SelectedPresetFont();
|
|
SelectedPresetFont();
|
|
@@ -406,7 +409,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//设置多选对齐方式
|
|
//设置多选对齐方式
|
|
@@ -421,34 +423,39 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
case "AlignLeft":
|
|
case "AlignLeft":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "AlignHorizonCenter":
|
|
case "AlignHorizonCenter":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "AlignRight":
|
|
case "AlignRight":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "DistributeHorizontal":
|
|
case "DistributeHorizontal":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "AlignTop":
|
|
case "AlignTop":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "AlignVerticalCenter":
|
|
case "AlignVerticalCenter":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "AlignBottom":
|
|
case "AlignBottom":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case "DistributeVertical":
|
|
case "DistributeVertical":
|
|
PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
|
|
PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//设置文本框内对齐方式
|
|
//设置文本框内对齐方式
|
|
private void TextAlignChecked(object obj)
|
|
private void TextAlignChecked(object obj)
|
|
{
|
|
{
|
|
@@ -517,7 +524,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
if (colorValue != null)
|
|
if (colorValue != null)
|
|
{
|
|
{
|
|
SelectColor = new SolidColorBrush(colorValue);
|
|
SelectColor = new SolidColorBrush(colorValue);
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -528,11 +534,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
if (obj != null && (PresetFontItem)obj != null)
|
|
if (obj != null && (PresetFontItem)obj != null)
|
|
{
|
|
{
|
|
var item = (PresetFontItem)obj;
|
|
var item = (PresetFontItem)obj;
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//设置字体大小
|
|
//设置字体大小
|
|
private void FontSizeChanged(object obj)
|
|
private void FontSizeChanged(object obj)
|
|
{
|
|
{
|
|
@@ -579,8 +583,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
|
|
+ #endregion 文本处理逻辑
|
|
|
|
|
|
#region 右键菜单
|
|
#region 右键菜单
|
|
|
|
|
|
@@ -599,9 +602,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
return popMenu;
|
|
return popMenu;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- #endregion
|
|
|
|
-
|
|
|
|
|
|
+ #endregion 右键菜单
|
|
|
|
|
|
#region 编辑PDF内容触发的事件
|
|
#region 编辑PDF内容触发的事件
|
|
|
|
|
|
@@ -610,7 +611,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
/// </summary>
|
|
/// </summary>
|
|
private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
|
|
private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
|
|
{
|
|
{
|
|
-
|
|
|
|
//if (e == null)
|
|
//if (e == null)
|
|
// return;
|
|
// return;
|
|
|
|
|
|
@@ -653,7 +653,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
menuItem.IsEnabled = false;
|
|
menuItem.IsEnabled = false;
|
|
if (currentItem.mTag != "Custom")
|
|
if (currentItem.mTag != "Custom")
|
|
{
|
|
{
|
|
-
|
|
|
|
if (FontWeightItem != currentItem.mFontWeight ||
|
|
if (FontWeightItem != currentItem.mFontWeight ||
|
|
FontStyleItem != currentItem.mFontStyle ||
|
|
FontStyleItem != currentItem.mFontStyle ||
|
|
CurrentFontSize.Value != currentItem.mFontSize ||
|
|
CurrentFontSize.Value != currentItem.mFontSize ||
|
|
@@ -663,7 +662,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
menuItem.Command = ReDefineFontStyleCommand;
|
|
menuItem.Command = ReDefineFontStyleCommand;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
//恢复默认预设样式
|
|
//恢复默认预设样式
|
|
menuItem = popMenu.Items[1] as MenuItem;
|
|
menuItem = popMenu.Items[1] as MenuItem;
|
|
menuItem.IsEnabled = isEnable;
|
|
menuItem.IsEnabled = isEnable;
|
|
@@ -671,17 +670,17 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
return popMenu;
|
|
return popMenu;
|
|
}
|
|
}
|
|
- #endregion
|
|
|
|
|
|
+
|
|
|
|
+ #endregion 编辑PDF内容触发的事件
|
|
|
|
|
|
protected List<PDFEditEvent> TextEditEventList;
|
|
protected List<PDFEditEvent> TextEditEventList;
|
|
|
|
+
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
-
|
|
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
|
|
navigationContext.Parameters.TryGetValue<List<PDFEditEvent>>(ParameterNames.AnnotEvent, out TextEditEventList);
|
|
if (PDFViewer != null)
|
|
if (PDFViewer != null)
|
|
{
|
|
{
|
|
-
|
|
|
|
if (TextEditEventList != null && TextEditEventList.Count > 0)
|
|
if (TextEditEventList != null && TextEditEventList.Count > 0)
|
|
{
|
|
{
|
|
TextEditEvent = TextEditEventList[0];
|
|
TextEditEvent = TextEditEventList[0];
|
|
@@ -739,11 +738,27 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //文本内容改变触发
|
|
|
|
|
|
+ private DefaultEditProperty GetEditDefault(ComPDFKit.PDFPage.CPDFEditType editType)
|
|
|
|
+ {
|
|
|
|
+ var edit = SettingHelper.GetPDFEditDefaultProperty(editType);
|
|
|
|
+ if (edit == null)
|
|
|
|
+ {
|
|
|
|
+ edit = new DefaultEditProperty();
|
|
|
|
+ edit.EditType = editType;
|
|
|
|
+ }
|
|
|
|
+ return edit;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 文本内容改变触发
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender"></param>
|
|
|
|
+ /// <param name="e"></param>
|
|
private void FontMode_ChangedValue(object sender, FontSetModeType e)
|
|
private void FontMode_ChangedValue(object sender, FontSetModeType e)
|
|
{
|
|
{
|
|
if (sender != null && TextEditEvent != null)
|
|
if (sender != null && TextEditEvent != null)
|
|
{
|
|
{
|
|
|
|
+ PDFEditEvent pdfEditEvent = PDFEditHelper.GetPDFEditDefaultProperty(out DefaultEditProperty defaultEdit, PDFViewer);
|
|
switch (e)
|
|
switch (e)
|
|
{
|
|
{
|
|
case FontSetModeType.PresetFontStyes:
|
|
case FontSetModeType.PresetFontStyes:
|
|
@@ -771,30 +786,44 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
itemlist.UpdatePDFEditByEventArgs();
|
|
itemlist.UpdatePDFEditByEventArgs();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ defaultEdit.FontName = TextEditEvent.FontName;
|
|
|
|
+ defaultEdit.FontSize = TextEditEvent.FontSize;
|
|
|
|
+ defaultEdit.IsBold = TextEditEvent.IsBold;
|
|
|
|
+ defaultEdit.IsItalic = TextEditEvent.IsItalic;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case FontSetModeType.FontFamilys:
|
|
case FontSetModeType.FontFamilys:
|
|
if (sender is string == true)
|
|
if (sender is string == true)
|
|
{
|
|
{
|
|
TextEditEvent.FontName = (string)sender;
|
|
TextEditEvent.FontName = (string)sender;
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
|
|
+
|
|
|
|
+ defaultEdit.FontName = TextEditEvent.FontName;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case FontSetModeType.FontSizes:
|
|
case FontSetModeType.FontSizes:
|
|
- if (sender is double == true && (double)sender > 0 && TextEditEvent.FontSize > 0)
|
|
|
|
|
|
+ if (sender is double == true && (double)sender > 0 && TextEditEvent.FontSize >= 0)
|
|
{
|
|
{
|
|
TextEditEvent.FontSize = (double)sender;
|
|
TextEditEvent.FontSize = (double)sender;
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
|
|
+
|
|
|
|
+ defaultEdit.FontSize = TextEditEvent.FontSize;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case FontSetModeType.FontWeight_Style:
|
|
case FontSetModeType.FontWeight_Style:
|
|
UpdateFontWeight_Style();
|
|
UpdateFontWeight_Style();
|
|
TextEditEvent.IsBold = FontWeightItem == FontWeights.Bold;
|
|
TextEditEvent.IsBold = FontWeightItem == FontWeights.Bold;
|
|
TextEditEvent.IsItalic = FontStyleItem == FontStyles.Italic;
|
|
TextEditEvent.IsItalic = FontStyleItem == FontStyles.Italic;
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
|
|
+
|
|
|
|
+ defaultEdit.IsBold = TextEditEvent.IsBold;
|
|
|
|
+ defaultEdit.IsItalic = TextEditEvent.IsItalic;
|
|
break;
|
|
break;
|
|
|
|
+
|
|
case FontSetModeType.FontColor:
|
|
case FontSetModeType.FontColor:
|
|
if (sender is Color == true)
|
|
if (sender is Color == true)
|
|
{
|
|
{
|
|
@@ -810,15 +839,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ defaultEdit.FontColor = TextEditEvent.FontColor;
|
|
break;
|
|
break;
|
|
|
|
|
|
case FontSetModeType.TextAlignment:
|
|
case FontSetModeType.TextAlignment:
|
|
break;
|
|
break;
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
+ PDFEditHelper.GetPDFEditEvent(defaultEdit, PDFViewer);
|
|
|
|
+ SettingHelper.SetPDFEditProperty(defaultEdit);
|
|
|
|
+ Settings.Default.Save();
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//获取文本参数
|
|
//获取文本参数
|
|
@@ -826,26 +856,29 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
{
|
|
{
|
|
if (!App.IsGetTextFamily)
|
|
if (!App.IsGetTextFamily)
|
|
{
|
|
{
|
|
-
|
|
|
|
- EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
|
|
|
|
|
|
+ if (TextEditEvent.SystemFontNameList.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ EditHelper.FontFamily = TextEditEvent.SystemFontNameList;
|
|
|
|
+ App.IsGetTextFamily = true;
|
|
|
|
+ }
|
|
InitBase_FontFamilys();
|
|
InitBase_FontFamilys();
|
|
- App.IsGetTextFamily = true;
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
|
|
SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
|
|
- CurrentFontSize =new ComboDataItem(TextEditEvent.FontSize);
|
|
|
|
|
|
+ CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
|
|
CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
|
|
FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
|
|
FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
|
|
FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
|
|
//GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
//GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
GetFontWeights_Style(FontStyleItem, FontWeightItem);
|
|
GetFontWeights_Style(FontStyleItem, FontWeightItem);
|
|
-
|
|
|
|
|
|
+
|
|
//判断样式列表中是否存在对应样式
|
|
//判断样式列表中是否存在对应样式
|
|
bool isExist = false;
|
|
bool isExist = false;
|
|
foreach (var item in PresetFontList)
|
|
foreach (var item in PresetFontList)
|
|
{
|
|
{
|
|
string itemmFontFamily = item.mFontFamily.Source;
|
|
string itemmFontFamily = item.mFontFamily.Source;
|
|
|
|
|
|
- if (item.mFontFamily.Source == "TimesRoman" )
|
|
|
|
|
|
+ if (item.mFontFamily.Source == "TimesRoman")
|
|
{
|
|
{
|
|
itemmFontFamily = "Times-Roman";
|
|
itemmFontFamily = "Times-Roman";
|
|
}
|
|
}
|
|
@@ -869,7 +902,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
CurrentPresetFont = new ComboDataItem("Custom", "Custom");
|
|
CurrentPresetFont = new ComboDataItem("Custom", "Custom");
|
|
GetCurrentFontSize((int)TextEditEvent.FontSize);
|
|
GetCurrentFontSize((int)TextEditEvent.FontSize);
|
|
|
|
|
|
- if (TextEditEvent.FontName == ""|| TextEditEvent.FontName == null)
|
|
|
|
|
|
+ if (TextEditEvent.FontName == "" || TextEditEvent.FontName == null)
|
|
{
|
|
{
|
|
GetCurrentFontFamily("Arial", "Arial");
|
|
GetCurrentFontFamily("Arial", "Arial");
|
|
}
|
|
}
|
|
@@ -897,7 +930,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -922,11 +954,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
}
|
|
}
|
|
TextAlign = TextEditEvent.TextAlign;
|
|
TextAlign = TextEditEvent.TextAlign;
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
|
+ { return true; }
|
|
|
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
@@ -937,6 +968,5 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
|
|
PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
|
|
ChangedValue -= FontMode_ChangedValue;
|
|
ChangedValue -= FontMode_ChangedValue;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|