File indexing completed on 2024-12-22 04:17:30

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef DOCUMENT_H
0014 #define DOCUMENT_H
0015 
0016 #include <QPointer>
0017 #include <QString>
0018 
0019 #include "coredocument.h"
0020 #include "dataobject.h"
0021 namespace Kst {
0022 
0023 class MainWindow;
0024 class SessionModel;
0025 class View;
0026 class ViewItem;
0027 class CommandLineParser;
0028 
0029 class Document : public CoreDocument {
0030   public:
0031     explicit Document(MainWindow *win);
0032     ~Document();
0033 
0034     SessionModel* session() const;
0035 
0036     QString fileName() const;
0037 
0038     bool initFromCommandLine(CommandLineParser *P);
0039 
0040     bool open(const QString& file);
0041     bool save(const QString& to = QString());
0042 
0043     ObjectList<DataObject> sortedDataObjectList();
0044 
0045 
0046     bool isChanged() const;
0047     void setChanged(bool changed);
0048     bool isOpen() const;
0049 
0050     QString lastError() const;
0051 
0052     void createView();
0053 
0054     View *currentView() const;
0055 
0056     void updateRecentDataFiles(const QStringList &datafiles);
0057 
0058 
0059   private:
0060     QPointer<MainWindow> _win;
0061     SessionModel *_session;
0062     bool _dirty;
0063     bool _isOpen;
0064     QString _fileName;
0065     QString _lastError;
0066 };
0067 
0068 }
0069 
0070 #endif
0071 
0072 // vim: ts=2 sw=2 et