b311480e |
1 | // Created on: 2002-11-19 |
2 | // Created by: Vladimir ANIKIN |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <TDF_Data.hxx> |
17 | |
18 | //======================================================================= |
19 | //function : SetNestedTransactionMode |
20 | //purpose : Sets nested transaction mode if isAllowed == Standard_True |
21 | //======================================================================= |
22 | |
23 | inline void |
24 | TDocStd_Document::SetNestedTransactionMode (const Standard_Boolean isAllowed) |
25 | { |
26 | myIsNestedTransactionMode = isAllowed; |
27 | } |
28 | |
29 | //======================================================================= |
30 | //function : SetNestedTransactionMode |
31 | //purpose : Sets nested transaction mode if isAllowed == Standard_True |
32 | //======================================================================= |
33 | |
34 | inline Standard_Boolean |
35 | TDocStd_Document::IsNestedTransactionMode () const |
36 | { |
37 | return myIsNestedTransactionMode; |
38 | } |
39 | |
40 | //======================================================================= |
41 | //function : IsModified |
42 | //purpose : returns True if document differs from the state of last saving. |
43 | // this method have to be called only wroking in the transaction mode |
44 | //======================================================================= |
45 | |
46 | inline Standard_Boolean |
47 | TDocStd_Document::IsChanged () const |
48 | { |
49 | return myData->Time() != mySaveTime; |
50 | } |
51 | |
52 | //======================================================================= |
53 | //function : SetSaved |
54 | //purpose : This method have to be called to show document that it has been saved |
55 | //======================================================================= |
56 | |
57 | inline void |
58 | TDocStd_Document::SetSaved () |
59 | { |
60 | mySaveTime = myData->Time(); |
61 | } |
62 | |
63 | //======================================================================= |
64 | //function : SetModificationMode |
65 | //purpose : if theTransactionOnly is True changes is denied outside transactions |
66 | //======================================================================= |
67 | |
68 | inline void TDocStd_Document::SetModificationMode |
69 | (const Standard_Boolean theTransactionOnly) |
70 | { |
71 | myOnlyTransactionModification = theTransactionOnly; |
72 | |
73 | // deny or allow modifications acording to transaction state |
74 | if(myOnlyTransactionModification) { |
75 | myData->AllowModification(myUndoTransaction.IsOpen()); |
76 | } |
77 | else { |
78 | myData->AllowModification(Standard_True); |
79 | } |
80 | } |
81 | |
82 | //======================================================================= |
83 | //function : ModificationMode |
84 | //purpose : returns True if changes allowed only inside transactions |
85 | //======================================================================= |
86 | |
87 | inline Standard_Boolean TDocStd_Document::ModificationMode() const |
88 | { |
89 | return myOnlyTransactionModification; |
90 | } |
91 | |
92 | //======================================================================= |
93 | //function : SetSavedTime |
94 | //purpose : Say to document what it is not saved. Use value, returned earlier by GetSavedTime(). |
95 | //======================================================================= |
96 | inline void TDocStd_Document::SetSavedTime (const Standard_Integer theTime) |
97 | { |
98 | mySaveTime = theTime; |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : GetSavedTime |
103 | //purpose : Returns value of <mySavedTime> to be used later in SetSavedTime() |
104 | //======================================================================= |
105 | inline Standard_Integer TDocStd_Document::GetSavedTime () const |
106 | { |
107 | return mySaveTime; |
108 | } |
030ba648 |
109 | |
110 | //======================================================================= |
111 | //function : SetEmptyLabelsSavingMode |
112 | //purpose : Sets saving mode for empty labels. If Standard_True, |
113 | // empty labels will be saved. |
114 | //======================================================================= |
115 | inline void TDocStd_Document::SetEmptyLabelsSavingMode (const Standard_Boolean isAllowed) |
116 | { |
117 | mySaveEmptyLabels = isAllowed; |
118 | } |
119 | |
120 | //======================================================================= |
121 | //function : EmptyLabelsSavingMode |
122 | //purpose : Returns saving mode for empty labels |
123 | //======================================================================= |
124 | inline Standard_Boolean TDocStd_Document::EmptyLabelsSavingMode() const |
125 | { |
126 | return mySaveEmptyLabels; |
127 | } |