File indexing completed on 2022-12-06 18:50:22

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2012 Martin Kuettler <martin.kuettler@gmail.com>
0004 */
0005 
0006 #ifndef PAGEBREAKENTRY_H
0007 #define PAGEBREAKENTRY_H
0008 
0009 #include "worksheetentry.h"
0010 
0011 class WorksheetTextItem;
0012 
0013 class PageBreakEntry : public WorksheetEntry
0014 {
0015   Q_OBJECT
0016 
0017   public:
0018     explicit PageBreakEntry(Worksheet* worksheet);
0019     ~PageBreakEntry() override = default;
0020 
0021     enum {Type = UserType + 3};
0022     int type() const override;
0023 
0024     bool isEmpty() override;
0025     bool acceptRichText() override;
0026     void setContent(const QString& content) override;
0027     void setContent(const QDomElement& content, const KZip& file) override;
0028     void setContentFromJupyter(const QJsonObject & cell) override;
0029     static bool isConvertableToPageBreakEntry(const QJsonObject& cell);
0030     QDomElement toXml(QDomDocument& doc, KZip* archive) override;
0031     QJsonValue toJupyterJson() override;
0032     QString toPlain(const QString& commandSep, const QString& commentStartingSeq, const QString& commentEndingSeq) override;
0033 
0034     void layOutForWidth(qreal entry_zone_x, qreal w, bool force = false) override;
0035 
0036     //void paint(QPainter* painter, const QStyleOptionGraphicsItem * option,
0037     //         QWidget * widget = 0);
0038 
0039   public Q_SLOTS:
0040     bool evaluate(WorksheetEntry::EvaluationOption evalOp = FocusNext) override;
0041     void updateEntry() override;
0042     void populateMenu(QMenu* menu, QPointF pos) override;
0043 
0044   protected:
0045     bool wantToEvaluate() override;
0046     bool wantFocus() override;
0047 
0048   private:
0049     WorksheetTextItem* m_msgItem;
0050 };
0051 
0052 #endif /* PAGEBREAKENTRY_H */
0053