Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLJasperEngine_p.h 00003 ------------------- 00004 begin : 02/01/2011 00005 copyright : (C) 2003-2011 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 /*************************************************************************** 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; version 2 of the License. * 00012 ***************************************************************************/ 00013 /*************************************************************************** 00014 Este programa es software libre. Puede redistribuirlo y/o modificarlo 00015 bajo los términos de la Licencia Pública General de GNU en su 00016 versión 2, publicada por la Free Software Foundation. 00017 ***************************************************************************/ 00018 00019 #ifndef FLJASPERENGINE_P_H_ 00020 #define FLJASPERENGINE_P_H_ 00021 00022 #include <string> 00023 #include <list> 00024 00025 using namespace std; 00026 typedef list<string> AQStdStringList; 00027 00028 typedef void (*AQMsgHandler)(FLJasperEngine::AQReportsMsgType, const char *, void *); 00029 typedef void *(*aqReportsInterface)(); 00030 00034 #define AQ_JASPER_IFACE(I,V) \ 00035 AQ##I##Interface * V = reinterpret_cast<AQ##I##Interface *>(d->aqReports_->create( #I )) 00036 00037 class AQReportsInterface 00038 { 00039 public: 00040 AQReportsInterface() {} 00041 virtual ~AQReportsInterface() {} 00042 virtual bool init(const char *) = 0; 00043 virtual const char *jarDeps() const = 0; 00044 virtual bool setConnection(const char *) = 0; 00045 virtual bool viewReport(const char *) = 0; 00046 virtual bool viewReport(const char *, const char *) = 0; 00047 virtual void installMsgHandler(AQMsgHandler, void *) = 0; 00048 virtual void *create(const char *) = 0; 00049 }; 00050 00051 class AQJasperCompileManagerInterface 00052 { 00053 public: 00054 virtual void compileReportToFile(const char *, const char *) = 0; 00055 }; 00056 00057 class AQJasperFillManagerInterface 00058 { 00059 public: 00060 virtual void fillReportToFile(const char *, const char *, 00061 const char *, const char *, 00062 const char *, const char *) = 0; 00063 }; 00064 00065 class AQJasperPrintManagerInterface 00066 { 00067 public: 00068 virtual void loadJasperPrint(const char *) = 0; 00069 virtual int pageCount() const = 0; 00070 virtual int pageWidth() const = 0; 00071 virtual int pageHeight() const = 0; 00072 virtual int pageOrientation() = 0; 00073 virtual void printPageToImage(const char *, int, const char *) = 0; 00074 virtual bool printReport(bool) = 0; 00075 virtual bool printReport(const char *, int = 1) = 0; 00076 virtual bool exportReportToFile(const char *, const char *) = 0; 00077 }; 00078 00079 class AQJavaPrintServiceInterface 00080 { 00081 public: 00082 virtual AQStdStringList printServiceNames() = 0; 00083 private: 00084 virtual void *printService(const char *) = 0; 00085 friend class AQJasperPrintManagerInterface; 00086 }; 00090 00091 #define AQ_WARN_NO_JAVAVM QApplication::restoreOverrideCursor(); \ 00092 QMessageBox::warning(0, QApplication::tr("Aviso"), \ 00093 QApplication::tr("No se ha encontrado la Máquina Virtual de Java.\n") \ 00094 + QApplication::tr("Se necesita para poder usar informes de JasperReports."), \ 00095 QMessageBox::Ok, 0, 0); 00096 00097 #define AQ_WARN_NO_PLUGIN QApplication::restoreOverrideCursor(); \ 00098 QMessageBox::warning(0, QApplication::tr("Aviso"), \ 00099 QApplication::tr("No se ha encontrado el plugin AQReports.\n") \ 00100 + QApplication::tr("Se necesita para poder usar informes de JasperReports.\n") \ 00101 + QApplication::tr("Por favor visita http://abanq.org para obtenerlo."), \ 00102 QMessageBox::Ok, 0, 0); 00103 00104 static inline QDomDocument formatXmlData(QDomNode n, bool *ok = 0) 00105 { 00106 QString strXml(n.toDocument().toString()); 00107 strXml.replace(QRegExp("\\s*\\|\\|\\s*' '\\s*\\|\\|\\s*"), "_"); 00108 QDomDocument docXml; 00109 bool ret = FLUtil::domDocumentSetContent(docXml, strXml); 00110 if (ok) 00111 *ok = ret; 00112 return docXml; 00113 } 00114 00115 class FLJasperEnginePrivate 00116 { 00117 public: 00118 00119 FLJasperEnginePrivate(FLJasperEngine *q); 00120 ~FLJasperEnginePrivate(); 00121 00122 bool existsJasperFile() const; 00123 bool existsJRPrintFile() const; 00124 void cleanupJasperFile(); 00125 void cleanupJRPrintFile(); 00126 bool pluginLinked(); 00127 QString defaultExportFormat() const; 00128 bool loadAQReportsPlugin(); 00129 QString createTemplateFile(); 00130 QString createDataFile(); 00131 00132 static bool loadJvm(); 00133 static AQReportsInterface *loadAQReports(FLJasperEngine *q = 0); 00134 00135 private: 00136 00137 FLJasperEngine *q_; 00138 bool showErrorDialog_; 00139 00140 QString selectExpression_; 00141 QString datePattern_; 00142 QString numberPattern_; 00143 00144 QDomDocument xmlData_; 00145 QDomDocument xmlTemplate_; 00146 00147 QString jasperFile_; 00148 QString jrprintFile_; 00149 FLReportPages *reportPages_; 00150 00151 QString defaultExportFormat_; 00152 00153 AQReportsInterface *aqReports_; 00154 static QStringList jvmLibBlackList_; 00155 static QString jvmLib_; 00156 static aqReportsInterface aqReportsInterface_; 00157 00158 friend class FLJasperEngine; 00159 }; 00160 00161 #endif /* FLJASPERENGINE_P_H_ */