Salome HOME
Issue #904 - Fatal error aftre delete sketch from dataset used in extrusion in part
[modules/shaper.git] / src / XGUI / XGUI_DataModel.h
index 88a0934b88f7a3ca5c6bb382a65bc382a73d2227..70f537651933431b8d340810a009752992c43930 100644 (file)
@@ -9,9 +9,11 @@
 #define XGUI_DataModel_H
 
 #include "XGUI.h"
+#include <ModuleBase_Definitions.h>
 #include <ModelAPI_Object.h>
+#include <ModelAPI_Document.h>
 #include <Config_DataModelReader.h>
-#include <QAbstractItemModel>
+#include <ModuleBase_IDocumentDataModel.h>
 #include <Events_Listener.h>
 
 
@@ -25,7 +27,7 @@
  * - An index which contains internal pointer as ModelAPI_Object its the object
  * - An index which contains internal pointer as ModelAPI_Document is a folder which belongs to this document
  */
-class XGUI_EXPORT XGUI_DataModel : public QAbstractItemModel, public Events_Listener
+class XGUI_EXPORT XGUI_DataModel : public ModuleBase_IDocumentDataModel, public Events_Listener
 {
 Q_OBJECT
 public:
@@ -105,8 +107,35 @@ public:
   /// \param theIndex a model index
   virtual Qt::ItemFlags flags(const QModelIndex& theIndex) const;
 
+  /// Returns an index which is root of the given document
+  /// \param theDoc a document
+  QModelIndex documentRootIndex(DocumentPtr theDoc) const;
+
+  /// Returns last history object index
+  virtual QModelIndex lastHistoryIndex() const;
 
 private:
+  /// Find a root index which contains objects of the given document
+  /// \param theDoc the document object
+  QModelIndex findDocumentRootIndex(const ModelAPI_Document* theDoc) const;
+
+  /// Returns number of folders in document. Considered folders which has to be shown only if they are not empty.
+  /// \param theDoc document which has to be checked. If 0 then Root document will be considered 
+  int foldersCount(ModelAPI_Document* theDoc = 0) const;
+
+  /// Retrurns indexes of folders which can not be shown because they are empty
+  /// \param theDoc document which has to be checked. If 0 then Root document will be considered 
+  QIntList missedFolderIndexes(ModelAPI_Document* theDoc = 0) const;
+
+  /// Returns Id (row) of a folder taking into consideration folders which can not be shown non empty
+  /// \param theType Type of the folder
+  /// \param theDoc a document which contains this folder
+  int folderId(std::string theType, ModelAPI_Document* theDoc = 0);
+
+  /// Returns list of folders types which can not be shown empty
+  /// \param fromRoot - root document flag
+  QStringList listOfShowNotEmptyFolders(bool fromRoot = true) const;
+
   Config_DataModelReader myXMLReader;
 };