summaryrefslogtreecommitdiff
path: root/inc/TDocStd_MultiTransactionManager.hxx
blob: 38523d83581ed9a7c7bbd412c43b9b9e5f3090c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _TDocStd_MultiTransactionManager_HeaderFile
#define _TDocStd_MultiTransactionManager_HeaderFile

#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_TDocStd_MultiTransactionManager_HeaderFile
#include <Handle_TDocStd_MultiTransactionManager.hxx>
#endif

#ifndef _TDocStd_SequenceOfDocument_HeaderFile
#include <TDocStd_SequenceOfDocument.hxx>
#endif
#ifndef _TDocStd_SequenceOfApplicationDelta_HeaderFile
#include <TDocStd_SequenceOfApplicationDelta.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Standard_OStream_HeaderFile
#include <Standard_OStream.hxx>
#endif
#ifndef _Handle_TDocStd_Document_HeaderFile
#include <Handle_TDocStd_Document.hxx>
#endif
class TDocStd_SequenceOfApplicationDelta;
class TCollection_ExtendedString;
class TDocStd_Document;
class TDocStd_SequenceOfDocument;


//! Class for synchronization of transactions within multiple documents. <br>
//!          Each transaction of this class involvess one transaction in each modified document. <br>
class TDocStd_MultiTransactionManager : public MMgt_TShared {

public:

  //! Constructor <br>
  Standard_EXPORT   TDocStd_MultiTransactionManager();
  //! Sets undo limit for the manager and all documents. <br>
  Standard_EXPORT     void SetUndoLimit(const Standard_Integer theLimit) ;
  //! Returns undo limit for the manager. <br>
        Standard_Integer GetUndoLimit() const;
  //! Undoes the current transaction of the manager. <br>
//!          It calls the Undo () method of the document being <br>
//!          on top of the manager list of undos (list.First()) <br>
//!          and moves the list item to the top of the list of manager <br>
//!          redos (list.Prepend(item)). <br>
  Standard_EXPORT     void Undo() ;
  //! Redoes the current transaction of the application. It calls <br>
//!          the Redo () method of the document being on top of the <br>
//!          manager list of redos (list.First()) and moves the list <br>
//!          item to the top of the list of manager undos (list.Prepend(item)). <br>
  Standard_EXPORT     void Redo() ;
  //! Returns available manager undos. <br>
       const TDocStd_SequenceOfApplicationDelta& GetAvailableUndos() const;
  //! Returns available manager redos. <br>
       const TDocStd_SequenceOfApplicationDelta& GetAvailableRedos() const;
  //! Opens transaction in each document and sets the flag that <br>
//!          transaction is opened. If there are already opened transactions in the documents, <br>
//!          these transactions will be aborted before openning new ones. <br>
  Standard_EXPORT     void OpenCommand() ;
  //! Unsets the flag of started manager transaction and aborts <br>
//!          transaction in each document. <br>
  Standard_EXPORT     void AbortCommand() ;
  //! Commits transaction in all documents and fills the transaction manager <br>
//!          with the documents that have been changed during the transaction. <br>
//!          Returns True if new data has been added to myUndos. <br>
//!          NOTE: All nested transactions in the documents will be commited. <br>
  Standard_EXPORT     Standard_Boolean CommitCommand() ;
  //! Makes the same steps as the previous function but defines the name for transaction. <br>
//!          Returns True if new data has been added to myUndos. <br>
  Standard_EXPORT     Standard_Boolean CommitCommand(const TCollection_ExtendedString& theName) ;
  //! Returns true if a transaction is opened. <br>
        Standard_Boolean HasOpenCommand() const;
  //! Removes undo information from the list of undos of the manager and <br>
//!          all documents which have been modified during the transaction. <br>
  Standard_EXPORT     void RemoveLastUndo() ;
  //! Dumps transactions in undos and redos <br>
  Standard_EXPORT     void DumpTransaction(Standard_OStream& theOS) const;
  //! Adds the document to the transaction manager and <br>
//!          checks if it has been already added <br>
  Standard_EXPORT     void AddDocument(const Handle(TDocStd_Document)& theDoc) ;
  //! Removes the document from the transaction manager. <br>
  Standard_EXPORT     void RemoveDocument(const Handle(TDocStd_Document)& theDoc) ;
  //! Returns the added documents to the transaction manager. <br>
       const TDocStd_SequenceOfDocument& Documents() const;
  //! Sets nested transaction mode if isAllowed == Standard_True <br>
//!          NOTE: field myIsNestedTransactionMode exists only for synchronization <br>
//!           between several documents and has no effect on transactions <br>
//!          of multitransaction manager. <br>
  Standard_EXPORT     void SetNestedTransactionMode(const Standard_Boolean isAllowed = Standard_True) ;
  //! Returns Standard_True if NestedTransaction mode is set. <br>//! Methods for protection of changes outside transactions <br>
        Standard_Boolean IsNestedTransactionMode() const;
  //! If theTransactionOnly is True, denies all changes outside transactions. <br>
  Standard_EXPORT     void SetModificationMode(const Standard_Boolean theTransactionOnly) ;
  //! Returns True if changes are allowed only inside transactions. <br>
        Standard_Boolean ModificationMode() const;
  //! Clears undos in the manager and in documents. <br>
  Standard_EXPORT     void ClearUndos() ;
  //! Clears redos in the manager and in documents. <br>
  Standard_EXPORT     void ClearRedos() ;




  DEFINE_STANDARD_RTTI(TDocStd_MultiTransactionManager)

protected:




private: 


TDocStd_SequenceOfDocument myDocuments;
TDocStd_SequenceOfApplicationDelta myUndos;
TDocStd_SequenceOfApplicationDelta myRedos;
Standard_Integer myUndoLimit;
Standard_Boolean myOpenTransaction;
Standard_Boolean myIsNestedTransactionMode;
Standard_Boolean myOnlyTransactionModification;


};


#include <TDocStd_MultiTransactionManager.lxx>



// other Inline functions and methods (like "C++: function call" methods)


#endif