123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- using ComPDFKit.PDFDocument;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Text;
- using System.Threading.Tasks;
- namespace PDF_Master.Model.Dialog.ToolsDialogs.SaftyDialogs
- {
- public class SetPasswordDialogModel
- {
-
- public enum EnumNeedPassword
- {
- StatusNeedOpenPassword = 1 << 0,
- StatusNeedPermissionsPassword = 1 << 1
- }
- public enum EnumPermissionsMod
- {
- StatusUnknown = 0,
- StatusRestrictPrinting = 1 << 0,
- StatusRestrictCopying = 1 << 1
- }
- public static CPDFPermissionsInfo CreateDefaultPermissionsInfo()
- {
- CPDFPermissionsInfo permissionsInfo = new CPDFPermissionsInfo();
- permissionsInfo.AllowsDocumentAssembly = true;
- permissionsInfo.AllowsDocumentChanges = true;
- permissionsInfo.AllowsPrinting = true;
- permissionsInfo.AllowsCopying = true;
- permissionsInfo.AllowsCommenting = true;
- permissionsInfo.AllowsFormFieldEntry = true;
- permissionsInfo.AllowsHighQualityPrinting = true;
- permissionsInfo.AllowsFormFieldEntry = true;
- return permissionsInfo;
- }
- public static CPDFPermissionsInfo CreatePermissionsInfo(EnumPermissionsMod enumPermissionsMod)
- {
- CPDFPermissionsInfo permissionsInfo = CreateDefaultPermissionsInfo();
- if ((enumPermissionsMod & EnumPermissionsMod.StatusRestrictPrinting) > 0)
- {
- permissionsInfo.AllowsPrinting = false;
- permissionsInfo.AllowsHighQualityPrinting = false;
- }
- if ((enumPermissionsMod & EnumPermissionsMod.StatusRestrictCopying) > 0)
- {
- permissionsInfo.AllowsCopying = false;
- }
- return permissionsInfo;
- }
- ///<returns>
- ///生成带有指定权限的CPDFPermissionsInfo对象
- ///</returns>
- }
- public class SecurityInfo
- {
- public bool IsPasswordChanged = false;
- public bool IsPasswordRemoved = false;
- public bool NeedOpenPassword = false;
- public bool NeedPermissionsPassword = false;
- public string OpenPassword = string.Empty;
- public string PermissionsPassword = string.Empty;
- public CPDFPermissionsInfo CPDFPermissionsInfo = SetPasswordDialogModel.CreateDefaultPermissionsInfo();
- }
- public class PasswordInfo {
- public string OpenPassword = string.Empty;
- public string PermissionsPassword = string.Empty;
- public static PasswordInfo CreateDefaultPasswordInfo()
- {
- PasswordInfo passwordInfo = new PasswordInfo();
- passwordInfo.OpenPassword= string.Empty;
- passwordInfo.PermissionsPassword= string.Empty;
- return passwordInfo;
- }
- }
- }
|