GME  13
ConstraintMgr.h
Go to the documentation of this file.
00001 // ConstraintMgr.h : Declaration of the CConstraintMgr
00002 
00003 #ifndef __CONSTRAINTMGR_H_
00004 #define __CONSTRAINTMGR_H_
00005 
00006 #include "resource.h"       // main symbols
00007 
00008 #include "commonsmart.h"
00009 #include "commonMFC.h"
00010 #include "commonerror.h"
00011 #include "CommonVersionInfo.h"
00012 #include "OCLGMECMFacade.h"
00013 
00014 #define MGR_COMPONENT_PROGID "Mga.AddOn.ConstraintManager"
00015 #define MGR_COMPONENT_NAME "ConstraintManager"
00016 #define MGR_CETYPE ((componenttype_enum)(COMPONENTTYPE_ADDON | COMPONENTTYPE_PARADIGM_INDEPENDENT))
00017 #define MGR_PARADIGM "*"
00018 
00020 // CConstraintMgr
00021 
00022 class CConstraintMgr;
00023 
00024 class ATL_NO_VTABLE CMgrEventSink :
00025 public CComObjectRootEx<CComSingleThreadModel>, public IMgaEventSink {
00026 public:
00027         CConstraintMgr *cm;
00028 BEGIN_COM_MAP(CMgrEventSink)
00029         COM_INTERFACE_ENTRY(IMgaEventSink)
00030 END_COM_MAP()
00031         STDMETHOD(GlobalEvent) (globalevent_enum event);
00032         STDMETHOD(ObjectEvent) (IMgaObject * obj, unsigned long eventmask, VARIANT v);
00033 };
00034 
00035 
00036 class ATL_NO_VTABLE CConstraintMgr :
00037         public CComObjectRootEx<CComSingleThreadModel>,
00038         public CComCoClass<CConstraintMgr, &CLSID_ConstraintManager>,
00039         public IDispatchImpl<IMgaComponentEx, &IID_IMgaComponentEx, &LIBID_CONSTRAINTMANAGERLib>,
00040         public ISupportErrorInfo,
00041         public IGMEVersionInfoImpl
00042 {
00043 public:
00044         CConstraintMgr()
00045         {
00046         }
00047 
00048 DECLARE_REGISTRY_RESOURCEID(IDR_CONSTRAINTMGR)
00049 
00050 DECLARE_PROTECT_FINAL_CONSTRUCT()
00051 
00052 BEGIN_COM_MAP(CConstraintMgr)
00053         COM_INTERFACE_ENTRY(IMgaComponentEx)
00054         COM_INTERFACE_ENTRY_IID(IID_IMgaComponent, IMgaComponentEx)
00055         COM_INTERFACE_ENTRY_IID(IID_IDispatch, IMgaComponentEx)
00056         COM_INTERFACE_ENTRY(ISupportErrorInfo)
00057         COM_INTERFACE_ENTRY_IID(IID_IGMEVersionInfo, IGMEVersionInfoImpl)
00058 END_COM_MAP()
00059 
00060 // IMgaComponentEx
00061 public:
00062         STDMETHOD(Invoke)(IMgaProject *project, IMgaFCOs *selectedobjs, long param);
00063         STDMETHOD(InvokeEx)(IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
00064         STDMETHOD(ObjectsInvokeEx)(IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param);
00065 
00066         STDMETHOD(Initialize)(IMgaProject *p);
00067         STDMETHOD(Enable)(VARIANT_BOOL enabled);
00068         STDMETHOD(get_InteractiveMode)(VARIANT_BOOL * enabled);
00069         STDMETHOD(put_InteractiveMode)(VARIANT_BOOL enabled);
00070         STDMETHOD(get_ComponentName)(BSTR *rVal);
00071         STDMETHOD(get_ComponentType)(componenttype_enum *t);
00072         STDMETHOD(get_Paradigm)(BSTR *rVal);
00073         STDMETHOD(get_ComponentProgID)(BSTR *rVal);
00074         STDMETHOD(get_ComponentParameter)(BSTR name, VARIANT *pVal);
00075         STDMETHOD(put_ComponentParameter)(BSTR name, VARIANT newVal);
00076 
00077 
00078         STDMETHOD(GlobalEvent) (globalevent_enum event);
00079         STDMETHOD(ObjectEvent) (IMgaObject * obj, unsigned long eventmask, VARIANT v);
00080         STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) { ASSERT(InlineIsEqualGUID(riid,IID_IMgaComponentEx) ||
00081                                                                                                                                 InlineIsEqualGUID(riid,IID_IMgaComponent)       ); return S_OK; };
00082 private:
00083 
00084         void GotoViolatorObject(CComPtr<IUnknown> &gotoPunk);
00085         CComObjPtr<IMgaTerritory>       m_spTerritory;
00086         CComObjPtr<CMgrEventSink>       m_spEventSink;
00087         CComObjPtr<IMgaProject>                 m_spProject;
00088         CComPtr<IMgaAddOn>                      m_spAddOn;
00089 
00090         OclGmeCM::Facade                                m_Facade;
00091 };
00092 
00093 #endif //__CONSTRAINTMGR_H_