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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
-- File: TDocStd_Document.cdl
-- Created: Wed Apr 7 11:01:48 1999
-- Author: Denis PASCAL
-- <dp@dingox.paris1.matra-dtv.fr>
---Copyright: Matra Datavision 1999
class Document from TDocStd inherits Document from CDM
---Purpose: The contents of a TDocStd_Application, a
-- document is a container for a data framework
-- composed of labels and attributes. As such,
-- TDocStd_Document is the entry point into the data framework.
-- To gain access to the data, you create a document as follows:
-- Handle(TDocStd_Document) MyDF = new TDocStd_Document
-- The document also allows you to manage:
-- - modifications, providing Undo and Redo functions.
-- - command transactions.
-- Warning: The only data saved is the framework (TDF_Data)
---Purpose:
uses Data from TDF,
Label from TDF,
LabelMap from TDF,
ExtendedString from TCollection,
AsciiString from TCollection,
Context from TDocStd,
Delta from TDF,
DeltaList from TDF,
Transaction from TDF,
CompoundDelta from TDocStd
is
--Destroy (me : mutable);
---Purpose: Will Abort any execution, and commit the Undo transaction
-----C++: alias ~
Get (myclass; L : Label from TDF)
---Purpose: returns the document which contains <L>. raises an
-- exception if the document is not found.
returns Document from TDocStd;
Create (astorageformat : ExtendedString from TCollection)
returns mutable Document from TDocStd;
---Purpose: Constructs a document object defined by the
-- string astorageformat.
IsSaved (me)
---Purpose: the document is saved in a file.
returns Boolean from Standard;
IsChanged (me)
returns Boolean from Standard;
---Purpose: returns True if document differs from the state of last saving.
-- this method have to be called only wroking in the transaction mode
---C++: inline
SetSaved (me : mutable);
---Purpose: This method have to be called to show document that it has been saved
---C++: inline
SetSavedTime (me : mutable; theTime : Integer from Standard);
---Purpose: Say to document what it is not saved.
-- Use value, returned earlier by GetSavedTime().
---C++: inline
GetSavedTime (me)
---Purpose: Returns value of <mySavedTime> to be used later in SetSavedTime()
---C++: inline
returns Integer from Standard;
GetName (me)
---Purpose: raise if <me> is not saved.
returns ExtendedString from TCollection;
GetPath (me)
---Purpose: returns the OS path of the file, in wich one <me> is
-- saved. Raise an exception if <me> is not saved.
returns ExtendedString from TCollection;
---Category: Data Framework
-- ==============
SetData (me : mutable ; data : Data from TDF);
GetData (me)
returns Data from TDF;
Main (me)
---Purpose: Returns the main label in this data framework.
-- By definition, this is the label with the entry 0:1.
returns Label from TDF;
IsEmpty(me)
---Purpose: Returns True if the main label has no attributes
returns Boolean from Standard;
---Category: Durty Flag and Modified labels
-- ==============================
IsValid(me) returns Boolean;
---Purpose: Returns False if the document has been modified
-- but not recomputed.
SetModified (me : mutable; L : Label from TDF);
---Purpose: Notify the label as modified, the Document becomes UnValid.
--IsModified (me; L : Label from TDF)
--returns Boolean from Standard;
---Purpose: returns True if <L> has been notified as modified.
PurgeModified (me : mutable);
---Purpose: Remove all modifications. After this call The document
-- becomesagain Valid.
GetModified (me)
---Purpose: Returns the labels which have been modified in
-- this document.
---C++: return const&
returns LabelMap from TDF;
---Category: COMMAND Transaction and UNDO/REDO
-- =================================
NewCommand (me : mutable);
---Purpose: Launches a new command. This command may be undone.
HasOpenCommand (me)
---Purpose: returns True if a Command transaction is open in the curret .
returns Boolean from Standard;
OpenCommand (me : mutable);
---Purpose: Opens a new command transaction in this document.
-- You can use HasOpenCommand to see whether a command is already open.
-- Exceptions
-- Standard_DomainError if a command is already open in this document.
CommitCommand (me : mutable) returns Boolean;
---Purpose: Commits documents transactions and fills the
-- transaction manager with documents that have
-- been changed during the transaction.
-- If no command transaction is open, nothing is done.
-- Returns True if a new delta has been added to myUndos.
AbortCommand (me : mutable);
---Purpose: Abort the Command transaction. Does nothing If there is
-- no Command transaction open.
GetUndoLimit(me) returns Integer;
---Purpose: The current limit on the number of undos
SetUndoLimit(me : mutable; L : Integer);
---Purpose: Set the limit on the number of Undo Delta stored 0
-- will disable Undo on the document A negative value
-- means no limit. Note that by default Undo is disabled.
-- Enabling it will take effect with the next call to
-- NewCommand. Of course this limit is the same for Redo
ClearUndos(me : mutable);
---Purpose: Remove all stored Undos and Redos
ClearRedos(me : mutable);
---Purpose: Remove all stored Redos
GetAvailableUndos (me) returns Integer;
---Purpose: Returns the number of undos stored in this
-- document. If this figure is greater than 0, the method Undo
-- can be used.
Undo (me:mutable) returns Boolean;
---Purpose: Will UNDO one step, returns False if no undo was
-- done (Undos == 0).
-- Otherwise, true is returned and one step in the
-- list of undoes is undone.
GetAvailableRedos (me) returns Integer;
---Purpose: Returns the number of redos stored in this
-- document. If this figure is greater than 0, the method Redo
-- can be used.
Redo (me : mutable) returns Boolean;
---Purpose: Will REDO one step, returns False if no redo was
-- done (Redos == 0).
-- Otherwise, true is returned, and one step in the list of redoes is done again.
GetUndos (me)
---C++: return const &
returns DeltaList from TDF;
GetRedos (me)
---C++: return const &
returns DeltaList from TDF;
RemoveFirstUndo (me : mutable);
---Purpose: Removes the first undo in the list of document undos.
-- It is used in the application when the undo limit is exceed.
InitDeltaCompaction(me : mutable)
---Purpose: Initializes the procedure of delta compaction
-- Returns false if there is no delta to compact
-- Marks the last delta as a "from" delta
returns Boolean from Standard;
PerformDeltaCompaction(me : mutable)
---Purpose: Performs the procedure of delta compaction
-- Makes all deltas starting from "from" delta
-- till the last one to be one delta.
returns Boolean from Standard;
---Category: External references
-- ===================
UpdateReferences (me : mutable; aDocEntry : AsciiString from TCollection);
---Purpose: Set modifications on labels impacted by external
-- references to the entry. The document becomes invalid
-- and must be recomputed.
Recompute (me : mutable);
---Purpose: Recompute if the document was not valid and propagate
-- the reccorded modification.
---Category: deferred methods CDM_Document
-- =============================
Update (me: mutable; aToDocument : Document from CDM;
aReferenceIdentifier : Integer from Standard;
aModifContext : Address from Standard)
is redefined;
--Update(me:mutable; ErrorString: out ExtendedString from TCollection)
--returns Boolean from Standard
---Purpose: This method Update will be called
-- to signal the end of the modified references list.
-- The document should be recomputed and
-- UpdateFromDocuments should be called. Update should
-- returns True in case of success, false otherwise. In
-- case of Failure, additional information can be given in
-- ErrorString.
--is redefined;
--Update (me: mutable)
--is redefined;
---Purpose: Update the document by propagation
-- ==================================
--Propagate (me: mutable);
---Purpose: Update the document from internal stored
-- modifications. If you want to undoing this
-- operation, please call NewCommand before.
---Purpose: to change format (advanced programming)
-- ================
StorageFormat(me)
returns ExtendedString from TCollection
is virtual;
ChangeStorageFormat(me : mutable; newStorageFormat : ExtendedString from TCollection)
is virtual;
---Purpose: methods for the nested transaction mode
SetNestedTransactionMode(me : mutable; isAllowed : Boolean = Standard_True);
---Purpose: Sets nested transaction mode if isAllowed == Standard_True
IsNestedTransactionMode (me)
returns Boolean from Standard;
---Purpose: Returns Standard_True if mode is set
---C++: inline
AppendDeltaToTheFirst (myclass;
theDelta1 : CompoundDelta from TDocStd;
theDelta2 : Delta from TDF) is private;
---Purpose: Appends delta to the first delta in the myUndoFILO
---Purpose: private methods
-- ===============
CommitTransaction (me : mutable) returns Boolean
is virtual protected;
---Purpose: Returns Standard_True done
AbortTransaction (me : mutable)
is virtual protected;
OpenTransaction (me : mutable)
is virtual protected;
---Purpose: methods for protection of changes outside transactions
SetModificationMode (me : mutable; theTransactionOnly : Boolean from Standard);
---Purpose: if theTransactionOnly is True changes is denied outside transactions
---C++: inline
ModificationMode (me) returns Boolean from Standard;
---Purpose: returns True if changes allowed only inside transactions
---C++: inline
fields
---Purpose: storage format
myStorageFormat : ExtendedString from TCollection is protected;
---Purpose: data framework
myData : Data from TDF;
myUndoLimit : Integer from Standard;
myUndoTransaction : Transaction from TDF;
myUndos : DeltaList from TDF is protected;
myRedos : DeltaList from TDF is protected;
myFromUndo : Delta from TDF;
myFromRedo : Delta from TDF;
mySaveTime : Integer from Standard;
---Purpose: data for the nested transactions
myIsNestedTransactionMode : Boolean from Standard;
myUndoFILO : DeltaList from TDF;
---Purpose: data for protection of changes outside transactions
myOnlyTransactionModification : Boolean from Standard;
end Document;
|