Преглед на файлове

编辑PDF - 调整文字编辑和图像编辑

chenrongqian преди 2 години
родител
ревизия
6c0baeff71

+ 2 - 0
PDF Office/App.xaml.cs

@@ -45,6 +45,7 @@ using PDF_Office.Views.EditTools.Bates;
 using PDF_Office.Views.EditTools.HeaderFooter;
 using PDF_Office.Views.EditTools.Redaction;
 using PDF_Office.Views.Form;
+using PDF_Office.Views.PropertyPanel.PDFEdit;
 
 namespace PDF_Office
 {
@@ -193,6 +194,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<StampAnnotProperty>();
             containerRegistry.RegisterForNavigation<SignatureAnnotProperty>();
             containerRegistry.RegisterForNavigation<TextAnnotProperty>();
+            containerRegistry.RegisterForNavigation<ImageEditProperty>();
             containerRegistry.RegisterForNavigation<TextEditProperty>();
             containerRegistry.RegisterForNavigation<BatesContent>();
             containerRegistry.RegisterForNavigation<BatesTemplateListContent>();

+ 1 - 1
PDF Office/CustomControl/Form/FormFieldCombox.xaml.cs

@@ -38,7 +38,7 @@ namespace PDF_Office.CustomControl.Form
 
         // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TypeProperty =
-            DependencyProperty.Register("MyProperty", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible));
+            DependencyProperty.Register("Type", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible));
 
 
 

+ 15 - 7
PDF Office/PDF Office.csproj

@@ -397,11 +397,12 @@
     <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureAnnotPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureCreateDialogViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageEditPropertyViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\PDFEdit\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\CustomCreateDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\DynamicPropertyDialogViewModel.cs" />
-    <Compile Include="ViewModels\PropertyPanel\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\Tools\ConverterBarContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\ExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\FullScreenWindowViewModel.cs" />
@@ -816,12 +817,15 @@
     <Compile Include="CustomControl\CompositeControl\SlidContent.xaml.cs">
       <DependentUpon>SlidContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
-      <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
+    <Compile Include="Views\PropertyPanel\PDFEdit\ImageEditProperty.xaml.cs">
+      <DependentUpon>ImageEditProperty.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\PropertyPanel\TextEditProperty.xaml.cs">
+    <Compile Include="Views\PropertyPanel\PDFEdit\TextEditProperty.xaml.cs">
       <DependentUpon>TextEditProperty.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
+      <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml.cs">
       <DependentUpon>ReadModeContent.xaml</DependentUpon>
     </Compile>
@@ -1393,14 +1397,18 @@
     <Page Include="Views\EditTools\Background\BackgroundCreateBaseContent.xaml">
       <SubType>Designer</SubType>
     </Page>
-    <Page Include="Views\PropertyPanel\PropertyPanelContent.xaml">
-      <SubType>Designer</SubType>
+    <Page Include="Views\PropertyPanel\PDFEdit\ImageEditProperty.xaml">
       <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
     </Page>
-    <Page Include="Views\PropertyPanel\TextEditProperty.xaml">
+    <Page Include="Views\PropertyPanel\PDFEdit\TextEditProperty.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\PropertyPanel\PropertyPanelContent.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 7 - 7
PDF Office/ViewModels/Form/FormBaseVM.cs

@@ -73,42 +73,42 @@ namespace PDF_Office.ViewModels.Form
         #region 外观
         //边框大小
         private double _borderThiness = 0;
-        private double BorderThiness
+        public double BorderThiness
         {
             get { return _borderThiness; }
             set { SetProperty(ref _borderThiness, value); ChangeValueHandler?.Invoke(null, FormAttributeType.BorderThiness); }
         }
         //是否为实线条
-        private bool _isSolid = true;
-        private bool IsSolid
+        private ComPDFKit.PDFAnnotation.C_BORDER_STYLE _isSolid = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+        public ComPDFKit.PDFAnnotation.C_BORDER_STYLE IsSolid
         {
             get { return _isSolid; }
             set { SetProperty(ref _isSolid, value); ChangeValueHandler?.Invoke(null, FormAttributeType.IsSolid); }
         }
         //宽大小
         private double _widthSize = 150;
-        private double WidthSize
+        public double WidthSize
         {
             get { return _widthSize; }
             set { SetProperty(ref _widthSize, value); ChangeValueHandler?.Invoke(null, FormAttributeType.WidthSize); }
         }
         //高大小
         private double _heightSize = 22;
-        private double HeightSize
+        public double HeightSize
         {
             get { return _heightSize; }
             set { SetProperty(ref _heightSize, value); ChangeValueHandler?.Invoke(null, FormAttributeType.HeightSize); }
         }
         //边框颜色
         private Color _borderColor = Colors.Transparent;
-        private Color BorderColor
+        public Color BorderColor
         {
             get { return _borderColor; }
             set { SetProperty(ref _borderColor, value); ChangeValueHandler?.Invoke(null, FormAttributeType.BorderColor); }
         }
         //内容颜色
         private Color _contentColor = Colors.Transparent;
-        private Color ContentColor
+        public Color ContentColor
         {
             get { return _contentColor; }
             set { SetProperty(ref _contentColor, value); ChangeValueHandler?.Invoke(null, FormAttributeType.ContentColor); }

+ 2 - 2
PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs

@@ -105,8 +105,8 @@ namespace PDF_Office.ViewModels.Form
             if (radioButtonArgs == null)
             {
                 radioButtonArgs = new WidgetRadioButtonArgs();
-                radioButtonArgs.FieldName = "RadioButton1";
-                radioButtonArgs.BgColor = Colors.Transparent;
+                radioButtonArgs.FieldName = NameStr;
+                radioButtonArgs.BgColor =  Colors.Transparent;
                 radioButtonArgs.FontColor = Colors.Black;
                 radioButtonArgs.LineColor = Colors.Black;
                 radioButtonArgs.LineWidth = 1;

+ 37 - 1
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -3,6 +3,7 @@ using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using PDF_Office.Model.From;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -19,6 +20,15 @@ namespace PDF_Office.ViewModels.Form
     {
         #region 属性
 
+        #region 一般
+        private FormFieldType _formPos;
+        public FormFieldType FormPos
+        {
+            get { return _formPos; }
+            set { SetProperty(ref _formPos, value); ChangeFieldValue("FormPos"); }
+        }
+
+        #endregion
 
         #region 选项
         //默认值
@@ -193,47 +203,73 @@ namespace PDF_Office.ViewModels.Form
            switch(e)
             {
                 case FormAttributeType.Name:
+                    textBoxArgs.FieldName = NameStr;
                     AttribEvent?.UpdateAttrib(AnnotAttrib.FieldName, NameStr);
                     break;
 
                 case FormAttributeType.ToolTip:
+                    textBoxArgs.Tooltip = ToolTipStr;
                     AttribEvent?.UpdateAttrib(AnnotAttrib.Tooltip, ToolTipStr);
                     break;
 
                 case FormAttributeType.IsSolid:
+                    textBoxArgs.BorderStyle = IsSolid;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.LineStyle, IsSolid);
                     break;
 
                 case FormAttributeType.IsLocked:
                     textBoxArgs.Locked = IsLocked;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.Locked, IsLocked);
                     break;
 
                 case FormAttributeType.HeightSize:
+                    textBoxArgs.DefaultWidth = HeightSize;
+                    //AttribEvent?.UpdateAttrib(, BorderThiness);
                     break;
 
                 case FormAttributeType.BorderThiness:
+                    textBoxArgs.LineWidth = BorderThiness;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.Thickness, BorderThiness);
                     break;
 
                 case FormAttributeType.BorderColor:
+                    textBoxArgs.LineColor = BorderColor;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.Color, BorderColor);
                     break;
 
                 case FormAttributeType.ContentColor:
+                    textBoxArgs.FontColor = ContentColor;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontColor, ContentColor);
                     break;
 
                 case FormAttributeType.IsReadOnly:
+                    textBoxArgs.ReadOnly = IsReadOnly;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.ReadOnly, IsReadOnly);
                     break;
 
                 case FormAttributeType.WidthSize:
                     break;
 
                 case FormAttributeType.IsRequiredField:
+                    textBoxArgs.IsRequired = IsRequiredField;
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.IsRequired, IsRequiredField);
                     break;
 
             }
             AttribEvent?.UpdateAnnot();
-            //textBoxArgs.UpdateAnnotByEventArgs();
 
         }
 
+        private void ChangeFieldValue(string tag)
+        {
+            switch(tag)
+            {
+                case "FormPos":
+                    AttribEvent?.UpdateAttrib(AnnotAttrib.FormField,FormPos);
+                    break;
+            }
+            AttribEvent?.UpdateAnnot();
+        }
 
         #endregion
     }

+ 12 - 0
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageEditPropertyViewModel.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
+{
+    internal class ImageEditPropertyViewModel
+    {
+    }
+}

+ 1 - 1
PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs

@@ -16,7 +16,7 @@ using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
 
-namespace PDF_Office.ViewModels.PropertyPanel
+namespace PDF_Office.Views.PropertyPanel.PDFEdit
 {
     public class TextEditPropertyViewModel : BindableBase, INavigationAware
     {

Файловите разлики са ограничени, защото са твърде много
+ 24 - 4
PDF Office/Views/Form/TextFieldProperty.xaml


+ 12 - 0
PDF Office/Views/PropertyPanel/PDFEdit/ImageEditProperty.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.PDFEdit.ImageEditProperty"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.PDFEdit"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/PDFEdit/ImageEditProperty.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.PropertyPanel.PDFEdit
+{
+    /// <summary>
+    /// ImageEditProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class ImageEditProperty : UserControl
+    {
+        public ImageEditProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 4 - 4
PDF Office/Views/PropertyPanel/TextEditProperty.xaml

@@ -1,4 +1,4 @@
-<UserControl x:Class="PDF_Office.Views.PropertyPanel.TextEditProperty"
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.PDFEdit.TextEditProperty"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
@@ -18,9 +18,9 @@
     <UserControl.Resources>
         <ResourceDictionary>
             <ResourceDictionary.MergedDictionaries>
-                <ResourceDictionary Source="../../Styles/SliderStyle.xaml"></ResourceDictionary>
-                <ResourceDictionary Source="../../Styles/CustomBtnStyle.xaml"/>
-                <ResourceDictionary Source="../../Styles/RadioButtonStyle.xaml"/>
+                <ResourceDictionary Source="../Styles/SliderStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="../Styles/CustomBtnStyle.xaml"/>
+                <ResourceDictionary Source="/../Styles/RadioButtonStyle.xaml"/>
             </ResourceDictionary.MergedDictionaries>
 
             <Convert:BoolToVisible x:Key="BoolToVisible"/>

+ 1 - 1
PDF Office/Views/PropertyPanel/TextEditProperty.xaml.cs

@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
 
-namespace PDF_Office.Views.PropertyPanel
+namespace PDF_Office.Views.PropertyPanel.PDFEdit
 {
     /// <summary>
     /// TextEditProperty.xaml 的交互逻辑