File indexing completed on 2024-04-21 11:14:08

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004 */
0005 
0006 #ifndef _LATEXRESULT_H
0007 #define _LATEXRESULT_H
0008 
0009 #include "epsresult.h"
0010 #include "cantor_export.h"
0011 
0012 namespace Cantor{
0013 class LatexResultPrivate;
0014 
0015 /**Class used for LaTeX results, it is basically an Eps result,
0016    but it exports a different type, and additionally stores the
0017    LaTeX code, used to generate the Eps, so it can be retrieved
0018    later
0019 **/
0020 class CANTOR_EXPORT LatexResult : public EpsResult
0021 {
0022   public:
0023     enum {Type=7};
0024     LatexResult( const QString& code, const QUrl& url, const QString& plain = QString(), const QImage& image = QImage());
0025     ~LatexResult() override;
0026 
0027     int type() override;
0028     QString mimeType() override;
0029 
0030     bool isCodeShown();
0031     void showCode();
0032     void showRendered();
0033 
0034     QString code();
0035     QString plain();
0036 
0037     QString toHtml() override;
0038     QString toLatex() override;
0039     QVariant data() override;
0040 
0041     QDomElement toXml(QDomDocument& doc) override;
0042     QJsonValue toJupyterJson() override;
0043 
0044     void save(const QString& filename) override;
0045 
0046   private:
0047     LatexResultPrivate* d;
0048 };
0049 
0050 }
0051 
0052 #endif /* _LATEXRESULT_H */