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.

126 lines
4.7 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: copypast.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 7/21/1997 RaviR Created
  15. //____________________________________________________________________________
  16. //
  17. #ifndef COPYPAST_H__
  18. #define COPYPAST_H__
  19. /***************************************************************************\
  20. *
  21. * CLASS: CMMCClipBoardDataObject
  22. *
  23. * PURPOSE: Implements IMMCClipboardDataObject - interface to data object
  24. * added by MMC to the clipboard, or used in DragDrop operation.
  25. * Also implements several methods for creating and initializing
  26. * the object.
  27. *
  28. * USAGE: Used in Cut, Copy, Paste and DragDrop operations.
  29. * Static members are used to create the object, then it is passed to OLE
  30. * Accessed via interface from the target ( same process or the external one)
  31. *
  32. \***************************************************************************/
  33. class CMMCClipBoardDataObject :
  34. public IMMCClipboardDataObject,
  35. public CComObjectRoot
  36. {
  37. public:
  38. typedef std::vector<CNode *> CNodePtrArray;
  39. // destructor
  40. ~CMMCClipBoardDataObject();
  41. BEGIN_COM_MAP(CMMCClipBoardDataObject)
  42. COM_INTERFACE_ENTRY(IMMCClipboardDataObject)
  43. COM_INTERFACE_ENTRY(IDataObject)
  44. END_COM_MAP()
  45. // IMMCClipboardDataObject methods
  46. STDMETHOD(GetSourceProcessId)( DWORD *pdwProcID );
  47. STDMETHOD(GetAction) ( DATA_SOURCE_ACTION *peAction );
  48. STDMETHOD(GetCount) ( DWORD *pdwCount );
  49. STDMETHOD(GetDataObject) ( DWORD dwIndex, IDataObject **ppObject, DWORD *pdwFlags );
  50. STDMETHOD(RemoveCutItems) ( DWORD dwIndex, IDataObject *pCutDataObject );
  51. // IDataObject methods
  52. STDMETHOD(GetDataHere)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium);
  53. STDMETHOD(GetData)(LPFORMATETC lpFormatetcIn, LPSTGMEDIUM lpMedium);
  54. STDMETHOD(EnumFormatEtc)(DWORD dwDirection, LPENUMFORMATETC* ppEnumFormatEtc);
  55. STDMETHOD(QueryGetData)(LPFORMATETC lpFormatetc);
  56. // Not Implemented IDataObject methods
  57. STDMETHOD(GetCanonicalFormatEtc)(LPFORMATETC lpFormatetcIn, LPFORMATETC lpFormatetcOut) { return E_NOTIMPL; };
  58. STDMETHOD(SetData)(LPFORMATETC lpFormatetc, LPSTGMEDIUM lpMedium, BOOL bRelease) { return E_NOTIMPL; };
  59. STDMETHOD(DAdvise)(LPFORMATETC lpFormatetc, DWORD advf,LPADVISESINK pAdvSink, LPDWORD pdwConnection) { return E_NOTIMPL; };
  60. STDMETHOD(DUnadvise)(DWORD dwConnection) { return E_NOTIMPL; };
  61. STDMETHOD(EnumDAdvise)(LPENUMSTATDATA* ppEnumAdvise) { return E_NOTIMPL; }
  62. public:
  63. // method to add data objects
  64. SC ScAddSnapinDataObject( const CNodePtrArray& nodes, IComponent *pComponent, IDataObject *pDataObject,
  65. bool bCopyEnabled, bool bCutEnabled );
  66. static SC ScCreate( DATA_SOURCE_ACTION operation,
  67. CNode* pNode, bool bScope,
  68. bool bMultiSelect, LPARAM lvData,
  69. IMMCClipboardDataObject **ppMMCDataObject ,
  70. bool& bContainsItems);
  71. // to remove going away snapins
  72. SC ScInvalidate( void );
  73. private: // implementation helpers
  74. // returns DO of snapin if the object contains only one snapin
  75. SC ScGetSingleSnapinObject( IDataObject **ppDataObject );
  76. // method to create the instance
  77. static SC ScCreateInstance(DATA_SOURCE_ACTION operation,
  78. CMMCClipBoardDataObject **ppRawObject,
  79. IMMCClipboardDataObject **ppInterface);
  80. // helper to get node's verb state
  81. static SC ScGetNodeCopyAndCutVerbs( CNode* pNode, IDataObject *pDataObject,
  82. bool bScopePane, LPARAM lvData,
  83. bool *pbCopyEnabled, bool *pbCutEnabled );
  84. // method to add data objects for one item
  85. SC ScAddDataObjectForItem( CNode* pNode, bool bScopePane, LPARAM lvData,
  86. IComponent *pComponent, IDataObject *pDataObject,
  87. bool& bDataObjectAdded );
  88. CLIPFORMAT GetWrapperCF();
  89. private: // data
  90. DATA_SOURCE_ACTION m_eOperation;
  91. struct ObjectEntry
  92. {
  93. IDataObjectPtr spDataObject; // data
  94. IComponentPtr spComponent; // for Notification
  95. DWORD dwSnapinOptions; // copy/cut allowed
  96. };
  97. std::vector<ObjectEntry> m_SelectionObjects;
  98. bool m_bObjectValid; // valid to access any icluded data objects
  99. };
  100. #endif // COPYPAST_H__