klfbackend.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfbackend.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2007 by Philippe Faist
00005  *   philippe.faist@bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 
00023 #ifndef KLFBACKEND_H
00024 #define KLFBACKEND_H
00025 
00026 #include <qstring.h>
00027 #ifdef KLFBACKEND_QT4
00028 #include <QByteArray>
00029 #else
00030 #include <qmemarray.h>
00031 #endif
00032 #include <qimage.h>
00033 
00034 
00036 
00057 
00058 #define KLFERR_NOERROR 0
00059 
00061 #define KLFERR_MISSINGLATEXFORMULA -1
00063 #define KLFERR_MISSINGMATHMODETHREEDOTS -2
00065 #define KLFERR_TEXWRITEFAIL -3
00067 #define KLFERR_NOLATEXPROG -4
00069 #define KLFERR_LATEXNONORMALEXIT -5
00071 #define KLFERR_NODVIFILE -6
00073 #define KLFERR_NODVIPSPROG -7
00075 #define KLFERR_DVIPSNONORMALEXIT -8
00077 #define KLFERR_NOEPSFILE -9
00079 #define KLFERR_EPSREADFAIL -10
00081 #define KLFERR_NOEPSBBOX -11
00083 #define KLFERR_BADEPSBBOX -12
00085 #define KLFERR_EPSWRITEFAIL -13
00087 #define KLFERR_NOGSPROG -14
00089 #define KLFERR_GSNONORMALEXIT -15
00091 #define KLFERR_NOPNGFILE -16
00093 #define KLFERR_PNGREADFAIL -17
00095 #define KLFERR_NOEPSTOPDFPROG -18
00097 #define KLFERR_EPSTOPDFNONORMALEXIT -19
00099 #define KLFERR_NOPDFFILE -20
00101 #define KLFERR_PDFREADFAIL -21
00102 
00104 #define KLFERR_PROGERR_LATEX 1
00106 #define KLFERR_PROGERR_DVIPS 2
00108 #define KLFERR_PROGERR_GS 3
00110 #define KLFERR_PROGERR_EPSTOPDF 4
00111 
00112 
00113 
00115 
00123 class KLFBackend
00124 {
00125 public:
00126 
00128 
00133   struct klfSettings {
00134     QString tempdir; 
00136     QString latexexec; 
00137     QString dvipsexec; 
00138     QString gsexec; 
00139     QString epstopdfexec; 
00143     int tborderoffset; 
00144     int rborderoffset; 
00145     int bborderoffset; 
00146     int lborderoffset; 
00147   };
00148 
00150 
00152   struct klfInput {
00153     QString latex; 
00154     QString mathmode; 
00159     QString preamble; 
00161     unsigned long fg_color; 
00163     unsigned long bg_color; 
00167     int dpi; 
00169   };
00170 
00172 
00174   struct klfOutput {
00185     int status;
00193     QString errorstr;
00194 
00195     QImage result; 
00196     QByteArray pngdata; 
00197     QByteArray epsdata; 
00198     QByteArray pdfdata; 
00199   };
00200 
00252   static klfOutput getLatexFormula(const klfInput& in, const klfSettings& settings);
00253 
00254 
00255 
00256 private:
00257   KLFBackend();
00258 
00259   static void cleanup(QString tempfname);
00260 
00261 };
00262 
00263 
00264 
00265 
00266 #endif

Generated on Mon May 4 01:27:08 2009 for KLFBackend by  doxygen 1.5.3