Back to index

salome-gui  6.5.0
SUIT_Study.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef SUIT_STUDY_H
00024 #define SUIT_STUDY_H
00025 
00026 #include "SUIT.h"
00027 
00028 #include <QList>
00029 #include <QObject>
00030 #include <QListIterator>
00031 
00032 class SUIT_DataObject;
00033 class SUIT_Application;
00034 class SUIT_Operation;
00035 
00036 #ifdef WIN32
00037 #pragma warning( disable:4251 )
00038 #endif
00039 
00040 class SUIT_EXPORT SUIT_Study : public QObject
00041 {
00042   Q_OBJECT
00043   
00044 public:
00045   SUIT_Study( SUIT_Application* );
00046   virtual ~SUIT_Study();
00047 
00048   virtual int       id() const;
00049 
00050   SUIT_DataObject*  root() const;
00051   virtual QString   studyName() const;
00052   SUIT_Application* application() const;
00053 
00054   virtual bool      isSaved()  const;
00055   virtual bool      isModified() const;
00056   virtual void      Modified();
00057 
00058   virtual void      closeDocument( bool = true );
00059   virtual bool      openDocument( const QString& );
00060   virtual bool      createDocument( const QString& );
00061 
00062   bool              saveDocument();
00063   virtual bool      saveDocumentAs( const QString& );
00064 
00065   virtual void      update();
00066 
00067   virtual void      sendChangesNotification();
00068 
00069   // Operation management
00070   SUIT_Operation*   activeOperation() const;
00071   virtual void      abortAllOperations();
00072   const QList<SUIT_Operation*>& operations() const;
00073   
00074   virtual SUIT_Operation* blockingOperation( SUIT_Operation* ) const;
00075 
00076   bool              start( SUIT_Operation*, const bool check = true );
00077   bool              abort( SUIT_Operation* );
00078   bool              commit( SUIT_Operation* );
00079   bool              suspend( SUIT_Operation* );
00080   bool              resume( SUIT_Operation* );
00081 
00082   virtual void      restoreState(int savePoint);
00083 
00084 signals:
00085   void              studyModified( SUIT_Study* );
00086 
00087 protected:
00088   virtual void      setIsSaved( const bool );
00089   virtual void      setIsModified( const bool );
00090   virtual void      setRoot( SUIT_DataObject* );
00091   virtual void      setStudyName( const QString& );
00092 
00093   virtual void      operationStarted( SUIT_Operation* );
00094   virtual void      operationAborted( SUIT_Operation* );
00095   virtual void      operationStopped( SUIT_Operation* );
00096   virtual void      operationCommited( SUIT_Operation* );
00097 
00098   virtual bool      openTransaction();
00099   virtual bool      abortTransaction();
00100   virtual bool      hasTransaction() const;
00101   virtual bool      commitTransaction( const QString& = QString() );
00102 
00103 private:
00104   typedef QList<SUIT_Operation*> Operations;
00105   void              stop( SUIT_Operation* );
00106 
00107 private:
00108   int               myId;
00109   SUIT_Application* myApp;
00110   SUIT_DataObject*  myRoot;
00111   QString           myName;
00112   bool              myIsSaved;
00113   bool              myIsModified;
00114   Operations        myOperations;
00115   bool              myBlockChangeState;
00116 
00117   friend class SUIT_Operation;
00118 };
00119 
00120 #ifdef WIN32
00121 #pragma warning( default:4251 )
00122 #endif
00123 
00124 #endif