|
@@ -11,6 +11,9 @@ using System.Runtime.CompilerServices;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Controls.Primitives;
|
|
|
+using Compdfkit_Tools.PDFControlUI;
|
|
|
+using ComPDFKit.PDFPage;
|
|
|
+using ComPDFKit.Tool;
|
|
|
|
|
|
namespace ContentEditorViewControl
|
|
|
{
|
|
@@ -90,19 +93,15 @@ namespace ContentEditorViewControl
|
|
|
private void LoadDefaultDocument()
|
|
|
{
|
|
|
string defaultFilePath = "ComPDFKit_Sample_File_Windows.pdf";
|
|
|
- viewControl.PDFView.InitDocument(defaultFilePath);
|
|
|
+ viewControl.InitDocument(defaultFilePath);
|
|
|
LoadDocument();
|
|
|
}
|
|
|
|
|
|
private void LoadDocument()
|
|
|
{
|
|
|
- viewControl.PDFView.Load();
|
|
|
- viewControl.PDFView.SetShowLink(true);
|
|
|
-
|
|
|
- viewControl.PDFView.InfoChanged -= PdfViewer_InfoChanged;
|
|
|
- viewControl.PDFView.InfoChanged += PdfViewer_InfoChanged;
|
|
|
PDFGrid.Child = contentEditControl;
|
|
|
|
|
|
+ regularViewerControl.PdfViewControl = viewControl;
|
|
|
contentEditControl.PdfViewControl = viewControl;
|
|
|
contentEditControl.InitWithPDFViewer(viewControl);
|
|
|
InitialPDFViewControl();
|
|
@@ -112,7 +111,6 @@ namespace ContentEditorViewControl
|
|
|
contentEditControl.OnAnnotEditHandler -= PdfContentEditControlRefreshAnnotList;
|
|
|
contentEditControl.OnAnnotEditHandler += PdfContentEditControlRefreshAnnotList;
|
|
|
|
|
|
- contentEditControl.PdfViewControl.PDFView.SetFormFieldHighlight(true);
|
|
|
PasswordUI.Closed -= PasswordUI_Closed;
|
|
|
PasswordUI.Canceled -= PasswordUI_Canceled;
|
|
|
PasswordUI.Confirmed -= PasswordUI_Confirmed;
|
|
@@ -121,16 +119,16 @@ namespace ContentEditorViewControl
|
|
|
PasswordUI.Confirmed += PasswordUI_Confirmed;
|
|
|
|
|
|
ViewComboBox.SelectedIndex = 1;
|
|
|
- contentEditControl.PdfViewControl.PDFView.ChangeFitMode(FitMode.FitWidth);
|
|
|
- CPDFSaclingControl.InitWithPDFViewer(contentEditControl.PdfViewControl.PDFView);
|
|
|
- CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(contentEditControl.PdfViewControl.PDFView.ZoomFactor * 100)));
|
|
|
+ contentEditControl.PdfViewControl.GetCPDFViewer().SetFitMode(FitMode.FitWidth);
|
|
|
+ CPDFSaclingControl.InitWithPDFViewer(contentEditControl.PdfViewControl);
|
|
|
+ CPDFSaclingControl.SetZoomTextBoxText(string.Format("{0}", (int)(contentEditControl.PdfViewControl.GetCPDFViewer().GetZoom() * 100)));
|
|
|
|
|
|
ViewSettingBtn.IsChecked = false;
|
|
|
- botaBarControl.InitWithPDFViewer(contentEditControl.PdfViewControl.PDFView);
|
|
|
+ botaBarControl.InitWithPDFViewer(contentEditControl.PdfViewControl);
|
|
|
botaBarControl.AddBOTAContent(new[] { BOTATools.Thumbnail, BOTATools.Outline, BOTATools.Bookmark, BOTATools.Annotation, BOTATools.Search });
|
|
|
botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
|
|
|
contentEditControl.SetBOTAContainer(botaBarControl);
|
|
|
- displaySettingsControl.InitWithPDFViewer(contentEditControl.PdfViewControl.PDFView);
|
|
|
+ displaySettingsControl.InitWithPDFViewer(contentEditControl.PdfViewControl);
|
|
|
panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
|
}
|
|
@@ -140,9 +138,9 @@ namespace ContentEditorViewControl
|
|
|
string filePath = CommonHelper.GetExistedPathOrEmpty();
|
|
|
if (!string.IsNullOrEmpty(filePath) && contentEditControl.PdfViewControl != null)
|
|
|
{
|
|
|
- if (viewControl.PDFView != null && viewControl.PDFView.Document != null)
|
|
|
+ if (viewControl.PDFToolManager != null && viewControl.PDFToolManager.GetDocument() != null)
|
|
|
{
|
|
|
- string oldFilePath = viewControl.PDFView.Document.FilePath;
|
|
|
+ string oldFilePath = viewControl.PDFToolManager.GetDocument().FilePath;
|
|
|
if (oldFilePath.ToLower() == filePath.ToLower())
|
|
|
{
|
|
|
return;
|
|
@@ -150,14 +148,14 @@ namespace ContentEditorViewControl
|
|
|
}
|
|
|
|
|
|
passwordViewer = new PDFViewControl();
|
|
|
- passwordViewer.PDFView.InitDocument(filePath);
|
|
|
- if (passwordViewer.PDFView.Document == null)
|
|
|
+ passwordViewer.InitDocument(filePath);
|
|
|
+ if (passwordViewer.PDFToolManager.GetDocument() == null)
|
|
|
{
|
|
|
MessageBox.Show("Open File Failed");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (passwordViewer.PDFView.Document.IsLocked)
|
|
|
+ if (passwordViewer.PDFToolManager.GetDocument().IsLocked)
|
|
|
{
|
|
|
PasswordUI.SetShowText(System.IO.Path.GetFileName(filePath) + " " + LanguageHelper.CommonManager.GetString("Tip_Encrypted"));
|
|
|
PasswordUI.ClearPassword();
|
|
@@ -166,7 +164,7 @@ namespace ContentEditorViewControl
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- viewControl.PDFView.Document.Release();
|
|
|
+ viewControl.PDFToolManager.GetDocument().Release();
|
|
|
viewControl = passwordViewer;
|
|
|
LoadDocument();
|
|
|
}
|
|
@@ -183,8 +181,8 @@ namespace ContentEditorViewControl
|
|
|
{
|
|
|
CPDFViewer pdfViewer=passwordViewer.PDFViewTool.GetCPDFViewer();
|
|
|
|
|
|
- passwordViewer.PDFView.Document.UnlockWithPassword(e);
|
|
|
- if (passwordViewer.PDFView.Document.IsLocked == false)
|
|
|
+ passwordViewer.PDFToolManager.GetDocument().UnlockWithPassword(e);
|
|
|
+ if (passwordViewer.PDFToolManager.GetDocument().IsLocked == false)
|
|
|
{
|
|
|
PasswordUI.SetShowError("", Visibility.Collapsed);
|
|
|
PasswordUI.ClearPassword();
|
|
@@ -255,7 +253,7 @@ namespace ContentEditorViewControl
|
|
|
private void LeftToolPanelButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
panelState.IsLeftPanelExpand = (sender as ToggleButton).IsChecked == true;
|
|
|
- pdfViewer.PDFView.GoToPage(pageIndex: 1, new Point(100, 100));
|
|
|
+ contentEditControl.PdfViewControl.GetCPDFViewer().GoToPage(PageIndex: 1, new Point(100, 100));
|
|
|
}
|
|
|
|
|
|
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
@@ -269,7 +267,7 @@ namespace ContentEditorViewControl
|
|
|
|
|
|
if (currentMode == "Viewer")
|
|
|
{
|
|
|
- // regularViewerControl.ClearViewerControl();
|
|
|
+ regularViewerControl.ClearViewerControl();
|
|
|
}
|
|
|
else if (currentMode == "Content Edit")
|
|
|
{
|
|
@@ -277,34 +275,30 @@ namespace ContentEditorViewControl
|
|
|
}
|
|
|
if ((string)item.Content == "Viewer")
|
|
|
{
|
|
|
- //if (regularViewerControl.PdfViewControl != null && regularViewerControl.PdfViewControl.PDFView != null)
|
|
|
- //{
|
|
|
- // PDFGrid.Child = regularViewerControl;
|
|
|
- // regularViewerControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
- // regularViewerControl.PdfViewControl = viewControl;
|
|
|
- // regularViewerControl.InitWithPDFViewer(viewControl.PDFView);
|
|
|
- // regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
|
- // regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
|
- //}
|
|
|
+ if (regularViewerControl.PdfViewControl != null && regularViewerControl.PdfViewControl.PDFViewTool != null)
|
|
|
+ {
|
|
|
+ PDFGrid.Child = regularViewerControl;
|
|
|
+ regularViewerControl.PdfViewControl.PDFViewTool.SetViewerModel(MouseModes.Viewer);
|
|
|
+ regularViewerControl.PdfViewControl = viewControl;
|
|
|
+ regularViewerControl.InitWithPDFViewer(viewControl);
|
|
|
+ regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
|
+ regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
|
+ }
|
|
|
}
|
|
|
else if ((string)item.Content == "Content Edit")
|
|
|
{
|
|
|
- //if (contentEditControl.PdfViewControl != null && contentEditControl.PdfViewControl.PDFView != null)
|
|
|
- //{
|
|
|
- // viewControl.PDFView?.SetPDFEditType(CPDFEditType.EditText | CPDFEditType.EditImage);
|
|
|
- // viewControl.PDFView?.SetPDFEditCreateType(CPDFEditType.None);
|
|
|
- // viewControl.PDFView?.SetMouseMode(MouseModes.PDFEdit);
|
|
|
- // viewControl.PDFView?.SetSplitMode(SplitMode.None);
|
|
|
-
|
|
|
- // PDFGrid.Child = contentEditControl;
|
|
|
- // contentEditControl.PdfViewControl.PDFView.SetMouseMode(MouseModes.PDFEdit);
|
|
|
- // contentEditControl.PdfViewControl = viewControl;
|
|
|
- // contentEditControl.InitWithPDFViewer(viewControl.PDFView);
|
|
|
- // contentEditControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
- // contentEditControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
- // contentEditControl.SetBOTAContainer(botaBarControl);
|
|
|
- // contentEditControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
|
- //}
|
|
|
+ contentEditControl.PdfViewControl = viewControl;
|
|
|
+ contentEditControl.InitWithPDFViewer(viewControl);
|
|
|
+ displaySettingsControl.SetVisibilityWhenContentEdit(Visibility.Collapsed);
|
|
|
+ if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl!= null)
|
|
|
+ {
|
|
|
+ PDFGrid.Child = contentEditControl;
|
|
|
+ viewControl.SetToolType(ComPDFKit.Tool.CPDFToolManager.ToolType.ContentEdit);
|
|
|
+ contentEditControl.OnCanSaveChanged -= ControlOnCanSaveChanged;
|
|
|
+ contentEditControl.OnCanSaveChanged += ControlOnCanSaveChanged;
|
|
|
+ contentEditControl.SetBOTAContainer(botaBarControl);
|
|
|
+ contentEditControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
|
+ }
|
|
|
}
|
|
|
currentMode = item.Content as string;
|
|
|
}
|