summaryrefslogtreecommitdiff
path: root/NSCmpts/EncryptAdvancedProp.h
blob: 864407c7e656105ce2b0429bce103ca15f01a738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// EncryptAdvancedProp.h : Declaration of the CEncryptAdvancedProp

#ifndef __ENCRYPTADVANCEDPROP_H_
#define __ENCRYPTADVANCEDPROP_H_

#include "resource.h"       // main symbols

#include "../common/CmptData.h"
#include <contexthelp.h>

#include "IgnoreProp.h"

EXTERN_C const CLSID CLSID_EncryptAdvancedProp;

/////////////////////////////////////////////////////////////////////////////
// CEncryptAdvancedProp
class ATL_NO_VTABLE CEncryptAdvancedProp :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CEncryptAdvancedProp, &CLSID_EncryptAdvancedProp>,
	public IPropertyPageImpl<CEncryptAdvancedProp>,
	public CDialogImplEx,

	// Some dialog functionality from
	public CIgnoreProp,
	public CContextHelp<CEncryptAdvancedProp>
{

// Construction
public:
	CEncryptAdvancedProp() : CIgnoreProp(m_Data), CDialogImplEx(IDD)
	{
		m_dwTitleID = IDS_TITLEEncryptAdvancedProp;
		m_dwHelpFileID = IDS_NSHELPFILE;
		m_dwDocStringID = IDS_DOCSTRINGEncryptAdvancedProp;
	}

	enum {IDD = IDD_ENCRYPTADVANCED};

DECLARE_REGISTRY_RESOURCEID(IDR_ENCRYPTADVANCEDPROP)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CEncryptAdvancedProp) 
	COM_INTERFACE_ENTRY(IPropertyPage)
END_COM_MAP()

BEGIN_MSG_MAP(CEncryptAdvancedProp)
	MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
	MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
	NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_ENDLABELEDIT, OnEndLabelEdit)
	NOTIFY_HANDLER(IDC_IGNORE_LIST, NM_SETFOCUS, OnListSetFocus)
	NOTIFY_HANDLER(IDC_IGNORE_LIST, LVN_KEYDOWN, OnKeyDown)
	COMMAND_ID_HANDLER(IDC_NEW, OnAdd)
	COMMAND_ID_HANDLER(IDC_DEL, OnRemove)
	CHAIN_MSG_MAP(IPropertyPageImpl<CEncryptAdvancedProp>)
	CHAIN_MSG_MAP(CContextHelp<CEncryptAdvancedProp>)
END_MSG_MAP()

BEGIN_HELP_MAP(NS_HELP_FILE)
	HELP_ID(IDC_DISABLEPASSWORD, 4009)
	HELP_ID(IDC_ENCRYPTREADONLY, 4011)
	HELP_ID(IDC_IGNORE_LIST, 4010)
	HELP_ID(IDC_NEW, 4018)
	HELP_ID(IDC_DEL, 4017)
END_HELP_MAP

// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

	LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	STDMETHOD(Apply)(void)
	{
		ATLTRACE(_T("CEncryptAdvancedProp::Apply\n"));

		// Let it choose an object for data
		if(!m_Data.IsInitialized())
			m_Data.Initialize(m_nObjects, m_ppUnk);

		if(!m_Data.IsInitialized())
			E_FAIL;

		UpdateData(true);

		m_Data.WriteStringSet(NS_IGNORE_REG_EXT, m_asExtensions);
		m_Data.WriteInt(NS_ENCRYPT_REG_DISABLE, m_bDisablePassword);
		m_Data.WriteInt(NS_ENCRYPT_REG_READONLY, m_bEncryptReadOnly);

		m_bDirty = FALSE;
		return S_OK;
	}

protected:
	CPropertyBag	m_Data;
	bool m_bDisablePassword;
	bool m_bEncryptReadOnly;

	void UpdateData(bool bSave = true);
};

#endif //__ENCRYPTADVANCEDPROP_H_