DbDataLink.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. // Name: DbDataLink.h
  13. //
  14. // Description: Data link classes
  15. // Contains the following classes:
  16. // AcDbDataLink
  17. // AcDbDataLinkManager
  18. //////////////////////////////////////////////////////////////////////////////
  19. #pragma once
  20. #include "AcString.h"
  21. class AcValue;
  22. class AcDbLinkedData;
  23. class AcDbDataLink;
  24. class AcDbDataLinkManager;
  25. class AcDbImpDataLinkManager;
  26. class AcDbDataAdapter;
  27. class AcTableSystemInternals;
  28. // Excel data adapter id
  29. #define ACDB_DATA_ADAPTER_EXCEL ACRX_T(/*MSG0*/"AcExcel")
  30. //*************************************************************************
  31. // AcDbDataLink
  32. //*************************************************************************
  33. class AcDbDataLink : public AcDbObject
  34. {
  35. public:
  36. ACDB_DECLARE_MEMBERS(AcDbDataLink);
  37. ACDB_PORT AcDbDataLink(void);
  38. ACDB_PORT virtual ~AcDbDataLink(void);
  39. ACDB_PORT AcString name (void) const;
  40. ACDB_PORT Acad::ErrorStatus setName (const ACHAR* pszName);
  41. ACDB_PORT const ACHAR* description (void) const;
  42. ACDB_PORT Acad::ErrorStatus setDescription(const ACHAR* pszDescription);
  43. ACDB_PORT AcString getToolTip (void) const;
  44. ACDB_PORT Acad::ErrorStatus setToolTip (const ACHAR* pszToolTip);
  45. ACDB_PORT const ACHAR* dataAdapterId (void) const;
  46. ACDB_PORT Acad::ErrorStatus setDataAdapterId(const ACHAR* pszAdapterId);
  47. ACDB_PORT const ACHAR* connectionString (void) const;
  48. ACDB_PORT Acad::ErrorStatus setConnectionString(const ACHAR* pszConnectionString);
  49. ACDB_PORT AcDb::DataLinkOption option (void) const;
  50. ACDB_PORT Acad::ErrorStatus setOption (AcDb::DataLinkOption nOption);
  51. ACDB_PORT int updateOption (void) const;
  52. ACDB_PORT Acad::ErrorStatus setUpdateOption(int nOption);
  53. ACDB_PORT Acad::ErrorStatus update (AcDb::UpdateDirection nDir,
  54. AcDb::UpdateOption nOption);
  55. ACDB_PORT Acad::ErrorStatus getUpdateStatus(AcDb::UpdateDirection* pDir,
  56. SYSTEMTIME* pTime,
  57. AcString* pErrMessage) const;
  58. ACDB_PORT Acad::ErrorStatus setUpdateStatus(const ACHAR* pszErrMessage);
  59. ACDB_PORT bool isValid (void) const;
  60. ACDB_PORT int getTargets (AcDbObjectIdArray& targetIds) const;
  61. ACDB_PORT Acad::ErrorStatus getSourceFiles(AcDb::DataLinkGetSourceContext nContext,
  62. AcStringArray& files) const;
  63. ACDB_PORT Acad::ErrorStatus repathSourceFiles(LPCTSTR pszBasePath,
  64. AcDb::PathOption nOption);
  65. ACDB_PORT Acad::ErrorStatus getCustomData(const ACHAR* pszKey,
  66. AcValue* pData) const;
  67. ACDB_PORT Acad::ErrorStatus setCustomData(const ACHAR* pszKey,
  68. const AcValue* pData);
  69. ACDB_PORT virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
  70. ACDB_PORT virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
  71. ACDB_PORT virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* pFiler);
  72. ACDB_PORT virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* pFiler) const;
  73. };
  74. typedef AcArray<AcDbDataLink*> AcDbDataLinkArray;
  75. //*************************************************************************
  76. // AcDbDataLinkManager
  77. //*************************************************************************
  78. class AcDbDataLinkManager : public AcRxObject
  79. {
  80. public:
  81. ACRX_DECLARE_MEMBERS(AcDbDataLinkManager);
  82. ACDB_PORT virtual ~AcDbDataLinkManager(void);
  83. ACDB_PORT Acad::ErrorStatus createDataLink(const ACHAR* pszAdapterId,
  84. const ACHAR* pszName,
  85. const ACHAR* pszDescription,
  86. const ACHAR* pszConnectionString,
  87. AcDbObjectId& idDataLink);
  88. ACDB_PORT Acad::ErrorStatus getDataLink (const ACHAR* pszName,
  89. AcDbObjectId& idDataLink) const;
  90. ACDB_PORT Acad::ErrorStatus getDataLink (const ACHAR* pszName,
  91. AcDbDataLink*& pDataLink,
  92. AcDb::OpenMode mode) const;
  93. ACDB_PORT int dataLinkCount (void) const;
  94. ACDB_PORT int getDataLink (AcDbObjectIdArray& dataLinks) const;
  95. ACDB_PORT Acad::ErrorStatus addDataLink (AcDbDataLink* pDataLink);
  96. ACDB_PORT Acad::ErrorStatus addDataLink (AcDbDataLink* pDataLink,
  97. AcDbObjectId& idDataLink);
  98. Acad::ErrorStatus removeDataLink (const ACHAR* pszKey,
  99. AcDbObjectId& idDataLink);
  100. ACDB_PORT Acad::ErrorStatus removeDataLink(const AcDbObjectId& idDataLink);
  101. ACDB_PORT Acad::ErrorStatus update (const AcDbObjectIdArray& dataIds,
  102. AcDb::UpdateDirection nDir,
  103. AcDb::UpdateOption nOption);
  104. ACDB_PORT Acad::ErrorStatus update (AcDb::UpdateDirection nDir,
  105. AcDb::UpdateOption nOption);
  106. protected:
  107. ACDB_PORT AcDbDataLinkManager(void);
  108. private:
  109. void * mpImpObj;
  110. friend class AcTableSystemInternals;
  111. friend class AcDbImpDataLinkManager;
  112. };