0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / XmlMFunction / XmlMFunction_ScopeDriver.cxx
index e3a2afd..fa37251 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <XmlMFunction_ScopeDriver.ixx>
-#include <XmlObjMgt.hxx>
-#include <XmlObjMgt_Document.hxx>
-#include <LDOM_MemManager.hxx>
 
-#include <TColStd_ListOfInteger.hxx>
+#include <Message_Messenger.hxx>
+#include <LDOM_MemManager.hxx>
+#include <Standard_Type.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <TDF_Tool.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TDF_Attribute.hxx>
 #include <TDF_Label.hxx>
 #include <TDF_LabelList.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
-
-#include <TFunction_Scope.hxx>
+#include <TDF_Tool.hxx>
 #include <TFunction_DoubleMapIteratorOfDoubleMapOfIntegerLabel.hxx>
+#include <TFunction_Scope.hxx>
+#include <XmlMFunction_ScopeDriver.hxx>
+#include <XmlObjMgt.hxx>
+#include <XmlObjMgt_Document.hxx>
+#include <XmlObjMgt_Persistent.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(XmlMFunction_ScopeDriver,XmlMDF_ADriver)
 IMPLEMENT_DOMSTRING (LastIDIndex,    "lastid")
 IMPLEMENT_DOMSTRING (LastLabelIndex, "lastlabel")
 
@@ -38,7 +41,7 @@ IMPLEMENT_DOMSTRING (ExtString,      "string")
 //function : XmlMFunction_ScopeDriver
 //purpose  : Constructor
 //=======================================================================
-XmlMFunction_ScopeDriver::XmlMFunction_ScopeDriver(const Handle(CDM_MessageDriver)& theMsgDriver)
+XmlMFunction_ScopeDriver::XmlMFunction_ScopeDriver(const Handle(Message_Messenger)& theMsgDriver)
       : XmlMDF_ADriver (theMsgDriver, NULL)
 {
 
@@ -58,8 +61,8 @@ Handle(TDF_Attribute) XmlMFunction_ScopeDriver::NewEmpty() const
 //purpose  : persistent -> transient (retrieve)
 //=======================================================================
 Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  theSource,
-                                                const Handle(TDF_Attribute)& theTarget,
-                                                XmlObjMgt_RRelocationTable&  ) const
+                                                 const Handle(TDF_Attribute)& theTarget,
+                                                 XmlObjMgt_RRelocationTable&  ) const
 {
   Handle(TFunction_Scope) S = Handle(TFunction_Scope)::DownCast(theTarget);
   TColStd_ListOfInteger   IDs;
@@ -80,7 +83,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
     TCollection_ExtendedString aMessageString =
       TCollection_ExtendedString("Cannot retrieve the last index"
                                  " for Scope attribute");
-    WriteMessage (aMessageString);
+    myMessageDriver->Send (aMessageString, Message_Fail);
     return Standard_False;
   }
   nbIDs = aLastInd - aFirstInd + 1;
@@ -93,7 +96,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
       TCollection_ExtendedString aMessageString =
         TCollection_ExtendedString("Cannot retrieve integer member"
                                    " for Scope attribute as \"");
-      WriteMessage (aMessageString);
+      myMessageDriver->Send (aMessageString, Message_Fail);
       return Standard_False;
     }
     IDs.Append(anInteger);
@@ -111,7 +114,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
           TCollection_ExtendedString("Cannot retrieve integer member"
                                      " for Scope attribute as \"")
             + aValueStr + "\"";
-        WriteMessage (aMessageString);
+        myMessageDriver->Send (aMessageString, Message_Fail);
         return Standard_False;
       }
       IDs.Append(aValue);
@@ -130,7 +133,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
     TCollection_ExtendedString aMessageString =
       TCollection_ExtendedString("Cannot retrieve the last index"
                                  " for Scope attribute");
-    WriteMessage (aMessageString);
+    myMessageDriver->Send (aMessageString, Message_Fail);
     return Standard_False;
   }
   nbLabels = aLastInd - aFirstInd + 1;
@@ -139,7 +142,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
   {
     TCollection_ExtendedString aMessageString = 
       TCollection_ExtendedString("Cannot retrieve an array of labels");
-    WriteMessage (aMessageString);
+    myMessageDriver->Send (aMessageString, Message_Fail);
     return Standard_False;
   }
 
@@ -161,7 +164,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
       TCollection_ExtendedString aMessage =
        TCollection_ExtendedString ("Cannot retrieve reference from \"")
          + aValueStr + '\"';
-      WriteMessage (aMessage);
+      myMessageDriver->Send (aMessage, Message_Fail);
       return Standard_False;
     }
     // Find label by entry
@@ -179,7 +182,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
   aValueStr = XmlObjMgt::GetStringValue( *aCurElement );
   if (aValueStr == NULL)
   {
-    WriteMessage ("Cannot retrieve reference string from element");
+    myMessageDriver->Send ("Cannot retrieve reference string from element", Message_Fail);
     return Standard_False;
   }
   TCollection_AsciiString anEntry;
@@ -188,7 +191,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
     TCollection_ExtendedString aMessage =
       TCollection_ExtendedString ("Cannot retrieve reference from \"")
        + aValueStr + '\"';
-    WriteMessage (aMessage);
+    myMessageDriver->Send (aMessage, Message_Fail);
     return Standard_False;
   }
   // Find label by entry
@@ -204,7 +207,7 @@ Standard_Boolean XmlMFunction_ScopeDriver::Paste(const XmlObjMgt_Persistent&  th
   {
     TCollection_ExtendedString aMessage =
       TCollection_ExtendedString ("Numbers of IDs & Labels are different");
-    WriteMessage (aMessage);
+    myMessageDriver->Send (aMessage, Message_Fail);
     return Standard_False;
   }
 
@@ -259,7 +262,7 @@ void XmlMFunction_ScopeDriver::Paste (const Handle(TDF_Attribute)& theSource,
   XmlObjMgt_Element& anElement = theTarget;
   anElement.setAttribute(::LastLabelIndex(), S->GetFunctions().Extent());
   
-  XmlObjMgt_Document aDoc = anElement.getOwnerDocument().Doc();
+  XmlObjMgt_Document aDoc (anElement.getOwnerDocument());
   
   for (itrd.Initialize(S->GetFunctions()); itrd.More(); itrd.Next())
   {