2011-09-22 17:09:26 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2004 by Duncan Mac-Vicar Prett <duncan@kde.org> *
|
|
|
|
* Copyright (C) 2004-2005 by Olivier Goffart <ogoffart@kde.org> *
|
|
|
|
* Copyright (C) 2011 by Niels Ole Salscheider *
|
|
|
|
* <niels_ole@salscheider-online.de> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef LATEXRENDERER_H
|
|
|
|
#define LATEXRENDERER_H
|
2011-09-22 17:14:02 +00:00
|
|
|
|
2011-09-22 18:20:53 +00:00
|
|
|
#include <QStringList>
|
|
|
|
|
2011-09-22 17:09:26 +00:00
|
|
|
class QString;
|
|
|
|
class QColor;
|
|
|
|
|
|
|
|
namespace GuiUtils
|
|
|
|
{
|
|
|
|
|
|
|
|
class LatexRenderer
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum Error {
|
|
|
|
NoError,
|
|
|
|
LatexNotFound,
|
|
|
|
DvipngNotFound,
|
|
|
|
LatexFailed,
|
|
|
|
DvipngFailed
|
|
|
|
};
|
|
|
|
|
|
|
|
LatexRenderer();
|
2011-09-22 18:20:53 +00:00
|
|
|
~LatexRenderer();
|
2011-09-22 17:09:26 +00:00
|
|
|
|
2019-01-09 23:28:49 +00:00
|
|
|
LatexRenderer(const LatexRenderer &) = delete;
|
|
|
|
LatexRenderer &operator=(const LatexRenderer &) = delete;
|
|
|
|
|
2011-09-22 17:09:26 +00:00
|
|
|
Error renderLatexInHtml( QString& html, const QColor &textColor, int fontSize, int resolution, QString &latexOutput );
|
|
|
|
static bool mightContainLatex ( const QString& text );
|
|
|
|
|
|
|
|
private:
|
|
|
|
Error handleLatex( QString &fileName, const QString &latexFormula, const QColor &textColor, int fontSize, int resolution, QString &latexOutput );
|
|
|
|
static bool securityCheck( const QString &latexFormula );
|
2011-09-22 18:20:53 +00:00
|
|
|
|
|
|
|
QStringList m_fileList;
|
2011-09-22 17:09:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // LATEXRENDERER_H
|