Leaked source code of windows server 2003
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.

194 lines
4.9 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1998 - 1999
  4. Module Name:
  5. IASMultivaluedEditorPage.h
  6. Abstract:
  7. Declaration of the CMultivaluedEditorPage class.
  8. This class wraps a dialog which allows a user to edit the constituent
  9. items of a multivalued attribute.
  10. Declaration (and inline implementation) of the CMyOleSafeArrayLock helper class.
  11. This class locks an OleSafeArray for element access until it goes out of scope.
  12. Declaration of the SetUpAttributeEditor utility function.
  13. CoCreate's the appropriate attribute editor based on ProgID.
  14. See IASMultivaluedEditorPage.cpp for implementation.
  15. Revision History:
  16. mmaguire 06/25/98 - created
  17. --*/
  18. //////////////////////////////////////////////////////////////////////////////
  19. #if !defined(_MULTIVALUED_ATTRIBUTE_EDITOR_PAGE_H_)
  20. #define _MULTIVALUED_ATTRIBUTE_EDITOR_PAGE_H_
  21. //////////////////////////////////////////////////////////////////////////////
  22. // BEGIN INCLUDES
  23. //
  24. // where we can find what this class derives from:
  25. //
  26. //
  27. // where we can find what this class has or uses:
  28. //
  29. //
  30. // END INCLUDES
  31. //////////////////////////////////////////////////////////////////////////////
  32. #if _MSC_VER >= 1000
  33. #pragma once
  34. #endif // _MSC_VER >= 1000
  35. #include "dlgcshlp.h"
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CMultivaluedEditorPage dialog
  38. class CMultivaluedEditorPage : public CHelpDialog
  39. {
  40. DECLARE_DYNCREATE(CMultivaluedEditorPage)
  41. public:
  42. CMultivaluedEditorPage();
  43. ~CMultivaluedEditorPage();
  44. // Call this to pass this page an interface pointer to the "AttributeInfo"
  45. // which describes the attribute we are editing, and a pointer
  46. // to the variant containing the SafeArray of variant values.
  47. HRESULT SetData( IIASAttributeInfo *pIASAttributeInfo, VARIANT * pvarVariant );
  48. // Call this when you want the page to save its values to the
  49. // variant whose pointer you passed in SetData.
  50. HRESULT CommitArrayToVariant();
  51. // Set the m_strAttrXXXX members below before creating the page.
  52. // Dialog Data
  53. //{{AFX_DATA(CMultivaluedEditorPage)
  54. enum { IDD = IDD_IAS_MULTIVALUED_EDITOR };
  55. CListCtrl m_listMultiValues;
  56. ::CString m_strAttrFormat;
  57. ::CString m_strAttrName;
  58. ::CString m_strAttrType;
  59. //}}AFX_DATA
  60. // Overrides
  61. // ClassWizard generate virtual function overrides
  62. //{{AFX_VIRTUAL(CMultivaluedEditorPage)
  63. protected:
  64. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  65. //}}AFX_VIRTUAL
  66. // Implementation
  67. protected:
  68. // Generated message map functions
  69. //{{AFX_MSG(CMultivaluedEditorPage)
  70. virtual BOOL OnInitDialog();
  71. afx_msg void OnDblclkListIasMultiAttrs(NMHDR* pNMHDR, LRESULT* pResult);
  72. afx_msg void OnItemChangedListIasMultiAttrs(NMHDR* pNMHDR, LRESULT* pResult);
  73. afx_msg void OnButtonMoveUp();
  74. afx_msg void OnButtonMoveDown();
  75. afx_msg void OnButtonAddValue();
  76. afx_msg void OnButtonRemove();
  77. afx_msg void OnButtonEdit();
  78. // afx_msg void OnContextMenu(CWnd* pWnd, ::CPoint point);
  79. // afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  80. //}}AFX_MSG
  81. DECLARE_MESSAGE_MAP()
  82. // We use the standard MFC wrapper for SafeArrays.
  83. // Note: This class throws exceptions!!!! Use try{}catch{} blocks.
  84. COleSafeArray m_osaValueList;
  85. STDMETHOD(UpdateAttrListCtrl)();
  86. STDMETHOD(UpdateProfAttrListItem)(int nItem);
  87. STDMETHOD(EditItemInList)( long lIndex );
  88. // The "AttributeInfo" which contains info about the attribute we are editing.
  89. // Call SetData to set this.
  90. CComPtr<IIASAttributeInfo> m_spIASAttributeInfo;
  91. // A pointer to the variant we are editing. Call SetData to set this.
  92. VARIANT * m_pvarData;
  93. // Flag whether we value changed.
  94. // ISSUE: Is this used? Inherited from Baogang's code.
  95. BOOLEAN m_fIsDirty;
  96. };
  97. /////////////////////////////////////////////////////////////////////////////
  98. // CMyOleSafeArrayLock
  99. //
  100. // Small utility class for correct locking and unlocking of safe array.
  101. //
  102. class CMyOleSafeArrayLock
  103. {
  104. public:
  105. CMyOleSafeArrayLock( COleSafeArray & osa )
  106. {
  107. m_posa = & osa;
  108. m_posa->Lock();
  109. }
  110. ~CMyOleSafeArrayLock()
  111. {
  112. m_posa->Unlock();
  113. }
  114. private:
  115. COleSafeArray * m_posa;
  116. };
  117. //////////////////////////////////////////////////////////////////////////////
  118. /*++
  119. SetUpAttributeEditor
  120. Utility function which, given a schema attribute, CoCreates the correct
  121. editor and sets it up for use with the given schema attribute.
  122. --*/
  123. //////////////////////////////////////////////////////////////////////////////
  124. STDMETHODIMP SetUpAttributeEditor( /* in */ IIASAttributeInfo *pAttributeInfo
  125. , /* out */ IIASAttributeEditor ** ppIIASAttributeEditor
  126. );
  127. //{{AFX_INSERT_LOCATION}}
  128. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  129. #endif // _MULTIVALUED_ATTRIBUTE_EDITOR_PAGE_H_