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.

174 lines
7.0 KiB

  1. // adcctl.h : Declaration of the CADCCtl
  2. #ifndef __ADCCTL_H_
  3. #define __ADCCTL_H_
  4. #include "resource.h" // main symbols
  5. #include "event.h" // for CEventBroker
  6. #include "iface.h" // for IARPSimpleProvider
  7. #include <shdispid.h> // DISPID_ constants
  8. #define NUM_ARP_SIMPLE_PROVIDERS 4
  9. //------------------------------------------------------------------------
  10. //
  11. // Class: CADCCtl
  12. //
  13. // Synopsis: This is the AppDataControl COM object.
  14. // It creates a CADCArr object to manage the control's data.
  15. //
  16. //------------------------------------------------------------------------
  17. // CADCCtl
  18. class ATL_NO_VTABLE CADCCtl :
  19. public CComObjectRootEx<CComSingleThreadModel>,
  20. public CComCoClass<CADCCtl, &CLSID_ADCCtl>,
  21. public CComControl<CADCCtl>,
  22. public CStockPropImpl<CADCCtl, IADCCtl, &IID_IADCCtl, &LIBID_SHAPPMGRPLib>,
  23. public IProvideClassInfo2Impl<&CLSID_ADCCtl, NULL, &LIBID_SHAPPMGRPLib>,
  24. public IPersistStreamInitImpl<CADCCtl>,
  25. public IPersistStorageImpl<CADCCtl>, // new
  26. public IQuickActivateImpl<CADCCtl>, // new
  27. public IOleControlImpl<CADCCtl>,
  28. public IOleObjectImpl<CADCCtl>,
  29. public IOleInPlaceActiveObjectImpl<CADCCtl>,
  30. public IViewObjectExImpl<CADCCtl>,
  31. public IConnectionPointContainerImpl<CADCCtl>,
  32. public IOleInPlaceObjectWindowlessImpl<CADCCtl>,
  33. public IPersistPropertyBagImpl<CADCCtl>, // missing
  34. public IRunnableObjectImpl<CADCCtl>, // missing
  35. public IPropertyNotifySinkCP<CADCCtl>, // missing
  36. public IDataObjectImpl<CADCCtl>, // new
  37. public ISpecifyPropertyPagesImpl<CADCCtl> // new
  38. {
  39. public:
  40. CADCCtl();
  41. virtual ~CADCCtl();
  42. DECLARE_REGISTRY_RESOURCEID(IDR_ADCCTL)
  43. DECLARE_NOT_AGGREGATABLE(CADCCtl)
  44. BEGIN_COM_MAP(CADCCtl)
  45. COM_INTERFACE_ENTRY(IADCCtl)
  46. COM_INTERFACE_ENTRY(IDispatch) // does order matter? TDC has IDispatch first
  47. COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
  48. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
  49. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
  50. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
  51. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
  52. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
  53. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
  54. COM_INTERFACE_ENTRY_IMPL(IOleControl)
  55. COM_INTERFACE_ENTRY_IMPL(IOleObject)
  56. COM_INTERFACE_ENTRY_IMPL(IQuickActivate) // new
  57. COM_INTERFACE_ENTRY_IMPL(IPersistStorage) // new
  58. COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
  59. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  60. COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages) // new
  61. COM_INTERFACE_ENTRY_IMPL(IDataObject) // new
  62. COM_INTERFACE_ENTRY(IProvideClassInfo)
  63. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  64. COM_INTERFACE_ENTRY_IMPL(IPersistPropertyBag) // missing
  65. COM_INTERFACE_ENTRY_IMPL(IRunnableObject) // missing
  66. END_COM_MAP()
  67. BEGIN_PROPERTY_MAP(CADCCtl)
  68. PROP_ENTRY("Dirty", DISPID_IADCCTL_DIRTY, CLSID_ADCCtl)
  69. PROP_ENTRY("Category", DISPID_IADCCTL_PUBCAT, CLSID_ADCCtl)
  70. PROP_ENTRY("ShowPostSetup", DISPID_IADCCTL_SHOWPOSTSETUP, CLSID_ADCCtl)
  71. PROP_ENTRY("OnDomain", DISPID_IADCCTL_ONDOMAIN, CLSID_ADCCtl)
  72. PROP_ENTRY("DefaultCategory", DISPID_IADCCTL_DEFAULTCAT, CLSID_ADCCtl)
  73. END_PROPERTY_MAP()
  74. BEGIN_CONNECTION_POINT_MAP(CADCCtl)
  75. CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
  76. END_CONNECTION_POINT_MAP()
  77. BEGIN_MSG_MAP(CADCCtl)
  78. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  79. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  80. MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  81. END_MSG_MAP()
  82. // These members and methods expose the IADCCtl interface
  83. // Control methods
  84. STDMETHOD(IsRestricted) (BSTR bstrPolicy, VARIANT_BOOL * pbRestricted);
  85. STDMETHOD(Reset) (BSTR bstrQualifier);
  86. STDMETHOD(Exec) (BSTR bstrQualifier, BSTR bstrCmd, LONG nRecord);
  87. // Control Properties
  88. //
  89. STDMETHOD(get_Dirty) (VARIANT_BOOL * pbDirty);
  90. STDMETHOD(put_Dirty) (VARIANT_BOOL bDirty);
  91. STDMETHOD(get_Category) (BSTR * pbstr);
  92. STDMETHOD(put_Category) (BSTR bstr);
  93. STDMETHOD(get_Sort) (BSTR * pbstr);
  94. STDMETHOD(put_Sort) (BSTR bstr);
  95. STDMETHOD(get_Forcex86) (VARIANT_BOOL * pbForce);
  96. STDMETHOD(put_Forcex86) (VARIANT_BOOL bForce);
  97. STDMETHOD(get_ShowPostSetup)(VARIANT_BOOL * pbShow);
  98. STDMETHOD(get_OnDomain) (VARIANT_BOOL * pbOnDomain);
  99. STDMETHOD(put_OnDomain) (VARIANT_BOOL bOnDomain);
  100. STDMETHOD(get_DefaultCategory) (BSTR * pbstr);
  101. // Data source notification methods
  102. STDMETHOD(msDataSourceObject) (BSTR qualifier, IUnknown **ppUnk);
  103. STDMETHOD(addDataSourceListener)(IUnknown *pEvent);
  104. // *** IViewObjectEx ***
  105. STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
  106. {
  107. ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
  108. *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
  109. return S_OK;
  110. }
  111. // *** Overriding ATL functions ***
  112. virtual STDMETHODIMP IOleObject_SetClientSite(IOleClientSite *pClientSite);
  113. private:
  114. HRESULT _CreateMatrixObject(DWORD dwEnum, IARPSimpleProvider ** pparposp);
  115. HRESULT _ReleaseMatrixObject(DWORD dwIndex);
  116. HRESULT _InitEventBrokers(DataSourceListener * pdsl, BOOL bRecreate);
  117. // Release all of the matrix objects
  118. HRESULT _ReleaseAllMatrixObjects(void);
  119. HRESULT _ReleaseAllEventBrokers();
  120. DWORD _GetEnumAreaFromQualifier(BSTR bstrQualifier);
  121. BOOL _IsMyComputerOnDomain();
  122. HRESULT _CheckSecurity(IOleClientSite * pClientSite);
  123. HRESULT _KillDatasrcWorkerThread(IARPSimpleProvider * parp);
  124. HRESULT _GetToplevelHWND(void);
  125. IShellAppManager * _psam; // shell app manager
  126. IARPEvent * _rgparpevt[NUM_ARP_SIMPLE_PROVIDERS];
  127. // array of event brokers, each OSP has one cooresponding
  128. IARPSimpleProvider * _rgparposp[NUM_ARP_SIMPLE_PROVIDERS];
  129. // array of OSP's we carry in this data source object
  130. IOleClientSite * _pclientsite; // cached client site
  131. CComBSTR _cbstrCategory;
  132. CComBSTR _cbstrSort;
  133. DWORD _dwEnum; // enumerate which items? (ENUM_*)
  134. BITBOOL _fInReset: 1; // TRUE if Reset has already been entered
  135. BITBOOL _fDirty : 1; // TRUE if the recordset is dirty.
  136. BITBOOL _fCategoryChanged: 1; // TRUE if Category property has changed
  137. BITBOOL _fSecure : 1; // TRUE if we don't have security problem
  138. BITBOOL _fOnDomain : 1; // TRUE if we are running on a machine connected to a domain
  139. HWND _hwndTB; // Toplevel browser hwnd
  140. };
  141. #endif //__ADCCTL_H_