GME
13
|
00001 #if !defined(AFX_GMEOLEIT_H__338DD18C_3C58_4C65_9202_2B5E00CF740A__INCLUDED_) 00002 #define AFX_GMEOLEIT_H__338DD18C_3C58_4C65_9202_2B5E00CF740A__INCLUDED_ 00003 00004 #include "GuiMeta.h" 00005 #include "GMEView.h" 00006 #include "MainFrm.h" 00007 00008 #if _MSC_VER > 1000 00009 #pragma once 00010 #endif // _MSC_VER > 1000 00011 // GMEOLEIt.h : header file 00012 // 00013 00015 // CGMEOLEIt command target 00016 00017 class CGMEOLEIt : public CCmdTarget 00018 { 00019 DECLARE_DYNCREATE(CGMEOLEIt) 00020 00021 CGMEOLEIt(); // protected constructor used by dynamic creation 00022 00023 // Attributes 00024 public: 00025 00026 // Operations 00027 public: 00028 00029 // Overrides 00030 public: 00031 virtual void OnFinalRelease(); 00032 //}}AFX_VIRTUAL 00033 00034 // Implementation 00035 protected: 00036 CGMEView * m_theView; 00037 CComPtr<IMgaModel> m_theMgaModel; 00038 virtual ~CGMEOLEIt(); 00039 00040 // this method is called by PRECONDITION_VALID_MODEL macro 00041 bool AmIValid(); 00042 00043 // mga related helpers 00044 static bool createObjs( CComPtr<IMgaModel>& mm, LPCTSTR partname, LPCTSTR newnm, IMgaFCO** pNewObj ); 00045 static bool cloneObjs( CComPtr<IMgaModel>& mm, IMgaFCO* pExistingObj, LPCTSTR partname, LPCTSTR newnm, IMgaFCO** pNewObj ); 00046 static void rename( CComPtr<IMgaFCO> pFco, LPCTSTR pName); 00047 static CComPtr<IMgaObject> myParent( const CComPtr<IMgaObject>& obj); 00048 static CComPtr<IMgaFCO> fcoByPath( const CComPtr<IMgaModel>& mod, LPCTSTR p_objPath); 00049 static CComPtr<IMgaFCO> getChildInByName( CComPtr<IMgaModel> model, LPCTSTR name ); 00050 static bool isValidChildIn( CComPtr<IMgaModel> model, CComPtr<IMgaFCO> fco); 00051 static CComPtr<IMgaMetaRole> metaRolePtrInByName( CComPtr<IMgaModel> p_model, CComBSTR p_part ); 00052 static CComPtr<IMgaMetaRole> connMetaRolePtrInBetween( CComPtr<IMgaModel> p_model, CComPtr<IMgaFCO> p_src, CComPtr<IMgaFCO> p_dst ); 00053 static CComPtr<IMgaMetaRole> connMetaRolePtrInBetween( CComPtr<IMgaModel> p_model, CComPtr<IMgaFCO> p_srcRole1, CComPtr<IMgaFCO> p_srcRole2, CComPtr<IMgaFCO> p_dstRole1, CComPtr<IMgaFCO> p_dstRole2); 00054 static CComPtr<IMgaMetaRole> connMetaRolePtrInBetween( CComPtr<IMgaModel> p_model, const CComBSTR& src_localpath, const CComBSTR& dst_localpath); 00055 static CComBSTR roleNameOf( CComPtr<IMgaFCO> one_fco ); 00056 static objtype_enum myTypeIs( CComPtr<IMgaFCO> fco); 00057 static void refPortFinderAndChainBuilder( LPCTSTR p_portRole, CComPtr<IMgaFCO> p_ref, CComPtr<IMgaFCO>& p_portResult, CComPtr<IMgaFCOs>& p_refChainResult ); 00058 static bool areCollectionsEqual( const CComPtr<IMgaFCOs>& op1, const CComPtr<IMgaFCOs>& op2); 00059 static bool refChainBuilder2( CComPtr<IMgaFCO> p_ref, CComPtr<IMgaFCO> port, CComPtr<IMgaFCOs>& chain); 00060 00061 // gui related helpers 00062 void moveAspect( int dir); 00063 void moveView( int dir); 00064 void setObjPos( CComPtr<IMgaFCO> pChild, LPCTSTR pAspectName, long parX, long parY); 00065 00066 // transaction related helper methods 00067 bool m_isInUserInitiatedTransaction; 00068 bool m_initedByMe; 00069 bool start(); 00070 bool end(); 00071 bool beginTrans(); 00072 bool commitTrans(); 00073 bool abortTrans(); 00074 LPDISPATCH putInTerr( LPDISPATCH); 00075 CComPtr<IMgaFCO> putInTerr( const CComPtr<IMgaFCO>& fco); 00076 00077 // Generated message map functions 00078 //{{AFX_MSG(CGMEOLEIt) 00079 // NOTE - the ClassWizard will add and remove member functions here. 00080 //}}AFX_MSG 00081 00082 DECLARE_MESSAGE_MAP() 00083 // OLE dispatch map functions 00084 afx_msg LPDISPATCH GetAspects(); 00085 afx_msg void SetAspects(LPDISPATCH newValue); 00086 afx_msg void Print(); 00087 afx_msg void PrintDialog(); 00088 afx_msg void DumpWindowsMetaFile(LPCTSTR filePath); 00089 afx_msg void CheckConstraints(); 00090 afx_msg void RunComponent(LPCTSTR appID); 00091 afx_msg void RunComponentDialog(); 00092 afx_msg void Close(); 00093 afx_msg void GrayOutFCO(BOOL bGray, BOOL bNeighbours, LPDISPATCH mgaFCOs); 00094 afx_msg void GrayOutHide(); 00095 afx_msg void ShowSetMembers(LPDISPATCH mgaFCO); 00096 afx_msg void HideSetMembers(); 00097 afx_msg void Zoom(long percent); 00098 afx_msg void ZoomTo(LPDISPATCH mgaFCOs); 00099 afx_msg void Scroll(long bar, long scroll); 00100 afx_msg void DumpModelGeometryXML(LPCTSTR filePath); 00101 00102 afx_msg BOOL GetValid(); 00103 afx_msg void SetValid(BOOL); 00104 afx_msg LPDISPATCH GetMgaModel(); 00105 afx_msg void SetMgaModel(LPDISPATCH); 00106 00107 afx_msg void ShowFCO( LPCTSTR, BOOL); 00108 afx_msg void ShowFCOPtr( LPDISPATCH, BOOL); 00109 afx_msg LPDISPATCH Child( LPCTSTR); 00110 afx_msg LPDISPATCH Create( LPCTSTR, LPCTSTR); 00111 afx_msg LPDISPATCH CreateInChild( LPCTSTR, LPCTSTR, LPCTSTR); 00112 afx_msg LPDISPATCH CreateInChildFCO( LPDISPATCH, LPCTSTR, LPCTSTR); 00113 afx_msg LPDISPATCH Duplicate( LPCTSTR, LPCTSTR); 00114 afx_msg LPDISPATCH DuplicateFCO( LPDISPATCH, LPCTSTR); 00115 afx_msg void Rename( LPCTSTR, LPCTSTR); 00116 afx_msg void SetName( LPDISPATCH, LPCTSTR); 00117 afx_msg void Include( LPCTSTR, LPCTSTR); 00118 afx_msg void IncludeFCO( LPDISPATCH, LPDISPATCH); 00119 afx_msg void Exclude( LPCTSTR, LPCTSTR); 00120 afx_msg void ExcludeFCO( LPDISPATCH, LPDISPATCH); 00121 afx_msg LPDISPATCH Connect( LPCTSTR, LPCTSTR, LPCTSTR); 00122 afx_msg void Disconnect( LPCTSTR, LPCTSTR, LPCTSTR); 00123 afx_msg LPDISPATCH ConnectThruPort( LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR); 00124 afx_msg LPDISPATCH ConnectThruPortFCO( LPDISPATCH, LPDISPATCH, LPDISPATCH, LPDISPATCH, LPCTSTR); 00125 afx_msg void DisconnectThruPort( LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR); 00126 afx_msg LPDISPATCH ConnectFCOs( LPDISPATCH, LPDISPATCH, LPCTSTR); 00127 afx_msg void DisconnectFCOs( LPDISPATCH, LPDISPATCH, LPCTSTR); 00128 afx_msg void Refer( LPCTSTR, LPCTSTR); 00129 afx_msg void ReferFCO( LPDISPATCH, LPDISPATCH); 00130 afx_msg void ClearRef( LPCTSTR); 00131 afx_msg void ClearRefFCO( LPDISPATCH); 00132 afx_msg void FollowRef( LPCTSTR); 00133 afx_msg void FollowRefFCO( LPDISPATCH); 00134 afx_msg LPDISPATCH NullFCO(); 00135 00136 afx_msg void SetAttribute( LPCTSTR, LPCTSTR, VARIANT&); 00137 afx_msg VARIANT GetAttribute( LPCTSTR, LPCTSTR); 00138 00139 afx_msg void SetAttributeFCO( LPDISPATCH, LPCTSTR, VARIANT&); 00140 afx_msg VARIANT GetAttributeFCO( LPDISPATCH, LPCTSTR); 00141 00142 afx_msg LPDISPATCH SubType( LPCTSTR, LPCTSTR); 00143 afx_msg LPDISPATCH Instantiate( LPCTSTR, LPCTSTR); 00144 afx_msg LPDISPATCH SubTypeFCO( LPDISPATCH, LPCTSTR); 00145 afx_msg LPDISPATCH InstantiateFCO( LPDISPATCH, LPCTSTR); 00146 00147 afx_msg void BeginTransaction( ); 00148 afx_msg void CommitTransaction( ); 00149 afx_msg void AbortTransaction( ); 00150 afx_msg VARIANT_BOOL IsInTransaction( ); 00151 afx_msg LPDISPATCH PutInTerritory( LPDISPATCH); 00152 00153 afx_msg void Help( ); 00154 00155 afx_msg void SetSelected( LPCTSTR); 00156 afx_msg BSTR GetSelected( ); 00157 afx_msg void SetSelectedFCOs( LPDISPATCH); 00158 afx_msg LPDISPATCH GetSelectedFCOs( ); 00159 00160 afx_msg CString GetCurrentAspect(void); 00161 afx_msg void SetCurrentAspect(const CString& aspectName); 00162 afx_msg void NextAspect( ); 00163 afx_msg void PrevAspect( ); 00164 afx_msg void Next( ); 00165 afx_msg void Prev( ); 00166 afx_msg void Position( LPCTSTR, LPCTSTR, long, long); 00167 afx_msg void PositionFCO( LPDISPATCH, LPCTSTR, long, long); 00168 00169 DECLARE_DISPATCH_MAP() 00170 DECLARE_INTERFACE_MAP() 00171 00172 BEGIN_DUAL_INTERFACE_PART(Dual, IGMEOLEIt) 00173 STDMETHOD(get_Valid)(THIS_ VARIANT_BOOL* isValid); 00174 STDMETHOD(get_MgaModel)(THIS_ IMgaModel** model); 00175 STDMETHOD(get_Aspects)(THIS_ IGMEOLEColl** coll); 00176 00177 STDMETHOD(Print)(THIS); 00178 STDMETHOD(PrintDialog)(THIS); 00179 STDMETHOD(DumpWindowsMetaFile)(THIS_ BSTR filePath); 00180 STDMETHOD(CheckConstraints)(THIS); 00181 STDMETHOD(RunComponent)(THIS_ BSTR appID); 00182 STDMETHOD(RunComponentDialog)(THIS); 00183 STDMETHOD(Close)(THIS); 00184 STDMETHOD(GrayOutFCO)(THIS_ VARIANT_BOOL bGray, VARIANT_BOOL bNeighbours, IMgaFCOs* mgaFCO); 00185 STDMETHOD(GrayOutHide)(THIS); 00186 STDMETHOD(ShowSetMembers)(THIS_ IMgaFCO* mgaFCO); 00187 STDMETHOD(HideSetMembers)(THIS); 00188 STDMETHOD(Zoom)(THIS_ DWORD percent); 00189 STDMETHOD(ZoomTo)(THIS_ IMgaFCOs* mgaFCOs); 00190 STDMETHOD(Scroll)(THIS_ bar_enum bar, scroll_enum scroll); 00191 STDMETHOD(DumpModelGeometryXML)(THIS_ BSTR filePath); 00192 00193 STDMETHOD(ShowFCO)(THIS_ BSTR path, VARIANT_BOOL inparent); 00194 STDMETHOD(ShowFCOPtr)(THIS_ IMgaFCO* ptr, VARIANT_BOOL inparent); 00195 STDMETHOD(Child)(THIS_ BSTR name, IMgaFCO** child_fco); 00196 STDMETHOD(Create)(THIS_ BSTR part, BSTR name, IMgaFCO** new_fco); 00197 STDMETHOD(CreateInChild)(THIS_ BSTR child_as_parent, BSTR part, BSTR name, IMgaFCO** new_fco); 00198 STDMETHOD(CreateInChildFCO)(THIS_ IMgaFCO* child_as_parent, BSTR part, BSTR name, IMgaFCO** new_fco); 00199 00200 STDMETHOD(Duplicate)(THIS_ BSTR existing_fco_name, BSTR new_fco_name, IMgaFCO** new_fco); 00201 STDMETHOD(DuplicateFCO)(THIS_ IMgaFCO* existing_fco, BSTR new_fco_name, IMgaFCO** new_fco); 00202 STDMETHOD(Rename)(THIS_ BSTR oldname, BSTR newname); 00203 STDMETHOD(SetName)(THIS_ IMgaFCO* fco, BSTR name); 00204 STDMETHOD(Include)(THIS_ BSTR setname, BSTR fconame); 00205 STDMETHOD(IncludeFCO)(THIS_ IMgaSet* set, IMgaFCO* fco); 00206 STDMETHOD(Exclude)(THIS_ BSTR setname, BSTR fconame); 00207 STDMETHOD(ExcludeFCO)(THIS_ IMgaSet* set, IMgaFCO* fco); 00208 STDMETHOD(Connect)(THIS_ BSTR name1, BSTR name2, BSTR connection, IMgaConnection** conn ); 00209 STDMETHOD(Disconnect)(THIS_ BSTR part1, BSTR part2, BSTR connection); 00210 STDMETHOD(ConnectThruPort)(THIS_ BSTR part1, BSTR port1, BSTR part2, BSTR port2, BSTR connection, IMgaConnection ** conn ); 00211 STDMETHOD(ConnectThruPortFCO)(THIS_ IMgaFCO* part1, IMgaFCO* port1, IMgaFCO* part2, IMgaFCO* port2, BSTR connection_role, IMgaConnection ** conn); 00212 STDMETHOD(DisconnectThruPort)(THIS_ BSTR part1, BSTR port1, BSTR part2, BSTR port2, BSTR connection); 00213 STDMETHOD(ConnectFCOs)(THIS_ IMgaFCO* part1, IMgaFCO* part2, BSTR connection, IMgaConnection ** conn ); 00214 STDMETHOD(DisconnectFCOs)(THIS_ IMgaFCO* part1, IMgaFCO* part2, BSTR connection); 00215 STDMETHOD(Refer)(THIS_ BSTR reference, BSTR referred); 00216 STDMETHOD(ReferFCO)(THIS_ IMgaReference* reference, IMgaFCO* referred); 00217 STDMETHOD(ClearRef)(THIS_ BSTR reference); 00218 STDMETHOD(ClearRefFCO)(THIS_ IMgaReference* reference); 00219 STDMETHOD(FollowRef)(THIS_ BSTR reference); 00220 STDMETHOD(FollowRefFCO)(THIS_ IMgaReference* reference); 00221 STDMETHOD(NullFCO)(THIS_ IMgaFCO** nullobj); 00222 00223 STDMETHOD(SetAttribute)(THIS_ BSTR name, BSTR attr_name, VARIANT value); 00224 STDMETHOD(GetAttribute)(THIS_ BSTR name, BSTR attr_name, VARIANT* value); 00225 00226 STDMETHOD(SetAttributeFCO)(THIS_ IMgaFCO* fco, BSTR attr_name, VARIANT value); 00227 STDMETHOD(GetAttributeFCO)(THIS_ IMgaFCO* fco, BSTR attr_name, VARIANT* value); 00228 00229 STDMETHOD(SubType)( THIS_ BSTR base, BSTR name_of_subtype, IMgaFCO** subtype); 00230 STDMETHOD(Instantiate)( THIS_ BSTR base, BSTR name_of_instance, IMgaFCO** instance); 00231 00232 STDMETHOD(SubTypeFCO)( THIS_ IMgaFCO* base, BSTR name_of_subtype, IMgaFCO** subtype); 00233 STDMETHOD(InstantiateFCO)( THIS_ IMgaFCO* base, BSTR name_of_instance, IMgaFCO** instance); 00234 00235 STDMETHOD(BeginTransaction)(THIS); 00236 STDMETHOD(CommitTransaction)(THIS); 00237 STDMETHOD(AbortTransaction)(THIS); 00238 STDMETHOD(IsInTransaction)(THIS_ VARIANT_BOOL* intrans); 00239 STDMETHOD(PutInTerritory)(THIS_ IMgaFCO* fco, IMgaFCO** newfco); 00240 00241 STDMETHOD(Help)(THIS); 00242 00243 STDMETHOD(SetSelected)(THIS_ BSTR space_delimited_string ); 00244 STDMETHOD(GetSelected)(THIS_ BSTR * space_delimited_string ); 00245 STDMETHOD(SetSelectedFCOs)(THIS_ IMgaFCOs* fcos_to_select); 00246 STDMETHOD(GetSelectedFCOs)(THIS_ IMgaFCOs** selected_fcos); 00247 00248 STDMETHOD(GetCurrentAspect)(THIS_ BSTR* aspectName); 00249 STDMETHOD(SetCurrentAspect)(THIS_ BSTR aspectName); 00250 STDMETHOD(NextAspect)(THIS); 00251 STDMETHOD(PrevAspect)(THIS); 00252 STDMETHOD(Next)(THIS); 00253 STDMETHOD(Prev)(THIS); 00254 STDMETHOD(Position)(THIS_ BSTR child, BSTR aspect, long parX, long parY); 00255 STDMETHOD(PositionFCO)(THIS_ IMgaFCO* child, BSTR aspect, long parX, long parY); 00256 00257 END_DUAL_INTERFACE_PART(Dual) 00258 00259 // add declaration of ISupportErrorInfo implementation 00260 // to indicate we support the OLE Automation error object 00261 DECLARE_DUAL_ERRORINFO() 00262 }; 00263 00265 00266 //{{AFX_INSERT_LOCATION}} 00267 // Microsoft Visual C++ will insert additional declarations immediately before the previous line. 00268 00269 #endif // !defined(AFX_GMEOLEIT_H__338DD18C_3C58_4C65_9202_2B5E00CF740A__INCLUDED_)