+void Model_Session::setActiveDocument(
+ std::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal)
+{
+ if (myCurrentDoc != theDoc) {
+ myCurrentDoc = theDoc;
+ if (theDoc.get() && theSendSignal) {
+ // syncronize the document: it may be just opened or opened but removed before
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theDoc);
+ if (aDoc.get()) {
+ bool aWasChecked = myCheckTransactions;
+ setCheckTransactions(false);
+ aDoc->synchronizeFeatures(false, true);
+ if (aWasChecked)
+ setCheckTransactions(true);
+ }
+ static std::shared_ptr<Events_Message> aMsg(
+ new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
+ Events_Loop::loop()->send(aMsg);
+ }
+ }
+}
+
+std::list<std::shared_ptr<ModelAPI_Document> > Model_Session::allOpenedDocuments()