GME  13
GMEOLEApp.cpp
Go to the documentation of this file.
00001 // GMEOLEApp.cpp : implementation file
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "gme.h"
00006 #include "parser.h"
00007 #include "GMEOLEApp.h"
00008 #include "GMEOLEError.h"
00009 #include "GMEApp.h"
00010 #include "GMEView.h"
00011 #include "GMEDoc.h"
00012 #include "MainFrm.h"
00013 #include "GMEVersion.h"
00014 #include "GMEOLEColl.h"
00015 #include "GMEOLEModel.h"
00016 #include "GMEOLEPanel.h"
00017 #include "GMEOLEIt.h"
00018 #include "GMEEventLogger.h"
00019 
00020 #ifdef _DEBUG
00021 #define new DEBUG_NEW
00022 #undef THIS_FILE
00023 static char THIS_FILE[] = __FILE__;
00024 #endif
00025 
00027 // CGMEOLEApp
00028 
00029 IMPLEMENT_DYNCREATE(CGMEOLEApp, CCmdTarget)
00030 
00031 CGMEOLEApp::CGMEOLEApp()
00032 {
00033         EnableAutomation();
00034         
00035         // To keep the application running as long as an OLE automation 
00036         //      object is active, the constructor calls AfxOleLockApp.
00037 
00038         AfxOleLockApp();
00039 }
00040 
00041 CGMEOLEApp::~CGMEOLEApp()
00042 {
00043         // To terminate the application when all objects created with
00044         //      with OLE automation, the destructor calls AfxOleUnlockApp.
00045 
00046         AfxOleUnlockApp();
00047 }
00048 
00049 
00050 void CGMEOLEApp::OnFinalRelease()
00051 {
00052         // When the last reference for an automation object is released
00053         // OnFinalRelease is called.  The base class will automatically
00054         // deletes the object.  Add additional cleanup required for your
00055         // object before calling the base class.
00056 
00057         CCmdTarget::OnFinalRelease();
00058 }
00059 
00060 
00061 BEGIN_MESSAGE_MAP(CGMEOLEApp, CCmdTarget)
00062         //{{AFX_MSG_MAP(CGMEOLEApp)
00063                 // NOTE - the ClassWizard will add and remove mapping macros here.
00064         //}}AFX_MSG_MAP
00065 END_MESSAGE_MAP()
00066 
00067 
00068 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00069 // comment by Zoltan Molnar: if you happen to enhance the public interface please make sure that 
00070 // the dispIDs (found in gme.idl) correspond with the order of macros in the dispatch map below
00071 // hint: always add to the tail of the DISPATCH_MAP
00072 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00073 BEGIN_DISPATCH_MAP(CGMEOLEApp, CCmdTarget)
00074         //{{AFX_DISPATCH_MAP(CGMEOLEApp)
00075         DISP_PROPERTY_EX(CGMEOLEApp, "Visible", GetVisible, SetVisible, VT_BOOL)
00076         DISP_PROPERTY_EX(CGMEOLEApp, "Version", GetVersion, SetVersion, VT_BSTR)
00077         DISP_PROPERTY_EX(CGMEOLEApp, "VersionMajor", GetVersionMajor, SetVersionMajor, VT_I2)
00078         DISP_PROPERTY_EX(CGMEOLEApp, "VersionMinor", GetVersionMinor, SetVersionMinor, VT_I2)
00079         DISP_PROPERTY_EX(CGMEOLEApp, "VersionPatchLevel", GetVersionPatchLevel, SetVersionPatchLevel, VT_I2)
00080         DISP_PROPERTY_EX(CGMEOLEApp, "Models", GetModels, SetModels, VT_DISPATCH)
00081         DISP_PROPERTY_EX(CGMEOLEApp, "MgaProject", GetMgaProject, SetMgaProject, VT_DISPATCH)
00082         DISP_PROPERTY_EX(CGMEOLEApp, "Panels", GetPanels, SetPanels, VT_DISPATCH)
00083         DISP_PROPERTY_EX(CGMEOLEApp, "ConsoleContents", GetConsoleContents, SetConsoleContents, VT_BSTR)
00084 
00085         DISP_FUNCTION(CGMEOLEApp, "CreateProject", CreateProject, VT_EMPTY, VTS_BSTR VTS_BSTR)
00086         DISP_FUNCTION(CGMEOLEApp, "OpenProject", OpenProject, VT_EMPTY, VTS_BSTR)
00087         DISP_FUNCTION(CGMEOLEApp, "CreateProjectDialog", CreateProjectDialog, VT_EMPTY, VTS_NONE)
00088         DISP_FUNCTION(CGMEOLEApp, "OpenProjectDialog", OpenProjectDialog, VT_EMPTY, VTS_NONE)
00089         DISP_FUNCTION(CGMEOLEApp, "CloseProject", CloseProject, VT_EMPTY, VTS_BOOL)
00090         DISP_FUNCTION(CGMEOLEApp, "SaveProject", SaveProject, VT_EMPTY, VTS_NONE)
00091         DISP_FUNCTION(CGMEOLEApp, "SaveProjectAs", SaveProjectAs, VT_EMPTY, VTS_BSTR)
00092         DISP_FUNCTION(CGMEOLEApp, "SaveProjectAsDialog", SaveProjectAsDialog, VT_EMPTY, VTS_NONE)
00093         DISP_FUNCTION(CGMEOLEApp, "ExportProject", ExportProject, VT_EMPTY, VTS_BSTR)
00094         DISP_FUNCTION(CGMEOLEApp, "ImportProject", ImportProject, VT_EMPTY, VTS_BSTR)
00095         DISP_FUNCTION(CGMEOLEApp, "ConstraintsDialog", ConstraintsDialog, VT_EMPTY, VTS_NONE)
00096         DISP_FUNCTION(CGMEOLEApp, "CheckAllConstraints", CheckAllConstraints, VT_EMPTY, VTS_NONE)
00097         DISP_FUNCTION(CGMEOLEApp, "RegisterParagimsDialog", RegisterParagimsDialog, VT_EMPTY, VTS_NONE)
00098         DISP_FUNCTION(CGMEOLEApp, "RegisterComponentsDialog", RegisterComponentsDialog, VT_EMPTY, VTS_NONE)
00099         DISP_FUNCTION(CGMEOLEApp, "RunComponent", RunComponent, VT_EMPTY, VTS_BSTR)
00100         DISP_FUNCTION(CGMEOLEApp, "RunComponentDialog", RunComponentDialog, VT_EMPTY, VTS_NONE)
00101         DISP_FUNCTION(CGMEOLEApp, "SettingsDialog", SettingsDialog, VT_EMPTY, VTS_NONE)
00102         DISP_FUNCTION(CGMEOLEApp, "Undo", Undo, VT_EMPTY, VTS_NONE)
00103         DISP_FUNCTION(CGMEOLEApp, "Redo", Redo, VT_EMPTY, VTS_NONE)
00104         DISP_FUNCTION(CGMEOLEApp, "ClearUndoQueue", ClearUndoQueue, VT_EMPTY, VTS_NONE)
00105         DISP_FUNCTION(CGMEOLEApp, "ProjectPropertiesDialog", ProjectPropertiesDialog, VT_EMPTY, VTS_NONE)
00106         DISP_FUNCTION(CGMEOLEApp, "ShowHelpContents", ShowHelpContents, VT_EMPTY, VTS_NONE)
00107         DISP_FUNCTION(CGMEOLEApp, "ShowAbout", ShowAbout, VT_EMPTY, VTS_NONE)
00108         DISP_FUNCTION(CGMEOLEApp, "ShowFCO", ShowFCO, VT_EMPTY, VTS_DISPATCH VTS_BOOL)
00109         DISP_FUNCTION(CGMEOLEApp, "ConsoleMessage", ConsoleMessage, VT_EMPTY, VTS_BSTR VTS_I4)
00110         DISP_FUNCTION(CGMEOLEApp, "ConsoleClear", ConsoleClear, VT_EMPTY, VTS_NONE)
00111         DISP_FUNCTION(CGMEOLEApp, "ConsoleNavigateTo", ConsoleNavigateTo, VT_EMPTY, VTS_BSTR)
00112 
00113         DISP_FUNCTION(CGMEOLEApp, "ChangeEditmode", ChangeEditmode, VT_EMPTY, VTS_I4)
00114         DISP_FUNCTION(CGMEOLEApp, "GridShow", GridShow, VT_EMPTY, VTS_BOOL)
00115         DISP_FUNCTION(CGMEOLEApp, "AttributepanelPage", AttributepanelPage, VT_EMPTY, VTS_I4)
00116 
00117         DISP_PROPERTY_EX(CGMEOLEApp, "OleIt", GetOleIt, SetOleIt, VT_DISPATCH)
00118 
00119         DISP_FUNCTION(CGMEOLEApp, "DisableComp", DisableComp, VT_EMPTY, VTS_BSTR VTS_BOOL)
00120         DISP_FUNCTION(CGMEOLEApp, "DisableCompForKinds", DisableCompForKinds, VT_EMPTY, VTS_BSTR VTS_BSTR)
00121         DISP_FUNCTION(CGMEOLEApp, "SetCompFiltering", SetCompFiltering, VT_EMPTY, VTS_BOOL)
00122         DISP_FUNCTION(CGMEOLEApp, "GetCompFiltering", GetCompFiltering, VT_BOOL, VTS_NONE)
00123         DISP_FUNCTION(CGMEOLEApp, "SetWorkingDirectory", SetWorkingDirectory, VT_EMPTY, VTS_BSTR)
00124         DISP_FUNCTION(CGMEOLEApp, "Exit", Exit, VT_EMPTY, VTS_NONE)
00125         DISP_FUNCTION(CGMEOLEApp, "RefreshLib", RefreshLib, VT_I4, VTS_BSTR VTS_BOOL)
00126 
00127         //}}AFX_DISPATCH_MAP
00128 END_DISPATCH_MAP()
00129 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00130 // if you modify the interface IGmeOleApp: please see comment above how to
00131 // keep in sync the DISPIDs (in gme.idl) and the order of DISP_FUNCTION macros
00132 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
00133 
00134 // Note: we add support for IID_IGMEOLEApp to support typesafe binding
00135 //  from VBA.  This IID must match the GUID that is attached to the 
00136 //  dispinterface in the .ODL file.
00137 
00138 // {81191A44-B898-4143-BF8B-CA7501FEC19A}
00139 //static const IID_IGMEOLEApp = 
00140 //{ 0x81191a44, 0xb898, 0x4143, { 0xbf, 0x8b, 0xca, 0x75, 0x1, 0xfe, 0xc1, 0x9a } };
00141 
00142 
00143 BEGIN_INTERFACE_MAP(CGMEOLEApp, CCmdTarget)
00144         INTERFACE_PART(CGMEOLEApp, __uuidof(IGMEOLEApp), Dual)
00145         DUAL_ERRORINFO_PART(CGMEOLEApp)
00146 END_INTERFACE_MAP()
00147 
00148 // Note: we use an own IMPLEMENT_OLECREATE macro here in order to register a REGCLS_SINGLEUSE class factory
00149 // For MDI OLE server's the default mechanism is REGCLS_MULTIPLEUSE (bMultiInstance == FALSE), but here we pass TRUE
00150 // For more explanation see: "How to use single or multiple instances of an OLE object in MFC by using Visual C++" KB article:
00151 // http://support.microsoft.com/kb/141154
00152 
00153 // The skeleton for this macro snippet was copied from MFC 9.0's afxdisp.h instead of the KB article's example
00154 // Then I set the bMultiInstance to TRUE
00155 #define MY_IMPLEMENT_OLECREATE(class_name, external_name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
00156         COleObjectFactory class_name::factory(class_name::guid, \
00157                 RUNTIME_CLASS(class_name), TRUE, _T(external_name)); \
00158         AFX_COMDAT const GUID class_name::guid = \
00159                 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }; \
00160 
00161 // {C7DCCC2E-1642-4a40-8060-51A7B9FAE488}
00162 MY_IMPLEMENT_OLECREATE(CGMEOLEApp, "GME.Application", 0xC7DCCC2E, 0x1642, 0x4a40, 0x80, 0x60, 0x51, 0xA7, 0xB9, 0xFA, 0xE4, 0x88)
00163 
00164 
00165 // CGMEOLEApp message handlers
00166 
00167 
00168 
00169 BOOL CGMEOLEApp::GetVisible() 
00170 {
00171         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetVisible()\r\n");
00172         
00173         // PRECONDITIONS: None
00174 
00175         return AfxGetMainWnd()->IsWindowVisible();
00176 }
00177 
00178 void CGMEOLEApp::SetVisible(BOOL bNewValue) 
00179 {
00180         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetVisible()\r\n");
00181         
00182         // PRECONDITIONS: None
00183 
00184         AfxGetMainWnd()->ShowWindow(bNewValue ? SW_SHOW : SW_HIDE);
00185 }
00186 
00187 void CGMEOLEApp::CreateProject(LPCTSTR metaname, LPCTSTR connstr) 
00188 {
00189         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::CreateProject() "+CString(metaname)+" "+CString(connstr)+"\r\n");
00190         
00191         PRECONDITION_NO_PROJECT
00192 
00193         theApp.CreateProject(metaname, connstr);
00194 }
00195 
00196 void CGMEOLEApp::OpenProject(LPCTSTR connstr) 
00197 {
00198         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::OpenProject() "+CString(connstr)+"\r\n");
00199         
00200         PRECONDITION_NO_PROJECT
00201 
00202         theApp.OpenProject(connstr);
00203 }
00204 
00205 void CGMEOLEApp::CreateProjectDialog() 
00206 {
00207         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::CreateProjectDialog()\r\n");
00208         
00209         PRECONDITION_NO_PROJECT
00210 
00211         theApp.OnFileNew();
00212 }
00213 
00214 void CGMEOLEApp::OpenProjectDialog() 
00215 {
00216         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::OpenProjectDialog()\r\n");
00217         
00218         PRECONDITION_NO_PROJECT
00219 
00220         theApp.OnFileOpen();
00221 }
00222 
00223 void CGMEOLEApp::CloseProject(BOOL saveOnClose) 
00224 {
00225         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::CloseProject()\r\n");
00226         
00227         PRECONDITION_ACTIVE_PROJECT
00228 
00229         if (saveOnClose == FALSE) {
00230                 theApp.OnFileAbortProject();
00231         }
00232         else {
00233                 theApp.OnFileCloseproject();
00234         }
00235 }
00236 
00237 void CGMEOLEApp::SaveProject() 
00238 {
00239         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SaveProject()\r\n");
00240 
00241         PRECONDITION_ACTIVE_REAL_MGA_PROJECT
00242 
00243         theApp.OnFileSave();
00244 }
00245 
00246 void CGMEOLEApp::SaveProjectAs(LPCTSTR connstr) 
00247 {
00248         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SaveProjectAs() "+CString(connstr)+"\r\n");
00249 
00250         PRECONDITION_ACTIVE_REAL_MGA_PROJECT
00251 
00252         theApp.SaveProject(connstr);
00253 }
00254 
00255 void CGMEOLEApp::SaveProjectAsDialog() 
00256 {
00257         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SaveProjectAsDialog()\r\n");
00258         
00259         PRECONDITION_ACTIVE_REAL_MGA_PROJECT
00260 
00261         theApp.OnFileSaveAs();
00262 }
00263 
00264 void CGMEOLEApp::ExportProject(LPCTSTR connstr) 
00265 {
00266         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ExportProject() "+CString(connstr)+"\r\n");
00267 
00268         PRECONDITION_ACTIVE_PROJECT
00269 
00270         try
00271         {
00272                 CComPtr<IMgaDumper> dumper;
00273                 COMTHROW( dumper.CoCreateInstance(L"Mga.MgaDumper") );
00274                 ASSERT( dumper != NULL );
00275 
00276                 COMTHROW( dumper->DumpProject(theApp.mgaProject,PutInBstr(CString(connstr))) );
00277 
00278         }
00279         catch (hresult_exception &){
00280 
00281         }
00282 }
00283 
00284 void CGMEOLEApp::ImportProject(LPCTSTR connstr) 
00285 {
00286         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ImportProject() "+CString(connstr)+"\r\n");
00287 
00288         PRECONDITION_ACTIVE_PROJECT
00289 
00290         try
00291         {
00292                 CComPtr<IMgaParser> parser;
00293                 COMTHROW( parser.CoCreateInstance(L"Mga.MgaParser") );
00294                 ASSERT( parser != NULL );
00295 
00296                 if(theApp.mgaConstMgr) COMTHROW(theApp.mgaConstMgr->Enable(false));
00297 
00298                 IMgaParser2Ptr parser2 = (IMgaParser*)parser;
00299                 if (parser2 && theApp.m_pMainWnd)
00300                         COMTHROW(parser2->ParseProject2(theApp.mgaProject,PutInBstr(CString(connstr)), (ULONGLONG)(theApp.m_pMainWnd->GetSafeHwnd())));
00301                 else
00302                         COMTHROW(parser->ParseProject(theApp.mgaProject,PutInBstr(CString(connstr))) );
00303 
00304         }
00305         catch (hresult_exception &){
00306 
00307         }
00308         if (theApp.mgaConstMgr) COMTHROW(theApp.mgaConstMgr->Enable(true));
00309 }
00310 
00311 void CGMEOLEApp::ConstraintsDialog() 
00312 {
00313         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ConstraintsDialog()\r\n");
00314 
00315         PRECONDITION_ACTIVE_CONSTMGR    
00316 
00317         theApp.OnFileDisplayConstraints();
00318 }
00319 
00320 void CGMEOLEApp::CheckAllConstraints() 
00321 {
00322         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::CheckAllConstraints()\r\n");
00323 
00324         PRECONDITION_ACTIVE_CONSTMGR
00325 
00326         theApp.OnFileCheckall();
00327 }
00328 
00329 
00330 void CGMEOLEApp::RegisterParagimsDialog() 
00331 {
00332         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::RegisterParagimsDialog()\r\n");
00333 
00334         // PRECONDITIONS: None
00335 
00336         theApp.OnFileRegparadigms();
00337 }
00338 
00339 void CGMEOLEApp::RegisterComponentsDialog() 
00340 {
00341         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::RegisterComponentsDialog()\r\n");
00342 
00343         PRECONDITION_ACTIVE_PROJECT
00344 
00345         theApp.OnFileRegcomponents();
00346 }
00347 
00348 
00349 void CGMEOLEApp::RunComponent(LPCTSTR progID) 
00350 {
00351         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::RunComponent() "+CString(progID)+"\r\n");
00352 
00353         PRECONDITION_ACTIVE_PROJECT
00354 
00355         CString compname(progID);
00356         theApp.RunComponent(compname);
00357 }
00358 
00359 
00360 void CGMEOLEApp::RunComponentDialog() 
00361 {
00362         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::RunComponentDialog()\r\n");
00363 
00364         PRECONDITION_ACTIVE_PROJECT
00365 
00366         CString compname;
00367         theApp.RunComponent(compname);
00368 }
00369 
00370 void CGMEOLEApp::SettingsDialog() 
00371 {
00372         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SettingsDialog()\r\n");
00373 
00374         // PRECONDITIONS: None
00375 
00376         theApp.OnFileSettings();
00377 }
00378 
00379 
00380 void CGMEOLEApp::Undo() 
00381 {
00382         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::Undo()\r\n");
00383 
00384         PRECONDITION_ACTIVE_PROJECT
00385 
00386         theApp.OnEditUndo();
00387 }
00388 
00389 
00390 void CGMEOLEApp::Redo() 
00391 {
00392         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::Redo()\r\n");
00393 
00394         PRECONDITION_ACTIVE_PROJECT
00395 
00396         theApp.OnEditRedo();
00397 }
00398 
00399 
00400 void CGMEOLEApp::ClearUndoQueue() 
00401 {
00402         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ClearUndoQueue()\r\n");
00403 
00404         PRECONDITION_ACTIVE_PROJECT
00405 
00406         theApp.OnEditClearUndo();
00407 }
00408 
00409 
00410 void CGMEOLEApp::ProjectPropertiesDialog() 
00411 {
00412         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ProjectPropertiesDialog()\r\n");
00413 
00414         PRECONDITION_ACTIVE_PROJECT
00415 
00416         theApp.OnEditProjectproperties();
00417 }
00418 
00419 void CGMEOLEApp::ShowHelpContents() 
00420 {
00421         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ShowHelpContents()\r\n");
00422 
00423         // PRECONDITIONS: None
00424 
00425         theApp.OnHelpContents();
00426 }
00427 
00428 void CGMEOLEApp::ShowAbout() 
00429 {
00430         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ShowAbout()\r\n");
00431 
00432         // PRECONDITIONS: None
00433 
00434         theApp.OnAppAbout();
00435 }
00436 
00437 BSTR CGMEOLEApp::GetVersion() 
00438 {
00439         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetVersion()\r\n");
00440 
00441         // PRECONDITIONS: None
00442 
00443         CString strResult(GME_VERSION_STR);
00444         return strResult.AllocSysString();
00445 }
00446 
00447 void CGMEOLEApp::SetVersion(LPCTSTR) 
00448 {
00449         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetVersion()\r\n");
00450 
00451         SetNotSupported();
00452 }
00453 
00454 short CGMEOLEApp::GetVersionMajor() 
00455 {
00456         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetVersionMajor()\r\n");
00457 
00458         // PRECONDITIONS: None
00459 
00460         return GME_VERSION_MAJOR;
00461 }
00462 
00463 void CGMEOLEApp::SetVersionMajor(short) 
00464 {
00465         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetVersionMajor()\r\n");
00466 
00467         SetNotSupported();
00468 }
00469 
00470 short CGMEOLEApp::GetVersionMinor() 
00471 {
00472         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetVersionMinor()\r\n");
00473 
00474         // PRECONDITIONS: None
00475 
00476         return GME_VERSION_MINOR;
00477 }
00478 
00479 void CGMEOLEApp::SetVersionMinor(short) 
00480 {
00481         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetVersionMinor()\r\n");
00482 
00483         SetNotSupported();
00484 }
00485 
00486 short CGMEOLEApp::GetVersionPatchLevel() 
00487 {
00488         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetVersionPatchLevel()\r\n");
00489 
00490         // PRECONDITIONS: None
00491 
00492         return GME_VERSION_PLEVEL;
00493 }
00494 
00495 void CGMEOLEApp::SetVersionPatchLevel(short) 
00496 {
00497         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetVersionPatchLevel()\r\n");
00498 
00499         SetNotSupported();
00500 }
00501 
00502 
00503 void CGMEOLEApp::ShowFCO(LPDISPATCH mgaFCO, BOOL inParent) 
00504 {
00505         try {
00506                 CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ShowFCO()\r\n");
00507 
00508                 PRECONDITION_ACTIVE_PROJECT
00509 
00510                 // JIRA GME-219, CGMEView::OnInitialUpdate would throw this anyway
00511                 long status;
00512                 COMTHROW(theApp.mgaProject->get_ProjectStatus(&status));
00513                 bool inTrans = (status & 0x08L) != 0;
00514                 if (inTrans)
00515                         COMTHROW(E_MGA_ALREADY_IN_TRANSACTION);
00516 
00517                 if (CGMEDoc::theInstance) {
00518                         CGMEDoc::theInstance->ShowObject(mgaFCO, inParent);
00519                 }
00520         } catch (const hresult_exception& e) {
00521                 AfxThrowOleException(e.hr);
00522         }
00523 }
00524 
00525 LPDISPATCH CGMEOLEApp::GetModels() 
00526 {
00527         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetModels()\r\n");
00528 
00529         PRECONDITION_ACTIVE_PROJECT
00530 
00531         CGMEOLEColl* coll = new CGMEOLEColl();
00532 
00533         if (CGMEDoc::theInstance) {
00534                 POSITION pos = CGMEDoc::theInstance->GetFirstViewPosition();
00535                 while (pos) {
00536                         CGMEView* view = (CGMEView*)(CGMEDoc::theInstance->GetNextView(pos));
00537                         ASSERT(view);
00538                         CGMEOLEModel* model = new CGMEOLEModel();
00539                         model->SetView(view);
00540                         coll->Add(model->GetIDispatch(FALSE));
00541                         model->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00542                 }
00543         }
00544 
00545         return coll->GetIDispatch(FALSE);
00546 }
00547 
00548 void CGMEOLEApp::SetModels(LPDISPATCH) 
00549 {
00550         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetModels()\r\n");
00551 
00552         SetNotSupported();
00553 }
00554 
00555 void CGMEOLEApp::ChangeEditmode(long mode)
00556 {
00557         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ChangeEditmode()\r\n");
00558         if (CGMEDoc::theInstance) 
00559                 CGMEDoc::theInstance->SetMode(mode);
00560 }
00561 
00562 void CGMEOLEApp::GridShow(BOOL show)
00563 {
00564         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GridShow()\r\n");
00565         CMDIChildWnd *pChild  = CMainFrame::theInstance->MDIGetActive();
00566         if (pChild) 
00567         {
00568 #if !defined (ACTIVEXGMEVIEW)
00569                 CGMEView *view = (CGMEView*)pChild->GetActiveView();
00570                 if (view) 
00571                         view->ShowGrid(show==TRUE);
00572 #endif
00573         }
00574 }
00575 
00576 void CGMEOLEApp::AttributepanelPage(long page)
00577 {
00578         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::AttributepanelPage()\r\n");
00579         CGMEObjectInspector::theInstance->ShowPanel(page);
00580 }
00581 
00582 
00583 LPDISPATCH CGMEOLEApp::GetMgaProject() 
00584 {
00585         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetMgaProject()\r\n");
00586 
00587         // PRECONDITIONS: None
00588 
00589         LPDISPATCH ret = nullptr;
00590         if (theApp.mgaProject)
00591         {
00592                 theApp.mgaProject->QueryInterface(IID_IDispatch, (void**)&ret);
00593         }
00594         return ret;
00595 }
00596 
00597 void CGMEOLEApp::SetMgaProject(LPDISPATCH) 
00598 {
00599         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetMgaProject()\r\n");
00600 
00601         SetNotSupported();
00602 }
00603 
00604 LPDISPATCH CGMEOLEApp::GetOleIt() 
00605 {
00606         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetOleIt()\r\n");
00607 
00608         // PRECONDITIONS: None
00609 
00610         CGMEOLEIt* opened = new CGMEOLEIt();
00611         LPDISPATCH rr = opened->GetIDispatch( FALSE);
00612 
00613         return rr;
00614 }
00615 
00616 void CGMEOLEApp::SetOleIt(LPDISPATCH) 
00617 {
00618         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetOleIt()\r\n");
00619 
00620         SetNotSupported();
00621 }
00622 
00623 LPDISPATCH CGMEOLEApp::GetPanels() 
00624 {
00625         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetPanels()\r\n");
00626 
00627         // PRECONDITIONS: None
00628 
00629         CGMEOLEColl* coll = new CGMEOLEColl();
00630 
00631         CGMEOLEPanel* panel = new CGMEOLEPanel();
00632         panel->SetParams( &CMainFrame::theInstance->m_browser, _T("Browser"), CMainFrame::theInstance->m_browser.GetInterface());
00633         coll->Add(panel->GetIDispatch(FALSE));
00634         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00635 
00636         panel = new CGMEOLEPanel();
00637         panel->SetParams( &CMainFrame::theInstance->m_objectInspector, _T("Attribute Panel"), CMainFrame::theInstance->m_objectInspector.GetInterface());
00638         coll->Add(panel->GetIDispatch(FALSE));
00639         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00640 
00641         panel = new CGMEOLEPanel();
00642         panel->SetParams( &CMainFrame::theInstance->m_console, _T("Console"), CMainFrame::theInstance->m_console.GetInterface());
00643         coll->Add(panel->GetIDispatch(FALSE));
00644         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00645 
00646         panel = new CGMEOLEPanel();
00647         panel->SetParams( &CMainFrame::theInstance->m_partBrowser, _T("Part Browser"), CMainFrame::theInstance->m_partBrowser.GetInterface());
00648         coll->Add(panel->GetIDispatch(FALSE));
00649         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00650 
00651         // terge 
00652         panel = new CGMEOLEPanel();
00653         panel->SetParams( &CMainFrame::theInstance->m_panningWindow, _T("Panning Window"), CMainFrame::theInstance->m_panningWindow.GetInterface());
00654         coll->Add(panel->GetIDispatch(FALSE));
00655         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00656 
00657         panel = new CGMEOLEPanel();
00658         panel->SetParams( &CMainFrame::theInstance->m_wndStatusBar, _T("Status Bar"));
00659         coll->Add(panel->GetIDispatch(FALSE));
00660         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00661 
00662         panel = new CGMEOLEPanel();
00663         panel->SetParams( &CMainFrame::theInstance->m_wndToolBarMain, _T("Main Toolbar"));
00664         coll->Add(panel->GetIDispatch(FALSE));
00665         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00666 
00667         panel = new CGMEOLEPanel();
00668         panel->SetParams( &CMainFrame::theInstance->m_wndToolBarModeling, _T("Modeling Toolbar"));
00669         coll->Add(panel->GetIDispatch(FALSE));
00670         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00671 
00672         panel = new CGMEOLEPanel();
00673         panel->SetParams( &CMainFrame::theInstance->m_wndToolBarWins, _T("Window Toolbar"));
00674         coll->Add(panel->GetIDispatch(FALSE));
00675         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00676 
00677         panel = new CGMEOLEPanel();
00678         panel->SetParams( &CMainFrame::theInstance->m_wndComponentBar, _T("Component Toolbar"));
00679         coll->Add(panel->GetIDispatch(FALSE));
00680         panel->GetIDispatch(FALSE)->Release();  // We do not hold reference, hopefully the collection will hold one
00681 
00682         return coll->GetIDispatch(FALSE);
00683 }
00684 
00685 void CGMEOLEApp::SetPanels(LPDISPATCH) 
00686 {
00687         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetPanels()\r\n");
00688 
00689         SetNotSupported();
00690 }
00691 
00692 BSTR CGMEOLEApp::GetConsoleContents() 
00693 {
00694         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetConsoleContents()\r\n");
00695         
00696         // PRECONDITIONS: None
00697 
00698         CString str = CMainFrame::theInstance->m_console.GetContents();
00699         
00700         return str.AllocSysString();
00701 }
00702 
00703 void CGMEOLEApp::SetConsoleContents(LPCTSTR contents) 
00704 {
00705         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetConsoleContents("+CString(contents)+")\r\n");
00706         
00707         // PRECONDITIONS: None
00708 
00709         CMainFrame::theInstance->m_console.SetContents(contents);
00710 }
00711 
00712 void CGMEOLEApp::ConsoleMessage(LPCTSTR msg, long type)
00713 {
00714         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ConsoleMessage("+CString(msg)+")\r\n");
00715         
00716         // PRECONDITIONS: None
00717 
00718         CMainFrame::theInstance->m_console.Message(msg, (short)type);
00719 }
00720 
00721 void CGMEOLEApp::ConsoleClear()
00722 {
00723         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ConsoleClear()\r\n");
00724         
00725         // PRECONDITIONS: None
00726 
00727         CMainFrame::theInstance->m_console.Clear();
00728 }
00729 
00730 void CGMEOLEApp::ConsoleNavigateTo(LPCTSTR url)
00731 {
00732         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::ConsoleNavigateTo("+CString(url)+")\r\n");
00733         
00734         // PRECONDITIONS: None
00735 
00736         CMainFrame::theInstance->m_console.NavigateTo(url);
00737 }
00738 
00739 void CGMEOLEApp::DisableComp(LPCTSTR pCompName, BOOL pDisable)
00740 {
00741         // this method allows user added components to be disabled
00742         // thus preventing their launch at inappropriate time
00743         // it is not equivalent with "Toggle", since that removes
00744         // a component from the possible list of interpreters/plugins
00745         // and that state is saved and used across several GME sessions
00746         // in contrast this disable mechanism is not saves between
00747         // separate GME sessions
00748         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::DisableComp()\r\n");
00749         theApp.DisableComp( pCompName, pDisable == TRUE);
00750 }
00751 
00752 void CGMEOLEApp::DisableCompForKinds( LPCTSTR pCompName, LPCTSTR pKindNameSeq)
00753 {
00754         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::DisableCompForKinds()\r\n");
00755         theApp.DisableCompForKinds( pCompName, pKindNameSeq);
00756 }
00757 
00758 void CGMEOLEApp::SetCompFiltering( BOOL pOn)
00759 {
00760         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetCompFiltering()\r\n");
00761         return theApp.SetCompFiltering( pOn == TRUE);
00762 }
00763 
00764 BOOL CGMEOLEApp::GetCompFiltering()
00765 {
00766         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::GetCompFiltering()\r\n");
00767         return theApp.GetCompFiltering();
00768 }
00769 
00770 void CGMEOLEApp::SetWorkingDirectory( LPCTSTR pPath)
00771 {
00772         CGMEEventLogger::LogGMEEvent("CGMEOLEApp::SetWorkingDirectory()\r\n");
00773         bool rv = theApp.SetWorkingDirectory( pPath);
00774         if( !rv) throw CString("Error happened");
00775 }
00776 
00777 void CGMEOLEApp::Exit()
00778 {
00779         theApp.CloseProject(false);
00780         // n.b. Post here, since this call could be out-of-proc, and it won't succeed 
00781         // if TerminateProcess is called
00782         CMainFrame::theInstance->PostMessage(WM_CLOSE, 0, 0);
00783 }
00784 
00785 long CGMEOLEApp::RefreshLib( LPCTSTR pLibName, BOOL pUngroup)
00786 {
00787         return 0;
00788 }
00789 
00790 DELEGATE_DUAL_INTERFACE(CGMEOLEApp, Dual)
00791 
00792 // Implement ISupportErrorInfo to indicate we support the
00793 // OLE Automation error handler.
00794 IMPLEMENT_DUAL_ERRORINFO(CGMEOLEApp, __uuidof(IGMEOLEApp))
00795 
00796 STDMETHODIMP CGMEOLEApp::XDual::put_Visible( VARIANT_BOOL isVisible)
00797 {
00798         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00799 
00800         TRY_DUAL(__uuidof(IGMEOLEApp))
00801         {
00802                 pThis->SetVisible(isVisible);
00803                 return NOERROR;
00804         }
00805         CATCH_ALL_DUAL
00806 }
00807 
00808 
00809 STDMETHODIMP CGMEOLEApp::XDual::get_Visible( VARIANT_BOOL* isVisible)
00810 {
00811         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00812 
00813         TRY_DUAL(__uuidof(IGMEOLEApp))
00814         {
00815                 *isVisible = (pThis->GetVisible() == FALSE) ? VARIANT_FALSE : VARIANT_TRUE;
00816                 return NOERROR;
00817         }
00818         CATCH_ALL_DUAL
00819 }
00820 
00821 STDMETHODIMP CGMEOLEApp::XDual::get_Version( BSTR* versionStr)
00822 {
00823         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00824 
00825         TRY_DUAL(__uuidof(IGMEOLEApp))
00826         {
00827                 // CString str = pThis->GetVersion();
00828                 // str.SetSysString(versionStr);
00829                 *versionStr = pThis->GetVersion();
00830                 return NOERROR;
00831         }
00832         CATCH_ALL_DUAL
00833 }
00834 
00835 STDMETHODIMP CGMEOLEApp::XDual::get_VersionMajor( short* n)
00836 {
00837         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00838 
00839         TRY_DUAL(__uuidof(IGMEOLEApp))
00840         {
00841                 *n = pThis->GetVersionMajor();
00842                 return NOERROR;
00843         }
00844         CATCH_ALL_DUAL
00845 }
00846 
00847 STDMETHODIMP CGMEOLEApp::XDual::get_VersionMinor( short* n)
00848 {
00849         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00850 
00851         TRY_DUAL(__uuidof(IGMEOLEApp))
00852         {
00853                 *n = pThis->GetVersionMinor();
00854                 return NOERROR;
00855         }
00856         CATCH_ALL_DUAL
00857 }
00858 
00859 STDMETHODIMP CGMEOLEApp::XDual::get_VersionPatchLevel( short* n)
00860 {
00861         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00862 
00863         TRY_DUAL(__uuidof(IGMEOLEApp))
00864         {
00865                 *n = pThis->GetVersionPatchLevel();
00866                 return NOERROR;
00867         }
00868         CATCH_ALL_DUAL
00869 }
00870 
00871 STDMETHODIMP CGMEOLEApp::XDual::get_Models( IGMEOLEColl** coll)
00872 {
00873         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00874 
00875         TRY_DUAL(__uuidof(IGMEOLEApp))
00876         {
00877                 LPDISPATCH lpDisp = pThis->GetModels();
00878                 lpDisp->QueryInterface(__uuidof(IGMEOLEColl), (LPVOID*)coll);
00879                 return NOERROR;
00880         }
00881         CATCH_ALL_DUAL
00882 }
00883 
00884 STDMETHODIMP CGMEOLEApp::XDual::get_MgaProject( IMgaProject** project)
00885 {
00886         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00887 
00888         TRY_DUAL(__uuidof(IGMEOLEApp))
00889         {
00890                 LPDISPATCH lpDisp = pThis->GetMgaProject();
00891                 lpDisp->QueryInterface(__uuidof(IMgaProject), (LPVOID*)project);
00892                 return NOERROR;
00893         }
00894         CATCH_ALL_DUAL
00895 }
00896 
00897 STDMETHODIMP CGMEOLEApp::XDual::get_OleIt( IGMEOLEIt** model)
00898 {
00899         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00900 
00901         TRY_DUAL(__uuidof(IGMEOLEApp))
00902         {
00903                 LPDISPATCH lpDisp = pThis->GetOleIt();
00904                 lpDisp->QueryInterface(__uuidof(IGMEOLEIt), (LPVOID*)model);
00905                 lpDisp->Release();
00906                 return NOERROR;
00907         }
00908         CATCH_ALL_DUAL
00909 }
00910 
00911 STDMETHODIMP CGMEOLEApp::XDual::get_Panels( IGMEOLEColl** coll)
00912 {
00913         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00914 
00915         TRY_DUAL(__uuidof(IGMEOLEApp))
00916         {
00917                 LPDISPATCH lpDisp = pThis->GetPanels();
00918                 lpDisp->QueryInterface(__uuidof(IGMEOLEColl), (LPVOID*)coll);
00919                 lpDisp->Release();
00920                 return NOERROR;
00921         }
00922         CATCH_ALL_DUAL
00923 }
00924 
00925 STDMETHODIMP CGMEOLEApp::XDual::get_ConsoleContents( BSTR* contents)
00926 {
00927         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00928 
00929         TRY_DUAL(__uuidof(IGMEOLEApp))
00930         {
00931                 *contents = pThis->GetConsoleContents();
00932                 return NOERROR;
00933         }
00934         CATCH_ALL_DUAL
00935 }
00936 
00937 
00938 STDMETHODIMP CGMEOLEApp::XDual::put_ConsoleContents( BSTR contents)
00939 {
00940         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00941 
00942         TRY_DUAL(__uuidof(IGMEOLEApp))
00943         {
00944                 pThis->SetConsoleContents(CString(contents));
00945                 return NOERROR;
00946         }
00947         CATCH_ALL_DUAL
00948 }
00949 
00950 STDMETHODIMP CGMEOLEApp::XDual::CreateProject( BSTR metaname, BSTR connstr)
00951 {
00952         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00953 
00954         TRY_DUAL(__uuidof(IGMEOLEApp))
00955         {
00956                 pThis->CreateProject(CString(metaname), CString(connstr));
00957                 return NOERROR;
00958         }
00959         CATCH_ALL_DUAL
00960 }
00961 
00962 STDMETHODIMP CGMEOLEApp::XDual::OpenProject( BSTR connstr)
00963 {
00964         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00965 
00966         TRY_DUAL(__uuidof(IGMEOLEApp))
00967         {
00968                 pThis->OpenProject(CString(connstr));
00969                 return NOERROR;
00970         }
00971         CATCH_ALL_DUAL
00972 }
00973 
00974 STDMETHODIMP CGMEOLEApp::XDual::CreateProjectDialog()
00975 {
00976         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00977 
00978         TRY_DUAL(__uuidof(IGMEOLEApp))
00979         {
00980                 pThis->CreateProjectDialog();
00981                 return NOERROR;
00982         }
00983         CATCH_ALL_DUAL
00984 }
00985 
00986 STDMETHODIMP CGMEOLEApp::XDual::OpenProjectDialog()
00987 {
00988         METHOD_PROLOGUE(CGMEOLEApp, Dual)
00989 
00990         TRY_DUAL(__uuidof(IGMEOLEApp))
00991         {
00992                 pThis->OpenProjectDialog();
00993                 return NOERROR;
00994         }
00995         CATCH_ALL_DUAL
00996 }
00997 
00998 STDMETHODIMP CGMEOLEApp::XDual::CloseProject( VARIANT_BOOL saveOnClose)
00999 {
01000         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01001 
01002         TRY_DUAL(__uuidof(IGMEOLEApp))
01003         {
01004                 pThis->CloseProject(saveOnClose);
01005                 return NOERROR;
01006         }
01007         CATCH_ALL_DUAL
01008 }
01009 
01010 STDMETHODIMP CGMEOLEApp::XDual::SaveProject()
01011 {
01012         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01013 
01014         TRY_DUAL(__uuidof(IGMEOLEApp))
01015         {
01016                 pThis->SaveProject();
01017                 return NOERROR;
01018         }
01019         CATCH_ALL_DUAL
01020 }
01021 
01022 
01023 STDMETHODIMP CGMEOLEApp::XDual::SaveProjectAs( BSTR connstr)
01024 {
01025         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01026 
01027         TRY_DUAL(__uuidof(IGMEOLEApp))
01028         {
01029                 pThis->SaveProjectAs(CString(connstr));
01030                 return NOERROR;
01031         }
01032         CATCH_ALL_DUAL
01033 }
01034 
01035 STDMETHODIMP CGMEOLEApp::XDual::SaveProjectAsDialog()
01036 {
01037         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01038 
01039         TRY_DUAL(__uuidof(IGMEOLEApp))
01040         {
01041                 pThis->SaveProjectAsDialog();
01042                 return NOERROR;
01043         }
01044         CATCH_ALL_DUAL
01045 }
01046 
01047 
01048 STDMETHODIMP CGMEOLEApp::XDual::ExportProject( BSTR connstr)
01049 {
01050         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01051 
01052         TRY_DUAL(__uuidof(IGMEOLEApp))
01053         {
01054                 pThis->ExportProject(CString(connstr));
01055                 return NOERROR;
01056         }
01057         CATCH_ALL_DUAL
01058 }
01059 
01060 STDMETHODIMP CGMEOLEApp::XDual::ImportProject( BSTR connstr)
01061 {
01062         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01063 
01064         TRY_DUAL(__uuidof(IGMEOLEApp))
01065         {
01066                 pThis->ImportProject(CString(connstr));
01067                 return NOERROR;
01068         }
01069         CATCH_ALL_DUAL
01070 }
01071 
01072 STDMETHODIMP CGMEOLEApp::XDual::ConstraintsDialog()
01073 {
01074         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01075 
01076         TRY_DUAL(__uuidof(IGMEOLEApp))
01077         {
01078                 pThis->ConstraintsDialog();
01079                 return NOERROR;
01080         }
01081         CATCH_ALL_DUAL
01082 }
01083 
01084 
01085 STDMETHODIMP CGMEOLEApp::XDual::CheckAllConstraints()
01086 {
01087         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01088 
01089         TRY_DUAL(__uuidof(IGMEOLEApp))
01090         {
01091                 pThis->CheckAllConstraints();
01092                 return NOERROR;
01093         }
01094         CATCH_ALL_DUAL
01095 }
01096 
01097 
01098 STDMETHODIMP CGMEOLEApp::XDual::RegisterParagimsDialog()
01099 {
01100         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01101 
01102         TRY_DUAL(__uuidof(IGMEOLEApp))
01103         {
01104                 pThis->RegisterParagimsDialog();
01105                 return NOERROR;
01106         }
01107         CATCH_ALL_DUAL
01108 }
01109 
01110 
01111 STDMETHODIMP CGMEOLEApp::XDual::RegisterComponentsDialog()
01112 {
01113         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01114 
01115         TRY_DUAL(__uuidof(IGMEOLEApp))
01116         {
01117                 pThis->RegisterComponentsDialog();
01118                 return NOERROR;
01119         }
01120         CATCH_ALL_DUAL
01121 }
01122 
01123 
01124 STDMETHODIMP CGMEOLEApp::XDual::RunComponent( BSTR progID)
01125 {
01126         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01127 
01128         TRY_DUAL(__uuidof(IGMEOLEApp))
01129         {
01130                 pThis->RunComponent(CString(progID));
01131                 return NOERROR;
01132         }
01133         CATCH_ALL_DUAL
01134 }
01135 
01136 
01137 STDMETHODIMP CGMEOLEApp::XDual::RunComponentDialog()
01138 {
01139         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01140 
01141         TRY_DUAL(__uuidof(IGMEOLEApp))
01142         {
01143                 pThis->RunComponentDialog();
01144                 return NOERROR;
01145         }
01146         CATCH_ALL_DUAL
01147 }
01148 
01149 
01150 STDMETHODIMP CGMEOLEApp::XDual::SettingsDialog()
01151 {
01152         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01153 
01154         TRY_DUAL(__uuidof(IGMEOLEApp))
01155         {
01156                 pThis->SettingsDialog();
01157                 return NOERROR;
01158         }
01159         CATCH_ALL_DUAL
01160 }
01161 
01162 
01163 STDMETHODIMP CGMEOLEApp::XDual::Undo()
01164 {
01165         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01166 
01167         TRY_DUAL(__uuidof(IGMEOLEApp))
01168         {
01169                 pThis->Undo();
01170                 return NOERROR;
01171         }
01172         CATCH_ALL_DUAL
01173 }
01174 
01175 
01176 STDMETHODIMP CGMEOLEApp::XDual::Redo()
01177 {
01178         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01179 
01180         TRY_DUAL(__uuidof(IGMEOLEApp))
01181         {
01182                 pThis->Redo();
01183                 return NOERROR;
01184         }
01185         CATCH_ALL_DUAL
01186 }
01187 
01188 
01189 STDMETHODIMP CGMEOLEApp::XDual::ClearUndoQueue()
01190 {
01191         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01192 
01193         TRY_DUAL(__uuidof(IGMEOLEApp))
01194         {
01195                 pThis->ClearUndoQueue();
01196                 return NOERROR;
01197         }
01198         CATCH_ALL_DUAL
01199 }
01200 
01201 
01202 STDMETHODIMP CGMEOLEApp::XDual::ProjectPropertiesDialog()
01203 {
01204         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01205 
01206         TRY_DUAL(__uuidof(IGMEOLEApp))
01207         {
01208                 pThis->ProjectPropertiesDialog();
01209                 return NOERROR;
01210         }
01211         CATCH_ALL_DUAL
01212 }
01213 
01214 
01215 STDMETHODIMP CGMEOLEApp::XDual::ShowHelpContents()
01216 {
01217         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01218 
01219         TRY_DUAL(__uuidof(IGMEOLEApp))
01220         {
01221                 pThis->ShowHelpContents();
01222                 return NOERROR;
01223         }
01224         CATCH_ALL_DUAL
01225 }
01226 
01227 
01228 STDMETHODIMP CGMEOLEApp::XDual::ShowAbout()
01229 {
01230         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01231 
01232         TRY_DUAL(__uuidof(IGMEOLEApp))
01233         {
01234                 pThis->ShowAbout();
01235                 return NOERROR;
01236         }
01237         CATCH_ALL_DUAL
01238 }
01239 
01240 
01241 STDMETHODIMP CGMEOLEApp::XDual::ShowFCO( IMgaFCO* mgaFCO, VARIANT_BOOL inParent)
01242 {
01243         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01244 
01245         TRY_DUAL(__uuidof(IGMEOLEApp))
01246         {
01247                 LPDISPATCH lpDisp = NULL;
01248                 mgaFCO->QueryInterface(IID_IDispatch, (LPVOID*)&lpDisp);
01249                 pThis->ShowFCO(lpDisp, inParent);
01250                 lpDisp->Release();
01251                 return NOERROR;
01252         }
01253         CATCH_ALL_DUAL
01254 }
01255 
01256 STDMETHODIMP CGMEOLEApp::XDual::ConsoleMessage(BSTR msg, msgtype_enum type)
01257 {
01258         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01259 
01260         TRY_DUAL(__uuidof(IGMEOLEApp))
01261         {
01262                 pThis->ConsoleMessage(CString(msg), type);
01263                 return NOERROR;
01264         }
01265         CATCH_ALL_DUAL
01266 }
01267 
01268 STDMETHODIMP CGMEOLEApp::XDual::ConsoleClear()
01269 {
01270         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01271 
01272         TRY_DUAL(__uuidof(IGMEOLEApp))
01273         {
01274                 pThis->ConsoleClear();
01275                 return NOERROR;
01276         }
01277         CATCH_ALL_DUAL
01278 }
01279 
01280 STDMETHODIMP CGMEOLEApp::XDual::ConsoleNavigateTo(BSTR url)
01281 {
01282         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01283 
01284         TRY_DUAL(__uuidof(IGMEOLEApp))
01285         {
01286                 pThis->ConsoleNavigateTo(CString(url));
01287                 return NOERROR;
01288         }
01289         CATCH_ALL_DUAL
01290 }
01291 
01292 
01293 STDMETHODIMP CGMEOLEApp::XDual::ChangeEditmode(editmode_enum mode)
01294 {
01295         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01296 
01297         TRY_DUAL(__uuidof(IGMEOLEApp))
01298         {
01299                 pThis->ChangeEditmode((long)mode);
01300                 return NOERROR;
01301         }
01302         CATCH_ALL_DUAL
01303 }
01304 
01305 STDMETHODIMP CGMEOLEApp::XDual::GridShow(VARIANT_BOOL show)
01306 {
01307         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01308 
01309         TRY_DUAL(__uuidof(IGMEOLEApp))
01310         {
01311                 pThis->GridShow(show);
01312                 return NOERROR;
01313         }
01314         CATCH_ALL_DUAL
01315 }
01316 
01317 STDMETHODIMP CGMEOLEApp::XDual::AttributepanelPage(attribpanel_page page)
01318 {
01319         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01320 
01321         TRY_DUAL(__uuidof(IGMEOLEApp))
01322         {
01323                 pThis->AttributepanelPage((long)page);
01324                 return NOERROR;
01325         }
01326         CATCH_ALL_DUAL
01327 }
01328 
01329 STDMETHODIMP CGMEOLEApp::XDual::DisableComp(BSTR pCompName, VARIANT_BOOL pHide)
01330 {
01331         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01332 
01333         TRY_DUAL(__uuidof(IGMEOLEApp))
01334         {
01335                 pThis->DisableComp( CString( pCompName), pHide);
01336                 return NOERROR;
01337         }
01338         CATCH_ALL_DUAL
01339 }
01340 
01341 STDMETHODIMP CGMEOLEApp::XDual::DisableCompForKinds(BSTR pCompName, BSTR pKindSequence)
01342 {
01343         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01344 
01345         TRY_DUAL(__uuidof(IGMEOLEApp))
01346         {
01347                 pThis->DisableCompForKinds( CString( pCompName), CString( pKindSequence));
01348                 return NOERROR;
01349         }
01350         CATCH_ALL_DUAL
01351 }
01352 
01353 STDMETHODIMP CGMEOLEApp::XDual::SetCompFiltering( VARIANT_BOOL pOn)
01354 {
01355         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01356 
01357         TRY_DUAL(__uuidof(IGMEOLEApp))
01358         {
01359                 pThis->SetCompFiltering( pOn);
01360                 return NOERROR;
01361         }
01362         CATCH_ALL_DUAL
01363 }
01364 
01365 STDMETHODIMP CGMEOLEApp::XDual::GetCompFiltering( VARIANT_BOOL* pOn)
01366 {
01367         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01368 
01369         TRY_DUAL(__uuidof(IGMEOLEApp))
01370         {
01371                 *pOn = (pThis->GetCompFiltering())?VARIANT_TRUE:VARIANT_FALSE;
01372                 return NOERROR;
01373         }
01374         CATCH_ALL_DUAL
01375 }
01376 
01377 STDMETHODIMP CGMEOLEApp::XDual::SetWorkingDirectory(BSTR pPath)
01378 {
01379         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01380 
01381         TRY_DUAL(__uuidof(IGMEOLEApp))
01382         {
01383                 pThis->SetWorkingDirectory( CString( pPath));
01384                 return NOERROR;
01385         }
01386         CATCH_ALL_DUAL
01387 }
01388 
01389 STDMETHODIMP CGMEOLEApp::XDual::Exit()
01390 {
01391         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01392 
01393         TRY_DUAL(__uuidof(IGMEOLEApp))
01394         {
01395                 pThis->Exit();
01396                 return NOERROR;
01397         }
01398         CATCH_ALL_DUAL
01399 }
01400 
01401 STDMETHODIMP CGMEOLEApp::XDual::RefreshLib( BSTR pLibName, VARIANT_BOOL pUngroup, long* pNumOfErrors)
01402 {
01403         METHOD_PROLOGUE(CGMEOLEApp, Dual)
01404 
01405         TRY_DUAL(__uuidof(IGMEOLEApp))
01406         {
01407                 long res = pThis->RefreshLib( CString( pLibName), pUngroup);
01408                 *pNumOfErrors = res;
01409                 return NOERROR;
01410         }
01411         CATCH_ALL_DUAL
01412 }