Back to index

salome-gui  6.5.0
SalomeApp_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 SALOMEAPP_STUDY_H
00024 #define SALOMEAPP_STUDY_H
00025 
00026 #include "SalomeApp.h"
00027 
00028 #include <LightApp_Study.h>
00029 
00030 #ifdef WIN32
00031 #pragma warning( disable:4251 )
00032 #endif
00033 
00034 #include "SALOMEDSClient.hxx"
00035 
00036 class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study
00037 {
00038   Q_OBJECT
00039 
00040   class Observer_i;
00041 
00042 public:
00043   SalomeApp_Study( SUIT_Application* );
00044   virtual ~SalomeApp_Study();
00045 
00046   virtual int         id() const;
00047   virtual QString     studyName() const;
00048 
00049   virtual bool        createDocument( const QString& );
00050   virtual bool        openDocument( const QString& );
00051   virtual bool        loadDocument( const QString& );
00052 
00053   virtual bool        saveDocument();
00054   virtual bool        saveDocumentAs( const QString& );
00055 
00056   virtual void        closeDocument(bool permanently = true);
00057 
00058   virtual bool        dump( const QString&, bool, bool, bool );
00059 
00060   virtual bool        isSaved()  const;
00061   virtual bool        isModified() const;
00062   virtual void        Modified();
00063 
00064   virtual void        addComponent   ( const CAM_DataModel* dm);
00065 
00066   _PTR(Study)         studyDS() const;
00067 
00068   virtual std::string GetTmpDir      ( const char* theURL, const bool  isMultiFile);
00069 
00070   // to delete all references to object, whose have the same component
00071   void                deleteReferencesTo( _PTR( SObject ) );
00072 
00073   virtual QString     componentDataType( const QString& ) const;
00074   virtual QString     referencedToEntry( const QString& ) const;
00075   virtual bool        isComponent( const QString& ) const;
00076   virtual void        children( const QString&, QStringList& ) const;
00077   virtual void        components( QStringList& ) const;
00078   virtual QString     centry( const QString& ) const;
00079 
00080   std::vector<int>    getSavePoints();
00081   void                removeSavePoint(int savePoint);
00082   QString             getNameOfSavePoint(int savePoint);
00083   void                setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint);
00084 
00085   virtual void        restoreState(int savePoint);
00086   void                markAsSavedIn(QString theFileName);
00087 
00088   virtual LightApp_DataObject* findObjectByEntry( const QString& theEntry );
00089 
00090 protected:
00091   virtual void        saveModuleData ( QString theModuleName, QStringList theListOfFiles );
00092   virtual void        openModuleData ( QString theModuleName, QStringList& theListOfFiles );
00093   virtual bool        saveStudyData  (  const QString& theFileName );
00094   virtual bool        openStudyData  ( const QString& theFileName );
00095 
00096   virtual std::vector<std::string> GetListOfFiles ( const char* theModuleName ) const;
00097   virtual void        SetListOfFiles ( const char* theModuleName,
00098                                        const std::vector<std::string> theListOfFiles);
00099   virtual void        RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const;
00100 
00101 protected:
00102   virtual void        dataModelInserted( const CAM_DataModel* );
00103   virtual bool        openDataModel( const QString&, CAM_DataModel* );
00104   void                setStudyDS(const _PTR(Study)& s );
00105   virtual CAM_ModuleObject* createModuleObject( LightApp_DataModel* theDataModel, 
00106                                           SUIT_DataObject* theParent ) const;
00107 protected slots:
00108   virtual void        updateModelRoot( const CAM_DataModel* );
00109 
00110 private:
00111   QString             newStudyName() const;
00112 
00113 private:
00114   _PTR(Study)         myStudyDS;
00115   Observer_i*         myObserver;
00116 };
00117 
00118 #ifdef WIN32
00119 #pragma warning( default:4251 )
00120 #endif
00121 
00122 #endif