File indexing completed on 2024-04-28 11:20:47

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004     SPDX-FileCopyrightText: 2022 by Alexander Semke (alexander.semke@web.de)
0005 */
0006 
0007 #ifndef _IMAGERESULT_H
0008 #define _IMAGERESULT_H
0009 
0010 #include "result.h"
0011 #include <QUrl>
0012 #include <QSize>
0013 
0014 class QImage;
0015 
0016 namespace Cantor
0017 {
0018 class ImageResultPrivate;
0019 
0020 class CANTOR_EXPORT ImageResult : public Result
0021 {
0022   public:
0023     enum{Type=2};
0024     explicit ImageResult( const QUrl& url, const QString& alt=QString());
0025     explicit ImageResult( const QImage& image, const QString& alt=QString());
0026     ~ImageResult() override;
0027 
0028     QString toHtml() override;
0029     QString toLatex() override;
0030     QVariant data() override;
0031     QUrl url() override;
0032 
0033     int type() override;
0034     QString mimeType() override;
0035     QString extension();
0036 
0037     QSize displaySize();
0038     void setDisplaySize(QSize size);
0039 
0040     QString originalFormat();
0041     void setOriginalFormat(const QString& format);
0042     void setSvgContent(const QString& svgContent);
0043 
0044     QDomElement toXml(QDomDocument& doc) override;
0045     QJsonValue toJupyterJson() override;
0046     void saveAdditionalData(KZip* archive) override;
0047 
0048     void save(const QString& filename) override;
0049 
0050   private:
0051     ImageResultPrivate* d;
0052 };
0053 
0054 }
0055 
0056 #endif /* _IMAGERESULT_H */