CFx SDK Documentation  2023 SP0
FxDatabase.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2022 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,
307  OdDb::DwgVersion fileVersion,
308  bool saveThumbnailImage = false,
309  int dxfPrecision = 16);
310 
311 };
312 
313 #include "FxPragmaPop.h"
#define DDKERNEL_API
Definition: DDKERNEL.h:32
OdString OdPassword
Definition: DbSecurity.h:52
fileType
Definition: FxBIM.h:78
OdSmartPtr< CFxDatabase > CFxDatabasePtr
Definition: FxDatabase.h:37
#define LAST_DWGDIRECT_UNDO_ID
Definition: FxDatabase.h:40
OdCodePageId
Definition: OdCodePage.h:31
short OdInt16
virtual OdString getUSERS5() const =0
virtual void StartUndoRecord(const CFxString &strLabel)=0
virtual bool setTDINDWG(OdDbDate value)=0
virtual OdString getUSERS2() const =0
virtual bool setUSERS2(const OdString &value)=0
virtual bool setUCSORG(OdGePoint3d value)=0
virtual OdInt16 getBINDTYPE() const =0
virtual CFxRecentlyErased * GetRecentlyErased()=0
static CFxDatabasePtr RecoverFile(const CFxString &strFilename, OdCodePageId *pCodepage=0, const OdPassword &password=OdPassword())
virtual OdString getUSERS3() const =0
OdDbObjectId GetActiveViewportId(OdDbObjectId idLayout=OdDbObjectId::kNull) const
~CFxDatabase(void) override
virtual bool setTDUCREATE(OdDbDate value)=0
OdGePoint2d getPLIMMIN() const override=0
virtual int BlockPurge(OdDbObjectId id, bool block)=0
Block purge.
virtual CFxDatabaseHistory * GetDatabaseHistory()=0
Gets the database history.
@ kPU_DbPSTYLEMODE
Definition: FxDatabase.h:268
@ kPU_DbTDUSRTIMER
Definition: FxDatabase.h:267
@ kPU_DbDWGCODEPAGE
Definition: FxDatabase.h:263
virtual void SetFileData(const CFxFileData &) const =0
static CFxDatabasePtr LoadFile(const CFxString &strFilename, OdCodePageId *pCodepage=0, const OdPassword &password=OdPassword())
virtual void ResetTime()=0
virtual const CFxFileData & GetFileData() const =0
virtual bool setUSERS3(const OdString &value)=0
virtual bool setTDUUPDATE(OdDbDate value)=0
virtual const OdTimeStamp & getElapsedTime()=0
virtual OdString getUSERS4() const =0
OdCodePageId getDWGCODEPAGE() const override
OdGePoint2d getPLIMMAX() const override=0
virtual bool setUSERS1(const OdString &value)=0
virtual bool setPUCSXDIR(OdGeVector3d value)=0
virtual bool setPSTYLEMODE(bool value)=0
virtual bool setUSERS5(const OdString &value)=0
virtual const std::set< OdDbObjectId > & GetBlockedPurge() const =0
OdDbObjectId GetActiveBlockId() const
virtual const CFxGsModel * GetFxGsModel() const =0
virtual bool SaveFile(const CFxFileData *pNewData=0, bool deleteBackupFile=true)=0
virtual bool setTDUSRTIMER(OdDbDate value)=0
virtual CFxGsModel * GetFxGsModel()=0
virtual bool setDWGCODEPAGE(OdCodePageId value)=0
virtual bool setBINDTYPE(OdInt16 value)=0
CFxDatabase(void)
virtual void LockFile(bool bLock)=0
virtual bool setUCSYDIR(OdGeVector3d value)=0
ODRX_DECLARE_MEMBERS(CFxDatabase)
virtual bool setUCSXDIR(OdGeVector3d value)=0
virtual bool setPUCSORG(OdGePoint3d value)=0
virtual CFxView * GetGsView(OdDbObjectId id) const =0
virtual OdString getUSERS1() const =0
virtual bool setPUCSYDIR(OdGeVector3d value)=0
bool IsModelLayoutActive() const
virtual bool setUSERS4(const OdString &value)=0
virtual const CFxUnitsFormatter * GetUnitsFormatter() const =0
void writeFile(OdStreamBuf *pStreamBuf, OdDb::SaveType fileType, OdDb::DwgVersion fileVersion, bool saveThumbnailImage=false, int dxfPrecision=16)
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:118
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
DwgVersion
Definition: OdaDefs.h:46
SaveType
Definition: DbObject.h:150