QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ROperation.h
Go to the documentation of this file.
1 
20 #ifndef ROPERATION_H
21 #define ROPERATION_H
22 
23 #include "core_global.h"
24 
25 #include "RNonCopyable.h"
26 #include "RRequireHeap.h"
27 #include "RS.h"
28 #include "RTransaction.h"
29 
30 class RDocument;
31 class RExporter;
32 
33 
34 
45 public:
47  bool undoable=true,
48  RS::EntityType entityTypeFilter = RS::EntityAll
49  ) : undoable(undoable),
50  recordAffectedObjects(true),
51  spatialIndexDisabled(false),
52  allowInvisible(false),
53  entityTypeFilter(entityTypeFilter) {}
54  virtual ~ROperation() {
55  }
56 
64  virtual RTransaction apply(RDocument& document, bool preview = false) const = 0;
65 
67  return entityTypeFilter;
68  }
69 
70  void setRecordAffectedObjects(bool on) {
71  recordAffectedObjects = on;
72  }
73 
74  void setSpatialIndexDisabled(bool on) {
75  spatialIndexDisabled = on;
76  }
77 
78  void setAllowInvisible(bool on) {
79  allowInvisible = on;
80  }
81 
82 protected:
83  bool undoable;
88 };
89 
91 
92 #endif