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 
45 public:
46  enum Mode {
47  NoMode = 0x0,
48  UseCurrentAttributes = 0x1,
49  Delete = 0x2,
50  ForceNew = 0x4,
51  EndCycle = 0x8
52  };
53  Q_DECLARE_FLAGS(Modes, Mode)
54 
55 public:
56  RMixedOperation(bool undoable = true);
57  virtual ~RMixedOperation() {
58  }
59 
60  QSharedPointer<RObject> addObject(const QSharedPointer<RObject>& obj,
61  bool useCurrentAttributes = true, bool forceNew=false);
62  void deleteObject(const QSharedPointer<RObject>& obj);
63  void endCycle();
64 
65  virtual RTransaction apply(RDocument& document, bool preview = false) const;
66 
67 // int getPreviewCounter() const {
68 // return previewCounter;
69 // }
70 
71 // void setLimitPreview(bool on) {
72 // limitPreview = on;
73 // }
74 
75 protected:
76  void setMode(RMixedOperation::Modes& modes, RMixedOperation::Mode mode, bool on = true);
77  bool getMode(const RMixedOperation::Modes& modes, RMixedOperation::Mode mode) const;
78 
79 private:
80  QList<QPair<QSharedPointer<RObject>, Modes> > list;
81 // int previewCounter;
82 // bool limitPreview;
83 };
84 
85 Q_DECLARE_OPERATORS_FOR_FLAGS(RMixedOperation::Modes)
88 
89 #endif