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.

189 lines
6.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: DSObj.h
  7. //
  8. // Contents: Main DS Snapin file
  9. //
  10. // History: 02-Oct-96 WayneSc Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __DSEVENT_H__
  14. #define __DSEVENT_H__
  15. class CDSCookie;
  16. class CDSEvent;
  17. class CInternalFormatCracker;
  18. #define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))
  19. #define dsNewUser 1100
  20. #define dsNewGroup 1101
  21. #define dsNewOU 1102
  22. #define dsFind 1103
  23. #define dsFilter 1104
  24. #define dsAddMember 1105
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CDSEvent
  27. class CDSEvent :
  28. public IComponent,
  29. public IExtendContextMenu,
  30. public IExtendControlbar,
  31. public IExtendPropertySheet,
  32. public IResultDataCompareEx,
  33. //public IExtendTaskPad,
  34. public CComObjectRoot,
  35. public CComCoClass<CDSEvent,&CLSID_DSSnapin>
  36. {
  37. public:
  38. CDSEvent();
  39. ~CDSEvent(); // Operators
  40. public:
  41. BEGIN_COM_MAP(CDSEvent)
  42. COM_INTERFACE_ENTRY(IComponent)
  43. COM_INTERFACE_ENTRY(IExtendContextMenu)
  44. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  45. COM_INTERFACE_ENTRY(IExtendControlbar)
  46. COM_INTERFACE_ENTRY(IResultDataCompareEx)
  47. //COM_INTERFACE_ENTRY(IExtendTaskPad)
  48. END_COM_MAP()
  49. //DECLARE_NOT_AGGREGATABLE(CDSEvent)
  50. // Remove the comment from the line above if you don't want your object to
  51. // support aggregation. The default is to support it
  52. // INTERFACES
  53. public:
  54. // IComponent
  55. STDMETHOD(Initialize)(IConsole* pFrame);
  56. STDMETHOD(Notify)(IDataObject * pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  57. STDMETHOD(Destroy)(MMC_COOKIE cookie);
  58. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  59. STDMETHOD(GetResultViewType)(MMC_COOKIE cookie, LPWSTR* ppViewType, long *pViewOptions);
  60. STDMETHOD(GetDisplayInfo)(LPRESULTDATAITEM pResult);
  61. STDMETHOD(CompareObjects) (IDataObject * pDataObject, IDataObject * pDataObject2);
  62. // IExtendContextMenu
  63. STDMETHOD(AddMenuItems)(IDataObject* piDataObject,
  64. IContextMenuCallback* piCallback,
  65. long *pInsertionAllowed);
  66. STDMETHOD(Command)(LONG lCommandID,
  67. IDataObject* piDataObject );
  68. // IExtendControlbar
  69. STDMETHOD(SetControlbar) (LPCONTROLBAR pControlbar);
  70. STDMETHOD(ControlbarNotify) (MMC_NOTIFY_TYPE event,
  71. LPARAM arg,
  72. LPARAM param);
  73. STDMETHOD(ToolbarCreateObject) (CString csClass,
  74. LPDATAOBJECT lpDataObj);
  75. STDMETHOD(ToolbarFilter)();
  76. STDMETHOD (ToolbarFind)(LPDATAOBJECT lpDataObj);
  77. STDMETHOD (ToolbarAddMember) (LPDATAOBJECT lpDataObj);
  78. INT IsCreateAllowed(CString csClass,
  79. CDSCookie * pContainer);
  80. STDMETHOD(LoadToolbarStrings) (MMCBUTTON * Buttons);
  81. // IExtendPropertySheet
  82. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK pCall,
  83. LONG_PTR lNotifyHandle, LPDATAOBJECT pDataObject);
  84. STDMETHOD(QueryPagesFor)(LPDATAOBJECT pDataObject);
  85. // IResultDataCompareEx
  86. STDMETHOD(Compare)(RDCOMPARE* prdc, int* pnResult);
  87. // Helpers for CDSEvent
  88. void SetIComponentData(CDSComponentData * pData);
  89. void SetUpdateAllViewsOrigin(BOOL b) { m_bUpdateAllViewsOrigin = b; }
  90. HRESULT SelectResultNode(CUINode* pUINode);
  91. protected:
  92. // Initialisation routines for scope and result views
  93. HRESULT _SetColumns(CUINode* pUINode);
  94. HRESULT _InitView(CUINode* pUINode);
  95. // Enum routines for scope and result view
  96. HRESULT _ShowCookie(CUINode* pUINode, HSCOPEITEM hParent, MMC_NOTIFY_TYPE event);
  97. HRESULT _EnumerateCookie(CUINode* pUINode, HSCOPEITEM hParent, MMC_NOTIFY_TYPE event);
  98. // command helpers (called from Command())
  99. HRESULT _CommandShellExtension(long nCommandID, LPDATAOBJECT pDataObject);
  100. // other routines
  101. void HandleStandardVerbs(BOOL bScope, BOOL bSelect, CUINode* pUINode);
  102. void HandleViewChange(LPDATAOBJECT pDataObject,
  103. LPARAM arg,
  104. LPARAM Action);
  105. void _Delete(IDataObject* pDataObject, CInternalFormatCracker* pObjCracker);
  106. void _DeleteSingleSel(IDataObject* pDataObject, CUINode *pUINode);
  107. void _DeleteMultipleSel(IDataObject* pDataObject, CInternalFormatCracker* pObjCracker);
  108. void _DeleteNodeListFromUI(CUINodeList* pNodesDeletedList);
  109. // handlers for Cut/Copy/Paste operations
  110. HRESULT _QueryPaste(CUINode* pUINode, IDataObject* pPasteData);
  111. void _Paste(CUINode* pUINode, IDataObject* pPasteData, LPDATAOBJECT* ppCutDataObj);
  112. void _CutOrMove(IDataObject* pCutOrMoveData);
  113. void _PasteDoMove(CDSUINode* pUINode,
  114. CObjectNamesFormatCracker* pObjectNamesFormatPaste,
  115. CInternalFormatCracker* pInternalFC,
  116. LPDATAOBJECT* ppCutDataObj);
  117. void _PasteAddToGroup(CDSUINode* pUINode,
  118. CObjectNamesFormatCracker* pObjectNamesFormatPaste,
  119. LPDATAOBJECT* ppCutDataObj);
  120. // Utility routines
  121. HRESULT _AddResultItem(CUINode* pUINode, BOOL bSetSelected = FALSE);
  122. HRESULT _DisplayCachedNodes(CUINode* pUINode);
  123. void _UpdateObjectCount(BOOL fZero /* set the count to 0 */);
  124. //Attributes
  125. protected:
  126. IConsole3* m_pFrame;
  127. IHeaderCtrl* m_pHeader;
  128. IResultData2* m_pResultData;
  129. IConsoleNameSpace* m_pScopeData;
  130. IImageList* m_pRsltImageList;
  131. CDSComponentData* m_pComponentData; // CODEWORK use smartpointer
  132. HWND m_hwnd; // hwnd of main console window
  133. IConsoleVerb * m_pConsoleVerb;
  134. IToolbar * m_pToolbar;
  135. IControlbar * m_pControlbar;
  136. CLIPFORMAT m_cfNodeType;
  137. CLIPFORMAT m_cfNodeTypeString;
  138. CLIPFORMAT m_cfDisplayName;
  139. CUINode* m_pSelectedFolderNode;
  140. BOOL m_UseSelectionParent;
  141. BOOL m_bUpdateAllViewsOrigin;
  142. };
  143. inline void CDSEvent::SetIComponentData(CDSComponentData * pData)
  144. {
  145. if (NULL != m_pComponentData)
  146. ((IComponentData*)m_pComponentData)->Release();
  147. m_pComponentData = pData;
  148. if (NULL != m_pComponentData)
  149. ((IComponentData*)m_pComponentData)->AddRef();
  150. }
  151. // String comparison with respect to locale
  152. int LocaleStrCmp(LPCTSTR ptsz1, LPCTSTR ptsz2);
  153. #endif //__DSEVENT_H__