0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / DDocStd / DDocStd.hxx
1 // Created on: 2000-03-01
2 // Created by: Denis PASCAL
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _DDocStd_HeaderFile
17 #define _DDocStd_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22
23 #include <Standard_Boolean.hxx>
24 #include <Standard_CString.hxx>
25 #include <Draw_Interpretor.hxx>
26 class TDocStd_Application;
27 class TDocStd_Document;
28 class TDF_Label;
29 class Standard_GUID;
30 class TDF_Attribute;
31 class DDocStd_DrawDocument;
32
33
34 //! This package   provides Draw services to test  CAF
35 //! standard documents (see TDocStd package)
36 //!
37 //! It provides :
38 //!
39 //! * Modification registration and Update management.
40 //!
41 //! * External references mechanism
42 //!
43 //! * UNDO/REDO
44 //!
45 //! * Document Creation, Save and Restore
46 class DDocStd 
47 {
48 public:
49
50   DEFINE_STANDARD_ALLOC
51
52   
53   //! Returns the global instance of application.
54   Standard_EXPORT static const Handle(TDocStd_Application)& GetApplication ();
55   
56   Standard_EXPORT static Standard_Boolean GetDocument (Standard_CString& Name, Handle(TDocStd_Document)& Doc, const Standard_Boolean Complain = Standard_True);
57   
58   Standard_EXPORT static Standard_Boolean Find (const Handle(TDocStd_Document)& Document, const Standard_CString Entry, TDF_Label& Label, const Standard_Boolean Complain = Standard_True);
59   
60   Standard_EXPORT static Standard_Boolean Find (const Handle(TDocStd_Document)& Document, const Standard_CString Entry, const Standard_GUID& ID, Handle(TDF_Attribute)& A, const Standard_Boolean Complain = Standard_True);
61   
62   //! Safe variant for arbitrary type of argument
63   template <class T> 
64   static Standard_Boolean Find (const Handle(TDocStd_Document)& Document, const Standard_CString Entry, const Standard_GUID& ID, Handle(T)& A, const Standard_Boolean Complain = Standard_True)
65   {
66     Handle(TDF_Attribute) anAttr = A;
67     return Find (Document, Entry, ID, anAttr, Complain) && ! (A = Handle(T)::DownCast(anAttr)).IsNull();
68   }
69
70   Standard_EXPORT static Draw_Interpretor& ReturnLabel (Draw_Interpretor& theCommands, const TDF_Label& L);
71   
72   Standard_EXPORT static void AllCommands (Draw_Interpretor& theCommands);
73   
74   //! NewDocument, Open, SaveAs, Save
75   Standard_EXPORT static void ApplicationCommands (Draw_Interpretor& theCommands);
76   
77   //! Undo, Redo, SetModified, Propagate
78   Standard_EXPORT static void DocumentCommands (Draw_Interpretor& theCommands);
79   
80   //! Modified, Update
81   Standard_EXPORT static void ToolsCommands (Draw_Interpretor& theCommands);
82   
83   //! Create, Add, Remove, Open, Commit, Undo, Redo, SetNestedMode
84   Standard_EXPORT static void MTMCommands (Draw_Interpretor& theCommands);
85
86   //! ShapeSchema_Read
87   Standard_EXPORT static void ShapeSchemaCommands(Draw_Interpretor& theCommands);
88
89
90 protected:
91
92
93
94
95
96 private:
97
98
99
100
101 friend class DDocStd_DrawDocument;
102
103 };
104
105
106
107
108
109
110
111 #endif // _DDocStd_HeaderFile