00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 // RealDWG includes 00011 #include "acgi.h" 00012 #include "acestext.h" 00013 #include "acdbxref.h" 00014 #include <windows.h> 00015 #include "adesk.h" 00016 00017 #include "dbapserv.h" 00018 #include "dbacis.h" 00019 #include "dbmstyle.h" 00020 #include "dbsymtb.h" 00021 #include "dbents.h" 00022 #include "dbelipse.h" 00023 #include "dbspline.h" 00024 #include "dblead.h" 00025 #include "dbray.h" 00026 #include "dbxline.h" 00027 #include "dbmline.h" 00028 #include "dbbody.h" 00029 #include "dbregion.h" 00030 #include "dbsol3d.h" 00031 #include "rxregsvc.h" 00032 #include <map> 00033 #include <string> 00034 00035 #include "misc.h" 00036 00037 00038 class MrDwgHostApp : public AcDbHostApplicationServices 00039 { 00040 private: 00041 00042 struct FindFileKey 00043 { 00044 int nBufferLength; 00045 AcDbDatabase * pDb; 00046 AcDbHostApplicationServices::FindFileHint hint; 00047 char pcFilenameHash[DWG_HASH_SIZE]; 00048 00049 bool operator < (const struct FindFileKey & rhs) const 00050 { 00051 if (memcmp(this, &rhs, sizeof(struct FindFileKey) < 0)) 00052 return true; 00053 return false; 00054 } 00055 }; 00056 00057 struct FindFileResult 00058 { 00059 DWORD result; 00060 std::wstring pcFullPathOut; 00061 }; 00062 00063 std::map<struct FindFileKey, struct FindFileResult> FindFileMap; 00064 00065 00066 public: 00067 Acad::ErrorStatus findFile( 00068 ACHAR* pcFullPathOut, 00069 int nBufferLength, 00070 const ACHAR* pcFilename, 00071 AcDbDatabase* pDb = NULL, 00072 AcDbHostApplicationServices::FindFileHint hint = kDefault); 00073 00074 Acad::ErrorStatus getRoamableRootFolder(const char*& folder); 00075 Acad::ErrorStatus getLocalRootFolder(const char*& folder); 00076 Adesk::Boolean isURL(const char* pszURL) const; 00077 00078 Adesk::Boolean isRemoteFile(const char* pszLocalFile, char* pszURL) const; 00079 #if _MSC_VER == 1700 00080 virtual const ACHAR * getAlternateFontName() const; 00081 #else 00082 virtual ACHAR * getAlternateFontName() const; 00083 #endif 00084 virtual void fatalError(const ACHAR * format,...); 00085 }; 00086 00087 extern MrDwgHostApp gMrDwgHostApp;