dbapserv.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // DESCRIPTION:
  13. //
  14. // AcDbHostApplicationServices provides a mechanism for a client of
  15. // AcDb.dll to provide runtime information to the database engine.
  16. // For example when the database (or a dll client) needs to find
  17. // a specific file, the services can dictate the search that will
  18. // be followed.
  19. //
  20. // A client application (.exe) (there can be only one 'application'
  21. // client) in a given session may chose to override the default services
  22. // with their own custom version implementation.
  23. //
  24. #ifndef AcDbHostApplicationServices_INC
  25. #define AcDbHostApplicationServices_INC
  26. #include "adesk.h"
  27. #include "acdb.h"
  28. #include "acarray.h"
  29. #include "codepgid.h"
  30. #include "acdlflagbits.h"
  31. // Internet-related status codes
  32. #include "inetstrc.h"
  33. #include "rxdlinkr.h"
  34. #pragma pack (push, 8)
  35. class AcDbAuditInfo;
  36. class AcDbDatabase;
  37. class AcDbUndoController;
  38. class AcDbTransactionManager;
  39. class AcDbGlobals;
  40. class AcDbAppSystemVariables;
  41. class COleClientItem;
  42. class CArchive;
  43. class AcadInternalServices;
  44. struct flagmat;
  45. class AcDbAbstractClipBoundaryDefinition;
  46. class ClipBoundaryArray;
  47. class AcDbPlotSettingsValidator;
  48. class AcDbLayoutManager;
  49. class AcPwdCache;
  50. struct _EXCEPTION_POINTERS;
  51. #ifndef ACUTIL_API
  52. #ifdef ACUTIL_INTERNAL
  53. #ifdef _ADESK_IOS_
  54. #define ACUTIL_API
  55. #else
  56. #define ACUTIL_API __declspec(dllexport)
  57. #endif
  58. #else
  59. #define ACUTIL_API __declspec(dllimport)
  60. #endif
  61. #endif
  62. #ifdef __LP64__
  63. typedef DWORD LCID;
  64. #else
  65. typedef unsigned long LCID;
  66. #endif
  67. enum AcSDIValues {
  68. kMDIEnabled = 0,
  69. kSDIUserEnforced,
  70. kSDIAppEnforced,
  71. kSDIUserAndAppEnforced
  72. };
  73. enum ProdIdCode {
  74. kProd_ACAD = 1,
  75. // 2 is obsolete
  76. kProd_OEM = 3,
  77. kProd_AcDb = 4,
  78. };
  79. int acdbHostAppMinorVersion();
  80. class AcDbHostApplicationProgressMeter {
  81. public:
  82. AcDbHostApplicationProgressMeter();
  83. virtual ~AcDbHostApplicationProgressMeter();
  84. virtual void start(const ACHAR * displayString = NULL);
  85. virtual void stop();
  86. virtual void meterProgress();
  87. virtual void setLimit(int max);
  88. };
  89. typedef Acad::ErrorStatus (*SELECTFILEPROC )(/*[out]*/ short *userCancel,
  90. /*[out]*/ ACHAR *& chosenPath,
  91. void* h, // HWND
  92. const int nFlags,
  93. const ACHAR * prompt,
  94. const ACHAR * dir,
  95. const ACHAR * name,
  96. const ACHAR * type,
  97. int* pnChoice,
  98. bool* pbReadOnly,
  99. const ACHAR * pszWSTags,
  100. void* pReserved);
  101. typedef Acad::ErrorStatus (* REMAPPROC) (/*[out]*/ ACHAR *& newName,
  102. const ACHAR * filename,
  103. int context,
  104. void* pReserved);
  105. typedef void (* MAPFILENOTIFYPROC) (const ACHAR * filename,
  106. const ACHAR * newName,
  107. int context,
  108. void* pReserved);
  109. class ADESK_NO_VTABLE AcDbHostApplicationServices : public AcRxObject
  110. {
  111. friend class AcadInternalServices;
  112. public:
  113. ACRX_DECLARE_MEMBERS(AcDbHostApplicationServices);
  114. AcDbHostApplicationServices( int createGlobals = 1 );
  115. virtual ~AcDbHostApplicationServices();
  116. enum FindFileHint
  117. {
  118. kDefault = 0,
  119. kFontFile, // Could be either
  120. kCompiledShapeFile, // shx
  121. kTrueTypeFontFile, // ttf
  122. kEmbeddedImageFile,
  123. kXRefDrawing,
  124. kPatternFile,
  125. kARXApplication,
  126. kFontMapFile,
  127. kUnderlayFile,
  128. kDataLinkFile,
  129. kPhotometricWebFile,
  130. kMaterialMapFile,
  131. kCloudOrProjectFile,
  132. };
  133. enum RemapFileContext
  134. {
  135. kDrawingOpen,
  136. kXrefResolution,
  137. kRasterResolution,
  138. kAfterXrefResolution
  139. };
  140. // When a file path is required
  141. //
  142. virtual Acad::ErrorStatus findFile(ACHAR * pcFullPathOut,
  143. int nBufferLength,
  144. const ACHAR * pcFilename,
  145. AcDbDatabase * pDb = NULL, // When this search
  146. // is related to a db
  147. AcDbHostApplicationServices::FindFileHint hint = kDefault) = 0;
  148. // These two functions return the full path to the root folder where roamable/local
  149. // customizable files were installed. The default implementation is to return the
  150. // directory where the EXE is located. These methods can be overridden by DBX
  151. // applications for their own install structure. Note that the user may have
  152. // reconfigured the location of some of the customizable files using the Options
  153. // Dialog, therefore these functions should not be used to locate all customizable
  154. // files. To locate customizable files either use the findFile function or the
  155. // appropriate system variable for the given file type.
  156. //
  157. virtual Acad::ErrorStatus getRoamableRootFolder(const ACHAR *& folder);
  158. virtual Acad::ErrorStatus getLocalRootFolder(const ACHAR *& folder);
  159. virtual Acad::ErrorStatus getAllUsersRootFolder(const ACHAR*& folder);
  160. // Returns the full path of the graphics cache files folder. The default path
  161. // <localroot>\GraphicsCache.
  162. //
  163. virtual Acad::ErrorStatus getGraphicsCacheFolder(const ACHAR *& folder);
  164. // Select File APIs
  165. ACDB_PORT virtual Acad::ErrorStatus selectFile(short *userCancel,
  166. ACHAR *& chosenPath,
  167. void* h, // HWND
  168. const int nFlags,
  169. const ACHAR * prompt,
  170. const ACHAR * dir,
  171. const ACHAR * name,
  172. const ACHAR * type,
  173. int* pnChoice,
  174. bool* pbReadOnly,
  175. const ACHAR * pszWSTags,
  176. void* pReserved) ;
  177. ACDB_PORT virtual Acad::ErrorStatus registerSelectFileCallback(const ACHAR * appName,
  178. SELECTFILEPROC proc,
  179. bool unRegister = false,
  180. bool asPrimary = false);
  181. ACDB_PORT virtual const ACHAR * primaryClientForSelectFileCallback();
  182. ACDB_PORT virtual Acad::ErrorStatus getRegisteredSelectFileClients(
  183. AcArray<const ACHAR *>& clients);
  184. // File remapping
  185. ACDB_PORT virtual Acad::ErrorStatus mapFile(/*out*/ ACHAR *& newName,
  186. const ACHAR * filename,
  187. int context,
  188. void* pReserved);
  189. ACDB_PORT virtual Acad::ErrorStatus registerMapFileCallback(const ACHAR * appName,
  190. REMAPPROC proc,
  191. bool unRegister = false,
  192. bool asPrimary = false);
  193. ACDB_PORT virtual const ACHAR * primaryClientForMapFileCallback();
  194. ACDB_PORT virtual bool setMapFlag(bool setIt);
  195. ACDB_PORT virtual Acad::ErrorStatus getRegisteredFileMapClients(
  196. AcArray<const ACHAR *>& clients);
  197. ACDB_PORT virtual Acad::ErrorStatus registerMapFileNotification(const ACHAR * appName,
  198. MAPFILENOTIFYPROC,
  199. bool unRegister = false);
  200. // When a fatal error is encountered this function may be called
  201. // to notify you.
  202. //
  203. virtual void fatalError(const ACHAR *format, ...);
  204. // Called when an unhandled exception occurs in an arx command or message.
  205. // The EXCEPTION_POINTERS pointer is obtained from the win32 api:
  206. // GetExceptionInformation().
  207. //
  208. ACDB_PORT virtual void reportUnhandledArxException(const _EXCEPTION_POINTERS *pExcPtrs,
  209. const ACHAR *pAppName);
  210. // The equivalent of ads_usrbrk()
  211. //
  212. virtual Adesk::Boolean userBreak(bool updCtrlsWhenEnteringIdle = true) const;
  213. virtual void displayChar(ACHAR c) const;
  214. virtual void displayString(const ACHAR* string, int count) const;
  215. // This function will be called to check if the application
  216. // wants to show text messages. Default implementation is always
  217. // returning true;
  218. virtual Adesk::Boolean readyToDisplayMessages();
  219. // This function can be used to used to programmatically change the
  220. // state of readyToDisplayMessages.
  221. virtual void enableMessageDisplay(Adesk::Boolean);
  222. // Instructs the system to run fulltime CRC checking on database
  223. // filing operations.
  224. virtual Adesk::Boolean doFullCRCCheck();
  225. // Indicates where temporary files are to be located. See WINSDK
  226. // function GetTempPath() for details on the argument and the return
  227. // value.
  228. virtual unsigned int getTempPath(Adesk::UInt32 lBufferSize,
  229. ACHAR* pcBuffer);
  230. // gets the value of a command switch, or an environment variable, or
  231. // registry entry (the search is in that order). This is the same
  232. // behavior as the LISP (getenv) function). Default implementation
  233. // is to return NULL.
  234. //
  235. virtual const ACHAR* getEnv(const ACHAR * var);
  236. // Whenever AcDb.dll needs to instantiate a progress meter, it will
  237. // call this method.
  238. // If you want to create your own progress meter, derive from
  239. // AcDbHostApplicationProgressMeter, and override this method to
  240. // to return a progress meter of your derived type.
  241. //
  242. virtual AcDbHostApplicationProgressMeter* newProgressMeter();
  243. // In other cases, AcDb.dll expects to make use of one global
  244. // instance of a progress meter that is always available. To
  245. // set that progress meter to one of your own type, instantiate
  246. // your meter and pass it to the following function.
  247. void setWorkingProgressMeter(AcDbHostApplicationProgressMeter* pNewMeter);
  248. virtual AcDbAbstractClipBoundaryDefinition* newClipBoundaryRectangular();
  249. virtual AcDbAbstractClipBoundaryDefinition* newClipBoundaryPolygonal();
  250. virtual ClipBoundaryArray* newClipBoundaryArray();
  251. // Should point to a viable database. The application is free to
  252. // reset this according to its need. Some entites will require
  253. // access to information within a database in order to function
  254. // properly when they are not yet database-resident.
  255. //
  256. AcDbDatabase* workingDatabase() const;
  257. void setWorkingDatabase(AcDbDatabase* pDatabase);
  258. ACDB_PORT virtual AcDbUndoController* defaultUndoController();
  259. void setDefaultUndoController(AcDbUndoController* pUndoCtrl);
  260. virtual AcDbTransactionManager* workingTransactionManager();
  261. void setWorkingTransactionManager(AcDbTransactionManager* pTM);
  262. virtual AcDbGlobals * createWorkingGlobals();
  263. AcDbGlobals * workingGlobals() const;
  264. void setWorkingGlobals(AcDbGlobals* pGlobals);
  265. AcDbAppSystemVariables * workingAppSysvars() const;
  266. void setWorkingAppSysvars(AcDbAppSystemVariables* pSysvars);
  267. virtual const ACHAR * program ();
  268. virtual const ACHAR * product ();
  269. virtual const ACHAR * companyName();
  270. virtual const ProdIdCode prodcode();
  271. virtual const ACHAR * releaseMajorMinorString();
  272. virtual int releaseMajorVersion();
  273. virtual int releaseMinorVersion();
  274. virtual const ACHAR * versionString();
  275. ACDB_PORT virtual const ACHAR * getMachineRegistryProductRootKey ();
  276. ACDB_PORT virtual const ACHAR * getUserRegistryProductRootKey ();
  277. virtual const ACHAR* releaseMarketVersion();
  278. virtual LCID getRegistryProductLCID() ;
  279. ACDB_PORT virtual bool supportsMultiRedo() const;
  280. enum ModelerFlavor {kModelerFull=0, kModelerRegionsOnly=1, kModelerObjectsOnly=2};
  281. ACDB_PORT virtual ModelerFlavor getModelerFlavor() const;
  282. code_page_id getSystemCodePage() const;
  283. virtual AcadInternalServices* acadInternalServices();
  284. void * acadInternalGetvar (const ACHAR *name);
  285. // BEGIN: Internet-related services
  286. // Determine whether a given string ('pszURL') is a valid URL.
  287. //
  288. virtual Adesk::Boolean isURL(const ACHAR * pszURL) const;
  289. // 'isRemoteFile()' is the inverse of 'isURL()'--it provides a mapping
  290. // from a local file to the corresponding URL that the file was down-
  291. // loaded from. The URL, if any, is returned via 'pszURL.'
  292. //
  293. ACDB_PORT
  294. virtual Adesk::Boolean isRemoteFile(const ACHAR * pszLocalFile,
  295. ACHAR * pszURL, size_t urlLen) const;
  296. template<size_t N> Adesk::Boolean isRemoteFile(const ACHAR * pszLocalFile,
  297. ACHAR (&pszURL)[N]) const
  298. {
  299. return isRemoteFile(pszLocalFile, pszURL, N);
  300. }
  301. // Download a resource (file) identified by the URL 'pszURL' to a local
  302. // file, and return its name in the buffer pointed to by 'pszLocalFile.'
  303. // The boolean argument 'bIgnoreCache' determines whether the file should
  304. // be downloaded even if it has already been transferred earlier in the
  305. // session.
  306. //
  307. ACDB_PORT
  308. virtual Acad::ErrorStatus getRemoteFile(const ACHAR * pszURL, ACHAR * pszLocalFile,
  309. size_t localFileLen,
  310. Adesk::Boolean bIgnoreCache) const;
  311. // Helper template for callers passing fixed size arrays.
  312. template<size_t N> Acad::ErrorStatus getRemoteFile(const ACHAR * pszURL,
  313. ACHAR (&pszLocalFile)[N]) const
  314. {
  315. return this->getRemoteFile(pszURL, pszLocalFile, N, /*bIgnoreCache*/false);
  316. }
  317. // Upload a local resource (file) identified by the pathname 'pszLocalFile'
  318. // to the remote location specified by the URL 'pszURL.'
  319. //
  320. virtual Acad::ErrorStatus putRemoteFile(const ACHAR * pszURL,
  321. const ACHAR * pszLocalFile) const;
  322. // Determine whether a given string ('pszCloudFile') is a valid Cloud file.
  323. virtual Adesk::Boolean isCloudFile(const ACHAR* pszCloudFile) const;
  324. // Launch the Web Browser dialog that allows the user to navigate to any
  325. // site and select a URL. The selected URL is returned in 'pszSelectedURL,'
  326. // which must point to a buffer large enough to hold the return value.
  327. // 'pszDialogTitle' and 'pszOpenButtonCaption' allow developers to supply
  328. // text for the dialog title and the button caption, that is more
  329. // meaningful in the context in which the dialog is being invoked. The
  330. // parameter 'pszStartURL' is a URL that the Web Browser uses as its start
  331. // page. The fifth argument is optional, and identifies the product root
  332. // key under which the Web Browser dialog's size and position information
  333. // is stored for persistence across sessions.
  334. // The last parameter determines whether the user can select HTML links
  335. // in addition to files that are "downloadable."
  336. //
  337. ACDB_PORT
  338. virtual Adesk::Boolean launchBrowserDialog(
  339. ACHAR * pszSelectedURL,
  340. size_t selectedUrlLen,
  341. const ACHAR * pszDialogTitle,
  342. const ACHAR * pszOpenButtonCaption,
  343. const ACHAR * pszStartURL,
  344. const ACHAR * pszRegistryRootKey = 0,
  345. Adesk::Boolean bOpenButtonAlwaysEnabled = Adesk::kFalse) const;
  346. template<size_t N> Adesk::Boolean launchBrowserDialog(
  347. ACHAR (&pszSelectedURL)[N],
  348. const ACHAR * pszDialogTitle,
  349. const ACHAR * pszOpenButtonCaption,
  350. const ACHAR * pszStartURL,
  351. const ACHAR * pszRegistryRootKey = 0,
  352. Adesk::Boolean bOpenButtonAlwaysEnabled = Adesk::kFalse) const
  353. {
  354. return launchBrowserDialog(pszSelectedURL,N,pszDialogTitle,
  355. pszOpenButtonCaption,pszStartURL,
  356. pszRegistryRootKey,bOpenButtonAlwaysEnabled);
  357. }
  358. // OLE Embedded Objects
  359. // Draw OLE object using given HDC, objectID and rectangle in screen
  360. // coordinate.
  361. //
  362. virtual void drawOleOwnerDrawItem(COleClientItem* pItem,
  363. Adesk::LongPtr hdc,
  364. Adesk::Int32 left, Adesk::Int32 top, Adesk::Int32 right, Adesk::Int32 bottom);
  365. // Get COleClientItem from Host application.
  366. virtual Acad::ErrorStatus getNewOleClientItem(COleClientItem*& pItem);
  367. // Called by AcDb when it needs to translate an OLE embedded object.
  368. virtual Acad::ErrorStatus serializeOleItem(COleClientItem* pItem,
  369. CArchive*);
  370. // This method is renamed from entToWorldTransform() because it is for
  371. // Internal Use only and will be removed in future.
  372. //
  373. virtual Adesk::Boolean _entToWorldTransform(double normal[3],
  374. flagmat *tran);
  375. ACDB_PORT virtual void terminateScript(); // end any running scripts
  376. // get substitute font for unfound font
  377. ACDB_PORT virtual Adesk::Boolean getSubstituteFont(ACHAR **pFileName,
  378. const ACHAR *prompt,
  379. int type, int fontAlt);
  380. // Legacy method with non-const prompt arg and final modifier.
  381. // Derived classes should override the above method, not this one.
  382. // This method will go away in the future..
  383. virtual Adesk::Boolean getSubstituteFont(ACHAR **pFileName,
  384. ACHAR *prompt,
  385. int type, int fontAlt) final
  386. {
  387. const ACHAR *pConstPrompt = prompt;
  388. return this->getSubstituteFont(pFileName, pConstPrompt, type, fontAlt);
  389. }
  390. virtual void alert(const ACHAR * string) const;
  391. virtual void auditPrintReport(AcDbAuditInfo * pAuditInfo,
  392. const ACHAR * line,
  393. int both) const;
  394. ACDB_PORT virtual const ACHAR * getAlternateFontName() const;
  395. ACDB_PORT virtual const ACHAR * getFontMapFileName() const;
  396. ACDB_PORT virtual bool cacheSymbolIndices() const;
  397. virtual AcDbPlotSettingsValidator* plotSettingsValidator() const;
  398. virtual AcDbLayoutManager* layoutManager() const;
  399. virtual bool loadApp(const ACHAR * appName,
  400. AcadApp::LoadReasons why,
  401. bool printit,
  402. bool asCmd);
  403. ACDB_PORT virtual bool getDefaultPlotCfgInfo(ACHAR * plotDeviceName, size_t nDevNameLen,
  404. ACHAR * plotStyleName, size_t nStyleNameLen);
  405. // helper template method for fixed size C arrays
  406. template<size_t nDevLen, size_t nStyleLen> bool getDefaultPlotCfgInfo(
  407. ACHAR (&devName)[nDevLen], ACHAR (&styleName)[nStyleLen])
  408. {
  409. return getDefaultPlotCfgInfo(devName, nDevLen, styleName, nStyleLen);
  410. }
  411. // BEGIN: DWG Security-related services
  412. virtual Acad::ErrorStatus signingComplete(Acad::ErrorStatus es,
  413. const ACHAR * msg,
  414. bool* result);
  415. enum PasswordOptions {kPasswordOptionDefault = 0, kPasswordOptionUpperCase =1, kPasswordOptionIsExternalReference = 2};
  416. virtual bool getPassword(const ACHAR * dwgName,
  417. PasswordOptions options,
  418. wchar_t *password,
  419. const size_t bufSize);
  420. virtual void usedPasswordFromCacheMsg(const ACHAR *dwgName);
  421. virtual void missingCryptoProviderMsg();
  422. ACDB_PORT virtual const ACHAR * getColorBookLocation() const;
  423. AcPwdCache * getPasswordCache() const;
  424. ACDB_PORT virtual short getKeyState(int nVirtKey) const;
  425. enum RequiredVersionFlags {
  426. kNoOpen = 0,
  427. kReadOnly = 1,
  428. kWriteAllowed = 2
  429. };
  430. virtual bool requiredVersionNotAvailable(AcDbHostApplicationServices::RequiredVersionFlags flags,
  431. AcDbDatabase* pDb) const;
  432. // Called when an attempt is made to read in a corrupt drawing.
  433. // Return true if your application has handled the error and wishes
  434. // to continue. If false is returned, fatalError() will be called,
  435. // and your application must then shut down.
  436. ACDB_PORT virtual bool notifyCorruptDrawingFoundOnOpen(AcDbObjectId id, Acad::ErrorStatus es);
  437. protected:
  438. // This method is used by the Internet-related methods of all classes that
  439. // derive from AcDbHostApplicationServices, to map a status code returned by
  440. // an Internet operation to an Acad::ErrorStatus value.
  441. //
  442. Acad::ErrorStatus mapInetStatusToAcadStatus(
  443. const AcadInet::Status status) const;
  444. // END: Internet-related services
  445. protected:
  446. void * mp_sessionVars;
  447. void acadInternalSetvar (const ACHAR *name, void * var);
  448. private:
  449. // NOTES:
  450. // As session-specific globals are gathered up during the AcDb.DLL and
  451. // MDI projects, if the DB requires them, they should be contained here,
  452. // and appropriate get/set methods created above. References to those
  453. // globals should be replaced by references to methods on this class or
  454. // a derived class. This header will ship with Tahoe Unplugged, but not
  455. // Tahoe ARX. These comments to be deleted before FCS.
  456. AcDbDatabase* mpWorkingDatabase;
  457. AcDbUndoController* mpDefaultUndoController;
  458. AcDbTransactionManager* mpWorkingTransactionManager;
  459. AcDbGlobals * mpWorkingGlobals;
  460. AcDbAppSystemVariables * mpWorkingAppSysvars;
  461. code_page_id m_eSystemCodePage;
  462. // Formerly "system_code_page".
  463. // Moved from module xstring.cpp.
  464. Adesk::Boolean mbDisplayMessages;
  465. AcPwdCache * mpPasswordCache;
  466. };
  467. // Use this method to replace the default services, you should do this
  468. // early on, in the InitInstance of your application for example.
  469. //
  470. Acad::ErrorStatus acdbSetHostApplicationServices(AcDbHostApplicationServices * pServices);
  471. // Use this method to access the services
  472. //
  473. AcDbHostApplicationServices * acdbHostApplicationServices();
  474. // A host application would use this function to send notification to
  475. // clients, e.g. Object Enablers, when it's done reading the initial
  476. // set of objects from a dwg file. This is different from what
  477. // readDwgFile() would read. readDwgFile() reads the basic set,
  478. // but a host application would, depending on the functionality it's
  479. // implementing, read some more objects, and let everyone know that
  480. // it's done.
  481. //
  482. Acad::ErrorStatus acdbSendInitialDwgFileOpenComplete(AcDbDatabase* pDb);
  483. extern AcDbGlobals* getDefaultGlobals();
  484. inline AcDbGlobals *
  485. AcDbHostApplicationServices::workingGlobals() const
  486. {
  487. return mpWorkingGlobals ? mpWorkingGlobals : getDefaultGlobals();
  488. }
  489. inline code_page_id
  490. AcDbHostApplicationServices::getSystemCodePage() const
  491. {
  492. return this->m_eSystemCodePage;
  493. }
  494. inline AcDbTransactionManager *
  495. AcDbHostApplicationServices::workingTransactionManager()
  496. {
  497. return mpWorkingTransactionManager;
  498. }
  499. inline AcDbDatabase *
  500. AcDbHostApplicationServices::workingDatabase() const
  501. {
  502. return mpWorkingDatabase;
  503. }
  504. inline AcDbAppSystemVariables *
  505. AcDbHostApplicationServices::workingAppSysvars() const
  506. {
  507. return mpWorkingAppSysvars;
  508. }
  509. inline void
  510. AcDbHostApplicationServices::setWorkingAppSysvars(AcDbAppSystemVariables* pSysvars)
  511. {
  512. mpWorkingAppSysvars = pSysvars;
  513. }
  514. inline AcPwdCache *
  515. AcDbHostApplicationServices::getPasswordCache() const
  516. {
  517. return mpPasswordCache;
  518. }
  519. // acdbTriggerAcadOctTreeReclassification
  520. //
  521. // *** For Internal Use Only ***
  522. //
  523. void acdbTriggerAcadOctTreeReclassification();
  524. // acdbSetBreak3dQueueForRegen
  525. //
  526. // *** For Internal Use Only ***
  527. //
  528. Acad::ErrorStatus acdbSetBreak3dQueueForRegen(bool);
  529. //Derived classes are expected to override tryPassword and cache a
  530. //file moniker (file name, file handle etc.) during construction so
  531. //they can try the passwords passed to tryPassword.
  532. // Here are the possible conditions for wszPassword:
  533. // NULL = check the password cache first then prompt for password
  534. // "value" = try the supplied value then the cache but don't prompt for another password if it fails
  535. // "" = skip the cache and the prompt and just fail if encrypted
  536. class ADESK_NO_VTABLE AcDbPasswordedFile
  537. {
  538. protected:
  539. virtual Acad::ErrorStatus tryPassword(const wchar_t* wzPassword) = 0;
  540. virtual const ACHAR* getFullPath() = 0;
  541. public:
  542. Acad::ErrorStatus open(const wchar_t* wszPassword, AcDbHostApplicationServices::PasswordOptions options);
  543. };
  544. #pragma pack (pop)
  545. #endif