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.

200 lines
5.6 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // sdonode.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the classes SdoResultItem and SdoScopeItem.
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/10/2000 Original version.
  16. // 04/19/2000 SdoScopeItem::getSelf returns by value, not reference.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef SDONODE_H
  20. #define SDONODE_H
  21. #if _MSC_VER >= 1000
  22. #pragma once
  23. #endif
  24. class ProxyNode;
  25. class SdoScopeItem;
  26. ///////////////////////////////////////////////////////////////////////////////
  27. //
  28. // CLASS
  29. //
  30. // SdoResultItem
  31. //
  32. // DESCRIPTION
  33. //
  34. // Maps an SDO to MMC result pane data item
  35. //
  36. ///////////////////////////////////////////////////////////////////////////////
  37. class SdoResultItem : public SnapInDataItem
  38. {
  39. public:
  40. SdoResultItem(
  41. SdoScopeItem& owner,
  42. ISdo* sdo
  43. );
  44. UINT getImageIndex() const throw ()
  45. { return mapResourceId(IMAGE_INDEX); }
  46. Sdo& getSelf() throw ()
  47. { return self; }
  48. virtual HRESULT queryPagesFor() throw ();
  49. virtual HRESULT onDelete(
  50. SnapInView& view
  51. );
  52. virtual HRESULT onPropertyChange(
  53. SnapInView& view,
  54. BOOL scopeItem
  55. );
  56. virtual HRESULT onRename(
  57. SnapInView& view,
  58. LPCOLESTR newName
  59. );
  60. virtual HRESULT onSelect(
  61. SnapInView& view,
  62. BOOL scopeItem,
  63. BOOL selected
  64. );
  65. virtual HRESULT onViewChange(
  66. SnapInView& view,
  67. LPARAM data,
  68. LPARAM hint
  69. );
  70. protected:
  71. // Various resource IDs that the derived class must provide.
  72. enum ResourceId
  73. {
  74. IMAGE_INDEX,
  75. DELETE_TITLE,
  76. DELETE_LOCAL,
  77. DELETE_REMOTE,
  78. DELETE_LAST_LOCAL,
  79. DELETE_LAST_REMOTE,
  80. ERROR_CAPTION,
  81. ERROR_NOT_UNIQUE,
  82. ERROR_NAME_EMPTY
  83. };
  84. virtual UINT mapResourceId(ResourceId id) const throw () = 0;
  85. SdoScopeItem& parent; // Our scope pane node.
  86. Sdo self; // The SDO containing our properties.
  87. CComBSTR name; // Our name.
  88. };
  89. ///////////////////////////////////////////////////////////////////////////////
  90. //
  91. // CLASS
  92. //
  93. // SdoScopeItem
  94. //
  95. // DESCRIPTION
  96. //
  97. // Map an SDO collection to an MMC scope pane node.
  98. //
  99. ///////////////////////////////////////////////////////////////////////////////
  100. class SdoScopeItem : public SnapInPreNamedItem, public SdoConsumer
  101. {
  102. public:
  103. SdoScopeItem(
  104. SdoConnection& connection,
  105. int nameId,
  106. int errorTitleId,
  107. int topMenuItemId,
  108. int newMenuItemId,
  109. int menuItemStatusBarId
  110. );
  111. ~SdoScopeItem() throw ();
  112. // Returns the connection to the SDOs.
  113. SdoConnection& getCxn() throw ()
  114. { return cxn; }
  115. // Returns the number of result pane items.
  116. LONG getNumItems() const throw ()
  117. { return (LONG)items.size(); }
  118. HSCOPEITEM getScopeId() const throw ()
  119. { return scopeId; }
  120. void setScopeId(HSCOPEITEM newScopeId) throw ()
  121. { scopeId = newScopeId; }
  122. // Add a new result item to the node.
  123. void addResultItem(SnapInView& view, SdoResultItem& item);
  124. // Deletes an item from the result pane.
  125. void deleteResultItem(SnapInView& view, SdoResultItem& item);
  126. virtual HRESULT addMenuItems(
  127. SnapInView& view,
  128. LPCONTEXTMENUCALLBACK callback,
  129. long insertionAllowed
  130. );
  131. virtual HRESULT onRefresh(
  132. SnapInView& view
  133. );
  134. virtual HRESULT onSelect(
  135. SnapInView& view,
  136. BOOL scopeItem,
  137. BOOL selected
  138. );
  139. virtual HRESULT onShow(
  140. SnapInView& view,
  141. HSCOPEITEM itemId,
  142. BOOL selected
  143. );
  144. virtual HRESULT onViewChange(
  145. SnapInView& view,
  146. LPARAM data,
  147. LPARAM hint
  148. );
  149. protected:
  150. typedef ObjectVector<SdoResultItem> ResultItems;
  151. typedef ResultItems::iterator ResultIterator;
  152. // SdoConsumer.
  153. virtual bool queryRefresh(SnapInView& view);
  154. virtual void refreshComplete(SnapInView& view);
  155. // Insert the contents of 'items' into the result pane.
  156. void insertResultItems(SnapInView& view);
  157. // Return the collection corresponding to this node.
  158. virtual SdoCollection getSelf() = 0;
  159. // Populate dst with the SDOs from src.
  160. virtual void getResultItems(
  161. SdoEnum& src,
  162. ResultItems& dst
  163. ) = 0;
  164. // Set the result pane column headers.
  165. virtual void insertColumns(
  166. IHeaderCtrl2* headerCtrl
  167. ) = 0;
  168. SdoConnection& cxn; // Connection to the sdos.
  169. ResultItems items; // Our children.
  170. bool active; // 'true' if we're currently selected.
  171. bool loaded; // 'true' if we've loaded 'items'.
  172. private:
  173. int errorTitle; // Resource ID for error dialog titles.
  174. ResourceString topMenuItem; // Menu items.
  175. ResourceString newMenuItem;
  176. ResourceString menuItemStatusBar;
  177. HSCOPEITEM scopeId;
  178. };
  179. #endif // SDONODE_H