|
@@ -90,13 +90,6 @@ namespace edit_ctrl_demo
|
|
|
{
|
|
|
LoadDefaultDocument();
|
|
|
BindZoomLevel();
|
|
|
-
|
|
|
- if(pdfViewControl!=null)
|
|
|
- {
|
|
|
- pdfViewControl.PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
|
|
|
- pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
- pdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private void BindZoomLevel()
|
|
@@ -119,6 +112,13 @@ namespace edit_ctrl_demo
|
|
|
PasswordUI.Canceled += PasswordUI_Canceled;
|
|
|
PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
|
|
|
+ pdfViewControl.PDFView.PDFEditActiveHandler -= PDFView_PDFEditActiveHandler;
|
|
|
+ pdfViewControl.PDFView.PDFEditActiveHandler += PDFView_PDFEditActiveHandler;
|
|
|
+ pdfViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
+ pdfViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
+ pdfViewControl.PDFView.PDFEditCommandHandler -= PDFView_PDFEditCommandHandler;
|
|
|
+ pdfViewControl.PDFView.PDFEditCommandHandler += PDFView_PDFEditCommandHandler;
|
|
|
+
|
|
|
UIElement currentBotaTool = GetBotaTool();
|
|
|
if (currentBotaTool is CPDFSearchControl)
|
|
|
{
|
|
@@ -138,6 +138,9 @@ namespace edit_ctrl_demo
|
|
|
((CPDFBookmarkControl)currentBotaTool).LoadBookmark();
|
|
|
}
|
|
|
|
|
|
+ ViewSettingBtn.IsChecked = false;
|
|
|
+ PropertyContainer.Child = null;
|
|
|
+ PropertyContainer.Visibility = Visibility.Collapsed;
|
|
|
ZoomTextBox.Text = string.Format("{0}", (int)(pdfViewControl.PDFView.ZoomFactor * 100)) + "%";
|
|
|
|
|
|
SetEditMode();
|
|
@@ -481,16 +484,6 @@ namespace edit_ctrl_demo
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void Border_MouseEnter(object sender, MouseEventArgs e)
|
|
|
- {
|
|
|
- FloatPageTool.Visibility = Visibility.Visible;
|
|
|
- }
|
|
|
-
|
|
|
- private void PDFGrid_MouseMove(object sender, MouseEventArgs e)
|
|
|
- {
|
|
|
- FloatPageTool.Visibility = Visibility.Collapsed;
|
|
|
- }
|
|
|
-
|
|
|
private void ViewSettingBtn_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
ToggleButton toggleButton = sender as ToggleButton;
|
|
@@ -575,6 +568,15 @@ namespace edit_ctrl_demo
|
|
|
string filePath = CommonHelper.GetFilePathOrEmpty();
|
|
|
if (!string.IsNullOrEmpty(filePath) && pdfViewControl != null)
|
|
|
{
|
|
|
+ if(pdfViewControl.PDFView!=null && pdfViewControl.PDFView.Document!=null)
|
|
|
+ {
|
|
|
+ string oldFilePath=pdfViewControl.PDFView.Document.FilePath;
|
|
|
+ if (oldFilePath.ToLower() == filePath.ToLower())
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
passwordViewer = new PDFViewControl();
|
|
|
passwordViewer.PDFView.InitDocument(filePath);
|
|
|
if (passwordViewer.PDFView.Document == null)
|
|
@@ -732,12 +734,12 @@ namespace edit_ctrl_demo
|
|
|
editCommand.PopupMenu = new ContextMenu();
|
|
|
if (lastPDFEditEvent != null)
|
|
|
{
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "复制", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "剪切", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "删除", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "粘贴", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
MenuItem propertyMenu = new MenuItem();
|
|
|
- propertyMenu.Header = "属性";
|
|
|
+ propertyMenu.Header = "Property";
|
|
|
propertyMenu.Click += (o, p) =>
|
|
|
{
|
|
|
if (lastPDFEditEvent != null && lastPDFEditEvent.EditType == CPDFEditType.EditText)
|
|
@@ -745,16 +747,17 @@ namespace edit_ctrl_demo
|
|
|
PDFTextEditControl textEditControl = new PDFTextEditControl();
|
|
|
textEditControl.SetPDFTextEditData(lastPDFEditEvent);
|
|
|
PropertyContainer.Child = textEditControl;
|
|
|
+ PropertyContainer.Visibility = Visibility.Visible;
|
|
|
}
|
|
|
};
|
|
|
editCommand.PopupMenu.Items.Add(propertyMenu);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "粘贴", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
if(editCommand.TextAreaCopied)
|
|
|
{
|
|
|
- editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "粘贴样式", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
|
|
|
+ editCommand.PopupMenu.Items.Add(new MenuItem() { Header = "Paste And Match Style", Command = CustomCommands.PasteMatchStyle, CommandTarget = (UIElement)sender });
|
|
|
}
|
|
|
}
|
|
|
}
|