File indexing completed on 2024-05-12 15:26:40

0001 /***************************************************************************
0002     File                 : Workbook.h
0003     Project              : LabPlot
0004     Description          : Aspect providing a container for storing data
0005                 in form of spreadsheets and matrices
0006     --------------------------------------------------------------------
0007     Copyright            : (C) 2015 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 WORKBOOK_H
0030 #define WORKBOOK_H
0031 
0032 #include "backend/core/AbstractPart.h"
0033 
0034 class Spreadsheet;
0035 class Matrix;
0036 class WorkbookView;
0037 class QXmlStreamWriter;
0038 class XmlStreamReader;
0039 
0040 class Workbook : public AbstractPart {
0041     Q_OBJECT
0042 
0043 public:
0044     explicit Workbook(const QString& name);
0045 
0046     QIcon icon() const override;
0047     QMenu* createContextMenu() override;
0048     QWidget* view() const override;
0049 
0050     bool exportView() const override;
0051     bool printView() override;
0052     bool printPreview() const override;
0053 
0054     Spreadsheet* currentSpreadsheet() const;
0055     Matrix* currentMatrix() const;
0056     void setChildSelectedInView(int index, bool selected);
0057 
0058     void save(QXmlStreamWriter*) const override;
0059     bool load(XmlStreamReader*, bool preview) override;
0060 
0061 public slots:
0062     void childSelected(const AbstractAspect*) override;
0063 
0064 private:
0065     mutable WorkbookView* m_view{nullptr};
0066 
0067 private slots:
0068     void childDeselected(const AbstractAspect*) override;
0069 
0070 signals:
0071     void requestProjectContextMenu(QMenu*);
0072     void workbookItemSelected(int);
0073 };
0074 
0075 #endif