|
@@ -1,6 +1,7 @@
|
|
using ComPDFKitViewer;
|
|
using ComPDFKitViewer;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
using PDF_Office.Model;
|
|
using PDF_Office.Model;
|
|
|
|
+using PDF_Office.Model.PropertyPanel.AnnotPanel;
|
|
using PDF_Office.ViewModels.Tools;
|
|
using PDF_Office.ViewModels.Tools;
|
|
using Prism.Commands;
|
|
using Prism.Commands;
|
|
using Prism.Mvvm;
|
|
using Prism.Mvvm;
|
|
@@ -28,7 +29,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private Brush selectColor = new SolidColorBrush(Colors.Transparent);
|
|
|
|
|
|
+ private Brush selectColor = new SolidColorBrush(Colors.Black);
|
|
public Brush SelectColor
|
|
public Brush SelectColor
|
|
{
|
|
{
|
|
get { return selectColor; }
|
|
get { return selectColor; }
|
|
@@ -93,7 +94,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<FontStyleItem> fontStyleList = new List<FontStyleItem>();
|
|
|
|
+ public List<FontStyleItem> FontStyleList
|
|
|
|
+ {
|
|
|
|
+ get { return fontStyleList; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref fontStyleList, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
|
|
|
|
+ public DelegateCommand<object> SelectedFontStyleCommand { get; set; }
|
|
public DelegateCommand<object> SelectedColorCommand { get; set; }
|
|
public DelegateCommand<object> SelectedColorCommand { get; set; }
|
|
public DelegateCommand<object> SelectedFillColorCommand { get; set; }
|
|
public DelegateCommand<object> SelectedFillColorCommand { get; set; }
|
|
public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
|
|
public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
|
|
@@ -105,14 +117,60 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
public FreetextAnnotPropertyViewModel()
|
|
public FreetextAnnotPropertyViewModel()
|
|
{
|
|
{
|
|
|
|
+ SelectedFillOpacityCommand = new DelegateCommand<object>(SelectedFillOpacity);
|
|
|
|
+ SelectedFontStyleCommand = new DelegateCommand<object>(SelectedFontStyle);
|
|
SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
|
|
SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
|
|
SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
|
|
SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
|
|
FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged_Command);
|
|
FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged_Command);
|
|
FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged_Command);
|
|
FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged_Command);
|
|
FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged_Command);
|
|
FontSizeChangedCommand = new DelegateCommand<object>(FontSizeChanged_Command);
|
|
TextAlignChecked = new DelegateCommand<object>(TextAlign_Checked);
|
|
TextAlignChecked = new DelegateCommand<object>(TextAlign_Checked);
|
|
|
|
+ InitVariable();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void InitVariable()
|
|
|
|
+ {
|
|
|
|
+ InitFontStyles();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void InitFontStyles()
|
|
|
|
+ {
|
|
|
|
+ FontStyleItem custom = new FontStyleItem();
|
|
|
|
+ custom.mFontSize = 32;
|
|
|
|
+ custom.mFontStyleName = "自定义";
|
|
|
|
+
|
|
|
|
+ FontStyleItem h1 = new FontStyleItem();
|
|
|
|
+ h1.mFontSize = 24;
|
|
|
|
+ h1.mFontStyleName = "H1大标题";
|
|
|
|
+
|
|
|
|
+ FontStyleItem h2 = new FontStyleItem();
|
|
|
|
+ h2.mFontSize = 16;
|
|
|
|
+ h2.mFontStyleName = "h2(标准)";
|
|
|
|
+
|
|
|
|
+ FontStyleItem h3 = new FontStyleItem();
|
|
|
|
+ h3.mFontSize = 10;
|
|
|
|
+ h3.mFontStyleName = "H3小标题";
|
|
|
|
+
|
|
|
|
+ FontStyleItem b1 = new FontStyleItem();
|
|
|
|
+ b1.mFontSize = 8;
|
|
|
|
+ b1.mFontStyleName = "B1标题";
|
|
|
|
+
|
|
|
|
+ FontStyleItem b2 = new FontStyleItem();
|
|
|
|
+ b2.mFontSize = 6;
|
|
|
|
+ b2.mFontStyleName = "B2标题";
|
|
|
|
+
|
|
|
|
+ FontStyleItem b3 = new FontStyleItem();
|
|
|
|
+ b3.mFontSize = 4;
|
|
|
|
+ b3.mFontStyleName = "B3标题";
|
|
|
|
+
|
|
|
|
+ FontStyleList.Add(custom);
|
|
|
|
+ FontStyleList.Add(h1);
|
|
|
|
+ FontStyleList.Add(h2);
|
|
|
|
+ FontStyleList.Add(h3);
|
|
|
|
+ FontStyleList.Add(b1);
|
|
|
|
+ FontStyleList.Add(b2);
|
|
|
|
+ FontStyleList.Add(b3);
|
|
|
|
+ }
|
|
private void TextAlign_Checked(object obj)
|
|
private void TextAlign_Checked(object obj)
|
|
{
|
|
{
|
|
if (obj != null && (string)obj != null)
|
|
if (obj != null && (string)obj != null)
|
|
@@ -135,6 +193,31 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void SelectedFontStyle(object obj)
|
|
|
|
+ {
|
|
|
|
+ if (obj != null && (FontStyleItem)obj != null)
|
|
|
|
+ {
|
|
|
|
+ var item = (FontStyleItem)obj;
|
|
|
|
+
|
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.FontSize, item.mFontSize);
|
|
|
|
+
|
|
|
|
+ AnnotEvent?.UpdateAnnot();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void SelectedFillOpacity(object obj)
|
|
|
|
+ {
|
|
|
|
+ if (obj != null)
|
|
|
|
+ {
|
|
|
|
+ FillOpacity = (double)obj;
|
|
|
|
+ SelectColor.Opacity = FillOpacity;
|
|
|
|
+
|
|
|
|
+ AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
|
|
|
|
+ AnnotEvent?.UpdateAnnot();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void FontSizeChanged_Command(object obj)
|
|
private void FontSizeChanged_Command(object obj)
|
|
{
|
|
{
|
|
if (obj != null)
|
|
if (obj != null)
|
|
@@ -144,6 +227,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
if (content != null)
|
|
if (content != null)
|
|
{
|
|
{
|
|
var intData = int.Parse(content);
|
|
var intData = int.Parse(content);
|
|
|
|
+ TextFontSize = intData;
|
|
AnnotEvent?.UpdateAttrib(AnnotAttrib.FontSize, intData);
|
|
AnnotEvent?.UpdateAttrib(AnnotAttrib.FontSize, intData);
|
|
|
|
|
|
AnnotEvent?.UpdateAnnot();
|
|
AnnotEvent?.UpdateAnnot();
|