File indexing completed on 2024-05-12 03:47:28

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     SPDX-FileCopyrightText: 2015 Alexander Semke <alexander.semke@web.de>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef WORKBOOK_H
0012 #define WORKBOOK_H
0013 
0014 #include "backend/core/AbstractPart.h"
0015 
0016 class Spreadsheet;
0017 class Matrix;
0018 class WorkbookView;
0019 class QXmlStreamWriter;
0020 class XmlStreamReader;
0021 
0022 class Workbook : public AbstractPart {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit Workbook(const QString& name);
0027 
0028     QIcon icon() const override;
0029     QMenu* createContextMenu() override;
0030     QWidget* view() const override;
0031 
0032     bool exportView() const override;
0033     bool printView() override;
0034     bool printPreview() const override;
0035 
0036     Spreadsheet* currentSpreadsheet() const;
0037     Matrix* currentMatrix() const;
0038     void setChildSelectedInView(int index, bool selected);
0039 
0040     QVector<AspectType> pasteTypes() const override;
0041     void processDropEvent(const QVector<quintptr>&) override;
0042 
0043     void save(QXmlStreamWriter*) const override;
0044     bool load(XmlStreamReader*, bool preview) override;
0045 
0046 public Q_SLOTS:
0047     void childSelected(const AbstractAspect*) override;
0048 
0049 private:
0050     mutable WorkbookView* m_view{nullptr};
0051 
0052 private Q_SLOTS:
0053     void childDeselected(const AbstractAspect*) override;
0054 
0055 Q_SIGNALS:
0056     void requestProjectContextMenu(QMenu*);
0057     void workbookItemSelected(int);
0058 };
0059 
0060 #endif