Browse Source

编辑PDF - 拆分为选中文字和图像三种状态的UI文件

chenrongqian@kdanmobile.com 2 years ago
parent
commit
2efb2ae7f8

+ 9 - 0
PDF Office/PDF Office.csproj

@@ -484,6 +484,8 @@
     <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\ImageTextEditPropertyViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\PDFEdit\PDFEditVM.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\TextEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\Scan\ScanPropertyPanelViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
@@ -991,6 +993,9 @@
     <Compile Include="Views\PropertyPanel\PDFEdit\ImageEditProperty.xaml.cs">
       <DependentUpon>ImageEditProperty.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\PDFEdit\ImageTextEditProperty.xaml.cs">
+      <DependentUpon>ImageTextEditProperty.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\PDFEdit\TextEditProperty.xaml.cs">
       <DependentUpon>TextEditProperty.xaml</DependentUpon>
     </Compile>
@@ -1721,6 +1726,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Views\PropertyPanel\PDFEdit\ImageTextEditProperty.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Views\PropertyPanel\PDFEdit\TextEditProperty.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 39 - 0
PDF Office/ViewModels/PropertyPanel/PDFEdit/ImageTextEditPropertyViewModel.cs

@@ -0,0 +1,39 @@
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
+{
+    public class ImageTextEditPropertyViewModel : PDFEditVM, INavigationAware
+    {
+        public ImageTextEditPropertyViewModel()
+        {
+
+           
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+
+            //navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            //if (PDFViewer != null)
+            //{
+            //    PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+            //    PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+
+            //    PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
+            //    PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+
+            //}
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext) { return true; }
+
+
+        public void OnNavigatedFrom(NavigationContext navigationContext) { }
+    }
+}

+ 51 - 0
PDF Office/ViewModels/PropertyPanel/PDFEdit/PDFEditVM.cs

@@ -0,0 +1,51 @@
+using ComPDFKitViewer;
+using ComPDFKitViewer.PdfViewer;
+using Prism.Mvvm;
+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.Input;
+
+namespace PDF_Office.ViewModels.PropertyPanel.PDFEdit
+{
+    public class PDFEditVM: BindableBase
+    {
+       
+        #region 变量
+        protected PDFEditEvent TextEditEvent;
+        protected CPDFViewer PDFViewer;
+        #endregion
+
+        #region 编辑PDF全局
+
+        //多选时,选中的既是文本也是图像
+        private bool _isSelectTextAndImg = false;
+        public bool IsSelectTextAndImg { get { return _isSelectTextAndImg; } set { SetProperty(ref _isSelectTextAndImg, value); } }
+
+        //平均对齐布局
+        private bool _isLayoutAvgAlign = false;
+        public bool IsLayoutAvgAlign { get { return _isLayoutAvgAlign; } set { SetProperty(ref _isLayoutAvgAlign, value); } }
+        //对齐布局
+
+        private bool _isLayoutAlign = false;
+        public bool IsLayoutAlign { get { return _isLayoutAlign; } set { SetProperty(ref _isLayoutAlign, value); } }
+        //是否为文本
+
+        private bool _isTextEdit = true;
+        public bool IsTextEdit { get { return _isTextEdit; } set { SetProperty(ref _isTextEdit, value); } }
+
+
+        #endregion
+        protected void SetPopMenuItem(MenuItem menu, object sender, ICommand command)
+        {
+            MenuItem menuItem = menu;
+            menuItem.CommandTarget = (UIElement)sender;
+            menuItem.Command = command;
+        }
+      
+    }
+}

+ 22 - 0
PDF Office/Views/PropertyPanel/PDFEdit/ImageTextEditProperty.xaml

@@ -0,0 +1,22 @@
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.PDFEdit.ImageTextEditProperty"
+             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:FormControl="clr-namespace:PDF_Office.CustomControl.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
+             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.PDFEdit"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid VerticalAlignment="Top">
+        <FormControl:LayoutAglinContent x:Name="laoutAglin" Grid.Row="1" IsLayoutAlign="{Binding IsLayoutAlign}" IsLayoutAvgAlign="{Binding IsLayoutAvgAlign}">
+            <i:Interaction.Triggers>
+                <i:EventTrigger EventName="ValueChanged">
+                    <i:InvokeCommandAction Command="{Binding ImgAlignCheckedCommand}" CommandParameter="{Binding ElementName=laoutAglin, Path=Btntag}" />
+                </i:EventTrigger>
+            </i:Interaction.Triggers>
+        </FormControl:LayoutAglinContent>
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/PDFEdit/ImageTextEditProperty.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>
+    /// ImageTextEditProperty.xaml 的交互逻辑
+    /// </summary>
+    public partial class ImageTextEditProperty : UserControl
+    {
+        public ImageTextEditProperty()
+        {
+            InitializeComponent();
+        }
+    }
+}