Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
6.8 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // DS Administration MMC snapin.
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1999
  7. //
  8. // File: queryui.h
  9. //
  10. //--------------------------------------------------------------------------
  11. #ifndef __QUERYUI_
  12. #define __QUERYUI_
  13. #include "query.h"
  14. #include "dsfilter.h"
  15. #include "helpids.h"
  16. #include "uiutil.h"
  17. #include <Cmnquery.h> // IQueryForm
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CQueryPageBase
  20. class CQueryPageBase : public CHelpDialog
  21. {
  22. // Construction
  23. public:
  24. CQueryPageBase(UINT nIDTemplate) : CHelpDialog(nIDTemplate) { };
  25. virtual void Init() PURE;
  26. virtual HRESULT GetQueryParams(LPDSQUERYPARAMS* ppDsQueryParams) PURE;
  27. virtual HRESULT BuildQueryParams(LPDSQUERYPARAMS* ppDsQueryParams, LPWSTR pQuery) PURE;
  28. virtual HRESULT ClearForm() {Init(); return S_OK;}
  29. virtual HRESULT Enable(BOOL) { return S_OK; }
  30. virtual HRESULT Persist(IPersistQuery*, BOOL) { return S_OK; }
  31. DECLARE_MESSAGE_MAP()
  32. };
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CStdQueryPage
  35. class CStdQueryPage : public CQueryPageBase
  36. {
  37. // Construction
  38. public:
  39. CStdQueryPage(PCWSTR pszFilterPrefix) : CQueryPageBase(IDD_QUERY_STD_PAGE)
  40. {
  41. m_szFilterPrefix = pszFilterPrefix;
  42. }
  43. CStdQueryPage(UINT nDlgID, PCWSTR pszFilterPrefix) : CQueryPageBase(nDlgID)
  44. {
  45. m_szFilterPrefix = pszFilterPrefix;
  46. }
  47. virtual BOOL OnInitDialog();
  48. virtual void DoContextHelp(HWND hWndControl);
  49. afx_msg void OnNameComboChange();
  50. afx_msg void OnDescriptionComboChange();
  51. void SelectComboAssociatedWithData(UINT nCtrlID, LRESULT lData);
  52. virtual void Init();
  53. virtual HRESULT GetQueryParams(LPDSQUERYPARAMS* ppDsQueryParams);
  54. virtual HRESULT BuildQueryParams(LPDSQUERYPARAMS* ppDsQueryParams, LPWSTR pQuery);
  55. virtual HRESULT ClearForm() {Init(); return S_OK;}
  56. virtual HRESULT Enable(BOOL) { return S_OK; }
  57. virtual HRESULT Persist(IPersistQuery*, BOOL);
  58. DECLARE_MESSAGE_MAP()
  59. protected:
  60. CString m_szFilterPrefix;
  61. };
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CUserComputerQueryPage
  64. class CUserComputerQueryPage : public CStdQueryPage
  65. {
  66. // Construction
  67. public:
  68. //
  69. // Note: this page can be used for both users and computers
  70. //
  71. CUserComputerQueryPage(UINT nDialogID, PCWSTR pszFilterPrefix)
  72. : CStdQueryPage(nDialogID, pszFilterPrefix)
  73. {
  74. }
  75. virtual BOOL OnInitDialog();
  76. virtual void DoContextHelp(HWND hWndControl);
  77. virtual void Init();
  78. virtual HRESULT GetQueryParams(LPDSQUERYPARAMS* ppDsQueryParams);
  79. virtual HRESULT Persist(IPersistQuery* pPersistQuery, BOOL fRead);
  80. DECLARE_MESSAGE_MAP()
  81. };
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CUserQueryPage
  84. class CUserQueryPage : public CUserComputerQueryPage
  85. {
  86. // Construction
  87. public:
  88. //
  89. // Note: this page can be used for both users and computers
  90. //
  91. CUserQueryPage(PCWSTR pszFilterPrefix)
  92. : CUserComputerQueryPage(IDD_QUERY_USER_PAGE, pszFilterPrefix)
  93. {
  94. m_lLogonSelection = -1;
  95. }
  96. virtual BOOL OnInitDialog();
  97. virtual void DoContextHelp(HWND hWndControl);
  98. virtual void Init();
  99. virtual HRESULT GetQueryParams(LPDSQUERYPARAMS* ppDsQueryParams);
  100. virtual HRESULT Persist(IPersistQuery* pPersistQuery, BOOL fRead);
  101. DECLARE_MESSAGE_MAP()
  102. private:
  103. LRESULT m_lLogonSelection;
  104. };
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CQueryFormBase
  107. class ATL_NO_VTABLE CQueryFormBase :
  108. public CComObjectRootEx<CComSingleThreadModel>,
  109. public CComCoClass<CQueryFormBase, &CLSID_DSAdminQueryUIForm>,
  110. public IQueryForm
  111. {
  112. public:
  113. CQueryFormBase()
  114. {
  115. }
  116. DECLARE_REGISTRY_CLSID()
  117. //
  118. // IQueryForm methods
  119. //
  120. STDMETHOD(Initialize)(THIS_ HKEY hkForm);
  121. STDMETHOD(AddForms)(THIS_ LPCQADDFORMSPROC pAddFormsProc, LPARAM lParam);
  122. STDMETHOD(AddPages)(THIS_ LPCQADDPAGESPROC pAddPagesProc, LPARAM lParam);
  123. BEGIN_COM_MAP(CQueryFormBase)
  124. COM_INTERFACE_ENTRY(IQueryForm)
  125. END_COM_MAP()
  126. };
  127. //////////////////////////////////////////////////////////////////////////////
  128. // CQueryDialog
  129. class CQueryDialog : public CHelpDialog
  130. {
  131. public:
  132. CQueryDialog(CSavedQueryNode* pQueryNode,
  133. CFavoritesNode* pFavNode,
  134. CDSComponentData* pComponentData,
  135. BOOL bNewQuery = TRUE,
  136. BOOL bImportQuery = FALSE);
  137. ~CQueryDialog();
  138. virtual BOOL OnInitDialog();
  139. virtual void OnOK();
  140. virtual void DoContextHelp(HWND hWndControl);
  141. afx_msg void OnBrowse();
  142. afx_msg void OnEditQuery();
  143. afx_msg void OnMultiLevelChange();
  144. afx_msg void OnNameChange();
  145. afx_msg void OnDescriptionChange();
  146. afx_msg BOOL OnNeedToolTipText(UINT nCtrlID, NMHDR* pTTTStruct, LRESULT* pResult);
  147. void SetDirty(BOOL bDirty = TRUE);
  148. void SetQueryRoot(PCWSTR pszPath);
  149. CSavedQueryNode* GetQueryNode() { return m_pQueryNode; }
  150. CFavoritesNode* GetFavNode() { return m_pFavNode; }
  151. void SetQueryFilterDisplay();
  152. DECLARE_MESSAGE_MAP()
  153. private:
  154. CSavedQueryNode* m_pQueryNode;
  155. CFavoritesNode* m_pFavNode;
  156. CDSComponentData* m_pComponentData;
  157. CString m_szName;
  158. CString m_szOriginalName;
  159. CString m_szDescription;
  160. CString m_szQueryRoot;
  161. CString m_szQueryFilter;
  162. BOOL m_bMultiLevel;
  163. BOOL m_bNewQuery;
  164. BOOL m_bImportQuery;
  165. BOOL m_bInit;
  166. BOOL m_bDirty;
  167. BOOL m_bLastLogonFilter;
  168. DWORD m_dwLastLogonData;
  169. //
  170. // for presisting DSQuery dialog info
  171. //
  172. CComObject<CDSAdminPersistQueryFilterImpl>* m_pPersistQueryImpl;
  173. };
  174. /////////////////////////////////////////////////////////////////////////////////
  175. // CFavoritesNodePropertyPage
  176. class CFavoritesNodePropertyPage : public CHelpPropertyPage
  177. {
  178. public:
  179. CFavoritesNodePropertyPage(CFavoritesNode* pFavNode,
  180. LONG_PTR lNotifyHandle,
  181. CDSComponentData* pComponentData,
  182. LPDATAOBJECT pDataObject)
  183. : m_pFavNode(pFavNode),
  184. m_lNotifyHandle(lNotifyHandle),
  185. m_pComponentData(pComponentData),
  186. m_pDataObject(pDataObject),
  187. CHelpPropertyPage(IDD_FAVORITES_PROPERTY_PAGE)
  188. {
  189. }
  190. ~CFavoritesNodePropertyPage()
  191. {
  192. if (m_lNotifyHandle != NULL)
  193. {
  194. MMCFreeNotifyHandle(m_lNotifyHandle);
  195. m_lNotifyHandle = NULL;
  196. }
  197. }
  198. DECLARE_MESSAGE_MAP()
  199. protected:
  200. virtual void DoContextHelp(HWND hWndControl);
  201. virtual BOOL OnInitDialog();
  202. virtual BOOL OnApply();
  203. afx_msg void OnDescriptionChange();
  204. private:
  205. CFavoritesNode* m_pFavNode;
  206. CDSComponentData* m_pComponentData;
  207. LONG_PTR m_lNotifyHandle;
  208. CString m_szOldDescription;
  209. LPDATAOBJECT m_pDataObject;
  210. };
  211. #endif // __QUERYUI_