CFx SDK Documentation  2020SP3
FxDatabase.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2020 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include "FxPragmaPush.h"
20 
21 #include "DDKERNEL.h"
22 
23 #include <OdCodePage.h>
24 #include <DbDatabase.h>
25 #include <DbSecurity.h>
26 
27 #include <set>
28 
29 class CFxFileData;
30 class CFxGsModel;
31 class CFxRecentlyErased;
32 class CFxUnitsFormatter;
33 class CFxDatabaseHistory;
34 class CFxString;
35 class CFxView;
36 
37 class CFxDatabase;
39 
40 #define LAST_DWGDIRECT_UNDO_ID 0x1000 //this value is much bigger than last DWGDirect undo value
41 
48 {
49 public:
51 
52  CFxDatabase(void);
53  ~CFxDatabase(void) override;
54 
61  static CFxDatabasePtr LoadFile( const CFxString& strFilename, OdCodePageId* pCodepage = 0, const OdPassword& password = OdPassword() );
62 
69  virtual bool SaveFile( const CFxFileData* pNewData = 0, bool deleteBackupFile = true ) = 0;
70 
77  static CFxDatabasePtr RecoverFile( const CFxString& strFilename, OdCodePageId* pCodepage = 0, const OdPassword& password = OdPassword() );
78 
82  virtual void LockFile( bool bLock ) = 0;
83 
89 
94  bool IsModelLayoutActive() const;
95 
101 
105  virtual const CFxUnitsFormatter* GetUnitsFormatter() const = 0;
106 
110  virtual const CFxFileData& GetFileData() const = 0;
111 
115  virtual void SetFileData(const CFxFileData &) const = 0;
116 
120  virtual CFxGsModel* GetFxGsModel() = 0;
124  virtual const CFxGsModel* GetFxGsModel() const = 0;
132  virtual void StartUndoRecord( const CFxString& strLabel ) = 0;
133 
137  virtual void ResetTime() = 0;
138 
145 
154  virtual int BlockPurge( OdDbObjectId id, bool block ) = 0;
155 
161  virtual const std::set<OdDbObjectId>& GetBlockedPurge() const = 0;
162 
168  virtual const OdTimeStamp& getElapsedTime() = 0;
169 
170  //overrides of system variables
171  OdCodePageId getDWGCODEPAGE() const override;
172  OdGePoint2d getPLIMMIN() const override = 0;
173  OdGePoint2d getPLIMMAX() const override = 0;
174 
175  //newly added functions
176  virtual bool setDWGCODEPAGE( OdCodePageId value ) = 0;
177  virtual bool setTDUCREATE( OdDbDate value ) = 0;
178  virtual bool setTDUUPDATE( OdDbDate value ) = 0;
179  virtual bool setTDINDWG( OdDbDate value ) = 0;
180  virtual bool setTDUSRTIMER( OdDbDate value ) = 0;
181  virtual bool setPSTYLEMODE( bool value ) = 0;
182  virtual bool setPUCSORG( OdGePoint3d value ) = 0;
183  virtual bool setPUCSXDIR( OdGeVector3d value ) = 0;
184  virtual bool setPUCSYDIR( OdGeVector3d value ) = 0;
185  virtual bool setUCSORG( OdGePoint3d value ) = 0;
186  virtual bool setUCSXDIR( OdGeVector3d value ) = 0;
187  virtual bool setUCSYDIR( OdGeVector3d value ) = 0;
188 
189  virtual OdString getUSERS1() const = 0;
190  virtual bool setUSERS1( const OdString& value ) = 0;
191  virtual OdString getUSERS2() const = 0;
192  virtual bool setUSERS2( const OdString& value ) = 0;
193  virtual OdString getUSERS3() const = 0;
194  virtual bool setUSERS3( const OdString& value ) = 0;
195  virtual OdString getUSERS4() const = 0;
196  virtual bool setUSERS4( const OdString& value ) = 0;
197  virtual OdString getUSERS5() const = 0;
198  virtual bool setUSERS5( const OdString& value ) = 0;
199  virtual OdInt16 getBINDTYPE() const = 0;
200  virtual bool setBINDTYPE( OdInt16 value ) = 0;
201 
205 #define QVAR_DEF_RO( type, name, validator ) \
206  virtual type get##name() const = 0; \
207  virtual bool set##name( type val ) = 0;
208 
209 #define QVAR_DEF( type, name, validator ) \
210  QVAR_DEF_RO( type, name, validator )
211 
212 #define QVAR_DEF_RO_2( type, name, validator )
213 #define QVAR_DEF_2( type, name, validator )
214 
215 #define FX_VAR_DEF_RO( type, name, def_val, metric_def_value, filerType, rbType, validation ) \
216  QVAR_DEF_RO( type, name, validation )
217 
218 #define FX_VAR_DEF( type, name, def_val, metric_def_value, filerType, rbType, validation ) \
219  QVAR_DEF_RO( type, name, validation )
220 
221 #define ODTUCSNAME OdDbHardPointerId
222 
223  #include <QuasiVarDefs.h>
224  #include "fxdbvardefs.h"
225 
226 #undef ODTUCSNAME
227 
228 #undef QVAR_DEF_RO
229 #undef QVAR_DEF
230 #undef QVAR_DEF_RO_2
231 #undef QVAR_DEF_2
232 
233 #undef FX_VAR_DEF_RO
234 #undef FX_VAR_DEF
235 
237  {
238  kPU_COMMANDNAME = LAST_DWGDIRECT_UNDO_ID + 1,
239 
240  //constant definitions
241  #define FX_VAR_DEF(type, name, def_val, metric_def_value, filerType, rbType, validate) kPU_Db##name,
242  #define FX_VAR_DEF_RO(type, name, def_val, metric_def_value, filerType, rbType, validate) kPU_Db##name,
243  #define FX_REGVAR_DEF( type, name, def_val, filerType, rbType, validation ) kPU_Db##name,
244  #define FX_REGVAR_DEF_RO( type, name, def_val, filerType, rbType, validation ) kPU_Db##name,
245  #define QVAR_DEF( type, name, validation ) kPU_Db##name,
246  #define QVAR_DEF_RO( type, name, validation ) kPU_Db##name,
247 
248  #include "fxdbvardefs.h"
249  #include "FxSysVarDefs.h"
250  #include <QuasiVarDefs.h>
251 
252  #undef FX_VAR_DEF
253  #undef FX_VAR_DEF_RO
254  #undef FX_REGVAR_DEF
255  #undef FX_REGVAR_DEF_RO
256  #undef QVAR_DEF
257  #undef QVAR_DEF_RO
258 
259  #define REGVAR_DEF( type, name, def_val, filerType, validation ) kPU_Db##name,
260  #include <SysVarDefs.h>
261  #undef REGVAR_DEF
262 
277 
278  kPU_DbDummy
279  };
280 
281  //UNDOCTL modes
283  {
284  Enabled = 0x1,
285  One = 0x2,
286  Auto = 0x4,
287  Combine = 0x10,
288  Layer = 0x20
289  };
290 
299  virtual CFxView* GetGsView( OdDbObjectId id ) const = 0;
300 
301 private:
302  //don't call this function
303  //use SaveFile
304  void writeFile(
305  OdStreamBuf* pStreamBuf,
306  OdDb::SaveType fileType,
307  OdDb::DwgVersion fileVersion,
308  bool saveThumbnailImage = false,
309  int dxfPrecision = 16);
310 
311 };
312 
313 #include "FxPragmaPop.h"
DbSecurity.h
CFxDatabase::StartUndoRecord
virtual void StartUndoRecord(const CFxString &strLabel)=0
FxPragmaPop.h
CFxDatabase::kPU_DbPUCSYDIR
@ kPU_DbPUCSYDIR
Definition: FxDatabase.h:271
OdGeVector3d
Definition: GeVector3d.h:54
OdString
Definition: OdString.h:95
CFxDatabase::getUSERS1
virtual OdString getUSERS1() const =0
OdDbDatabase
Definition: DbDatabase.h:421
CFxDatabase::BlockPurge
virtual int BlockPurge(OdDbObjectId id, bool block)=0
Block purge.
CFxDatabase::SaveFile
virtual bool SaveFile(const CFxFileData *pNewData=0, bool deleteBackupFile=true)=0
CFxDatabase::GetActiveViewportId
OdDbObjectId GetActiveViewportId(OdDbObjectId idLayout=OdDbObjectId::kNull) const
CFxDatabase::kPU_DbHIDEOBJ
@ kPU_DbHIDEOBJ
Definition: FxDatabase.h:275
CFxDatabase::CFxDatabase
CFxDatabase(void)
CFxDatabase::setTDINDWG
virtual bool setTDINDWG(OdDbDate value)=0
CFxDatabase::setPUCSYDIR
virtual bool setPUCSYDIR(OdGeVector3d value)=0
CFxDatabase::setBINDTYPE
virtual bool setBINDTYPE(OdInt16 value)=0
CFxDatabase::GetDatabaseHistory
virtual CFxDatabaseHistory * GetDatabaseHistory()=0
Gets the database history.
OdTimeStamp
Definition: OdTimeStamp.h:42
CFxDatabase
Definition: FxDatabase.h:48
CFxDatabase::kPU_DbTDUCREATE
@ kPU_DbTDUCREATE
Definition: FxDatabase.h:264
CFxDatabase::kPU_DbPSTYLEMODE
@ kPU_DbPSTYLEMODE
Definition: FxDatabase.h:268
CFxDatabase::GetBlockedPurge
virtual const std::set< OdDbObjectId > & GetBlockedPurge() const =0
CFxDatabase::setTDUUPDATE
virtual bool setTDUUPDATE(OdDbDate value)=0
OdPassword
OdString OdPassword
Definition: DbSecurity.h:52
CFxUnitsFormatter
Definition: FxUnitsFormatter.h:40
CFxDatabase::SetFileData
virtual void SetFileData(const CFxFileData &) const =0
OdDbDate
Definition: DbDate.h:45
CFxDatabase::kPU_DbPUCSORG
@ kPU_DbPUCSORG
Definition: FxDatabase.h:269
CFxDatabase::setTDUCREATE
virtual bool setTDUCREATE(OdDbDate value)=0
CFxDatabase::getPLIMMAX
OdGePoint2d getPLIMMAX() const override=0
OdDbObjectId
Definition: DbObjectId.h:99
CFxDatabase::getBINDTYPE
virtual OdInt16 getBINDTYPE() const =0
CFxDatabase::getDWGCODEPAGE
OdCodePageId getDWGCODEPAGE() const override
CFxDatabase::LoadFile
static CFxDatabasePtr LoadFile(const CFxString &strFilename, OdCodePageId *pCodepage=0, const OdPassword &password=OdPassword())
OdCodePageId
OdCodePageId
Definition: OdCodePage.h:31
DDKERNEL.h
CFxDatabase::setUSERS4
virtual bool setUSERS4(const OdString &value)=0
OdCodePage.h
CFxDatabase::setPUCSORG
virtual bool setPUCSORG(OdGePoint3d value)=0
CFxDatabase::GetFileData
virtual const CFxFileData & GetFileData() const =0
CFxDatabase::kPU_DbREFSET
@ kPU_DbREFSET
Definition: FxDatabase.h:273
OdDbDatabase::writeFile
void writeFile(OdStreamBuf *pStreamBuf, OdDb::SaveType fileType, OdDb::DwgVersion fileVersion, bool saveThumbnailImage=false, int dxfPrecision=16)
CFxDatabase::setUCSORG
virtual bool setUCSORG(OdGePoint3d value)=0
OdInt16
short OdInt16
Definition: OdPlatformSettings.h:756
CFxDatabase::setTDUSRTIMER
virtual bool setTDUSRTIMER(OdDbDate value)=0
CFxDatabase::kPU_DbBEDIT
@ kPU_DbBEDIT
Definition: FxDatabase.h:276
CFxDatabase::setUSERS5
virtual bool setUSERS5(const OdString &value)=0
OdDb::DwgVersion
DwgVersion
Definition: OdaDefs.h:46
CFxDatabase::RecoverFile
static CFxDatabasePtr RecoverFile(const CFxString &strFilename, OdCodePageId *pCodepage=0, const OdPassword &password=OdPassword())
CFxDatabase::kPU_DbDWGCODEPAGE
@ kPU_DbDWGCODEPAGE
Definition: FxDatabase.h:263
CFxDatabase::getUSERS2
virtual OdString getUSERS2() const =0
OdSmartPtr
Definition: SmartPtr.h:58
OdGePoint3d
Definition: GePoint3d.h:55
CFxString
Definition: FxString.h:48
DbDatabase.h
CFxFileData
Definition: FxFileData.h:37
CFxDatabase::GetUnitsFormatter
virtual const CFxUnitsFormatter * GetUnitsFormatter() const =0
CFxDatabaseHistory
Definition: FxDatabaseHistory.h:46
CFxDatabase::kPU_DbTDINDWG
@ kPU_DbTDINDWG
Definition: FxDatabase.h:266
CFxRecentlyErased
Definition: FxRecentlyErased.h:31
QuasiVarDefs.h
FxSysVarDefs.h
SysVarDefs.h
OdDbObjectId::kNull
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:118
CFxDatabase::FxPartialUndoID
FxPartialUndoID
Definition: FxDatabase.h:237
CFxDatabase::getElapsedTime
virtual const OdTimeStamp & getElapsedTime()=0
DDKERNEL_API
#define DDKERNEL_API
Definition: DDKERNEL.h:32
CFxDatabase::GetFxGsModel
virtual CFxGsModel * GetFxGsModel()=0
CFxView
Definition: FxView.h:265
CFxDatabase::getUSERS4
virtual OdString getUSERS4() const =0
CFxDatabase::setUSERS1
virtual bool setUSERS1(const OdString &value)=0
CFxDatabase::GetFxGsModel
virtual const CFxGsModel * GetFxGsModel() const =0
CFxDatabase::getUSERS3
virtual OdString getUSERS3() const =0
CFxDatabasePtr
OdSmartPtr< CFxDatabase > CFxDatabasePtr
Definition: FxDatabase.h:37
CFxDatabase::setPUCSXDIR
virtual bool setPUCSXDIR(OdGeVector3d value)=0
CFxDatabase::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(CFxDatabase)
CFxDatabase::kPU_DbTDUUPDATE
@ kPU_DbTDUUPDATE
Definition: FxDatabase.h:265
CFxDatabase::UNDOCTL_Modes
UNDOCTL_Modes
Definition: FxDatabase.h:283
OdStreamBuf
Definition: OdStreamBuf.h:67
OdDb::SaveType
SaveType
Definition: DbObject.h:150
CFxDatabase::setUSERS3
virtual bool setUSERS3(const OdString &value)=0
value
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
CFxDatabase::setPSTYLEMODE
virtual bool setPSTYLEMODE(bool value)=0
CFxDatabase::LockFile
virtual void LockFile(bool bLock)=0
CFxDatabase::setUSERS2
virtual bool setUSERS2(const OdString &value)=0
CFxDatabase::kPU_DbTDUSRTIMER
@ kPU_DbTDUSRTIMER
Definition: FxDatabase.h:267
CFxDatabase::kPU_DbREFBASEPT
@ kPU_DbREFBASEPT
Definition: FxDatabase.h:274
fxdbvardefs.h
CFxDatabase::GetGsView
virtual CFxView * GetGsView(OdDbObjectId id) const =0
FxPragmaPush.h
CFxDatabase::ResetTime
virtual void ResetTime()=0
CFxDatabase::setUCSXDIR
virtual bool setUCSXDIR(OdGeVector3d value)=0
CFxDatabase::GetActiveBlockId
OdDbObjectId GetActiveBlockId() const
CFxDatabase::kPU_DbREFEDIT
@ kPU_DbREFEDIT
Definition: FxDatabase.h:272
CFxDatabase::~CFxDatabase
~CFxDatabase(void) override
LAST_DWGDIRECT_UNDO_ID
#define LAST_DWGDIRECT_UNDO_ID
Definition: FxDatabase.h:40
CFxDatabase::getUSERS5
virtual OdString getUSERS5() const =0
CFxDatabase::GetRecentlyErased
virtual CFxRecentlyErased * GetRecentlyErased()=0
CFxDatabase::IsModelLayoutActive
bool IsModelLayoutActive() const
CFxDatabase::setDWGCODEPAGE
virtual bool setDWGCODEPAGE(OdCodePageId value)=0
CFxDatabase::setUCSYDIR
virtual bool setUCSYDIR(OdGeVector3d value)=0
CFxDatabase::getPLIMMIN
OdGePoint2d getPLIMMIN() const override=0
CFxDatabase::kPU_DbPUCSXDIR
@ kPU_DbPUCSXDIR
Definition: FxDatabase.h:270
OdGePoint2d
Definition: GePoint2d.h:60