GME  13
GMEOLEModel.cpp
Go to the documentation of this file.
00001 // GMEOLEModel.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "gme.h"
00006 #include "GMEOLEModel.h"
00007 #include "GMEOLEAspect.h"
00008 #include "GMEOLEError.h"
00009 #include "GMEOLEColl.h"
00010 #include "GMEDoc.h"
00011 #include "MainFrm.h"
00012 #include "GMEEventLogger.h"
00013 
00014 #ifdef _DEBUG
00015 #define new DEBUG_NEW
00016 #undef THIS_FILE
00017 static char THIS_FILE[] = __FILE__;
00018 #endif
00019 
00020 
00021         
00022 
00024 // CGMEOLEModel
00025 
00026 IMPLEMENT_DYNCREATE(CGMEOLEModel, CCmdTarget)
00027 
00028 CGMEOLEModel::CGMEOLEModel()
00029 {
00030         EnableAutomation();
00031 }
00032 
00033 CGMEOLEModel::~CGMEOLEModel()
00034 {
00035 }
00036 
00037 
00038 void CGMEOLEModel::OnFinalRelease()
00039 {
00040         // When the last reference for an automation object is released
00041         // OnFinalRelease is called.  The base class will automatically
00042         // deletes the object.  Add additional cleanup required for your
00043         // object before calling the base class.
00044 
00045         CCmdTarget::OnFinalRelease();
00046 }
00047 
00048 bool CGMEOLEModel::AmIValid() {
00049         if (CGMEDoc::theInstance) {
00050                 POSITION pos = CGMEDoc::theInstance->GetFirstViewPosition();
00051                 while (pos) {
00052                         CGMEView* view = (CGMEView*)(CGMEDoc::theInstance->GetNextView(pos));
00053                         ASSERT(view);
00054                         if (view == m_view) {
00055                                 return true;
00056                         }
00057                 }
00058         }
00059         return false;
00060 }
00061 
00062 
00063 BEGIN_MESSAGE_MAP(CGMEOLEModel, CCmdTarget)
00064         //{{AFX_MSG_MAP(CGMEOLEModel)
00065                 // NOTE - the ClassWizard will add and remove mapping macros here.
00066         //}}AFX_MSG_MAP
00067 END_MESSAGE_MAP()
00068 
00069 BEGIN_DISPATCH_MAP(CGMEOLEModel, CCmdTarget)
00070         //{{AFX_DISPATCH_MAP(CGMEOLEModel)
00071         DISP_PROPERTY_EX(CGMEOLEModel, "Active", GetActive, SetActive, VT_BOOL)
00072         DISP_PROPERTY_EX(CGMEOLEModel, "Aspects", GetAspects, SetAspects, VT_DISPATCH)
00073         DISP_PROPERTY_EX(CGMEOLEModel, "MgaModel", GetMgaModel, SetMgaModel, VT_DISPATCH)
00074         DISP_PROPERTY_EX(CGMEOLEModel, "Valid", GetValid, SetValid, VT_BOOL)
00075         DISP_FUNCTION(CGMEOLEModel, "Print", Print, VT_EMPTY, VTS_NONE)
00076         DISP_FUNCTION(CGMEOLEModel, "PrintDialog", PrintDialog, VT_EMPTY, VTS_NONE)
00077         DISP_FUNCTION(CGMEOLEModel, "DumpWindowsMetaFile", DumpWindowsMetaFile, VT_EMPTY, VTS_BSTR)
00078         DISP_FUNCTION(CGMEOLEModel, "CheckConstraints", CheckConstraints, VT_EMPTY, VTS_NONE)
00079         DISP_FUNCTION(CGMEOLEModel, "RunComponent", RunComponent, VT_EMPTY, VTS_BSTR)
00080         DISP_FUNCTION(CGMEOLEModel, "RunComponentDialog", RunComponentDialog, VT_EMPTY, VTS_NONE)
00081         DISP_FUNCTION(CGMEOLEModel, "Close", Close, VT_EMPTY, VTS_NONE)
00082         DISP_FUNCTION(CGMEOLEModel, "GrayOutFCO", GrayOutFCO, VT_EMPTY, VTS_BOOL VTS_BOOL VTS_DISPATCH)
00083         DISP_FUNCTION(CGMEOLEModel, "GrayOutHide", GrayOutHide, VT_EMPTY, VTS_NONE)
00084         DISP_FUNCTION(CGMEOLEModel, "ShowSetMembers", ShowSetMembers, VT_EMPTY, VTS_DISPATCH)
00085         DISP_FUNCTION(CGMEOLEModel, "HideSetMembers", HideSetMembers, VT_EMPTY, VTS_NONE)
00086         DISP_FUNCTION(CGMEOLEModel, "Zoom", Zoom, VT_EMPTY, VTS_I4)
00087         DISP_FUNCTION(CGMEOLEModel, "ZoomTo", ZoomTo, VT_EMPTY, VTS_DISPATCH)
00088         DISP_FUNCTION(CGMEOLEModel, "Scroll", Scroll, VT_EMPTY, VTS_I2 VTS_I2)
00089         DISP_FUNCTION(CGMEOLEModel, "DumpModelGeometryXML", DumpModelGeometryXML, VT_HRESULT, VTS_BSTR)
00090         DISP_FUNCTION(CGMEOLEModel, "GetCurrentAspect", GetCurrentAspect, VT_HRESULT, VTS_BSTR)
00091         DISP_FUNCTION(CGMEOLEModel, "SetCurrentAspect", SetCurrentAspect, VT_HRESULT, VTS_BSTR)
00092         //}}AFX_DISPATCH_MAP
00093 END_DISPATCH_MAP()
00094 
00095 // Note: we add support for IID_IGMEOLEModel to support typesafe binding
00096 //  from VBA.  This IID must match the GUID that is attached to the 
00097 //  dispinterface in the .ODL file.
00098 
00099 // {399A16A0-D209-4d00-9BDF-858D87EC4641}
00100 //static const IID IID_IGMEOLEModel = 
00101 //{ 0x399a16a0, 0xd209, 0x4d00, { 0x9b, 0xdf, 0x85, 0x8d, 0x87, 0xec, 0x46, 0x41 } };
00102 
00103 
00104 BEGIN_INTERFACE_MAP(CGMEOLEModel, CCmdTarget)
00105         INTERFACE_PART(CGMEOLEModel, __uuidof(IGMEOLEModel), Dual)
00106         DUAL_ERRORINFO_PART(CGMEOLEModel)
00107 END_INTERFACE_MAP()
00108 
00110 // CGMEOLEModel message handlers
00111 
00112 void CGMEOLEModel::Print() 
00113 {
00114         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::Print()\r\n");
00115 
00116         PRECONDITION_VALID_MODEL
00117 
00118         m_view->SendMessage(WM_COMMAND, ID_FILE_PRINT_DIRECT);
00119 }
00120 
00121 void CGMEOLEModel::PrintDialog() 
00122 {
00123         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::PrintDialog()\r\n");
00124 
00125         PRECONDITION_VALID_MODEL
00126 
00127         m_view->SendMessage(WM_COMMAND, ID_FILE_PRINT);
00128 
00129 }
00130 
00131 void CGMEOLEModel::DumpWindowsMetaFile(LPCTSTR filePath) 
00132 {
00133         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::DumpWindowsMetaFile()\r\n");
00134 
00135         PRECONDITION_VALID_MODEL
00136 
00137         CMetaFileDC cDC;
00138         BOOL ret = cDC.CreateEnhanced(m_view->GetDC(),filePath,NULL,_T("GME Model"));
00139         if (ret == FALSE) {
00140                 AfxMessageBox(_T("Unable to create metafile."), MB_OK | MB_ICONSTOP);
00141                 return;
00142         }
00143 
00144         cDC.m_bPrinting = TRUE;         // HACK by Peter (c)
00145         m_view->OnDraw(&cDC);
00146 
00147         HENHMETAFILE hEmf = cDC.CloseEnhanced();
00148         if ( hEmf ) {
00149                 DeleteEnhMetaFile(hEmf);
00150         }
00151 }
00152 
00153 void CGMEOLEModel::CheckConstraints() 
00154 {
00155         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::CheckConstraints()\r\n");
00156 
00157         PRECONDITION_VALID_MODEL
00158         PRECONDITION_ACTIVE_CONSTMGR
00159 
00160         m_view->OnFileCheck();
00161 }
00162 
00163 BOOL CGMEOLEModel::GetActive() 
00164 {
00165         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GetActive()\r\n");
00166 
00167         PRECONDITION_VALID_MODEL
00168 
00169         return (CGMEView::GetActiveView() == m_view) ? TRUE : FALSE;
00170 }
00171 
00172 void CGMEOLEModel::SetActive(BOOL bNewValue) 
00173 {
00174         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::SetActive()\r\n");
00175 
00176         PRECONDITION_VALID_MODEL;
00177 
00178         if (bNewValue == TRUE) {
00179                 CMainFrame::theInstance->ActivateView(m_view);
00180         }
00181 }
00182 
00183 void CGMEOLEModel::RunComponent(LPCTSTR appID) 
00184 {
00185         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::RunComponent()\r\n");
00186 
00187         PRECONDITION_VALID_MODEL
00188 
00189         m_view->RunComponent(appID);
00190 }
00191 
00192 void CGMEOLEModel::RunComponentDialog() 
00193 {
00194         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::RunComponentDialog()\r\n");
00195 
00196         PRECONDITION_VALID_MODEL
00197 
00198         m_view->RunComponent("");
00199 }
00200 
00201 LPDISPATCH CGMEOLEModel::GetAspects() 
00202 {
00203         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GetAspects()\r\n");
00204 
00205         PRECONDITION_VALID_MODEL
00206 
00207         CGMEOLEColl* coll = new CGMEOLEColl();
00208 
00209         POSITION pos = m_view->guiMeta->aspects.GetHeadPosition();
00210         while (pos) {
00211                 CGuiMetaAspect* guiaspect = (CGuiMetaAspect*)(m_view->guiMeta->aspects.GetNext(pos));
00212                 ASSERT(guiaspect);
00213                 CGMEOLEAspect* aspect = new CGMEOLEAspect();
00214                 aspect->SetGuiParams(m_view, guiaspect);
00215                 coll->Add(aspect->GetIDispatch(FALSE));
00216                 aspect->GetIDispatch(FALSE)->Release(); // We do not hold reference, hopefully the collection will hold one
00217         }
00218 
00219         return coll->GetIDispatch(FALSE);
00220 }
00221 
00222 void CGMEOLEModel::SetAspects(LPDISPATCH) 
00223 {
00224         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::SetAspects()\r\n");
00225 
00226         SetNotSupported();
00227 }
00228 
00229 LPDISPATCH CGMEOLEModel::GetMgaModel() 
00230 {
00231         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GetMgaModel()\r\n");
00232 
00233         PRECONDITION_VALID_MODEL
00234 
00235         return m_view->currentModel;
00236 
00237         //return NULL;//unreachable code
00238 }
00239 
00240 void CGMEOLEModel::SetMgaModel(LPDISPATCH) 
00241 {
00242         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::SetMgaModel()\r\n");
00243 
00244         SetNotSupported();
00245 }
00246 
00247 BOOL CGMEOLEModel::GetValid() 
00248 {
00249         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GetValid()\r\n");
00250         
00251         // PRECONDITIONS: None
00252 
00253         return (AmIValid() ? TRUE : FALSE);
00254 }
00255 
00256 void CGMEOLEModel::SetValid(BOOL) 
00257 {
00258         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::SetValid()\r\n");
00259 
00260         SetNotSupported();
00261 }
00262 
00263 void CGMEOLEModel::Close() 
00264 {
00265         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::Close()\r\n");
00266 
00267         PRECONDITION_VALID_MODEL;
00268 
00269         m_view->GetParentFrame()->DestroyWindow();
00270 }
00271 
00272 void CGMEOLEModel::GrayOutFCO(BOOL bGray, BOOL bNeighbours, LPDISPATCH mgaFCOs) 
00273 {
00274         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GrayOutFCO()\r\n");
00275 
00276         PRECONDITION_VALID_MODEL;
00277 
00278         if (CGMEDoc::theInstance) 
00279                 CGMEDoc::theInstance->SetMode(5);
00280 
00281         CComPtr<IDispatch> alienFCOs(mgaFCOs);
00282         CComPtr<IMgaFCOs> mFCOColl;
00283         if (!SUCCEEDED(alienFCOs.QueryInterface(&mFCOColl))) {
00284                 return;
00285         }
00286 
00287         long l = 0;
00288         COMTHROW( mFCOColl->get_Count( &l ));
00289         
00290         for( long i = 1; i <= l; ++i)
00291         {
00292                 CComPtr<IMgaFCO> item;
00293                 COMTHROW( mFCOColl->get_Item( i, &item));
00294 
00295                 // collection is coming from an unknown territory, do not use it as-is. (except for this search)
00296                 CGuiObject *gObj = CGuiObject::FindObject(item, m_view->children);
00297                 CGuiConnection *gConn = CGuiConnection::FindConnection(item, m_view->connections);
00298 
00299                 if (gObj) {
00300                         gObj->GrayOut(bGray == TRUE);
00301                         if (bNeighbours == TRUE) {
00302                                 gObj->GrayOutNeighbors();
00303                         }
00304                         CGuiFco::GrayOutNonInternalConnections(m_view->connections);
00305                 }
00306                 else if (gConn) {
00307                         gConn->GrayOut(bGray == TRUE);
00308                         gConn->GrayOutEndPoints();
00309                         if (bNeighbours == TRUE) {
00310                                 CGuiFco::GrayOutNonInternalConnections(m_view->connections);
00311                         }
00312                 }
00313         }
00314 
00315         m_view->Invalidate();
00316 }
00317 
00318 void CGMEOLEModel::GrayOutHide() 
00319 {
00320         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GrayOutHide()\r\n");
00321 
00322         PRECONDITION_VALID_MODEL;
00323 
00324         if (CGMEDoc::theInstance) 
00325                 CGMEDoc::theInstance->SetMode(5);
00326 
00327         CGuiFco::GrayOutFcos(m_view->children, TRUE);
00328         CGuiFco::GrayOutFcos(m_view->connections, TRUE);
00329         m_view->Invalidate();
00330 }
00331 
00332 void CGMEOLEModel::ShowSetMembers(LPDISPATCH mgaFCO) 
00333 {
00334         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::ShowSetMembers()\r\n");
00335 
00336         PRECONDITION_VALID_MODEL;
00337   
00338         if (CGMEDoc::theInstance) 
00339                 CGMEDoc::theInstance->SetMode(3);
00340 
00341         CGuiFco::GrayOutFcos(m_view->children, TRUE);
00342 
00343         CComPtr<IDispatch> alienFCO(mgaFCO);
00344         CComPtr<IMgaFCO> mFCO;
00345         if (!SUCCEEDED(alienFCO.QueryInterface(&mFCO))) 
00346                 return;
00347 
00348         // mgaFCO is comming from an unknown territory, do not use it as-is. (except for this search)
00349         CGuiObject *gObj = CGuiObject::FindObject(mFCO, m_view->children);
00350         if (gObj) 
00351         {
00352                 gObj->GrayOut(false);
00353 
00354                 // members of the set too 
00355                 CComPtr<IMgaSet> mSet;
00356                 if (!SUCCEEDED(mFCO.QueryInterface(&mSet))) 
00357                         return;
00358                 m_view->BeginTransaction();
00359 
00360                 try
00361                 {
00362                         CComPtr<IMgaFCOs> mSetMembers = NULL;
00363                         COMTHROW(mSet->get_Members(&mSetMembers));
00364 
00365                         long num = 0;
00366                         COMTHROW(mSetMembers->get_Count(&num));
00367                         for (int i=1; i<=num; i++)
00368                         {
00369                                 CComPtr<IMgaFCO> memb = NULL;
00370                                 COMTHROW(mSetMembers->get_Item(i, &memb));
00371                                 CGuiObject *gObj = CGuiObject::FindObject(memb, m_view->children);
00372                                 if (gObj) 
00373                                         gObj->GrayOut(false);
00374                         }
00375                         m_view->CommitTransaction();
00376                 }
00377                 catch(hresult_exception &e) 
00378                 {
00379                         m_view->AbortTransaction(e.hr);
00380                 }
00381         }
00382 
00383         m_view->Invalidate();
00384 }
00385 
00386 void CGMEOLEModel::HideSetMembers() 
00387 {
00388         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::HideSetMembers()\r\n");
00389 
00390         PRECONDITION_VALID_MODEL;
00391          
00392         if (CGMEDoc::theInstance) 
00393                 CGMEDoc::theInstance->SetMode(3);
00394 
00395         CGuiFco::GrayOutFcos(m_view->children, TRUE);
00396         m_view->Invalidate();
00397 }
00398 
00399 void CGMEOLEModel::Zoom(long percent) 
00400 {
00401         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::Zoom()\r\n");
00402 
00403         PRECONDITION_VALID_MODEL;
00404 
00405         m_view->ZoomPercent(percent);
00406         m_view->Invalidate();
00407 }
00408 
00409 void CGMEOLEModel::ZoomTo(LPDISPATCH mgaFCOs) 
00410 {
00411         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::ZoomTo()\r\n");
00412 
00413         PRECONDITION_VALID_MODEL;
00414  
00415         if (CGMEDoc::theInstance) 
00416                 CGMEDoc::theInstance->SetMode(4);
00417 
00418         CComPtr<IDispatch> disp(mgaFCOs);
00419         CComPtr<IMgaFCOs> fcos;
00420         if (!SUCCEEDED(disp.QueryInterface(&fcos))) 
00421                 return;
00422 
00423         // calculate the total size of them
00424         CRect totalr(0,0,0,0);
00425         m_view->BeginTransaction();
00426         try
00427         {
00428                 long num = 0;
00429                 COMTHROW(fcos->get_Count(&num));
00430                 for (int i=1; i<=num; i++)
00431                 {
00432                         CComPtr<IMgaFCO> memb = NULL;
00433                         COMTHROW(fcos->get_Item(i, &memb));
00434                         // size ??
00435                         CGuiObject *gObj = CGuiObject::FindObject(memb, m_view->children);
00436                         if (gObj) 
00437                         {
00438                                 CRect rec = gObj->GetLocation();
00439                                 totalr.UnionRect(totalr, rec);
00440                         }
00441                 }
00442                 m_view->CommitTransaction();
00443         }
00444         catch(hresult_exception &e) 
00445         {
00446                 m_view->AbortTransaction(e.hr);
00447         }
00448 
00449         m_view->ZoomToFCOs(totalr);
00450         m_view->Invalidate();
00451 
00452 }
00453 
00454 void CGMEOLEModel::Scroll(long bar, long scroll) 
00455 {
00456         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::Scroll()\r\n");
00457 
00458         PRECONDITION_VALID_MODEL;
00459 
00460         UINT code = SB_LINEDOWN;
00461         switch (scroll)
00462         {
00463         case 0:
00464                 code = SB_LINEUP;
00465                 break;
00466         case 1: 
00467                 code = SB_LINEDOWN;
00468                 break;
00469         case 2:
00470                 code = SB_PAGEUP;
00471                 break;
00472         case 3: 
00473                 code = SB_PAGEDOWN;
00474                 break;
00475         case 4:
00476                 code = SB_TOP;
00477                 break;
00478         case 5:
00479                 code = SB_BOTTOM;
00480                 break;
00481         }
00482 
00483         if (bar == 0)
00484                 m_view->OnHScroll(code, 1, NULL);
00485         else
00486                 m_view->OnVScroll(code, 1, NULL);
00487 
00488         m_view->Invalidate();
00489 }
00490 
00491 HRESULT CGMEOLEModel::DumpModelGeometryXML(LPCTSTR filePath) 
00492 {
00493         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::DumpModelGeometryXML()\r\n");
00494 
00495         PRECONDITION_VALID_MODEL
00496 
00497         return m_view->DumpModelGeometryXML(filePath);
00498 }
00499 
00500 CString CGMEOLEModel::GetCurrentAspect(void) 
00501 {
00502         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::GetCurrentAspect()\r\n");
00503 
00504         PRECONDITION_VALID_MODEL
00505 
00506         return m_view->GetCurrentAspectName();
00507 }
00508 
00509 void CGMEOLEModel::SetCurrentAspect(const CString& aspectName) 
00510 {
00511         CGMEEventLogger::LogGMEEvent("CGMEOLEModel::SetCurrentAspect()\r\n");
00512 
00513         PRECONDITION_VALID_MODEL
00514 
00515         m_view->ChangeAspect(aspectName);
00516 }
00517 
00518 DELEGATE_DUAL_INTERFACE(CGMEOLEModel, Dual)
00519 
00520 // Implement ISupportErrorInfo to indicate we support the
00521 // OLE Automation error handler.
00522 IMPLEMENT_DUAL_ERRORINFO(CGMEOLEModel, __uuidof(IGMEOLEModel))
00523 
00524 
00525 STDMETHODIMP CGMEOLEModel::XDual::put_Active(VARIANT_BOOL isActive)
00526 {
00527         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00528 
00529         TRY_DUAL(__uuidof(IGMEOLEModel))
00530         {
00531                 pThis->SetActive(isActive);
00532                 return NOERROR;
00533         }
00534         CATCH_ALL_DUAL
00535 }
00536 
00537 STDMETHODIMP CGMEOLEModel::XDual::get_Active(VARIANT_BOOL* isActive)
00538 {
00539         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00540 
00541         TRY_DUAL(__uuidof(IGMEOLEModel))
00542         {
00543                 *isActive = (pThis->GetActive() == FALSE) ? VARIANT_FALSE : VARIANT_TRUE;
00544                 return NOERROR;
00545         }
00546         CATCH_ALL_DUAL
00547 }
00548 
00549 STDMETHODIMP CGMEOLEModel::XDual::get_Aspects(IGMEOLEColl** coll)
00550 {
00551         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00552 
00553         TRY_DUAL(__uuidof(IGMEOLEModel))
00554         {
00555                 LPDISPATCH lpDisp = pThis->GetAspects();
00556                 lpDisp->QueryInterface(__uuidof(IGMEOLEColl), (LPVOID*)coll);
00557                 return NOERROR;
00558         }
00559         CATCH_ALL_DUAL
00560 }
00561 
00562 STDMETHODIMP CGMEOLEModel::XDual::get_MgaModel(IMgaModel** model)
00563 {
00564         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00565 
00566         TRY_DUAL(__uuidof(IGMEOLEModel))
00567         {
00568                 LPDISPATCH lpDisp = pThis->GetMgaModel();
00569                 lpDisp->QueryInterface(__uuidof(IMgaModel), (LPVOID*)model);
00570                 return NOERROR;
00571         }
00572         CATCH_ALL_DUAL
00573 }
00574 
00575 STDMETHODIMP CGMEOLEModel::XDual::get_Valid(VARIANT_BOOL* isValid)
00576 {
00577         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00578 
00579         TRY_DUAL(__uuidof(IGMEOLEModel))
00580         {
00581                 *isValid = (pThis->GetValid() == FALSE) ? VARIANT_FALSE : VARIANT_TRUE;
00582                 return NOERROR;
00583         }
00584         CATCH_ALL_DUAL
00585 }
00586 
00587 STDMETHODIMP CGMEOLEModel::XDual::Print()
00588 {
00589         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00590 
00591         TRY_DUAL(__uuidof(IGMEOLEModel))
00592         {
00593                 pThis->Print();
00594                 return NOERROR;
00595         }
00596         CATCH_ALL_DUAL
00597 }
00598 
00599 STDMETHODIMP CGMEOLEModel::XDual::PrintDialog()
00600 {
00601         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00602 
00603         TRY_DUAL(__uuidof(IGMEOLEModel))
00604         {
00605                 pThis->PrintDialog();
00606                 return NOERROR;
00607         }
00608         CATCH_ALL_DUAL
00609 }
00610 
00611 
00612 STDMETHODIMP CGMEOLEModel::XDual::DumpWindowsMetaFile(BSTR filePath)
00613 {
00614         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00615 
00616         TRY_DUAL(__uuidof(IGMEOLEModel))
00617         {
00618                 pThis->DumpWindowsMetaFile(CString(filePath));
00619                 return NOERROR;
00620         }
00621         CATCH_ALL_DUAL
00622 }
00623 
00624 
00625 STDMETHODIMP CGMEOLEModel::XDual::CheckConstraints()
00626 {
00627         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00628 
00629         TRY_DUAL(__uuidof(IGMEOLEModel))
00630         {
00631                 pThis->CheckConstraints();
00632                 return NOERROR;
00633         }
00634         CATCH_ALL_DUAL
00635 }
00636 
00637 
00638 STDMETHODIMP CGMEOLEModel::XDual::RunComponent(BSTR appID)
00639 {
00640         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00641 
00642         TRY_DUAL(__uuidof(IGMEOLEModel))
00643         {
00644                 pThis->RunComponent(CString(appID));
00645                 return NOERROR;
00646         }
00647         CATCH_ALL_DUAL
00648 }
00649 
00650 
00651 STDMETHODIMP CGMEOLEModel::XDual::RunComponentDialog()
00652 {
00653         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00654 
00655         TRY_DUAL(__uuidof(IGMEOLEModel))
00656         {
00657                 pThis->RunComponentDialog();
00658                 return NOERROR;
00659         }
00660         CATCH_ALL_DUAL
00661 }
00662 
00663 
00664 STDMETHODIMP CGMEOLEModel::XDual::Close()
00665 {
00666         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00667 
00668         TRY_DUAL(__uuidof(IGMEOLEModel))
00669         {
00670                 pThis->Close();
00671                 return NOERROR;
00672         }
00673         CATCH_ALL_DUAL
00674 }
00675 
00676 
00677 STDMETHODIMP CGMEOLEModel::XDual::GrayOutFCO(VARIANT_BOOL bGray, VARIANT_BOOL bNeighbours, IMgaFCOs* mgaFCO)
00678 {
00679         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00680 
00681         TRY_DUAL(__uuidof(IGMEOLEModel))
00682         {
00683                 LPDISPATCH lpDisp = NULL;
00684                 mgaFCO->QueryInterface(IID_IDispatch, (LPVOID*)&lpDisp);
00685                 pThis->GrayOutFCO(bGray, bNeighbours, lpDisp);
00686                 lpDisp->Release();
00687                 return NOERROR;
00688         }
00689         CATCH_ALL_DUAL
00690 }
00691 
00692 
00693 STDMETHODIMP CGMEOLEModel::XDual::GrayOutHide()
00694 {
00695         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00696 
00697         TRY_DUAL(__uuidof(IGMEOLEModel))
00698         {
00699                 pThis->GrayOutHide();
00700                 return NOERROR;
00701         }
00702         CATCH_ALL_DUAL
00703 }
00704 
00705 STDMETHODIMP CGMEOLEModel::XDual::ShowSetMembers(IMgaFCO* mgaFCO)
00706 {
00707         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00708 
00709         TRY_DUAL(__uuidof(IGMEOLEModel))
00710         {
00711                 LPDISPATCH lpDisp = NULL;
00712                 mgaFCO->QueryInterface(IID_IDispatch, (LPVOID*)&lpDisp);
00713                 pThis->ShowSetMembers(lpDisp);
00714                 lpDisp->Release();
00715                 return NOERROR;
00716         }
00717         CATCH_ALL_DUAL
00718 }
00719 
00720 
00721 STDMETHODIMP CGMEOLEModel::XDual::HideSetMembers()
00722 {
00723         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00724 
00725         TRY_DUAL(__uuidof(IGMEOLEModel))
00726         {
00727                 pThis->HideSetMembers();
00728                 return NOERROR;
00729         }
00730         CATCH_ALL_DUAL
00731 }
00732 
00733 STDMETHODIMP CGMEOLEModel::XDual::Zoom(DWORD percent)
00734 {
00735         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00736 
00737         TRY_DUAL(__uuidof(IGMEOLEModel))
00738         {
00739                 pThis->Zoom(percent);
00740                 return NOERROR;
00741         }
00742         CATCH_ALL_DUAL
00743 }
00744 
00745 STDMETHODIMP CGMEOLEModel::XDual::ZoomTo(IMgaFCOs* mgaFCOs)
00746 {
00747         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00748 
00749         TRY_DUAL(__uuidof(IGMEOLEModel))
00750         {
00751                 pThis->ZoomTo(mgaFCOs);
00752                 return NOERROR;
00753         }
00754         CATCH_ALL_DUAL
00755 }
00756 
00757 STDMETHODIMP CGMEOLEModel::XDual::Scroll(bar_enum bar, scroll_enum scroll)
00758 {
00759         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00760 
00761         TRY_DUAL(__uuidof(IGMEOLEModel))
00762         {
00763                 pThis->Scroll(bar, scroll);
00764                 return NOERROR;
00765         }
00766         CATCH_ALL_DUAL
00767 }
00768 
00769 
00770 STDMETHODIMP CGMEOLEModel::XDual::DumpModelGeometryXML(BSTR filePath)
00771 {
00772         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00773 
00774         TRY_DUAL(__uuidof(IGMEOLEModel))
00775         {
00776                 return pThis->DumpModelGeometryXML(CString(filePath));
00777         }
00778         CATCH_ALL_DUAL
00779 }
00780 
00781 STDMETHODIMP CGMEOLEModel::XDual::GetCurrentAspect(BSTR* aspectName)
00782 {
00783         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00784 
00785         TRY_DUAL(__uuidof(IGMEOLEModel))
00786         {
00787                 CComBSTR string_asp = pThis->GetCurrentAspect();
00788                 *aspectName = string_asp.Detach();
00789                 return NOERROR;
00790         }
00791         CATCH_ALL_DUAL
00792 }
00793 
00794 STDMETHODIMP CGMEOLEModel::XDual::SetCurrentAspect(BSTR aspectName)
00795 {
00796         METHOD_PROLOGUE(CGMEOLEModel, Dual)
00797 
00798         TRY_DUAL(__uuidof(IGMEOLEModel))
00799         {
00800                 pThis->SetCurrentAspect(CString(aspectName));
00801                 return S_OK;
00802         }
00803         CATCH_ALL_DUAL
00804 }