File indexing completed on 2024-05-12 15:26:31
0001 /*************************************************************************** 0002 File : CantorWorksheet.h 0003 Project : LabPlot 0004 Description : Aspect providing a Cantor Worksheets for Multiple backends 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2015 Garvit Khatri (garvitdelhi@gmail.com) 0007 Copyright : (C) 2016 by Alexander Semke (alexander.semke@web.de) 0008 0009 ***************************************************************************/ 0010 0011 /*************************************************************************** 0012 * * 0013 * This program is free software; you can redistribute it and/or modify * 0014 * it under the terms of the GNU General Public License as published by * 0015 * the Free Software Foundation; either version 2 of the License, or * 0016 * (at your option) any later version. * 0017 * * 0018 * This program is distributed in the hope that it will be useful, * 0019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0021 * GNU General Public License for more details. * 0022 * * 0023 * You should have received a copy of the GNU General Public License * 0024 * along with this program; if not, write to the Free Software * 0025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0026 * Boston, MA 02110-1301 USA * 0027 * * 0028 ***************************************************************************/ 0029 #ifndef CANTORWORKSHEET_H 0030 #define CANTORWORKSHEET_H 0031 0032 #include <backend/core/AbstractPart.h> 0033 #include <cantor/session.h> 0034 0035 namespace Cantor { 0036 class PanelPlugin; 0037 class WorksheetAccessInterface; 0038 } 0039 0040 namespace KParts { 0041 class ReadWritePart; 0042 } 0043 0044 class CantorWorksheetView; 0045 class Column; 0046 class QAbstractItemModel; 0047 0048 class CantorWorksheet : public AbstractPart { 0049 Q_OBJECT 0050 0051 public: 0052 explicit CantorWorksheet(const QString& name, bool loading = false); 0053 0054 bool init(QByteArray* content = nullptr); 0055 0056 QWidget* view() const override; 0057 QMenu* createContextMenu() override; 0058 QIcon icon() const override; 0059 0060 bool exportView() const override; 0061 bool printView() override; 0062 bool printPreview() const override; 0063 0064 void save(QXmlStreamWriter*) const override; 0065 bool load(XmlStreamReader*, bool preview) override; 0066 0067 QString backendName(); 0068 KParts::ReadWritePart* part(); 0069 QList<Cantor::PanelPlugin*> getPlugins(); 0070 0071 private: 0072 mutable CantorWorksheetView* m_view{nullptr}; 0073 QString m_backendName; 0074 Cantor::Session* m_session{nullptr}; 0075 KParts::ReadWritePart* m_part{nullptr}; 0076 QList<Cantor::PanelPlugin*> m_plugins; 0077 QAbstractItemModel* m_variableModel{nullptr}; 0078 Cantor::WorksheetAccessInterface* m_worksheetAccess{nullptr}; 0079 0080 private slots: 0081 void dataChanged(const QModelIndex&); 0082 void rowsInserted(const QModelIndex & parent, int first, int last); 0083 void rowsAboutToBeRemoved(const QModelIndex & parent, int first, int last); 0084 void modelReset(); 0085 void modified(); 0086 0087 signals: 0088 void requestProjectContextMenu(QMenu*); 0089 void statusChanged(Cantor::Session::Status); 0090 }; 0091 0092 #endif // CANTORWORKSHEET_H