+void Model_Session::finishOperation()
+{
+ setCheckTransactions(false);
+ ROOT_DOC->finishOperation();
+ if (myOperationAttachedToNext) { // twice, with nested
+ ROOT_DOC->finishOperation();
+ myOperationAttachedToNext = false;
+ }
+ setCheckTransactions(true);
+}
+
+void Model_Session::abortOperation()
+{
+ setCheckTransactions(false);
+ ROOT_DOC->abortOperation();
+ if (myOperationAttachedToNext) { // twice, with nested
+ ROOT_DOC->abortOperation();
+ myOperationAttachedToNext = false;
+ }
+ setCheckTransactions(true);
+ // here the update mechanism may work after abort, so, supress the warnings about
+ // modifications outside of the transactions
+ bool aWasCheck = myCheckTransactions;
+ myCheckTransactions = false;
+ static std::shared_ptr<Events_Message> anAbortMsg
+ (new Events_Message(Events_Loop::eventByName("AbortOperation")));
+ Events_Loop::loop()->send(anAbortMsg);
+ myCheckTransactions = true;
+ myCheckTransactions = aWasCheck;
+}
+
+bool Model_Session::isOperation()
+{
+ return ROOT_DOC->isOperation();
+}
+
+bool Model_Session::isModified()
+{
+ return ROOT_DOC->isModified();
+}
+
+bool Model_Session::canUndo()
+{
+ return ROOT_DOC->canUndo();
+}
+
+void Model_Session::undo()
+{
+ setCheckTransactions(false);
+ ROOT_DOC->undo();
+ setCheckTransactions(true);
+}
+
+bool Model_Session::canRedo()
+{
+ return ROOT_DOC->canRedo();
+}
+
+void Model_Session::redo()
+{
+ setCheckTransactions(false);
+ ROOT_DOC->redo();
+ setCheckTransactions(true);
+}
+
+//! Returns stack of performed operations
+std::list<std::string> Model_Session::undoList()
+{
+ return ROOT_DOC->undoList();
+}
+//! Returns stack of rolled back operations
+std::list<std::string> Model_Session::redoList()
+{
+ return ROOT_DOC->redoList();
+}
+
+ModelAPI_Plugin* Model_Session::getPlugin(const std::string& thePluginName)
+{
+ if (myPluginObjs.find(thePluginName) == myPluginObjs.end()) {
+ // before load the used plugins
+ if (myUsePlugins.find(thePluginName) != myUsePlugins.end()) {
+ std::string aUse = myUsePlugins[thePluginName];
+ std::stringstream aUseStream(aUse);
+ std::string aPluginName;
+ while (std::getline(aUseStream, aPluginName, ',')) {
+ if (myPluginObjs.find(aPluginName) == myPluginObjs.end())
+ getPlugin(aPluginName);
+ }
+ }
+ // load plugin library if not yet done
+ Config_ModuleReader::loadPlugin(thePluginName);
+ }
+ if (myPluginObjs.find(thePluginName) == myPluginObjs.end()) {
+ Events_InfoMessage("Model_Session", "Can not load plugin '%1'").arg(thePluginName).send();
+ return NULL;
+ }
+ return myPluginObjs[thePluginName];
+}
+
+FeaturePtr Model_Session::createFeature(std::string theFeatureID, Model_Document* theDocOwner)
+{
+ if (this != myImpl) {
+ return myImpl->createFeature(theFeatureID, theDocOwner);
+ }
+
+ // load all information about plugins, features and attributes