MrDwgHostApp.h
1 // Copyright (c) Tech Soft 3D, Inc.
2 //
3 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc.,
4 // and considered a trade secret as defined under civil and criminal statutes.
5 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of
6 // unauthorized use or misappropriation of its trade secrets. Use of this information
7 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under
8 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use.
9 
10 // RealDWG includes
11 #include "acgi.h"
12 #include "acestext.h"
13 #include "acdbxref.h"
14 #include <windows.h>
15 #include "adesk.h"
16 
17 #include "dbapserv.h"
18 #include "dbacis.h"
19 #include "dbmstyle.h"
20 #include "dbsymtb.h"
21 #include "dbents.h"
22 #include "dbelipse.h"
23 #include "dbspline.h"
24 #include "dblead.h"
25 #include "dbray.h"
26 #include "dbxline.h"
27 #include "dbmline.h"
28 #include "dbbody.h"
29 #include "dbregion.h"
30 #include "dbsol3d.h"
31 #include "rxregsvc.h"
32 #include <map>
33 #include <string>
34 
35 #include "misc.h"
36 
37 
38 class MrDwgHostApp : public AcDbHostApplicationServices
39 {
40 private:
41 
42  struct FindFileKey
43  {
44  int nBufferLength;
45  AcDbDatabase * pDb;
46  AcDbHostApplicationServices::FindFileHint hint;
47  char pcFilenameHash[DWG_HASH_SIZE];
48 
49  bool operator < (const struct FindFileKey & rhs) const
50  {
51  if (memcmp(this, &rhs, sizeof(struct FindFileKey) < 0))
52  return true;
53  return false;
54  }
55  };
56 
57  struct FindFileResult
58  {
59  DWORD result;
60  std::wstring pcFullPathOut;
61  };
62 
63  std::map<struct FindFileKey, struct FindFileResult> FindFileMap;
64 
65 
66 public:
67  Acad::ErrorStatus findFile(
68  ACHAR* pcFullPathOut,
69  int nBufferLength,
70  const ACHAR* pcFilename,
71  AcDbDatabase* pDb = NULL,
72  AcDbHostApplicationServices::FindFileHint hint = kDefault);
73 
74  Acad::ErrorStatus getRoamableRootFolder(const char*& folder);
75  Acad::ErrorStatus getLocalRootFolder(const char*& folder);
76  Adesk::Boolean isURL(const char* pszURL) const;
77 
78  Adesk::Boolean isRemoteFile(const char* pszLocalFile, char* pszURL) const;
79 #if _MSC_VER >= 1700
80  virtual const ACHAR * getAlternateFontName() const;
81 #else
82  virtual ACHAR * getAlternateFontName() const;
83 #endif
84  virtual void fatalError(const ACHAR * format,...);
85 };
86 
87 extern MrDwgHostApp gMrDwgHostApp;
Definition: MrDwgHostApp.h:38