|
@@ -2,6 +2,7 @@
|
|
|
using ComPDFKitViewer;
|
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
|
using ComPDFKitViewer.PdfViewer;
|
|
|
+using PDF_Office.CustomControl.CompositeControl;
|
|
|
using PDF_Office.Helper;
|
|
|
using PDF_Office.Model;
|
|
|
using PDF_Office.Model.From;
|
|
@@ -127,6 +128,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
private WidgetTextBoxArgs textBoxArgs;
|
|
|
private bool IsCurrentWidget = false;
|
|
|
private IDialogService dialogs;
|
|
|
+ public List<ComboDataItem> Items { get; private set; }
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -140,17 +142,24 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
private void InitVariable()
|
|
|
{
|
|
|
- ResetColorOne = new ResetColor() {
|
|
|
+ InitResetColor();
|
|
|
+ InitFontFamilyComboBox();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitResetColor()
|
|
|
+ {
|
|
|
+ ResetColorOne = new ResetColor()
|
|
|
+ {
|
|
|
BorderColor = new SolidColorBrush(Colors.Transparent),
|
|
|
FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
- FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
|
|
|
+ FillColor = new SolidColorBrush(Colors.Transparent)
|
|
|
};
|
|
|
|
|
|
ResetColorTwo = new ResetColor()
|
|
|
{
|
|
|
BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
- FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
|
|
|
+ FillColor = new SolidColorBrush(Colors.Transparent)
|
|
|
};
|
|
|
|
|
|
ResetColorThree = new ResetColor()
|
|
@@ -166,6 +175,17 @@ namespace PDF_Office.ViewModels.Form
|
|
|
FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
|
|
|
FillColor = new SolidColorBrush(Colors.Transparent)
|
|
|
};
|
|
|
+
|
|
|
+ }
|
|
|
+ private void InitFontFamilyComboBox()
|
|
|
+ {
|
|
|
+ Items = new List<ComboDataItem>();
|
|
|
+ ComboDataItem item = new ComboDataItem("Courier", "Courier New");
|
|
|
+ Items.Add(item);
|
|
|
+ item = new ComboDataItem("Arial", "Helvetica");
|
|
|
+ Items.Add(item);
|
|
|
+ item = new ComboDataItem("Times New Roman", "Times New Roman");
|
|
|
+ Items.Add(item);
|
|
|
}
|
|
|
|
|
|
private void InitCommand()
|
|
@@ -193,20 +213,21 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
private void LineStyleBtnEvent(object obj)
|
|
|
{
|
|
|
- if(obj != null)
|
|
|
+ if (obj != null)
|
|
|
{
|
|
|
- switch((string)obj)
|
|
|
+ switch ((string)obj)
|
|
|
{
|
|
|
case "Solid":
|
|
|
- IsSolid = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
|
|
|
+ BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
|
|
|
break;
|
|
|
case "Dotted":
|
|
|
- IsSolid = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
|
|
|
+ BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private void IsScrollToDisplayChecked(object obj)
|
|
|
{
|
|
|
if(obj != null)
|
|
@@ -292,17 +313,17 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
private void FontFamilyChanged(object obj)
|
|
|
{
|
|
|
- if(obj!= null)
|
|
|
+ if (obj != null && string.IsNullOrEmpty((string)obj) == false)
|
|
|
{
|
|
|
- switch((int)obj)
|
|
|
+ switch ((string)obj)
|
|
|
{
|
|
|
- case 0:
|
|
|
+ case "Courier":
|
|
|
FontFamilyItem = new FontFamily("Courier");
|
|
|
break;
|
|
|
- case 1:
|
|
|
+ case "Helvetica":
|
|
|
FontFamilyItem = new FontFamily("Helvetica");
|
|
|
break;
|
|
|
- case 2:
|
|
|
+ case "Times Roman":
|
|
|
FontFamilyItem = new FontFamily("Times Roman");
|
|
|
break;
|
|
|
}
|
|
@@ -311,38 +332,78 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
private void ResetColorCheckedBtn(object obj)
|
|
|
{
|
|
|
- if(obj != null)
|
|
|
+ if (obj != null)
|
|
|
{
|
|
|
var str = obj as string;
|
|
|
- if(str != null)
|
|
|
+ if (str != null)
|
|
|
{
|
|
|
- switch(str)
|
|
|
+ switch (str)
|
|
|
{
|
|
|
case "One":
|
|
|
BorderColor = ResetColorOne.BorderColor.Color;
|
|
|
ContentColor = ResetColorOne.FontColor.Color;
|
|
|
-
|
|
|
+ FillColor = ResetColorOne.FillColor.Color;
|
|
|
break;
|
|
|
|
|
|
case "Two":
|
|
|
BorderColor = ResetColorTwo.BorderColor.Color;
|
|
|
ContentColor = ResetColorTwo.FontColor.Color;
|
|
|
+ FillColor = ResetColorTwo.FillColor.Color;
|
|
|
break;
|
|
|
|
|
|
case "Three":
|
|
|
BorderColor = ResetColorThree.BorderColor.Color;
|
|
|
ContentColor = ResetColorThree.FontColor.Color;
|
|
|
+ FillColor = ResetColorThree.FillColor.Color;
|
|
|
break;
|
|
|
|
|
|
case "Forth":
|
|
|
BorderColor = ResetColorForth.BorderColor.Color;
|
|
|
ContentColor = ResetColorForth.FontColor.Color;
|
|
|
+ FillColor = ResetColorForth.FillColor.Color;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public event EventHandler<int> SelectResetColorBtnHandler;
|
|
|
+ private void UpdataSelectResetColorBtn()
|
|
|
+ {
|
|
|
+ int result = 0;
|
|
|
+ if (UpdataSelectResetColor(ResetColorOne))
|
|
|
+ {
|
|
|
+ result = 1;
|
|
|
+ }
|
|
|
+ else if (UpdataSelectResetColor(ResetColorTwo))
|
|
|
+ {
|
|
|
+ result = 2;
|
|
|
+ }
|
|
|
+ else if (UpdataSelectResetColor(ResetColorThree))
|
|
|
+ {
|
|
|
+ result = 3;
|
|
|
+ }
|
|
|
+ else if (UpdataSelectResetColor(ResetColorForth))
|
|
|
+ {
|
|
|
+ result = 4;
|
|
|
+ }
|
|
|
+
|
|
|
+ SelectResetColorBtnHandler?.Invoke(null, result);
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool UpdataSelectResetColor(ResetColor reset)
|
|
|
+ {
|
|
|
+ if (reset.FillColor.Color == FillColor &&
|
|
|
+ reset.FontColor.Color == ContentColor &&
|
|
|
+ reset.BorderColor.Color == BorderColor
|
|
|
+ )
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
private void ResetColorEvent(object obj)
|
|
|
{
|
|
|
|
|
@@ -448,6 +509,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
navigationContext.Parameters.TryGetValue<WidgetTextBoxArgs>("WidgetArgs", out textBoxArgs);
|
|
|
|
|
|
GetWidgeText();
|
|
|
+ UpdataSelectResetColorBtn();
|
|
|
}
|
|
|
bool isCreateWidget = false;
|
|
|
private void GetWidgeText()
|
|
@@ -458,10 +520,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
{
|
|
|
PDFViewer.SetMouseMode(MouseModes.FormEditTool);
|
|
|
WidgetTextBoxArgs textArgs = new WidgetTextBoxArgs();
|
|
|
- textArgs.BgColor = Colors.Transparent;
|
|
|
- textArgs.FontSize = 12;
|
|
|
- textArgs.FontFamily = "Courier New";
|
|
|
- textArgs.FontColor = Colors.Black;
|
|
|
+ textArgs.BgColor = Colors.LightGray;
|
|
|
textArgs.FieldName = "TextBox";
|
|
|
textBoxArgs = textArgs;
|
|
|
PDFViewer.SetToolParam(textBoxArgs);
|
|
@@ -469,7 +528,6 @@ namespace PDF_Office.ViewModels.Form
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
|
|
|
isCreateWidget = false;
|
|
|
}
|
|
@@ -479,23 +537,30 @@ namespace PDF_Office.ViewModels.Form
|
|
|
}
|
|
|
private void GetProperty()
|
|
|
{
|
|
|
- if(textBoxArgs != null)
|
|
|
+ if (textBoxArgs != null)
|
|
|
{
|
|
|
NameStr = textBoxArgs.FieldName;
|
|
|
IsRequiredField = textBoxArgs.IsRequired;
|
|
|
IsMultiLine = textBoxArgs.IsMultiLine;
|
|
|
IsLocked = textBoxArgs.Locked;
|
|
|
ToolTipStr = textBoxArgs.Tooltip;
|
|
|
-
|
|
|
-
|
|
|
+ FillColor = textBoxArgs.BgColor;
|
|
|
+ ContentColor = textBoxArgs.FontColor;
|
|
|
+ BorderColor = textBoxArgs.LineColor;
|
|
|
+ BorderThiness = textBoxArgs.LineWidth;
|
|
|
+ BorderStyle = textBoxArgs.BorderStyle;
|
|
|
+
|
|
|
+ if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
|
|
|
+ IsSolid = true;
|
|
|
+ else
|
|
|
+ IsSolid = false;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
|
|
|
private void ChangeValue(object sender, FormAttributeType e)
|
|
|
{
|
|
|
|
|
|
- switch(e)
|
|
|
+ switch (e)
|
|
|
{
|
|
|
case FormAttributeType.Name:
|
|
|
textBoxArgs.FieldName = NameStr;
|
|
@@ -508,8 +573,8 @@ namespace PDF_Office.ViewModels.Form
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.IsSolid:
|
|
|
- textBoxArgs.BorderStyle = IsSolid;
|
|
|
- AttribEvent?.UpdateAttrib(AnnotAttrib.LineStyle, IsSolid);
|
|
|
+ textBoxArgs.BorderStyle = BorderStyle;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.LineStyle, BorderStyle);
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.IsLocked:
|
|
@@ -519,7 +584,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
case FormAttributeType.HeightSize:
|
|
|
textBoxArgs.Height = HeightSize;
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.BorderThiness:
|
|
@@ -548,7 +613,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
case FormAttributeType.WidthSize:
|
|
|
textBoxArgs.Width = WidthSize;
|
|
|
-
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.IsRequiredField:
|
|
@@ -556,17 +621,22 @@ namespace PDF_Office.ViewModels.Form
|
|
|
AttribEvent?.UpdateAttrib(AnnotAttrib.IsRequired, IsRequiredField);
|
|
|
break;
|
|
|
|
|
|
+ case FormAttributeType.FontFamily:
|
|
|
+ textBoxArgs.FontFamily = FontFamilyItem.Source;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.FontFamily, FontFamilyItem.Source);
|
|
|
+ break;
|
|
|
+
|
|
|
}
|
|
|
AttribEvent?.UpdateAnnot();
|
|
|
}
|
|
|
|
|
|
private void ChangeFieldValue(string tag)
|
|
|
{
|
|
|
- switch(tag)
|
|
|
+ switch (tag)
|
|
|
{
|
|
|
case "FormPos":
|
|
|
textBoxArgs.FormField = FormField.Visible;
|
|
|
- AttribEvent?.UpdateAttrib(AnnotAttrib.FormField,FormPos);
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.FormField, FormPos);
|
|
|
break;
|
|
|
case "FontFamilyItem":
|
|
|
textBoxArgs.FontFamily = FontFamilyItem.Source;
|