Browse Source

compdfki(win) - 替换后点击搜索,保存并重新读取

liuaoran 1 year ago
parent
commit
d1947e7ed6

+ 15 - 11
Demo/Examples/Compdfkit_Tools/PDFView/PDFSearch/PDFSearchControl/CPDFSearchControl.xaml.cs

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Media;
-using Compdfkit_Tools.Helper;
+using Compdfkit_Tools.Helper; 
 
 namespace Compdfkit_Tools.PDFControl
 {
@@ -232,11 +232,13 @@ namespace Compdfkit_Tools.PDFControl
             {
                 return;
             }
-            
-            
-            
+              
             if (SearchTog.IsChecked == true)
             {
+                if (pdfView.UndoManager.CanSave)
+                {
+                    pdfView.Document.WriteToLoadedPath();
+                }
                 keyWord = e;
                 textSearch.TextSearchDocument = pdfView.Document;
                 SearchResult.ClearSearchResult();
@@ -261,15 +263,17 @@ namespace Compdfkit_Tools.PDFControl
                 return;
             }
 
-            List<TextSearchItem> selectList = new List<TextSearchItem>();
-            selectList.Add(new TextSearchItem()
+            List<TextSearchItem> selectList = new List<TextSearchItem>
             {
-                PageIndex = result.PageIndex,
-                TextRect = result.TextRect,
-                TextContent = result.TextContent,
-                PageRotate = result.PageRotate,
+                new TextSearchItem()
+                {
+                    PageIndex = result.PageIndex,
+                    TextRect = result.TextRect,
+                    TextContent = result.TextContent,
+                    PageRotate = result.PageRotate,
 
-            });
+                }
+            };
             pdfView.SetPageSelectText(selectList, highLightBrush);
         }
 

+ 5 - 12
Demo/Examples/Compdfkit_Tools/PDFView/RegularViewerControl.xaml.cs

@@ -1,17 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
+using System; 
+using System.ComponentModel; 
+using System.Runtime.CompilerServices; 
 using System.Windows;
 using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Media.Imaging;
-using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI;
-using Compdfkit_Tools.Common;
+using System.Windows.Input; 
+using Compdfkit_Tools.Annotation.PDFAnnotationPanel.PDFAnnotationUI; 
 using Compdfkit_Tools.Helper;
 using Compdfkit_Tools.PDFControl;
 using ComPDFKit.DigitalSign;

+ 5 - 4
Demo/Examples/Compdfkit_Tools/Strings/Bota.Designer.cs

@@ -1,13 +1,14 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace Compdfkit_Tools.Strings.Common {
+namespace Compdfkit_Tools.Strings {
     using System;
     
     
@@ -18,7 +19,7 @@ namespace Compdfkit_Tools.Strings.Common {
     // class via a tool like ResGen or Visual Studio.
     // To add or remove a member, edit your .ResX file then rerun ResGen
     // with the /str option, or rebuild your VS project.
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     internal class Bota {
@@ -141,7 +142,7 @@ namespace Compdfkit_Tools.Strings.Common {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to Ignore Case.
+        ///   Looks up a localized string similar to Match Case.
         /// </summary>
         internal static string Chb_Case {
             get {
@@ -150,7 +151,7 @@ namespace Compdfkit_Tools.Strings.Common {
         }
         
         /// <summary>
-        ///   Looks up a localized string similar to Whole Words only.
+        ///   Looks up a localized string similar to Match Whole Word.
         /// </summary>
         internal static string Chb_Match {
             get {

+ 249 - 150
Demo/Examples/Compdfkit_Tools/Strings/Bota.resx

@@ -1,153 +1,252 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <root>
-    <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-        <xsd:element name="root" msdata:IsDataSet="true">
-            
-        </xsd:element>
-    </xsd:schema>
-    <resheader name="resmimetype">
-        <value>text/microsoft-resx</value>
-    </resheader>
-    <resheader name="version">
-        <value>1.3</value>
-    </resheader>
-    <resheader name="reader">
-        <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-    </resheader>
-    <resheader name="writer">
-        <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-    </resheader>
-    <data name="Title_Thumb" xml:space="preserve">
-        <value>Thumbnails</value>
-    </data>
-    <data name="Title_Outlines" xml:space="preserve">
-        <value>Outlines</value>
-    </data>
-    <data name="Text_NoOutline" xml:space="preserve">
-        <value>No Outlines</value>
-    </data>
-    <data name="Title_Bookmarks" xml:space="preserve">
-        <value>Bookmarks</value>
-    </data>
-    <data name="Text_NoBookmarks" xml:space="preserve">
-        <value>No Bookmarks</value>
-    </data>
-    <data name="Tooltip_AddBookmarks" xml:space="preserve">
-        <value>Add Bookmarks</value>
-    </data>
-    <data name="Holder_BookmarkTitle" xml:space="preserve">
-        <value>Bookmark Title</value>
-    </data>
-    <data name="Button_Create" xml:space="preserve">
-        <value>Create</value>
-    </data>
-    <data name="Tooltip_Edit" xml:space="preserve">
-        <value>Edit</value>
-    </data>
-    <data name="Tooltip_Delete" xml:space="preserve">
-        <value>Delete</value>
-    </data>
-    <data name="Tooltip_Search" xml:space="preserve">
-        <value>Search</value>
-    </data>
-    <data name="Holder_Search" xml:space="preserve">
-        <value>Search</value>
-    </data>
-    <data name="Button_Done" xml:space="preserve">
-        <value>Done</value>
-    </data>
-    <data name="Text_NoResult" xml:space="preserve">
-        <value>No Results</value>
-    </data>
-    <data name="Text_Result" xml:space="preserve">
-        <value>Results: </value>
-    </data>
-    <data name="Title_Sig" xml:space="preserve">
-        <value>Signature List</value>
-    </data>
-    <data name="Menu_SigDetail" xml:space="preserve">
-        <value>Signature Details</value>
-    </data>
-    <data name="Menu_CertDetail" xml:space="preserve">
-        <value>Certification Details</value>
-    </data>
-    <data name="Warn_Warning" xml:space="preserve">
-        <value>Warning</value>
-    </data>
-    <data name="Text_SureDelete" xml:space="preserve">
-        <value>Are you sure to delete it?</value>
-    </data>
-    <data name="Button_OK" xml:space="preserve">
-        <value>OK</value>
-    </data>
-    <data name="Tooltip_Annot" xml:space="preserve">
-        <value>View Annotations</value>
-    </data>
-    <data name="Title_Annot" xml:space="preserve">
-        <value>Annotations</value>
-    </data>
-    <data name="Tooltip_Import" xml:space="preserve">
-        <value>Import Annotations</value>
-    </data>
-    <data name="Tooltip_Export" xml:space="preserve">
-        <value>Export Annotations</value>
-    </data>
-    <data name="Text_NoAnnotations" xml:space="preserve">
-        <value>No Annotations</value>
-    </data>
-    <data name="Text_Page" xml:space="preserve">
-        <value>Page</value>
-    </data>
-    <data name="Tooltip_Thumb" xml:space="preserve">
-        <value>View Thumbnails</value>
-    </data>
-    <data name="Menu_Delete" xml:space="preserve">
-        <value>Delete</value>
-    </data>
-    <data name="Menu_DeleteAll" xml:space="preserve">
-        <value>Delete All</value>
-    </data>
-    <data name="Tooltip_Outlines" xml:space="preserve">
-        <value>View Outlines</value>
-    </data>
-    <data name="Tooltip_Bookmarks" xml:space="preserve">
-        <value>View Bookmarks</value>
-    </data>
-    <data name="Tooltip_Sig" xml:space="preserve">
-        <value>View Signatures</value>
-    </data>
-    <data name="Button_Cancel" xml:space="preserve">
-        <value>Cancel</value>
-    </data>
-    <data name="Tip_Result" xml:space="preserve">
-        <value>result found</value>
-    </data>
-    <data name="Button_Replace" xml:space="preserve">
-        <value>Replace</value>
-    </data>
-    <data name="Holder_Find" xml:space="preserve">
-        <value>Find</value>
-    </data>
-    <data name="Holder_Replace" xml:space="preserve">
-        <value>Replace with</value>
-    </data>
-    <data name="Button_Prev" xml:space="preserve">
-        <value>Previous</value>
-    </data>
-    <data name="Button_Next" xml:space="preserve">
-        <value>Next</value>
-    </data>
-    <data name="Button_ReplaceAll" xml:space="preserve">
-        <value>Replace All</value>
-    </data>
-    <data name="Chb_Case" xml:space="preserve">
-        <value>Ignore Case</value>
-    </data>
-    <data name="Chb_Match" xml:space="preserve">
-        <value>Whole Words only</value>
-    </data>
-    <data name="Button_Search" xml:space="preserve">
-        <value>Search</value>
-    </data>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <data name="Title_Thumb" xml:space="preserve">
+    <value>Thumbnails</value>
+  </data>
+  <data name="Title_Outlines" xml:space="preserve">
+    <value>Outlines</value>
+  </data>
+  <data name="Text_NoOutline" xml:space="preserve">
+    <value>No Outlines</value>
+  </data>
+  <data name="Title_Bookmarks" xml:space="preserve">
+    <value>Bookmarks</value>
+  </data>
+  <data name="Text_NoBookmarks" xml:space="preserve">
+    <value>No Bookmarks</value>
+  </data>
+  <data name="Tooltip_AddBookmarks" xml:space="preserve">
+    <value>Add Bookmarks</value>
+  </data>
+  <data name="Holder_BookmarkTitle" xml:space="preserve">
+    <value>Bookmark Title</value>
+  </data>
+  <data name="Button_Create" xml:space="preserve">
+    <value>Create</value>
+  </data>
+  <data name="Tooltip_Edit" xml:space="preserve">
+    <value>Edit</value>
+  </data>
+  <data name="Tooltip_Delete" xml:space="preserve">
+    <value>Delete</value>
+  </data>
+  <data name="Tooltip_Search" xml:space="preserve">
+    <value>Search</value>
+  </data>
+  <data name="Holder_Search" xml:space="preserve">
+    <value>Search</value>
+  </data>
+  <data name="Button_Done" xml:space="preserve">
+    <value>Done</value>
+  </data>
+  <data name="Text_NoResult" xml:space="preserve">
+    <value>No Results</value>
+  </data>
+  <data name="Text_Result" xml:space="preserve">
+    <value>Results: </value>
+  </data>
+  <data name="Title_Sig" xml:space="preserve">
+    <value>Signature List</value>
+  </data>
+  <data name="Menu_SigDetail" xml:space="preserve">
+    <value>Signature Details</value>
+  </data>
+  <data name="Menu_CertDetail" xml:space="preserve">
+    <value>Certification Details</value>
+  </data>
+  <data name="Warn_Warning" xml:space="preserve">
+    <value>Warning</value>
+  </data>
+  <data name="Text_SureDelete" xml:space="preserve">
+    <value>Are you sure to delete it?</value>
+  </data>
+  <data name="Button_OK" xml:space="preserve">
+    <value>OK</value>
+  </data>
+  <data name="Tooltip_Annot" xml:space="preserve">
+    <value>View Annotations</value>
+  </data>
+  <data name="Title_Annot" xml:space="preserve">
+    <value>Annotations</value>
+  </data>
+  <data name="Tooltip_Import" xml:space="preserve">
+    <value>Import Annotations</value>
+  </data>
+  <data name="Tooltip_Export" xml:space="preserve">
+    <value>Export Annotations</value>
+  </data>
+  <data name="Text_NoAnnotations" xml:space="preserve">
+    <value>No Annotations</value>
+  </data>
+  <data name="Text_Page" xml:space="preserve">
+    <value>Page</value>
+  </data>
+  <data name="Tooltip_Thumb" xml:space="preserve">
+    <value>View Thumbnails</value>
+  </data>
+  <data name="Menu_Delete" xml:space="preserve">
+    <value>Delete</value>
+  </data>
+  <data name="Menu_DeleteAll" xml:space="preserve">
+    <value>Delete All</value>
+  </data>
+  <data name="Tooltip_Outlines" xml:space="preserve">
+    <value>View Outlines</value>
+  </data>
+  <data name="Tooltip_Bookmarks" xml:space="preserve">
+    <value>View Bookmarks</value>
+  </data>
+  <data name="Tooltip_Sig" xml:space="preserve">
+    <value>View Signatures</value>
+  </data>
+  <data name="Button_Cancel" xml:space="preserve">
+    <value>Cancel</value>
+  </data>
+  <data name="Tip_Result" xml:space="preserve">
+    <value>result found</value>
+  </data>
+  <data name="Button_Replace" xml:space="preserve">
+    <value>Replace</value>
+  </data>
+  <data name="Holder_Find" xml:space="preserve">
+    <value>Find</value>
+  </data>
+  <data name="Holder_Replace" xml:space="preserve">
+    <value>Replace with</value>
+  </data>
+  <data name="Button_Prev" xml:space="preserve">
+    <value>Previous</value>
+  </data>
+  <data name="Button_Next" xml:space="preserve">
+    <value>Next</value>
+  </data>
+  <data name="Button_ReplaceAll" xml:space="preserve">
+    <value>Replace All</value>
+  </data>
+  <data name="Chb_Case" xml:space="preserve">
+    <value>Match Case</value>
+  </data>
+  <data name="Chb_Match" xml:space="preserve">
+    <value>Match Whole Word</value>
+  </data>
+  <data name="Button_Search" xml:space="preserve">
+    <value>Search</value>
+  </data>
 </root>

+ 1 - 1
Demo/Examples/PDFViewer/MainWindow.xaml

@@ -283,7 +283,7 @@
                 <dragablz:TabablzControl.HeaderPrefixContent>
                     <Grid Margin="10,0,0,0">
                         <StackPanel Orientation="Horizontal">
-                            <cpdfcommon:HomePageButton Style="{StaticResource HomePageButtonStyle}" x:Name="HomePageButton" Width="170" IsToggled="False" Toggled="HomePageButton_Toggled" QueryLock="HomePageButton_QueryLock">
+                            <cpdfcommon:HomePageButton Style="{StaticResource HomePageButtonStyle}" x:Name="HomePageButton" Width="170" IsToggled="False" Toggled="HomePageButton_Toggled" QueryLock="HomePageButton_QueryLock"> 
                                 <Grid>
                                     <StackPanel Orientation="Horizontal">
                                         <Viewbox Width="20" Height="20" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

BIN
Demo/Examples/TestFile/ComPDFKit_Sample_File_Windows.pdf