OpenLexocad  28.0
CA_CommandObserver.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QObject>
4 
5 
6 
7 namespace Core
8 {
9 class Property;
10 class DocObject;
11 class CoreDocument;
12 class Command;
13 } // namespace Core
14 
15 
16 class LX_CORE_EXPORT CA_Transaction
17 {
18 public:
19  CA_Transaction() = default;
20 
21  enum why
22  {
32 
36 
42 
44  RecomputeFailure
45 
46  } Why;
47 
48  Core::CoreDocument* doc = nullptr;
49  Core::DocObject* object = nullptr;
50  Core::Property* property = nullptr;
51 };
52 
53 
54 
55 class LX_CORE_EXPORT CA_TransactionObserver
56 {
57 public:
59  virtual void onChange(const CA_Transaction& tr) = 0;
60  virtual std::string getName() = 0;
61 
62 protected:
63  virtual ~CA_TransactionObserver(void){};
64 };
65 
66 
67 class LX_CORE_EXPORT CA_CommandObserver : public QObject
68 {
69 public:
71  virtual ~CA_CommandObserver(void){};
72 
73  virtual void notifyRedo(Core::Command* const /*command*/){};
74  virtual void notifyUndo(Core::Command* const /*command*/){};
75  virtual void info(const std::string&){};
76 
77  virtual void notifyStart(){};
78  virtual void notifyStop(){};
79  virtual void notifyReset(){};
80 
81  virtual void notifySelectionAdd(Core::CoreDocument const*, const std::vector<Core::DocObject*>& /*objs*/){};
82  virtual void notifySelectionRemove(Core::CoreDocument const*, const std::vector<Core::DocObject*>& /*objs*/){};
83  virtual void notifySelectionClear(Core::CoreDocument const*){};
84 
85 
86  virtual void notifyPlayLastEvents(){};
87 
88  virtual void notifyDocumentNewFile(Core::CoreDocument const*){};
92  virtual void notifyDocumentClose(Core::CoreDocument const*){};
94 
95  virtual std::string getName() { return "NoName"; };
96 
97 protected:
98  virtual void setName(std::string&){};
99 };
100 
101 typedef std::vector<CA_CommandObserver*> ca_CommandObserver_Vector;
102 typedef std::vector<CA_TransactionObserver*> CA_TransactionObserver_Vector;
CA_TransactionObserver
Definition: CA_CommandObserver.h:56
CA_TransactionObserver::getName
virtual std::string getName()=0
Core::CoreDocument
Definition: CoreDocument.h:269
CA_Transaction::PropertyCreate
@ PropertyCreate
Definition: CA_CommandObserver.h:33
CA_Transaction::DocumentFinishedRead
@ DocumentFinishedRead
Definition: CA_CommandObserver.h:28
CA_CommandObserver::notifySelectionRemove
virtual void notifySelectionRemove(Core::CoreDocument const *, const std::vector< Core::DocObject * > &)
Definition: CA_CommandObserver.h:82
CA_TransactionObserver::onChange
virtual void onChange(const CA_Transaction &tr)=0
CA_TransactionObserver::CA_TransactionObserver
CA_TransactionObserver()
Definition: CA_CommandObserver.h:58
CA_CommandObserver::notifySelectionClear
virtual void notifySelectionClear(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:83
CA_Transaction::DocumentSaved
@ DocumentSaved
Definition: CA_CommandObserver.h:30
CA_Transaction::DocumentOpen
@ DocumentOpen
Definition: CA_CommandObserver.h:27
CA_Transaction::CA_Transaction
CA_Transaction()=default
CA_Transaction::RecomputeSuccess
@ RecomputeSuccess
Definition: CA_CommandObserver.h:43
Core::DocObject
Definition: DocObject.h:54
CA_Transaction::PropertyDelete
@ PropertyDelete
Definition: CA_CommandObserver.h:34
CA_CommandObserver::notifyUndo
virtual void notifyUndo(Core::Command *const)
Definition: CA_CommandObserver.h:74
CA_CommandObserver::info
virtual void info(const std::string &)
Definition: CA_CommandObserver.h:75
Core
Definition: Base.h:5
CA_Transaction::why
why
Definition: CA_CommandObserver.h:22
CA_CommandObserver::notifyStop
virtual void notifyStop()
Definition: CA_CommandObserver.h:78
CA_Transaction
Definition: CA_CommandObserver.h:17
CA_CommandObserver::getName
virtual std::string getName()
Definition: CA_CommandObserver.h:95
CA_CommandObserver::~CA_CommandObserver
virtual ~CA_CommandObserver(void)
Definition: CA_CommandObserver.h:71
CA_CommandObserver::notifyRedo
virtual void notifyRedo(Core::Command *const)
Definition: CA_CommandObserver.h:73
CA_CommandObserver
Definition: CA_CommandObserver.h:68
CA_CommandObserver::notifyDocumentOpenFile
virtual void notifyDocumentOpenFile(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:89
CA_Transaction::DocumentChange
@ DocumentChange
Definition: CA_CommandObserver.h:24
Core::Command
Definition: Command.h:38
CA_Transaction::PropertyChange
@ PropertyChange
Definition: CA_CommandObserver.h:35
CA_CommandObserver::notifyReset
virtual void notifyReset()
Definition: CA_CommandObserver.h:79
CA_CommandObserver::notifyStart
virtual void notifyStart()
Definition: CA_CommandObserver.h:77
CA_TransactionObserver::~CA_TransactionObserver
virtual ~CA_TransactionObserver(void)
Definition: CA_CommandObserver.h:63
CA_Transaction::ObjectCreate
@ ObjectCreate
Definition: CA_CommandObserver.h:37
CA_Transaction::DocumentSetActive
@ DocumentSetActive
Definition: CA_CommandObserver.h:31
CA_Transaction::DocumentCreate
@ DocumentCreate
Definition: CA_CommandObserver.h:23
CA_Transaction::ObjectChange
@ ObjectChange
Definition: CA_CommandObserver.h:38
Core::Property
Definition: Property.h:72
CA_CommandObserver::notifyDocumentSaveAsFile
virtual void notifyDocumentSaveAsFile(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:91
CA_CommandObserver::notifyDocumentSaveFile
virtual void notifyDocumentSaveFile(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:90
CA_Transaction::DocumentRenamed
@ DocumentRenamed
Definition: CA_CommandObserver.h:26
CA_Transaction::ObjectAdd
@ ObjectAdd
Definition: CA_CommandObserver.h:40
CA_Transaction::DocumentDelete
@ DocumentDelete
Definition: CA_CommandObserver.h:25
CA_Transaction::ObjectDelete
@ ObjectDelete
Definition: CA_CommandObserver.h:39
CA_TransactionObserver_Vector
std::vector< CA_TransactionObserver * > CA_TransactionObserver_Vector
Definition: CA_CommandObserver.h:102
CA_CommandObserver::setName
virtual void setName(std::string &)
Definition: CA_CommandObserver.h:98
CA_Transaction::DocumentClose
@ DocumentClose
Definition: CA_CommandObserver.h:29
CA_Transaction::ObjectHasError
@ ObjectHasError
Definition: CA_CommandObserver.h:41
CA_CommandObserver::notifyDocumentClose
virtual void notifyDocumentClose(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:92
CA_CommandObserver::notifySelectionAdd
virtual void notifySelectionAdd(Core::CoreDocument const *, const std::vector< Core::DocObject * > &)
Definition: CA_CommandObserver.h:81
ca_CommandObserver_Vector
std::vector< CA_CommandObserver * > ca_CommandObserver_Vector
Definition: CA_CommandObserver.h:101
CA_CommandObserver::CA_CommandObserver
CA_CommandObserver(void)
Definition: CA_CommandObserver.h:70
CA_CommandObserver::notifyDocumentNewFile
virtual void notifyDocumentNewFile(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:88
CA_CommandObserver::notifyPlayLastEvents
virtual void notifyPlayLastEvents()
Definition: CA_CommandObserver.h:86
CA_CommandObserver::notifySetActiveDocument
virtual void notifySetActiveDocument(Core::CoreDocument const *)
Definition: CA_CommandObserver.h:93