CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
FxDatabase.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2025 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
29class CFxFileData;
30class CFxGsModel;
34class CFxString;
35class CFxView;
36
37class CFxDatabase;
39
40#define LAST_DWGDIRECT_UNDO_ID 0x1000 //this value is much bigger than last DWGDirect undo value
41
48{
49public:
51
53 ~CFxDatabase(void) override;
54
60 static CFxDatabasePtr LoadFile( const CFxString& strFilename, OdCodePageId* pCodepage = 0, const OdPassword& password = OdPassword() );
61
67 virtual bool SaveFile( const CFxFileData* pNewData = 0, bool deleteBackupFile = true ) = 0;
68
74 static CFxDatabasePtr RecoverFile( const CFxString& strFilename, OdCodePageId* pCodepage = 0, const OdPassword& password = OdPassword() );
75
79 virtual void LockFile( bool bLock ) = 0;
80
86
91 bool IsModelLayoutActive() const;
92
98
102 virtual const CFxUnitsFormatter* GetUnitsFormatter() const = 0;
103
107 virtual const CFxFileData& GetFileData() const = 0;
108
112 virtual void SetFileData(const CFxFileData &) const = 0;
113
117 virtual CFxGsModel* GetFxGsModel() = 0;
121 virtual const CFxGsModel* GetFxGsModel() const = 0;
129 virtual void StartUndoRecord( const CFxString& strLabel ) = 0;
130
134 virtual void ResetTime() = 0;
135
142
150 virtual int BlockPurge( OdDbObjectId id, bool block ) = 0;
151
157 virtual const std::set<OdDbObjectId>& GetBlockedPurge() const = 0;
158
164 virtual const OdTimeStamp& getElapsedTime() = 0;
165
171 virtual const OdError& GetLastError() const = 0;
172
176 virtual void ClearError() = 0;
177
178 //overrides of system variables
179 OdCodePageId getDWGCODEPAGE() const override;
180 OdGePoint2d getPLIMMIN() const override = 0;
181 OdGePoint2d getPLIMMAX() const override = 0;
182
183 //newly added functions
184 virtual bool setDWGCODEPAGE( OdCodePageId value ) = 0;
185 virtual bool setTDUCREATE( OdDbDate value ) = 0;
186 virtual bool setTDUUPDATE( OdDbDate value ) = 0;
187 virtual bool setTDINDWG( OdDbDate value ) = 0;
188 virtual bool setTDUSRTIMER( OdDbDate value ) = 0;
189 virtual bool setPSTYLEMODE( bool value ) = 0;
190 virtual bool setPUCSORG( OdGePoint3d value ) = 0;
191 virtual bool setPUCSXDIR( OdGeVector3d value ) = 0;
192 virtual bool setPUCSYDIR( OdGeVector3d value ) = 0;
193 virtual bool setUCSORG( OdGePoint3d value ) = 0;
194 virtual bool setUCSXDIR( OdGeVector3d value ) = 0;
195 virtual bool setUCSYDIR( OdGeVector3d value ) = 0;
196 virtual bool setPUCSAll( OdGePoint3d org, OdGeVector3d xDir, OdGeVector3d yDir ) = 0;
197 virtual bool setUCSAll( OdGePoint3d org, OdGeVector3d xDir, OdGeVector3d yDir ) = 0;
198
199 virtual OdString getUSERS1() const = 0;
200 virtual bool setUSERS1( const OdString& value ) = 0;
201 virtual OdString getUSERS2() const = 0;
202 virtual bool setUSERS2( const OdString& value ) = 0;
203 virtual OdString getUSERS3() const = 0;
204 virtual bool setUSERS3( const OdString& value ) = 0;
205 virtual OdString getUSERS4() const = 0;
206 virtual bool setUSERS4( const OdString& value ) = 0;
207 virtual OdString getUSERS5() const = 0;
208 virtual bool setUSERS5( const OdString& value ) = 0;
209 virtual OdInt16 getBINDTYPE() const = 0;
210 virtual bool setBINDTYPE( OdInt16 value ) = 0;
211
215#define QVAR_DEF_RO( type, name, validator ) \
216 virtual type get##name() const = 0; \
217 virtual bool set##name( type val ) = 0;
218
219#define QVAR_DEF( type, name, validator ) \
220 QVAR_DEF_RO( type, name, validator )
221
222#define QVAR_DEF_RO_2( type, name, validator )
223#define QVAR_DEF_2( type, name, validator )
224
225#define FX_VAR_DEF_RO( type, name, def_val, metric_def_value, filerType, rbType, validation ) \
226 QVAR_DEF_RO( type, name, validation )
227
228#define FX_VAR_DEF( type, name, def_val, metric_def_value, filerType, rbType, validation ) \
229 QVAR_DEF_RO( type, name, validation )
230
231#define ODTUCSNAME OdDbHardPointerId
232
233 #include <QuasiVarDefs.h>
234 #include "fxdbvardefs.h"
235
236#undef ODTUCSNAME
237
238#undef QVAR_DEF_RO
239#undef QVAR_DEF
240#undef QVAR_DEF_RO_2
241#undef QVAR_DEF_2
242
243#undef FX_VAR_DEF_RO
244#undef FX_VAR_DEF
245
246 enum FxPartialUndoID
247 {
248 kPU_COMMANDNAME = LAST_DWGDIRECT_UNDO_ID + 1,
249
250 //constant definitions
251 #define FX_VAR_DEF(type, name, def_val, metric_def_value, filerType, rbType, validate) kPU_Db##name,
252 #define FX_VAR_DEF_RO(type, name, def_val, metric_def_value, filerType, rbType, validate) kPU_Db##name,
253 #define FX_REGVAR_DEF( type, name, def_val, filerType, rbType, validation ) kPU_Db##name,
254 #define FX_REGVAR_DEF_RO( type, name, def_val, filerType, rbType, validation ) kPU_Db##name,
255 #define QVAR_DEF( type, name, validation ) kPU_Db##name,
256 #define QVAR_DEF_RO( type, name, validation ) kPU_Db##name,
257
258 #include "fxdbvardefs.h"
259 #include "FxSysVarDefs.h"
260 #include <QuasiVarDefs.h>
261
262 #undef FX_VAR_DEF
263 #undef FX_VAR_DEF_RO
264 #undef FX_REGVAR_DEF
265 #undef FX_REGVAR_DEF_RO
266 #undef QVAR_DEF
267 #undef QVAR_DEF_RO
268
269 #define REGVAR_DEF( type, name, def_val, filerType, validation ) kPU_Db##name,
270 #include <SysVarDefs.h>
271 #undef REGVAR_DEF
272
273 kPU_DbDWGCODEPAGE,
274 kPU_DbTDUCREATE,
275 kPU_DbTDUUPDATE,
276 kPU_DbTDINDWG,
277 kPU_DbTDUSRTIMER,
278 kPU_DbPSTYLEMODE,
279 kPU_DbPUCSORG,
280 kPU_DbPUCSXDIR,
281 kPU_DbPUCSYDIR,
282 kPU_DbREFEDIT,
283 kPU_DbREFSET,
284 kPU_DbREFBASEPT,
285 kPU_DbHIDEOBJ,
286 kPU_DbBEDIT,
287 kPU_DbUCSALL,
288 kPU_DbPUCSALL,
289
290 kPU_DbDummy
291 };
292
293 //UNDOCTL modes
295 {
296 Enabled = 0x1,
297 One = 0x2,
298 Auto = 0x4,
299 Combine = 0x10,
300 Layer = 0x20
301 };
302
311 virtual CFxView* GetGsView( OdDbObjectId id ) const = 0;
312
313private:
314 //don't call this function
315 //use SaveFile
316 void writeFile(
317 OdStreamBuf* pStreamBuf,
319 OdDb::DwgVersion fileVersion,
320 bool saveThumbnailImage = false,
321 int dxfPrecision = 16);
322
323};
324
325#include "FxPragmaPop.h"
#define DDKERNEL_API
Definition DDKERNEL.h:32
OdString OdPassword
Definition DbSecurity.h:52
fileType
OdSmartPtr< CFxDatabase > CFxDatabasePtr
Definition FxDatabase.h:38
#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 const CFxFileData & GetFileData() const =0
static CFxDatabasePtr RecoverFile(const CFxString &strFilename, OdCodePageId *pCodepage=0, const OdPassword &password=OdPassword())
virtual CFxDatabaseHistory * GetDatabaseHistory()=0
Gets the database history. Return Value: null if it fails, else the database history.
virtual OdString getUSERS3() const =0
OdDbObjectId GetActiveViewportId(OdDbObjectId idLayout=OdDbObjectId::kNull) const
virtual bool setPUCSAll(OdGePoint3d org, OdGeVector3d xDir, OdGeVector3d yDir)=0
~CFxDatabase(void) override
virtual const OdTimeStamp & getElapsedTime()=0
virtual bool setTDUCREATE(OdDbDate value)=0
OdGePoint2d getPLIMMIN() const override=0
virtual int BlockPurge(OdDbObjectId id, bool block)=0
Block purge. Arguments:
virtual bool setUCSAll(OdGePoint3d org, OdGeVector3d xDir, OdGeVector3d yDir)=0
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 CFxView * GetGsView(OdDbObjectId id) const =0
virtual bool setUSERS3(const OdString &value)=0
virtual bool setTDUUPDATE(OdDbDate value)=0
virtual OdString getUSERS4() const =0
OdCodePageId getDWGCODEPAGE() const override
virtual CFxGsModel * GetFxGsModel()=0
OdGePoint2d getPLIMMAX() const override=0
virtual bool setUSERS1(const OdString &value)=0
virtual bool setPUCSXDIR(OdGeVector3d value)=0
virtual const CFxGsModel * GetFxGsModel() const =0
virtual bool setPSTYLEMODE(bool value)=0
virtual const CFxUnitsFormatter * GetUnitsFormatter() const =0
virtual const std::set< OdDbObjectId > & GetBlockedPurge() const =0
virtual bool setUSERS5(const OdString &value)=0
OdDbObjectId GetActiveBlockId() const
virtual bool SaveFile(const CFxFileData *pNewData=0, bool deleteBackupFile=true)=0
virtual bool setTDUSRTIMER(OdDbDate value)=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 CFxRecentlyErased * GetRecentlyErased()=0
virtual OdString getUSERS1() const =0
virtual void ClearError()=0
virtual const OdError & GetLastError() const =0
virtual bool setPUCSYDIR(OdGeVector3d value)=0
bool IsModelLayoutActive() const
virtual bool setUSERS4(const OdString &value)=0
OdString(OD_T(".")))
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:110
GLsizei const GLfloat * value
Definition gles2_ext.h:302
DwgVersion
Definition OdaDefs.h:47
SaveType
Definition DbObject.h:152