00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RTKOUTPUTQPAINTER_H
00022 #define RTKOUTPUTQPAINTER_H
00023
00024 #include <qpicture.h>
00025 #include <qpainter.h>
00026 #include <qvaluevector.h>
00027 #include "rtkoutput.h"
00028
00029 namespace RTK {
00030
00031 typedef QValueVector<QPicture *> QPageCollection;
00032
00033 class OutputQPainter : public Output {
00034
00035 public:
00036 OutputQPainter(Measure unitsperinchx = 72, Measure unitsperinchy = 72,
00037 PaperType papertype = A4, UnitsType units = dots,
00038 Measure sizex = 595, Measure sizey = 841, Measure marginleft = 0,
00039 Measure marginright = 0, Measure margintop = 0, Measure marginbottom = 0, int pageorientation = 0)
00040 :Output(papertype, units,
00041 sizex, sizey, marginleft,
00042 marginright, margintop, marginbottom, pageorientation),
00043 mUnitsPerInchX(unitsperinchx), mUnitsPerInchY(unitsperinchy)
00044
00045 {
00046 initSizes();
00047 };
00048
00049 ~OutputQPainter() {};
00050 int startReport(const Report &report);
00051 int endReport(const Report &report);
00052 Measure startPage();
00053 Measure endPage();
00054 Measure startSection(const Section §ion);
00055 Measure endSection(const Section §ion);
00056 Measure startObject(const Section §ion, const Object &object);
00057 Measure endObject(const Section §ion, const Object &object);
00058 Measure printObject(const Report &report, const Section §ion, const Object &object);
00059 bool sectionFits(const Section §ion, Measure nextsectionheight) const;
00060
00061 QPicture *getFirstPage() const;
00062 const QPageCollection *getPageCollection() const
00063 { return &mPageCollection; }
00064
00065
00066 public:
00067 Measure getUnitsPerInchX() const { return mUnitsPerInchX; };
00068 void setUnitsPerInchX(Measure unitsperinchx) { mUnitsPerInchX = unitsperinchx; };
00069 Measure getUnitsPerInchY() const { return mUnitsPerInchY; };
00070 void setUnitsPerInchY(Measure unitsperinchy) { mUnitsPerInchY = unitsperinchy; };
00071 protected:
00072 Measure mUnitsPerInchX;
00073 Measure mUnitsPerInchY;
00074
00075
00076 private:
00077 QPageCollection mPageCollection;
00078 QPainter mPainter;
00079 void initSizes();
00080 QBrush mSavedBrush;
00081 };
00082
00083 };
00084
00085 #endif // RTKOUTPUTQPAINTER
00086