1 // Created on: 2002-11-19
2 // Created by: Vladimir ANIKIN
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <TDF_Data.hxx>
18 //=======================================================================
19 //function : SetNestedTransactionMode
20 //purpose : Sets nested transaction mode if isAllowed == Standard_True
21 //=======================================================================
24 TDocStd_Document::SetNestedTransactionMode (const Standard_Boolean isAllowed)
26 myIsNestedTransactionMode = isAllowed;
29 //=======================================================================
30 //function : SetNestedTransactionMode
31 //purpose : Sets nested transaction mode if isAllowed == Standard_True
32 //=======================================================================
34 inline Standard_Boolean
35 TDocStd_Document::IsNestedTransactionMode () const
37 return myIsNestedTransactionMode;
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 //=======================================================================
46 inline Standard_Boolean
47 TDocStd_Document::IsChanged () const
49 return myData->Time() != mySaveTime;
52 //=======================================================================
54 //purpose : This method have to be called to show document that it has been saved
55 //=======================================================================
58 TDocStd_Document::SetSaved ()
60 mySaveTime = myData->Time();
63 //=======================================================================
64 //function : SetModificationMode
65 //purpose : if theTransactionOnly is True changes is denied outside transactions
66 //=======================================================================
68 inline void TDocStd_Document::SetModificationMode
69 (const Standard_Boolean theTransactionOnly)
71 myOnlyTransactionModification = theTransactionOnly;
73 // deny or allow modifications acording to transaction state
74 if(myOnlyTransactionModification) {
75 myData->AllowModification(myUndoTransaction.IsOpen());
78 myData->AllowModification(Standard_True);
82 //=======================================================================
83 //function : ModificationMode
84 //purpose : returns True if changes allowed only inside transactions
85 //=======================================================================
87 inline Standard_Boolean TDocStd_Document::ModificationMode() const
89 return myOnlyTransactionModification;
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)
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
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)
117 mySaveEmptyLabels = isAllowed;
120 //=======================================================================
121 //function : EmptyLabelsSavingMode
122 //purpose : Returns saving mode for empty labels
123 //=======================================================================
124 inline Standard_Boolean TDocStd_Document::EmptyLabelsSavingMode() const
126 return mySaveEmptyLabels;