Browse Source

打印 UI优化;转档 world 框排、流排效果相反的bug

OYXH\oyxh 1 năm trước cách đây
mục cha
commit
5f6359ed9b

+ 1 - 1
PDF Office/Model/Dialog/ConverterDialogs/ConverterDialogsModel.cs

@@ -35,7 +35,7 @@ namespace PDF_Master.Model.Dialog.ConverterDialogs
         public ImgType ImageType = ImgType.PNG;
         public uint ImageDpi = 150;
         public bool IsMergeCsv = false;
-        public LayoutOptions LayoutOpts = LayoutOptions.RetainPageLayout;
+        public LayoutOptions LayoutOpts = LayoutOptions.RetainFlowingText;
     }
 
     public class ConverterDialogsModel

+ 25 - 26
PDF Office/ViewModels/Dialog/ConverterDialogs/ConverterWordDialogViewModel.cs

@@ -73,7 +73,9 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 SetProperty(ref T_pageRange, value);
             }
         }
+
         private string _TextUpgrade;
+
         public string TextUpgrade
         {
             get { return _TextUpgrade; }
@@ -89,13 +91,14 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             T_PageRange = App.MainPageLoader.GetString("Convert_PDFPageRange");
         }
 
-        #endregion
+        #endregion 文案
 
         public string Title => "";
 
         public event Action<IDialogResult> RequestClose;
 
         #region 参数和属性
+
         public ConverterWordDialogModel ConverterWordModel = new ConverterWordDialogModel();
 
         public CPDFViewer currentViewer;
@@ -111,6 +114,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         public string PageRangeSelectIndex { set; get; } = "0";
 
         private int maxPageRange = 0;
+
         public int MaxPageRange
         {
             get { return maxPageRange; }
@@ -121,6 +125,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         }
 
         private bool oCRCheckBoxIsCheckBox = false;
+
         public bool OCRCheckBoxIsCheckBox
         {
             get { return oCRCheckBoxIsCheckBox; }
@@ -132,6 +137,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         }
 
         private int languageSelectedIndex = 2;
+
         public int LanguageSelectedIndex
         {
             get { return languageSelectedIndex; }
@@ -139,7 +145,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             {
                 SetProperty(ref languageSelectedIndex, value);
                 SelectLanguage(languageSelectedIndex);
-
             }
         }
 
@@ -158,7 +163,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         private void InitCheckPageSelect()
         {
-
             CheckPageSelect.Clear();
             if (!IsCurrentPageIndex)
             {
@@ -170,18 +174,18 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             }
             else
             {
-
                 CheckPageSelect.Add("0", "0");
                 CheckPageSelect.Add("1", "-2");
                 CheckPageSelect.Add("2", "1");
                 CheckPageSelect.Add("3", "2");
                 CheckPageSelect.Add("4", "3");
-
             }
         }
-        #endregion
+
+        #endregion 参数和属性
 
         #region 委托声明
+
         public DelegateCommand<string> RadioButtonCommand { get; set; }
 
         public DelegateCommand CancelCommand { get; set; }
@@ -202,7 +206,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
 
         public DelegateCommand OpenOCRCommand { get; set; }
 
-        #endregion
+        #endregion 委托声明
 
         public ConverterWordDialogViewModel(IDialogService dialogService)
         {
@@ -219,8 +223,8 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             dialogs = dialogService;
             IntString();
         }
-        #region 逻辑函数
 
+        #region 逻辑函数
 
         private void openOCR()
         {
@@ -243,7 +247,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         DialogParameters oCRDownloadProgress = new DialogParameters();
                         dialogs.ShowDialog(DialogNames.OCRDownloadProgress, oCRDownloadProgress, e =>
                         {
-
                             if (e.Result == Prism.Services.Dialogs.ButtonResult.OK)
                             {
                                 string folderPath = System.IO.Path.Combine(App.CurrentPath, "OCREngine");
@@ -261,16 +264,13 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         OCRCheckBoxIsCheckBox = false;
                     }
                 }
-
             }
-
         }
 
         public void SetCustomPageRange()
         {
             if (PageRangeSelectIndex == CheckPageSelect["4"])
             {
-
                 List<int> PageIndexLists = new List<int>();
                 if (!CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, currentViewer.Document.PageCount, new char[] { ',' }, new char[] { '-' }))
                 { //TODO
@@ -289,7 +289,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                     //    //});
                     //    return;
                     //}
-
                 }
             }
         }
@@ -317,7 +316,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
         {
             if (PageRangeSelectIndex == CheckPageSelect["4"])
             {
-
                 List<int> PageIndexLists = new List<int>();
                 if (!CommonHelper.GetPagesInRange(ref PageIndexLists, PageRangeText, currentViewer.Document.PageCount, new char[] { ',' }, new char[] { '-' }))
                 { //TODO
@@ -336,7 +334,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         //});
                         return;
                     }
-
                 }
             }
             System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
@@ -365,7 +362,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                     alertsMessage.ShowDialog("", App.MainPageLoader.GetString("FileNotExistWarning"), App.ServiceLoader.GetString("Text_ok"));
                     return;
                 }
-
             }
             else
             {
@@ -383,7 +379,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             char[] rangeSeparator = new char[] { '-' };
             if (!CommonHelper.GetPagesInRange(ref ConverterWordModel.PageIndexLists, ConverterWordModel.PageRange, currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
             { //TODO
-
                 Trace.WriteLine("输入不对");
                 AlertsMessage alertsMessage = new AlertsMessage();
                 alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
@@ -400,7 +395,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
             //RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
             //dialogs.ShowDialog(DialogNames.ConverterProgressBarDialog, value, e =>
             //{
-
             //});
         }
 
@@ -429,7 +423,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                         alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
                         return;
                     }
-
                 }
                 if (PageRangeSelectIndex == CheckPageSelect["1"])
                 {
@@ -438,7 +431,6 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                     if (!CommonHelper.GetPagesInRange(ref ConverterPreview.PageIndexLists, (currentViewer.CurrentIndex + 1).ToString()
 , currentViewer.Document.PageCount, enumerationSeparator, rangeSeparator))
                     { //TODO
-
                         Trace.WriteLine("输入不对");
                         AlertsMessage alertsMessage = new AlertsMessage();
                         alertsMessage.ShowDialog("", App.MainPageLoader.GetString("PageRangeWarning"), App.ServiceLoader.GetString("Text_ok"));
@@ -514,41 +506,47 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                     case "FlowingTextRadioBtn":
                         ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainFlowingText;
                         break;
+
                     case "PageLayoutRadioBtn":
-                        ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainFlowingText;
+                        ConverterWordModel.Options.LayoutOpts = LayoutOptions.RetainPageLayout;
                         break;
+
                     default:
                         break;
                 }
             }
-
         }
 
         private void SelectLanguage(int SelectedIndex)
         {
-
             switch (SelectedIndex)
             {
                 case 0:
                     ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageChinese;
                     break;
+
                 case 1:
                     ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageChineseTraditional;
                     break;
+
                 case 2:
                     ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageEnglish;
                     break;
+
                 case 3:
                     ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageJapanese;
                     break;
+
                 case 4:
                     ConverterWordModel.Options.OCRLanguage = COCRLanguage.COCRLanguageKorean;
                     break;
+
                 default:
                     break;
             }
         }
-        #endregion
+
+        #endregion 逻辑函数
 
         #region 构架行为
 
@@ -582,6 +580,7 @@ namespace PDF_Master.ViewModels.Dialog.ConverterDialogs
                 LanguageSelectedIndex = ConverterHelper.GetCOCRLanguageInt();
             }
         }
-        #endregion
+
+        #endregion 构架行为
     }
-}
+}

+ 103 - 42
PDF Office/Views/Dialog/HomePageToolsDialogs/HomePagePrinter/HomePagePrinterModSizeContent.xaml

@@ -1,63 +1,124 @@
-<UserControl x:Class="PDF_Master.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModSizeContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:cus="clr-namespace:PDF_Master.CustomControl"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
-             xmlns:homepageprinter="clr-namespace:PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter" 
-             d:DataContext="{d:DesignInstance Type=homepageprinter:HomePagePrinterModSizeContentViewModel}"
-             mc:Ignorable="d"
-             d:DesignHeight="184"
-             d:DesignWidth="466">
-    
+<UserControl
+    x:Class="PDF_Master.Views.Dialog.HomePageToolsDialogs.HomePagePrinter.HomePagePrinterModSizeContent"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Master.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:homepageprinter="clr-namespace:PDF_Master.ViewModels.Dialog.HomePageToolsDialogs.HomePagePrinter"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    d:DataContext="{d:DesignInstance Type=homepageprinter:HomePagePrinterModSizeContentViewModel}"
+    d:DesignHeight="184"
+    d:DesignWidth="466"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    mc:Ignorable="d">
+
     <Grid>
         <Grid.RowDefinitions>
-            <RowDefinition   Height="108"></RowDefinition>
-            <RowDefinition></RowDefinition>
+            <RowDefinition Height="120" />
+            <RowDefinition />
         </Grid.RowDefinitions>
-            <Border Background="#F7F8FA" CornerRadius="4" Grid.Row="0">
-            <Grid VerticalAlignment="Top"  Height="108">
+        <Border
+            Grid.Row="0"
+            Background="#F7F8FA"
+            CornerRadius="4">
+            <Grid Height="120" VerticalAlignment="Top">
                 <Grid.RowDefinitions>
-                    <RowDefinition></RowDefinition>
-                    <RowDefinition></RowDefinition>
-                    <RowDefinition></RowDefinition>
+                    <RowDefinition />
+                    <RowDefinition />
+                    <RowDefinition />
                 </Grid.RowDefinitions>
-                <Grid Grid.Row="0" Margin="0,8,0,8">
-                    <RadioButton Name="StatusAdaptiveRdo" VerticalAlignment="Center" GroupName="ModSize" IsChecked="True" Command="{Binding SetModSizeStatusCommand}" CommandParameter="{Binding ElementName=StatusAdaptiveRdo}">
-                        <TextBlock Text="Auto adapt" FontFamily="Segoe UI" FontSize="14"></TextBlock>
+                <Grid Grid.Row="0" Margin="8,8,0,0">
+                    <RadioButton
+                        Name="StatusAdaptiveRdo"
+                        VerticalContentAlignment="Center"
+                        Command="{Binding SetModSizeStatusCommand}"
+                        CommandParameter="{Binding ElementName=StatusAdaptiveRdo}"
+                        GroupName="ModSize"
+                        IsChecked="True">
+                        <TextBlock
+                            FontFamily="Segoe UI"
+                            FontSize="14"
+                            Text="Auto adapt" />
                     </RadioButton>
                 </Grid>
-                <Grid Grid.Row="1">
-                    <RadioButton Name="StatusActuralRdo" VerticalAlignment="Center" GroupName="ModSize" Command="{Binding SetModSizeStatusCommand}" CommandParameter="{Binding ElementName=StatusActuralRdo}">
-                        <TextBlock Text="Actual size" FontFamily="Segoe UI" FontSize="14"></TextBlock>
+                <Grid Grid.Row="1" Margin="8,0">
+                    <RadioButton
+                        Name="StatusActuralRdo"
+                        VerticalContentAlignment="Center"
+                        Command="{Binding SetModSizeStatusCommand}"
+                        CommandParameter="{Binding ElementName=StatusActuralRdo}"
+                        GroupName="ModSize">
+                        <TextBlock
+                            FontFamily="Segoe UI"
+                            FontSize="14"
+                            Text="Actual size" />
                     </RadioButton>
                 </Grid>
-                <Grid Grid.Row="2"  Margin="0,0,0,6"  Height="40" VerticalAlignment="Center">
-                    <RadioButton Name="StatusCustomizedRdo" VerticalAlignment="Center" GroupName="ModSize" Command="{Binding SetModSizeStatusCommand}" CommandParameter="{Binding ElementName=StatusCustomizedRdo}">
-                        <TextBlock Text="Custom scale:" FontFamily="Segoe UI" FontSize="14"></TextBlock>
+                <WrapPanel
+                    Grid.Row="2"
+                    Height="40"
+                    Margin="8,0,0,0"
+                    VerticalAlignment="Center">
+                    <RadioButton
+                        Name="StatusCustomizedRdo"
+                        VerticalContentAlignment="Center"
+                        Command="{Binding SetModSizeStatusCommand}"
+                        CommandParameter="{Binding ElementName=StatusCustomizedRdo}"
+                        GroupName="ModSize">
+                        <TextBlock
+                            FontFamily="Segoe UI"
+                            FontSize="14"
+                            Text="Custom scale:" />
                     </RadioButton>
-                    <cus:NumericUpDown x:Name="CustomRatioUpDown" Width="90" Height="30" Margin="15,0,0,0" Loaded="CustomRatioUpDown_Loaded" Text="{Binding DisplayRatio, Mode=TwoWay}" IsEnabled="{Binding ElementName=StatusCustomizedRdo, Path=IsChecked}" Minimum="20" Maximum="200"></cus:NumericUpDown>
-                </Grid>
+                    <cus:NumericUpDown
+                        x:Name="CustomRatioUpDown"
+                        Width="90"
+                        Height="28"
+                        Margin="15,0,0,0"
+                        IsEnabled="{Binding ElementName=StatusCustomizedRdo, Path=IsChecked}"
+                        Loaded="CustomRatioUpDown_Loaded"
+                        Maximum="200"
+                        Minimum="20"
+                        Text="{Binding DisplayRatio, Mode=TwoWay}" />
+                </WrapPanel>
             </Grid>
         </Border>
         <Grid Grid.Row="1" Margin="0,8,0,0">
-            <Border Background="#F7F8FA" CornerRadius="4" Grid.Row="0">
+            <Border
+                Grid.Row="0"
+                Background="#F7F8FA"
+                CornerRadius="4">
                 <StackPanel Orientation="Vertical">
-                    <CheckBox Margin="9,12" Name="DuplexChk" Command="{Binding UnlockDuplexCommand}" CommandParameter="{Binding ElementName=DuplexChk}">
-                        <TextBlock Text="Duplex Printing"></TextBlock>
+                    <CheckBox
+                        Name="DuplexChk"
+                        Margin="9,12"
+                        Command="{Binding UnlockDuplexCommand}"
+                        CommandParameter="{Binding ElementName=DuplexChk}">
+                        <TextBlock Text="Duplex Printing" />
                     </CheckBox>
-                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding ElementName=DuplexChk, Path=IsChecked}">
-                        <RadioButton Name="DuplexModLongEdgeRdo" Margin="12,0,17,0" IsChecked="{Binding IsDuplexModLongEdge}" Command="{Binding ChangeDuplexModCommand}" CommandParameter="{Binding ElementName=DuplexModLongEdgeRdo}">
-                            <TextBlock Text="Flip On Long Edge"></TextBlock>
+                    <StackPanel
+                        Margin="0,0,0,15"
+                        IsEnabled="{Binding ElementName=DuplexChk, Path=IsChecked}"
+                        Orientation="Horizontal">
+                        <RadioButton
+                            Name="DuplexModLongEdgeRdo"
+                            Margin="12,0,17,0"
+                            Command="{Binding ChangeDuplexModCommand}"
+                            CommandParameter="{Binding ElementName=DuplexModLongEdgeRdo}"
+                            IsChecked="{Binding IsDuplexModLongEdge}">
+                            <TextBlock Text="Flip On Long Edge" />
                         </RadioButton>
-                        <RadioButton Name="DuplexModShortEdgeRdo" IsChecked="{Binding IsDuplexModShortEdge}"  Command="{Binding ChangeDuplexModCommand}" CommandParameter="{Binding ElementName=DuplexModShortEdgeRdo}">
-                            <TextBlock Text="Flip On Short Edge"></TextBlock>
+                        <RadioButton
+                            Name="DuplexModShortEdgeRdo"
+                            Command="{Binding ChangeDuplexModCommand}"
+                            CommandParameter="{Binding ElementName=DuplexModShortEdgeRdo}"
+                            IsChecked="{Binding IsDuplexModShortEdge}">
+                            <TextBlock Text="Flip On Short Edge" />
                         </RadioButton>
                     </StackPanel>
                 </StackPanel>
             </Border>
-        </Grid> 
+        </Grid>
     </Grid>
-</UserControl>
+</UserControl>