00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef RTKSECTION_H
00021 #define RTKSECTION_H
00022
00023 #include <vector>
00024
00025 #include "rtkobject.h"
00026
00027 namespace RTK {
00028
00029 class Section: public Object
00030 {
00031 friend class Report;
00032
00033 public:
00034 Section(SectionType type = SectionDetails, const String& groupname = "",
00035 Variant groupvalue = Variant(), uint grouplevel = 0, Variant pagebefore = false,
00036 Variant pageafter = false, Variant resetnpage = false, Variant supifblank = false, Variant repeatheader = false,
00037 const String& name = String::null, Variant value = 0,
00038 AggregateType aggregate = AggNone, String posx = 0, String posy = 0,
00039 String sizex = 0, String sizey = 0, const String& style = String::null,
00040 const String& url = String::null, const String& tag = String::null, Variant marginleft = 0,
00041 Variant marginright = 0, Variant margintop = 0, Variant marginbottom = 0,
00042 Variant visible = true, Variant supressed = false, Variant fontfamily = String::null,
00043 Variant fontsize = 12, Variant fontweight = 0, Variant fontitalic = false,
00044 Variant mask = String::null, Variant format = String::null, Variant halignment = AlignAuto,
00045 Variant valignment = AlignTop, Variant maxlines = 0, Variant minfontsize = 8,
00046 Variant adjustment = AdjustTrim, Variant textcolor = Qt::black, Variant backcolor = Qt::white,
00047 Variant bordercolor = Qt::black, Variant borderwidth = 0, Variant borderstyle = BorderNone, Variant backgroundimage = String::null)
00048 :Object(name, value,
00049 aggregate, posx, posy,
00050 sizex, sizey, style,
00051 url, tag, marginleft,
00052 marginright, margintop, marginbottom,
00053 visible, supressed, fontfamily,
00054 fontsize, fontweight, fontitalic,
00055 mask, format, halignment,
00056 valignment, maxlines, minfontsize,
00057 adjustment, textcolor, backcolor,
00058 bordercolor, borderwidth, borderstyle, backgroundimage),
00059 mType(type), mGroupName(groupname),
00060 mGroupValue(groupvalue), mGroupLevel(grouplevel), mPageBefore(pagebefore),
00061 mPageAfter(pageafter), mResetNPage(resetnpage), mSupIfBlank(supifblank), mRepeatHeader(repeatheader)
00062
00063 , mRecordCount(0)
00064 {};
00065
00066 bool groupChanged() const { return mNextRealGroupValue != mRealGroupValue; }
00067 void setRealGroupValue(Variant value) { mRealGroupValue = mNextRealGroupValue; mNextRealGroupValue = value; };
00068 Variant getRealGroupValue() { return mRealGroupValue; }
00069
00070 uint getNObjects() const { return mObjects.size(); }
00071 Object *getObject(const String &name) const;
00072 Object *getObject(int i) const;
00073 int insertObject(Object *object);
00074
00075 int insertObject(String name = String::null, Variant value = 0, AggregateType aggregate = AggNone, String posx = 0, String posy = 0, String sizex = 0, String sizey = 0, String style = String::null, String url = String::null, String tag = String::null, String marginleft = 0, String marginright = 0, String margintop = 0, String marginbottom = 0, bool visible = true, bool supressed = false, String fontfamily = String::null, int fontsize = 12, int fontweight = 0, bool fontitalic = false, String mask = String::null, String format = String::null, AlignmentType halignment = AlignAuto, AlignmentType valignment = AlignTop, int maxlines = 0, int minfontsize = 8, AdjustmentType adjustment = AdjustTrim, Color textcolor = Qt::black, Color backcolor = Qt::white, Color bordercolor = Qt::black, int borderwidth = 0, BorderStyle borderstyle = BorderNone, String backgroundimage = String::null);
00076
00077 void fixObjectsMeasures(UnitsType outunit, Measure outsizex, Measure outsizey,
00078 UnitsType repunit, Measure repsizex, Measure repsizey);
00079 void calcAggregateValues(uint level);
00080 int getRecordCount() const { return mRecordCount; }
00081
00082 public:
00084 SectionType getType() const { return mType; };
00086 void setType(SectionType type) { mType = type; };
00088 const String& getGroupName() const { return mGroupName; };
00090 void setGroupName(const String& groupname) { mGroupName = groupname; };
00092 Variant getGroupValue() const { return mGroupValue; };
00094 void setGroupValue(Variant groupvalue) { mGroupValue = groupvalue; };
00096 uint getGroupLevel() const { return mGroupLevel; };
00098 void setGroupLevel(uint grouplevel) { mGroupLevel = grouplevel; };
00100 bool isPageBefore() const;
00101 bool isNullPageBefore() const { return mPageBefore.isNull(); }
00103 void setPageBefore(const Variant & pagebefore) { mPageBefore = pagebefore; };
00105 bool isPageAfter() const;
00106 bool isNullPageAfter() const { return mPageAfter.isNull(); }
00108 void setPageAfter(const Variant & pageafter) { mPageAfter = pageafter; };
00110 bool isResetNPage() const;
00111 bool isNullResetNPage() const { return mResetNPage.isNull(); }
00113 void setResetNPage(const Variant & resetnpage) { mResetNPage = resetnpage; };
00115 bool isSupIfBlank() const;
00116 bool isNullSupIfBlank() const { return mSupIfBlank.isNull(); }
00118 void setSupIfBlank(const Variant & supifblank) { mSupIfBlank = supifblank; };
00120 bool isRepeatHeader() const;
00121 bool isNullRepeatHeader() const { return mRepeatHeader.isNull(); }
00123 void setRepeatHeader(const Variant & repeatheader) { mRepeatHeader = repeatheader; };
00124 protected:
00125 SectionType mType;
00126 String mGroupName;
00127 Variant mGroupValue;
00128 uint mGroupLevel;
00129 Variant mPageBefore;
00130 Variant mPageAfter;
00131 Variant mResetNPage;
00132 Variant mSupIfBlank;
00133 Variant mRepeatHeader;
00134
00135
00136 QValueList<Object *> mObjects;
00137 Variant mRealGroupValue, mNextRealGroupValue;
00138 int mRecordCount;
00139
00140 #ifndef NDEBUG
00141 public:
00142 int debug_print() const;
00143 #endif
00144
00145 };
00146
00147 };
00148
00149 #endif
00150