#ifndef __CCmdTarget_h
#define __CCmdTarget_h

class MfcCmdTarget : public MfcObject
{
protected:
public:
	virtual MfcRuntimeClass* GetRuntimeClass() const;

protected:

public:
// Constructors

// Overridables
	// route and dispatch standard command message types
	//   (more sophisticated than OnCommand)
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
		AFX_MFC_CMDHANDLERINFO* pHandlerInfo);

#ifndef _AFX_MFC_NO_OLE_SUPPORT
	// called when last OLE reference is released
	virtual void OnFinalRelease();
#endif

#ifndef _AFX_MFC_NO_OLE_SUPPORT
	// called before dispatching to an automation handler function
	virtual BOOL IsInvokeAllowed(DISPID dispid);
#endif

#ifndef _AFX_MFC_NO_OLE_SUPPORT
	virtual BOOL GetDispatchIID(IID* pIID);
	virtual UINT GetTypeInfoCount();
	virtual MfcTypeLibCache* GetTypeLibCache();
	virtual HRESULT GetTypeLib(LCID lcid, LPTYPELIB* ppTypeLib);
#endif

// Implementation
public:
	virtual ~MfcCmdTarget();
#ifdef _DEBUG
	virtual void Dump(MfcDumpContext& dc) const;
	virtual void AssertValid() const;
#endif

protected:
	friend class MfcView;

	virtual const AFX_MFC_MSGMAP* GetMessageMap() const;


#ifndef _AFX_MFC_NO_DOCOBJECT_SUPPORT
	virtual const AFX_MFC_OLECMDMAP* GetCommandMap() const;

	friend class COleCmdUI;
#endif

#ifndef _AFX_MFC_NO_OLE_SUPPORT
	virtual const AFX_MFC_DISPMAP* GetDispatchMap() const;
	virtual const AFX_MFC_CONNECTIONMAP* GetConnectionMap() const;
	virtual const AFX_MFC_INTERFACEMAP* GetInterfaceMap() const;

#ifndef _AFX_MFC_NO_OCC_SUPPORT
	virtual const AFX_MFC_EVENTSINKMAP* GetEventSinkMap() const;
#endif // !_AFX_MFC_NO_OCC_SUPPORT

	// OLE interface map implementation
public:
	// data used when MfcCmdTarget is made OLE aware

public:
	// advanced overrideables for implementation
	virtual BOOL OnCreateAggregates();
	virtual LPUNKNOWN GetInterfaceHook(const void*);

	friend class COleDispatchImpl;

	virtual BOOL GetExtraConnectionPoints(MfcPtrArray* pConnPoints);
	virtual LPCONNECTIONPOINT GetConnectionHook(const IID& iid);

	friend class COleConnPtContainer;

#endif //!_AFX_MFC_NO_OLE_SUPPORT
};

#endif//__CCmdTarget_h
