src/CAF/CAF_Study.h

Go to the documentation of this file.
00001 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
00002 // 
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either 
00006 // version 2.1 of the License.
00007 // 
00008 // This library is distributed in the hope that it will be useful 
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public  
00014 // License along with this library; if not, write to the Free Software 
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 #ifndef CAF_STUDY_H
00020 #define CAF_STUDY_H
00021 
00022 #include "CAF.h"
00023 
00024 #include "SUIT_Study.h"
00025 
00026 #include <qobject.h>
00027 
00028 #include <TDocStd_Document.hxx>
00029 #include <TDocStd_Application.hxx>
00030 
00031 class CAF_Application;
00032 
00033 #if defined WNT
00034 #pragma warning ( disable: 4251 )
00035 #endif
00036 
00043 class CAF_EXPORT CAF_Study : public SUIT_Study
00044 {
00045   Q_OBJECT
00046 
00047 public:
00048      CAF_Study( SUIT_Application* theApp );
00049      CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc );
00050      virtual ~CAF_Study();
00051 
00052   virtual void                createDocument();
00053   virtual void                closeDocument( bool = true );
00054   virtual bool                openDocument( const QString& );
00055 
00056   virtual bool                saveDocumentAs( const QString& );
00057 
00058   bool                        isSaved() const;
00059      bool                        isModified() const;
00060      void                        doModified( bool = true );
00061      void                        undoModified();
00062      void                        clearModified();
00063 
00064   bool                        undo();
00065      bool                        redo();
00066      bool                        canUndo() const;
00067      bool                        canRedo() const;
00068      QStringList                 undoNames() const;
00069      QStringList                 redoNames() const;
00070 
00071   Handle(TDocStd_Document)    stdDoc() const;
00072 
00073 protected:
00074   Handle(TDocStd_Application) stdApp() const;
00075   CAF_Application*            cafApplication() const;
00076 
00077   virtual bool                openTransaction();
00078   virtual bool                abortTransaction();
00079   virtual bool                hasTransaction() const;
00080   virtual bool                commitTransaction( const QString& = QString::null );
00081 
00082   virtual void                setStdDoc( Handle(TDocStd_Document)& );
00083 
00084 private:
00085      Handle(TDocStd_Document)    myStdDoc;
00086      int                         myModifiedCnt;
00087 
00088   friend class CAF_Operation;
00089 };
00090 
00091 #if defined WNT
00092 #pragma warning ( default: 4251 )
00093 #endif
00094 
00095 #endif