123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 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_Office.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 = null;
- public string PermissionsPassword = null;
- public CPDFPermissionsInfo CPDFPermissionsInfo = SetPasswordDialogModel.CreateDefaultPermissionsInfo();
- }
- }
|