|
@@ -171,6 +171,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
|
|
|
}
|
|
|
GetFontWeights_Style(item.mFontStyle, item.mFontWeight);
|
|
|
+ CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
|
|
|
+ CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
+ FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
|
|
|
+ FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -181,6 +185,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
/// </summary>
|
|
|
private void CustomFontStyle()
|
|
|
{
|
|
|
+
|
|
|
if (CurrentPresetFont != null)
|
|
|
{
|
|
|
ContextMenu menu;
|
|
@@ -220,7 +225,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
if (string.IsNullOrEmpty(CurrentFontFamily.ValueStr) == false)
|
|
|
{
|
|
|
|
|
|
- GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
+ //GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
}
|
|
|
if (CurrentPresetFont != null)
|
|
|
{
|
|
@@ -276,12 +281,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
if (CurrrentFontWeightStyle != null)
|
|
|
{
|
|
|
UpdateFontWeight_Style();
|
|
|
+ FontStyleItem = TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal;
|
|
|
+ FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
|
|
|
|
|
|
//Dictionary<AnnotAttrib, object> AnnotAttribDir = new Dictionary<AnnotAttrib, object>();
|
|
|
//AnnotAttribDir.Add(AnnotAttrib.IsItalic,FontStyleItem == FontStyles.Italic);
|
|
|
//AnnotAttribDir.Add(AnnotAttrib.IsBold, FontWeightItem == FontWeights.Bold);
|
|
|
//PropertyPanel.UpdateAnnotAllAttribs(AnnotAttribDir);
|
|
|
- //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);
|
|
|
|
|
|
|
|
|
if (CurrentPresetFont != null)
|
|
@@ -448,18 +455,22 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
switch ((string)obj)
|
|
|
{
|
|
|
case "AlignLeft":
|
|
|
+ GetAnnotAlign(TextAlignment.Left);
|
|
|
TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignLeft;
|
|
|
break;
|
|
|
|
|
|
case "AlignCenter":
|
|
|
+ GetAnnotAlign(TextAlignment.Center);
|
|
|
TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignMiddle;
|
|
|
break;
|
|
|
|
|
|
case "AlignRight":
|
|
|
+ GetAnnotAlign(TextAlignment.Right);
|
|
|
TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignRight;
|
|
|
break;
|
|
|
|
|
|
case "Align":
|
|
|
+ GetAnnotAlign(TextAlignment.Justify);
|
|
|
TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignNone;
|
|
|
break;
|
|
|
}
|
|
@@ -468,7 +479,32 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //文本内容对齐
|
|
|
+ private void GetAnnotAlign(TextAlignment align)
|
|
|
+ {
|
|
|
+ switch (align)
|
|
|
+ {
|
|
|
+ case TextAlignment.Left:
|
|
|
+ StrTextAlign = "Left";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case TextAlignment.Center:
|
|
|
+ StrTextAlign = "Center";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case TextAlignment.Right:
|
|
|
+ StrTextAlign = "Right";
|
|
|
+ break;
|
|
|
+
|
|
|
+ case TextAlignment.Justify:
|
|
|
+ StrTextAlign = "Justify";
|
|
|
+ break;
|
|
|
|
|
|
+ default:
|
|
|
+ StrTextAlign = "None";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
private void SelectedColor(object obj)
|
|
|
{
|
|
|
if (obj != null)
|
|
@@ -496,7 +532,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
{
|
|
|
if (CurrentFontSize != null)
|
|
|
{
|
|
|
- GetCurrentFontSize((int)CurrentFontSize.Value);
|
|
|
+ CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
|
|
|
+ //GetCurrentFontSize((int)CurrentFontSize.Value);
|
|
|
//PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FontSize,CurrentFontSize.Value);
|
|
|
|
|
|
}
|
|
@@ -889,7 +926,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
}
|
|
|
break;
|
|
|
case FontSetModeType.FontWeight_Style:
|
|
|
- //UpdateFontWeight_Style();
|
|
|
+ UpdateFontWeight_Style();
|
|
|
TextEditEvent.IsBold = FontWeightItem == FontWeights.Bold;
|
|
|
TextEditEvent.IsItalic = FontStyleItem == FontStyles.Italic;
|
|
|
TextEditEvent.UpdatePDFEditByEventArgs();
|
|
@@ -923,19 +960,30 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
|
|
|
SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
|
|
|
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;
|
|
|
FontWeightItem = TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal;
|
|
|
-
|
|
|
+ GetFontWeights_Style(FontStyleItem, FontWeightItem);
|
|
|
+
|
|
|
|
|
|
bool isExist = false;
|
|
|
- if (TextEditEvent.FontSize == 0)
|
|
|
- {
|
|
|
- isExist = false;
|
|
|
- }
|
|
|
- else
|
|
|
+ //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
|
|
|
+ //遍历样式
|
|
|
+ foreach (var item in PresetFontList)
|
|
|
{
|
|
|
- isExist = true;
|
|
|
+ if (TextEditEvent.FontSize == item.mFontSize && TextEditEvent.IsBold == (item.mFontWeight == FontWeights.Bold) && TextEditEvent.IsItalic == (item.mFontStyle == FontStyles.Italic)
|
|
|
+ && (TextEditEvent.FontName == item.mFontFamily.Source || TextEditEvent.FontName == "Arial" && item.mFontFamily.Source == "Helvetica")
|
|
|
+ )
|
|
|
+ {
|
|
|
+ if (item.mTag != "Custom")
|
|
|
+ {
|
|
|
+ CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
|
|
|
+ isExist = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
if (isExist == false)
|
|
|
{
|
|
@@ -944,7 +992,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
CurrentPresetFont = new ComboDataItem("Custom", "Custom");
|
|
|
GetCurrentFontSize((int)TextEditEvent.FontSize);
|
|
|
|
|
|
- GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
+ GetCurrentFontFamily("Helvetica", "Helvetica");
|
|
|
GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
|
}
|
|
|
else
|
|
@@ -958,38 +1006,60 @@ namespace PDF_Master.ViewModels.PropertyPanel.PDFEdit
|
|
|
{
|
|
|
if (item.mTag != "Custom")
|
|
|
{
|
|
|
- CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
|
|
|
+ //CurrentFontSize = new ComboDataItem(TextEditEvent.FontSize);
|
|
|
GetCurrentFontSize(item.mFontSize);
|
|
|
if (item.mFontFamily != null)
|
|
|
{
|
|
|
- CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
+ //CurrentFontFamily = new ComboDataItem(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
|
|
|
}
|
|
|
- FontStyleItem = item.mFontStyle;
|
|
|
- FontWeightItem = item.mFontWeight;
|
|
|
+ //FontStyleItem = item.mFontStyle;
|
|
|
+ //FontWeightItem = item.mFontWeight;
|
|
|
GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
|
}
|
|
|
- TextAlign = TextEditEvent.TextAlign;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //if (TextEditEvent != null && TextEditEventList.Count == 1)
|
|
|
- //{
|
|
|
- // SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
|
|
|
+ //初始化传入的对齐方式
|
|
|
+ switch (TextEditEvent.TextAlign.ToString())
|
|
|
+ {
|
|
|
+ case "AlignLeft":
|
|
|
+ GetAnnotAlign(TextAlignment.Left);
|
|
|
+ break;
|
|
|
|
|
|
- // GetCurrentFontSize((int)TextEditEvent.FontSize);
|
|
|
+ case "AlignCenter":
|
|
|
+ GetAnnotAlign(TextAlignment.Center);
|
|
|
+ break;
|
|
|
|
|
|
- // if (TextEditEvent.FontName != null)
|
|
|
- // {
|
|
|
- // GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
- // }
|
|
|
+ case "AlignRight":
|
|
|
+ GetAnnotAlign(TextAlignment.Right);
|
|
|
+ break;
|
|
|
|
|
|
- // GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
|
- // TextAlign = TextEditEvent.TextAlign;
|
|
|
+ case "Align":
|
|
|
+ GetAnnotAlign(TextAlignment.Justify);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ TextAlign = TextEditEvent.TextAlign;
|
|
|
+ TextEditEvent.UpdatePDFEditByEventArgs();
|
|
|
+
|
|
|
+ //if (TextEditEvent != null && TextEditEventList.Count == 1)
|
|
|
+ //{
|
|
|
+ // SelectColor = new SolidColorBrush(TextEditEvent.FontColor);
|
|
|
|
|
|
+ // GetCurrentFontSize((int)TextEditEvent.FontSize);
|
|
|
|
|
|
- //}
|
|
|
- }
|
|
|
+ // if (TextEditEvent.FontName != null)
|
|
|
+ // {
|
|
|
+ // GetCurrentFontFamily(TextEditEvent.FontName, TextEditEvent.FontName);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // GetFontWeights_Style(TextEditEvent.IsItalic ? FontStyles.Italic : FontStyles.Normal, TextEditEvent.IsBold ? FontWeights.Bold : FontWeights.Normal);
|
|
|
+ // TextAlign = TextEditEvent.TextAlign;
|
|
|
+
|
|
|
+
|
|
|
+ //}
|
|
|
+ }
|
|
|
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
|
|
|
|