00001 #pragma once
00002
00003
00004 #include "ComHelp.h"
00005 #include "GMECOM.h"
00006 #include "Exceptions.h"
00007 #include "MgaUtil.h"
00008 #include "Core.h"
00009 #include "Mga.h"
00010
00011 #include "ComponentConfig.h"
00012
00013 #if defined(BUILDER_OBJECT_NETWORK)
00014 #else
00015
00016 #ifdef BUILDER_OBJECT_NETWORK_V2
00017 #include "BON.h"
00018 #include <BON2Component.h>
00019 #else
00020 #include <RawComponent.h>
00021 #endif // BUILDER_OBJECT_NETWORK_V2
00022
00023 #endif // BUILDER_OBJECT_NETWORK
00024
00025 #pragma once
00026
00027 class CComponentObj;
00028
00029 #ifdef GME_ADDON
00030
00031 #ifndef RAWCOMPONENT_H
00032
00033 #ifndef BON2Component_h
00034 #error GME AddOn-s must be built with the RAW Component interface or BON2 Component Interface
00035 #endif // BON2Component_h
00036
00037 #endif // RAWCOMPONENT_H
00038
00039 class CEventSink : public CCmdTarget {
00040 DECLARE_DYNCREATE(CEventSink)
00041 CEventSink();
00042 public:
00043 CComponentObj *comp;
00044
00045 IMgaEventSink* GetInterface() { return &m_xComponent; }
00046
00047
00048
00049
00050 public:
00051 virtual void OnFinalRelease();
00052
00053
00054
00055
00056 public:
00057 virtual ~CEventSink();
00058
00059 DECLARE_MESSAGE_MAP()
00060 DECLARE_OLECREATE(CEventSink)
00061
00062
00063
00064
00065
00066 DECLARE_DISPATCH_MAP()
00067
00068 DECLARE_INTERFACE_MAP()
00069 public:
00070 BEGIN_INTERFACE_PART(Component, IMgaEventSink)
00071 STDMETHODIMP GlobalEvent(globalevent_enum event);
00072 STDMETHODIMP ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v);
00073 END_INTERFACE_PART(Component)
00074 };
00075
00076 #endif // GME_ADDON
00077
00078
00080
00081
00082 class __declspec(uuid(COCLASS_UUID)) CComponentObj : public CCmdTarget
00083 {
00084
00085 DECLARE_DYNCREATE(CComponentObj)
00086
00087 CComponentObj();
00088 void RegisterActiveObject();
00089 unsigned long registeractiveobjectret;
00090
00091
00092 public:
00093
00094
00095 public:
00096 IMgaComponentEx* GetInterface() { return &m_xComponent; }
00097
00098
00099
00100
00101 public:
00102 virtual void OnFinalRelease();
00103
00104
00105
00106 protected:
00107 virtual ~CComponentObj();
00108 void UnregisterActiveObject();
00109
00110
00111
00112
00113
00114
00115 DECLARE_MESSAGE_MAP()
00116 DECLARE_OLECREATE(CComponentObj)
00117
00118
00119
00120
00121
00122 DECLARE_DISPATCH_MAP()
00123
00124 DECLARE_INTERFACE_MAP()
00125 BEGIN_INTERFACE_PART(Component, IMgaComponentEx)
00126 STDMETHODIMP InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
00127 STDMETHODIMP ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param);
00128 STDMETHODIMP Invoke(IMgaProject* gme, IMgaFCOs *models, long param);
00129 STDMETHODIMP Initialize(struct IMgaProject *);
00130 STDMETHODIMP Enable(VARIANT_BOOL newVal);
00131 STDMETHODIMP get_InteractiveMode(VARIANT_BOOL *enabled);
00132
00133 STDMETHODIMP get_ComponentParameter(BSTR name, VARIANT *pVal);
00134 STDMETHODIMP put_ComponentParameter(BSTR name, VARIANT newVal);
00135
00136
00137 STDMETHODIMP put_InteractiveMode(VARIANT_BOOL enabled);
00138 STDMETHODIMP get_ComponentType( componenttype_enum *t);
00139 STDMETHODIMP get_ComponentProgID(BSTR *pVal) {
00140 *pVal = CComBSTR(COCLASS_PROGID).Detach();
00141 return S_OK;
00142 };
00143 STDMETHODIMP get_ComponentName(BSTR *pVal) {
00144 *pVal = CComBSTR(COMPONENT_NAME).Detach();
00145 return S_OK;
00146 };
00147 STDMETHODIMP get_Paradigm( BSTR *pVal) {
00148 #ifdef PARADIGM_INDEPENDENT
00149 *pVal = CComBSTR("*").Detach();
00150 #else
00151 *pVal = CComBSTR(PARADIGMS).Detach();
00152 #endif // PARADIGM_INDEPENDENT
00153 return S_OK;
00154 };
00155 END_INTERFACE_PART(Component)
00156
00157 BEGIN_INTERFACE_PART(VersionInfo, IGMEVersionInfo)
00158 STDMETHODIMP get_version(enum GMEInterfaceVersion *pVal);
00159 END_INTERFACE_PART(VersionInfo)
00160
00161 public:
00162 bool interactive;
00163
00164 #ifdef BUILDER_OBJECT_NETWORK
00165 typedef CMap<CString, LPCTSTR, CString, LPCTSTR> CStringMap;
00166 CStringMap parmap;
00167 #endif
00168
00169 #ifdef RAWCOMPONENT_H
00170 RawComponent rawcomp;
00171
00172 #ifdef GME_ADDON
00173 CComPtr<IMgaEventSink> e_sink;
00174 #endif // GME_ADDON
00175
00176 #endif // RAWCOMPONENT_H
00177
00178 #ifdef BUILDER_OBJECT_NETWORK_V2
00179 BON::Component bon2Comp;
00180
00181 #ifdef GME_ADDON
00182 CComPtr<IMgaAddOn> addon;
00183 CComPtr<IMgaEventSink> e_sink;
00184 #endif // GME_ADDON
00185
00186 #endif // BUILDER_OBJECT_NETWORK_V2
00187
00188 void HandleError( Util::Exception* pEx );
00189 };
00190
00191
00192 #ifndef __AFXPRIV_H__
00193
00194 class CPushRoutingFrame
00195 {
00196 protected:
00197 CFrameWnd* pOldRoutingFrame;
00198 _AFX_THREAD_STATE* pThreadState;
00199
00200 public:
00201 CPushRoutingFrame(CFrameWnd* pNewRoutingFrame)
00202 {
00203 pThreadState = AfxGetThreadState();
00204 pOldRoutingFrame = pThreadState->m_pRoutingFrame;
00205 pThreadState->m_pRoutingFrame = pNewRoutingFrame;
00206 }
00207 ~CPushRoutingFrame()
00208 { pThreadState->m_pRoutingFrame = pOldRoutingFrame; }
00209 };
00210
00211 #endif // __AFXPRIV_H__
00212
00214
00215
00216