QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RMixedOperation.h
Go to the documentation of this file.
1 
20 #ifndef RMIXEDOPERATION_H
21 #define RMIXEDOPERATION_H
22 
23 #include "operations_global.h"
24 
25 #include <QList>
26 #include <QSharedPointer>
27 #include <QFlags>
28 
29 #include "RDocument.h"
30 #include "RExporter.h"
31 #include "ROperation.h"
32 #include "RTransaction.h"
33 #include "RVector.h"
34 
35 class RObject;
36 
44 public:
45  enum Mode {
46  NoMode = 0x0,
47  UseCurrentAttributes = 0x1,
48  Delete = 0x2,
49  ForceNew = 0x4,
50  EndCycle = 0x8
51  };
52  Q_DECLARE_FLAGS(Modes, Mode)
53 
54 public:
55  RMixedOperation(bool undoable = true);
56  virtual ~RMixedOperation() {
57  }
58 
59  QSharedPointer<RObject> addObject(const QSharedPointer<RObject>& obj,
60  bool useCurrentAttributes = true, bool forceNew=false);
61  void deleteObject(const QSharedPointer<RObject>& obj);
62  void endCycle();
63 
64  virtual RTransaction apply(RDocument& document, bool preview = false) const;
65 
66 // int getPreviewCounter() const {
67 // return previewCounter;
68 // }
69 
70 // void setLimitPreview(bool on) {
71 // limitPreview = on;
72 // }
73 
74 protected:
75  void setMode(RMixedOperation::Modes& modes, RMixedOperation::Mode mode, bool on = true);
76  bool getMode(const RMixedOperation::Modes& modes, RMixedOperation::Mode mode) const;
77 
78 private:
79  QList<QPair<QSharedPointer<RObject>, Modes> > list;
80 // int previewCounter;
81 // bool limitPreview;
82 };
83 
84 Q_DECLARE_OPERATORS_FOR_FLAGS(RMixedOperation::Modes)
87 
88 #endif