Salome HOME
Issue #1351: partition is not done
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetValidated.h
index d53bbb705beee95affa492329f44bbea9b49cb8c..f60cd1a0eeeb23122402a07822b7c10c39da8a5f 100644 (file)
@@ -36,6 +36,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
  public:
   /// Constructor
   /// \param theParent the parent object
+  /// \param theWorkshop a reference to workshop
   /// \param theData the widget configuation. The attribute of the model widget is obtained from
   /// \param theParentId is Id of a parent of the current attribute
   ModuleBase_WidgetValidated(QWidget* theParent,
@@ -45,8 +46,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   virtual ~ModuleBase_WidgetValidated();
 
   /// Checks whether all active viewer filters validate the presentation
-  /// \param theWorkshop an active workshop
-  /// \param theValue a selected presentation in the view
+  /// \param thePrs a selected presentation in the view
   /// \return a boolean value
   bool isValidInFilters(const ModuleBase_ViewerPrs& thePrs);
 
@@ -60,31 +60,35 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   /// The method is called by the current operation to process the operation preselection.
   /// It is redefined to check the value validity and if it is, fill the attribute with by value
   /// \param theValues the wrapped selection values
+  /// \param theToValidate a flag on validation of the values
   virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
                             const bool theToValidate);
 
   //! Returns data object by AIS
   ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
 
+  //! Clear all validated cash in the widget
+  void clearValidatedCash();
+
 protected:
   /// Creates a backup of the current values of the attribute
   /// It should be realized in the specific widget because of different
   /// parameters of the current attribute
-  virtual void storeAttributeValue() = 0;
+  virtual void storeAttributeValue();
 
   /// Creates a backup of the current values of the attribute
   /// It should be realized in the specific widget because of different
   /// parameters of the current attribute
   /// \param theValid a boolean flag, if restore happens for valid parameters
-  virtual void restoreAttributeValue(const bool theValid) = 0;
+  virtual void restoreAttributeValue(const bool theValid);
 
   /// Checks the widget validity. By default, it returns true.
-  /// \param theValue a selected presentation in the view
+  /// \param thePrs a selected presentation in the view
   /// \return a boolean value
   virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
 
   /// Fills the attribute with the value of the selected owner
-  /// \param theOwner a selected owner
+  /// \param thePrs a selected owner
   virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs) = 0;
 
   /// Checks the current attibute in all attribute validators
@@ -95,11 +99,6 @@ protected:
   /// \return boolean value
   bool isFilterActivated() const;
 
-  /// It obtains selection filters from the workshop and activates them in the active viewer
-  /// \param theWorkshop an active workshop
-  /// \param toActivate a flag about activation or deactivation the filters
-  void activateFilters(const bool toActivate);
-
   /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored
   /// \param theValue a viewer presentation
   /// \param theValid a valid state
@@ -110,7 +109,7 @@ protected:
   /// \param theValid a valid state
   void storeValidState(const ModuleBase_ViewerPrs& theValue, const bool theValid);
 
-  // Removes all presentations from internal maps.
+  /// Removes all presentations from internal maps.
   void clearValidState();
 
   /// Returns a list of selected presentations in the viewer and object browser
@@ -123,8 +122,30 @@ protected:
   /// \param theValues a list of presentations.
   void filterPresentations(QList<ModuleBase_ViewerPrs>& theValues);
 
+  /// Remove subshapes of compsolids if whole compsolid is present.
+  /// \param theValues a list of presentations.
+  void filterCompSolids(QList<ModuleBase_ViewerPrs>& theValues);
+
+  /// It obtains selection filters from the workshop and activates them in the active viewer
+  /// \param toActivate a flag about activation or deactivation the filters
+  /// \return true if the selection filter of the widget is activated in viewer context
+  bool activateFilters(const bool toActivate);
+
+  /// Block the model flush of update and intialization of attribute
+  /// \param theToBlock flag whether the model is blocked or unblocked
+  /// \param isActive out value if model is blocked, in value if model is unblocked
+  /// to be used to restore flush state when unblocked
+  /// \param isAttributeSetInitializedBlocked out value if model is blocked
+  /// in value if model is unblocked to be used to restore previous state when unblocked
+  virtual void blockAttribute(const bool& theToBlock, bool& isFlushesActived,
+                              bool& isAttributeSetInitializedBlocked);
+
 protected:
-  ModuleBase_IWorkshop* myWorkshop;  /// Reference to workshop
+  /// Reference to workshop
+  ModuleBase_IWorkshop* myWorkshop; 
+
+  /// The widget is in validation mode: store is performed, restore is not
+  bool myIsInValidate; 
 
 private:
   ObjectPtr myPresentedObject; /// back up of the filtered object