Eneboo - Documentación para desarrolladores
|
00001 /*************************************************************************** 00002 FLReportViewer.h - description 00003 ------------------- 00004 begin : vie jun 28 2002 00005 copyright : (C) 2002-2004 by InfoSiAL S.L. 00006 email : mail@infosial.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef FLREPORTVIEWER_H 00019 #define FLREPORTVIEWER_H 00020 00021 #include <qdom.h> 00022 00023 #include "FLWidgetReportViewer.h" 00024 #include "mreportviewer.h" 00025 00026 class MReportViewer; 00027 class MPageCollection; 00028 class FLSqlQuery; 00029 class FLSqlCursor; 00030 class FLReportEngine; 00031 class FLSmtpClient; 00032 class FLPicture; 00033 class FLReportPages; 00034 00049 class FL_EXPORT FLReportViewer: public FLWidgetReportViewer 00050 { 00051 00052 Q_OBJECT 00053 00054 public: 00055 00056 00066 FLReportViewer(QWidget *parent = 0, const char *name = 0, 00067 bool embedInParent = false, FLReportEngine *rptEngine = 0); 00068 00072 ~FLReportViewer(); 00073 00077 void exec(); 00078 00088 bool renderReport(const int initRow = 0, const int initCol = 0, 00089 const bool append = false, const bool displayReport = false); 00090 00091 bool renderReport(const int initRow = 0, const int initCol = 0, const uint flags = MReportViewer::Display); 00092 00099 bool setReportData(FLSqlQuery *q); 00100 00107 bool setReportData(FLSqlCursor *t); 00108 00115 bool setReportData(QDomNode n); 00116 00126 bool setReportTemplate(const QString &t, const QString &style = QString::null); 00127 00137 bool setReportTemplate(QDomNode d, const QString &style = QString::null); 00138 00142 QSize sizeHint() const; 00143 00147 void setNumCopies(const int numCopies); 00148 00152 void setPrintToPos(bool ptp); 00153 00161 void setPrinterName(const QString &pName); 00162 00166 bool reportPrinted(); 00167 00171 void setStyleName(const QString &style); 00172 00176 MReportViewer *rptViewer() const { 00177 return rptViewer_; 00178 } 00179 00183 FLReportEngine *rptEngine() const { 00184 return rptEngine_; 00185 } 00186 00192 void rptViewerEmbedInParent(QWidget *parentFrame); 00193 00199 void rptViewerReparent(QWidget *parentFrame); 00200 00206 QString csvData(); 00207 00217 void setReportPages(FLReportPages *pgs); 00218 00219 public slots: 00220 00227 void setReportEngine(FLReportEngine *r = 0); 00228 00232 void slotPrintReport(); 00233 00237 void slotPrintReportToPS(const QString &outPsFile); 00238 00242 void slotPrintReportToPDF(const QString &outPdfFile); 00243 00247 void slotFirstPage(); 00248 00252 void slotLastPage(); 00253 00257 void slotNextPage(); 00258 00262 void slotPrevPage(); 00263 00267 void slotExit(); 00268 00272 void slotZoomUp(); 00273 00277 void slotZoomDown(); 00278 00282 void exportFileCSVData(); 00283 00287 void exportToPDF(); 00288 00292 void sendEMailPDF(); 00293 00299 void showInitCentralWidget(bool show); 00300 00304 void saveSVGStyle(); 00305 00309 void saveSimpleSVGStyle(); 00310 00314 void loadSVGStyle(); 00315 00321 void setAutoClose(bool b); 00322 00328 void setResolution(int dpi); 00329 void setPixel(int relDpi); 00330 void setDefaults(); 00331 00338 void updateReport(); 00339 00343 void updateDisplay(); 00344 00353 void disableSlotsPrintExports(bool disablePrints = true, bool disableExports = true); 00354 00355 signals: 00356 00360 void requestUpdateReport(); 00361 00362 protected: 00363 00367 void closeEvent(QCloseEvent *e); 00368 00372 void showEvent(QShowEvent *e); 00373 00374 private: 00375 00379 bool loop; 00380 00384 bool reportPrinted_; 00385 00389 MReportViewer *rptViewer_; 00390 00394 FLReportEngine *rptEngine_; 00395 00399 QWidget *initCentralWidget_; 00400 00404 FLSmtpClient *smtpClient_; 00405 00409 bool autoClose_; 00410 00414 MPageCollection *report; 00415 00419 bool embedInParent_; 00420 00424 QString template_; 00425 00429 QDomNode xmlTemplate_; 00430 00434 QDomNode xmlData_; 00435 00439 FLSqlQuery *qry_; 00440 00444 QString styleName_; 00445 00454 bool slotsPrintDisabled_; 00455 bool slotsExportDisabled_; 00456 00457 public: 00458 00464 FLPicture *getCurrentPage(); 00465 FLPicture *getFirstPage(); 00466 FLPicture *getPreviousPage(); 00467 FLPicture *getNextPage(); 00468 FLPicture *getLastPage(); 00469 FLPicture *getPageAt(uint i); 00470 void clearPages(); 00471 void appendPage(); 00472 int getCurrentIndex(); 00473 void setCurrentPage(int idx); 00474 void setPageSize(int s); 00475 void setPageOrientation(int o); 00476 void setPageDimensions(QSize dim); 00477 int pageSize(); 00478 int pageOrientation(); 00479 QSize pageDimensions(); 00480 int pageCount(); 00481 }; 00482 00483 #endif