42cf5bc1 |
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 | //! return the application of the session. False |
54 | //! if there is noone current application. |
55 | Standard_EXPORT static Standard_Boolean Find (Handle(TDocStd_Application)& Appli, const Standard_Boolean Complain = Standard_True); |
56 | |
57 | Standard_EXPORT static Standard_Boolean GetDocument (Standard_CString& Name, Handle(TDocStd_Document)& Doc, const Standard_Boolean Complain = Standard_True); |
58 | |
59 | Standard_EXPORT static Standard_Boolean Find (const Handle(TDocStd_Document)& Document, const Standard_CString Entry, TDF_Label& Label, const Standard_Boolean Complain = Standard_True); |
60 | |
61 | 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); |
62 | |
aa00364d |
63 | //! Safe variant for arbitrary type of argument |
64 | template <class T> |
65 | 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) |
66 | { |
67 | Handle(TDF_Attribute) anAttr = A; |
68 | return Find (Document, Entry, ID, anAttr, Complain) && ! (A = Handle(T)::DownCast(anAttr)).IsNull(); |
69 | } |
70 | |
42cf5bc1 |
71 | Standard_EXPORT static Draw_Interpretor& ReturnLabel (Draw_Interpretor& theCommands, const TDF_Label& L); |
72 | |
73 | Standard_EXPORT static void AllCommands (Draw_Interpretor& theCommands); |
74 | |
75 | //! NewDocument, Open, SaveAs, Save |
76 | Standard_EXPORT static void ApplicationCommands (Draw_Interpretor& theCommands); |
77 | |
78 | //! Undo, Redo, SetModified, Propagate |
79 | Standard_EXPORT static void DocumentCommands (Draw_Interpretor& theCommands); |
80 | |
81 | //! Modified, Update |
82 | Standard_EXPORT static void ToolsCommands (Draw_Interpretor& theCommands); |
83 | |
84 | //! Create, Add, Remove, Open, Commit, Undo, Redo, SetNestedMode |
85 | Standard_EXPORT static void MTMCommands (Draw_Interpretor& theCommands); |
86 | |
87 | |
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 |