0031362: Inspectors - MessageView plugin for message alerts
[occt.git] / tools / DFBrowserPaneXDE / DFBrowserPaneXDE_Tools.cxx
1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 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 #include <inspector/DFBrowserPaneXDE_Tools.hxx>
17
18 #include <inspector/DFBrowserPane_AttributePaneAPI.hxx>
19
20 #include <TCollection_AsciiString.hxx>
21 #include <TDataStd_Name.hxx>
22 #include <TDF_ChildIterator.hxx>
23 #include <TDF_Tool.hxx>
24 #include <TDocStd_Document.hxx>
25
26 #include <Standard_GUID.hxx>
27
28 #include <XCAFDoc_Area.hxx>
29 #include <XCAFDoc_Centroid.hxx>
30 #include <XCAFDoc_Color.hxx>
31 #include <XCAFDoc_Datum.hxx>
32 #include <XCAFDoc_DocumentTool.hxx>
33 #include <XCAFDoc_GraphNode.hxx>
34 #include <XCAFDoc_Location.hxx>
35 #include <XCAFDoc_Material.hxx>
36 #include <XCAFDoc_Volume.hxx>
37
38 namespace DFBrowserPaneXDE_Tools
39 {
40
41   // =======================================================================
42   // function : IsXDEApplication
43   // purpose :
44   // =======================================================================
45   bool IsXDEApplication (const Handle(TDocStd_Application)& theApplication)
46   {
47     bool isXDEApp = false;
48
49     Handle(TDocStd_Document) aDocument;
50     Standard_Integer aNbDoc = theApplication->NbDocuments();
51     if (aNbDoc == 0)
52       return isXDEApp;
53
54     theApplication->GetDocument (1, aDocument);
55     if (aDocument.IsNull())
56       return isXDEApp;
57
58     for (TDF_ChildIterator aLabelsIt (aDocument->Main().Root()); aLabelsIt.More() && !isXDEApp; aLabelsIt.Next())
59     {
60       const TDF_Label aLabel = aLabelsIt.Value();
61       if (aLabel.IsNull())
62         break;
63       Handle(TDF_Attribute) anAttribute;
64       aLabel.FindAttribute (XCAFDoc_DocumentTool::GetID(), anAttribute);
65       isXDEApp = !anAttribute.IsNull();
66     }
67     return isXDEApp;
68   }
69 }