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  transactionGroup(-1) {}
55  virtual ~ROperation() {
56  }
57 
65  virtual RTransaction apply(RDocument& document, bool preview = false) const = 0;
66 
68  return entityTypeFilter;
69  }
70 
71  void setRecordAffectedObjects(bool on) {
72  recordAffectedObjects = on;
73  }
74 
75  void setSpatialIndexDisabled(bool on) {
76  spatialIndexDisabled = on;
77  }
78 
79  void setAllowInvisible(bool on) {
80  allowInvisible = on;
81  }
82 
83  void setTransactionGroup(int g) {
84  transactionGroup = g;
85  }
86 
87  void setText(const QString& t) {
88  text = t;
89  }
90 
91 protected:
92  bool undoable;
98  QString text;
99 };
100 
102 
103 #endif