Eneboo - Documentación para desarrolladores
src/kugar/mreportsection.h
Ir a la documentación de este archivo.
00001 /***************************************************************************
00002              mreportsection.h  -  Kugar report section
00003              -------------------
00004    begin     : Mon Aug 23 1999
00005    copyright : (C) 1999 by Mutiny Bay Software
00006    email     : info@mutinybaysoftware.com
00007    copyright : (C) 2002 Alexander Dymo
00008    email     : cloudtemple@mksat.net
00009 ***************************************************************************/
00010 
00011 #ifndef MREPORTSECTION_H
00012 #define MREPORTSECTION_H
00013 
00014 #include <qptrlist.h>
00015 #include <qobject.h>
00016 #include <qvaluevector.h>
00017 #include <qvaluelist.h>
00018 #include <qdom.h>
00019 #include <qpicture.h>
00020 
00021 #include "mlineobject.h"
00022 #include "mlabelobject.h"
00023 #include "mspecialobject.h"
00024 #include "mcalcobject.h"
00025 #include "mpagecollection.h"
00026 
00033 class MReportSection: public QObject
00034 {
00035 
00036 public:
00037 
00041   enum PrintFrequency {
00042     FirstPage = 0,
00043     EveryPage,
00044     LastPage
00045   };
00046 
00050   MReportSection(const QString &strIdSec = QString::null);
00051 
00055   MReportSection(const MReportSection &mReportSection);
00056 
00060   MReportSection operator=(const MReportSection &mReportSection);
00061 
00065   virtual ~ MReportSection();
00066 
00067 protected:
00068 
00072   int height;
00073 
00077   int width;
00078 
00082   int level;
00083 
00087   bool newPage_;
00088 
00092   bool placeAtBottom_;
00093 
00097   bool drawAllPages_;
00098 
00102   int frequency;
00103 
00107   int pageNumber;
00108 
00112   QString drawIf;
00113 
00117   QDate reportDate;
00118 
00119 private:
00120 
00124   QPtrList<MLineObject> lines;
00125 
00129   QPtrList<MLabelObject> labels;
00130 
00134   QPtrList<MSpecialObject> specialFields;
00135 
00139   QPtrList<MCalcObject> calculatedFields;
00140 
00144   QPtrList<MFieldObject> fields;
00145 
00146 public:
00147 
00151   void addField(MFieldObject *field);
00152 
00156   void addLine(MLineObject *line);
00157 
00161   void addLabel(MLabelObject *label);
00162 
00166   void addSpecialField(MSpecialObject *special);
00167 
00171   void addCalculatedField(MCalcObject *calc);
00172 
00176   void setHeight(int h);
00177 
00181   void setWidth(const int w);
00182 
00186   int getHeight() const;
00187   int getHeight(FLStylePainter *p);
00188 
00192   int getWidth() const;
00193 
00197   void setLevel(int l);
00198 
00202   int getLevel() const;
00203 
00207   void setDrawIf(const QString &dI);
00208 
00212   QString getDrawIf() const;
00213 
00217   void setNewPage(bool b);
00218 
00222   void setPlaceAtBottom(bool b);
00223 
00227   void setDrawAllPages(bool b);
00228 
00232   bool newPage();
00233 
00237   bool placeAtBottom();
00238 
00242   bool drawAllPages();
00243 
00247   void setPageNumber(int page);
00248 
00252   void setReportDate(const QDate &date);
00253 
00257   void setPrintFrequency(int printFrequency);
00258 
00262   int printFrequency();
00263 
00267   QString getCalcFieldName(int idx);
00268 
00272   int getCalcFieldIndex(const QString &field);
00273 
00277   int getFieldIndex(const QString &field);
00278 
00282   void setCalcFieldData(int idx, const QString &data);
00283 
00287   void setFieldData(int idx, const QString &data,
00288                     QDomNode *record = 0, bool fillRecord = false);
00289 
00293   void setCalcFieldData(QPtrList<QMemArray<double> > *values = 0,
00294                         QValueVector<QString> *valueS = 0,
00295                         QDomNode *record = 0, bool fillRecord = false);
00296 
00300   void setCalcFieldDataGT(QPtrList<QMemArray<double> > *values,
00301                           QDomNode *record = 0, bool fillRecord = false);
00302 
00310   void calculateField(MCalcObject *field, QMemArray<double> *values,
00311                       QString valueS = QString::null, QDomNode *record = 0, bool fillRecord = false);
00312 
00316   int getFieldCount() const;
00317 
00321   QString getFieldName(int idx);
00322 
00326   int getCalcFieldCount() const;
00327 
00331   virtual void draw(FLStylePainter *p, int xoffset, int yoffset, int &newHeight);
00332 
00336   void drawHeaderObjects(FLStylePainter *p, MPageCollection *pages, MReportSection *header);
00337 
00341   virtual void clear();
00342 
00346   bool mustBeDrawed(QDomNode *record);
00347 
00351   int getLastXOffset() const;
00352 
00356   int getLastYOffset() const;
00357 
00361   uint getLastPageIndex() const;
00362 
00366   void setLastPageIndex(uint i);
00367 
00371   MFieldObject *getField(int idx);
00372 
00376   MCalcObject *getCalcField(int idx);
00377 
00378   QPicture *onPage();
00379   void setOnPage(QPicture *page);
00380 
00381   QString csvData() const;
00382 
00383   void setIdSec(uint id) {
00384     idSec_ = id;
00385   }
00386   uint idSec() const {
00387     return idSec_;
00388   }
00389   static void resetIdSecGlob();
00390 
00391 protected:
00392 
00396   void drawObjects(FLStylePainter *p, int xoffset, int yoffset, int &newHeight);
00397 
00398 private:
00399 
00405   void copy(const MReportSection *mReportSection);
00406 
00407   int lastXOffset;
00408   int lastYOffset;
00409   uint lastPageIndex;
00410   QPicture *onPage_;
00411   QString csvData_;
00412 
00413   uint idSec_;
00414   static uint idSecGlob_;
00415 
00416   QString strIdSec_;
00417 };
00418 
00420 inline int MReportSection::getHeight() const
00421 {
00422   return height;
00423 }
00424 
00426 inline int MReportSection::getWidth() const
00427 {
00428   return width;
00429 }
00430 
00432 inline void MReportSection::setHeight(int h)
00433 {
00434   height = h;
00435 }
00436 
00438 inline void MReportSection::setWidth(const int w)
00439 {
00440   width = w;
00441 }
00442 
00444 inline void MReportSection::setDrawIf(const QString &dI)
00445 {
00446   drawIf = dI;
00447 }
00448 
00450 inline QString MReportSection::getDrawIf() const
00451 {
00452   return drawIf;
00453 }
00454 
00456 inline void MReportSection::setLevel(int l)
00457 {
00458   level = l;
00459 }
00460 
00462 inline int MReportSection::getLevel() const
00463 {
00464   return level;
00465 }
00466 
00468 inline void MReportSection::setNewPage(bool b)
00469 {
00470   newPage_ = b;
00471 }
00472 
00474 inline void MReportSection::setPlaceAtBottom(bool b)
00475 {
00476   placeAtBottom_ = b;
00477 }
00478 
00480 inline void MReportSection::setDrawAllPages(bool b)
00481 {
00482   drawAllPages_ = b;
00483 }
00484 
00486 inline bool MReportSection::newPage()
00487 {
00488   return newPage_;
00489 }
00490 
00492 inline bool MReportSection::placeAtBottom()
00493 {
00494   return placeAtBottom_;
00495 }
00496 
00498 inline bool MReportSection::drawAllPages()
00499 {
00500   return drawAllPages_;
00501 }
00502 
00504 inline void MReportSection::setPageNumber(int page)
00505 {
00506   pageNumber = page;
00507 }
00508 
00510 inline void MReportSection::setReportDate(const QDate &date)
00511 {
00512   reportDate = date;
00513 }
00514 
00516 inline void MReportSection::setPrintFrequency(int printFrequency)
00517 {
00518   frequency = printFrequency;
00519 }
00520 
00522 inline int MReportSection::printFrequency()
00523 {
00524   return frequency;
00525 }
00526 
00527 inline QString MReportSection::csvData() const
00528 {
00529   return csvData_;
00530 }
00531 
00532 inline int MReportSection::getLastXOffset() const
00533 {
00534   return lastXOffset;
00535 }
00536 
00537 inline int MReportSection::getLastYOffset() const
00538 {
00539   return lastYOffset;
00540 }
00541 
00542 inline uint MReportSection::getLastPageIndex() const
00543 {
00544   return lastPageIndex;
00545 }
00546 
00547 inline void MReportSection::setLastPageIndex(uint i)
00548 {
00549   lastPageIndex = i;
00550 }
00551 
00552 inline QPicture *MReportSection::onPage()
00553 {
00554   return onPage_;
00555 }
00556 
00557 inline void MReportSection::setOnPage(QPicture *page)
00558 {
00559   onPage_ = page;
00560 }
00561 
00563 inline int MReportSection::getCalcFieldCount() const
00564 {
00565   return calculatedFields.count();
00566 }
00567 
00569 inline int MReportSection::getFieldCount() const
00570 {
00571   return fields.count();
00572 }
00573 
00575 inline QString MReportSection::getFieldName(int idx)
00576 {
00577   return fields.at(idx)->getFieldName();
00578 }
00579 
00581 inline QString MReportSection::getCalcFieldName(int idx)
00582 {
00583   return calculatedFields.at(idx)->getFieldName();
00584 }
00585 
00587 inline void MReportSection::setCalcFieldData(int idx, const QString &data)
00588 {
00589   calculatedFields.at(idx)->setText(data);
00590 }
00591 
00593 inline MFieldObject *MReportSection::getField(int idx)
00594 {
00595   return fields.at(idx);
00596 }
00597 
00599 inline MCalcObject *MReportSection::getCalcField(int idx)
00600 {
00601   return calculatedFields.at(idx);
00602 }
00603 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'