Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

rtkobject.h

00001 /*<<<<<COPYRIGHT*/
00002 /*
00003  * RTK The report toolkit
00004  * Copyright (C) 2003 Francisco Santiago Capel Torres
00005 
00006  * rtkobject.h RTK base object
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  */
00019 /*>>>>>COPYRIGHT*/
00020 #ifndef RTKOBJECT_H
00021 #define RTKOBJECT_H
00022 
00023 #include "rtknamespace.h"
00024 #include "rtkvariant.h"
00025 #include "rtkstyle.h"
00026 #include "rtkformatter.h"
00027 #include "rtkimage.h"
00028 
00029 namespace RTK
00030 {
00031 
00032 class Object
00033 {
00034         friend class Section;
00035 /*<<<<<OBJECT_CONSTRUCTOR*/
00036 public:
00037         Object(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, const Variant &marginleft = 0, 
00041                 const Variant &marginright = 0, const Variant &margintop = 0, const Variant &marginbottom = 0, 
00042                 const Variant &visible = true, const Variant &supressed = false, const Variant &fontfamily = String::null, 
00043                 const Variant &fontsize = 12, const Variant &fontweight = 0, const Variant &fontitalic = false, 
00044                 const Variant &mask = String::null, const Variant &format = String::null, const Variant &halignment = AlignAuto, 
00045                 const Variant &valignment = AlignTop, const Variant &maxlines = 0, const Variant &minfontsize = 8, 
00046                 const Variant &adjustment = AdjustTrim, const Variant &textcolor = Qt::black, const Variant &backcolor = Qt::white, 
00047                 const Variant &bordercolor = Qt::black, const Variant &borderwidth = 0, const Variant &borderstyle = BorderNone, const Variant &backgroundimage = String::null)
00048         :mName(name), mValue(value), 
00049                 mAggregate(aggregate), mPosX(posx), mPosY(posy), 
00050                 mSizeX(sizex), mSizeY(sizey), mStyle(style), 
00051                 mUrl(url), mTag(tag), mMarginLeft(marginleft), 
00052                 mMarginRight(marginright), mMarginTop(margintop), mMarginBottom(marginbottom), 
00053                 mVisible(visible), mSupressed(supressed), mFontFamily(fontfamily), 
00054                 mFontSize(fontsize), mFontWeight(fontweight), mFontItalic(fontitalic), 
00055                 mMask(mask), mFormat(format), mHAlignment(halignment), 
00056                 mVAlignment(valignment), mMaxLines(maxlines), mMinFontSize(minfontsize), 
00057                 mAdjustment(adjustment), mTextColor(textcolor), mBackColor(backcolor), 
00058                 mBorderColor(bordercolor), mBorderWidth(borderwidth), mBorderStyle(borderstyle), mBackgroundImage(backgroundimage)
00059 /*>>>>>OBJECT_CONSTRUCTOR*/
00060                         , mParent(0), mIsConst(0)
00061         {}
00062 
00063         virtual ~Object() {}
00064                 Variant::Type getType() const { return mRealValue.type(); }
00065         bool valueChanged() const
00066         {
00067                 return mNextRealValue != mRealValue;
00068         }
00069         void setRealValue(Variant value)
00070         {
00071                 mRealValue = mNextRealValue;
00072                 mNextRealValue = value;
00073         };
00074         Object *getParent() const
00075         {
00076                 return mParent;
00077         }
00078         void setReport(class Report *report)
00079         {
00080                 mReport = report;
00081         }
00082         String getText() const;
00083         String getText(const String &mask, const String &format, const Formatter &f) const;
00084         void fixMeasures(UnitsType outunit, Measure outsizex, Measure outsizey,
00085                          UnitsType repunit, Measure repsizex, Measure repsizey);
00086         void calcAggregateValue(uint level);
00087         void resetAggregateValues(uint levels, uint level);
00088         Measure getFixedPosX() const
00089         {
00090                 return mFixedPosX;
00091         };
00092         Measure getFixedPosY() const
00093         {
00094                 return mFixedPosY;
00095         };
00096         Measure getFixedSizeX() const
00097         {
00098                 return mFixedSizeX;
00099         };
00100         Measure getFixedSizeY() const
00101         {
00102                 return mFixedSizeY;
00103         };
00104         Measure getFixedMarginLeft() const
00105         {
00106                 return mFixedMarginLeft;
00107         };
00108         Measure getFixedMarginRight() const
00109         {
00110                 return mFixedMarginRight;
00111         };
00112         Measure getFixedMarginTop() const
00113         {
00114                 return mFixedMarginTop;
00115         };
00116         Measure getFixedMarginBottom() const
00117         {
00118                 return mFixedMarginBottom;
00119         };
00120                 bool isConst() const { return mIsConst; }
00121                 void setConst(bool isconst) { mIsConst = isconst; }
00122 
00123         Variant getRealValue() const;
00124 
00125 /*<<<<<OBJECT_GETSET*/
00126 public:
00128         const String& getName() const { return mName; };
00130         void setName(const String& name) { mName = name; };
00132         Variant getValue() const { return mValue; };
00134         void setValue(Variant value) { mValue = value; };
00136         AggregateType getAggregate() const { return mAggregate; };
00138         void setAggregate(AggregateType aggregate) { mAggregate = aggregate; };
00140         String getPosX() const { return mPosX; };
00142         void setPosX(String posx) { mPosX = posx; };
00144         String getPosY() const { return mPosY; };
00146         void setPosY(String posy) { mPosY = posy; };
00148         String getSizeX() const { return mSizeX; };
00150         void setSizeX(String sizex) { mSizeX = sizex; };
00152         String getSizeY() const { return mSizeY; };
00154         void setSizeY(String sizey) { mSizeY = sizey; };
00156         String getStyle() const { return mStyle; };
00158         void setStyle(const String& style) { mStyle = style; };
00160         String getUrl() const { return mUrl; };
00162         void setUrl(const String& url) { mUrl = url; };
00164         String getTag() const { return mTag; };
00166         void setTag(const String& tag) { mTag = tag; };
00168         String getMarginLeft() const;
00169         bool isNullMarginLeft() const { return mMarginLeft.isNull(); }
00171         void setMarginLeft(const Variant & marginleft) { mMarginLeft = marginleft; };
00173         String getMarginRight() const;
00174         bool isNullMarginRight() const { return mMarginRight.isNull(); }
00176         void setMarginRight(const Variant & marginright) { mMarginRight = marginright; };
00178         String getMarginTop() const;
00179         bool isNullMarginTop() const { return mMarginTop.isNull(); }
00181         void setMarginTop(const Variant & margintop) { mMarginTop = margintop; };
00183         String getMarginBottom() const;
00184         bool isNullMarginBottom() const { return mMarginBottom.isNull(); }
00186         void setMarginBottom(const Variant & marginbottom) { mMarginBottom = marginbottom; };
00188         bool isVisible() const;
00189         bool isNullVisible() const { return mVisible.isNull(); }
00191         void setVisible(const Variant & visible) { mVisible = visible; };
00193         bool isSupressed() const;
00194         bool isNullSupressed() const { return mSupressed.isNull(); }
00196         void setSupressed(const Variant & supressed) { mSupressed = supressed; };
00198         String getFontFamily() const;
00199         bool isNullFontFamily() const { return mFontFamily.isNull(); }
00201         void setFontFamily(const Variant & fontfamily) { mFontFamily = fontfamily; };
00203         int getFontSize() const;
00204         bool isNullFontSize() const { return mFontSize.isNull(); }
00206         void setFontSize(const Variant & fontsize) { mFontSize = fontsize; };
00208         int getFontWeight() const;
00209         bool isNullFontWeight() const { return mFontWeight.isNull(); }
00211         void setFontWeight(const Variant & fontweight) { mFontWeight = fontweight; };
00213         bool isFontItalic() const;
00214         bool isNullFontItalic() const { return mFontItalic.isNull(); }
00216         void setFontItalic(const Variant & fontitalic) { mFontItalic = fontitalic; };
00218         String getMask() const;
00219         bool isNullMask() const { return mMask.isNull(); }
00221         void setMask(const Variant & mask) { mMask = mask; };
00223         String getFormat() const;
00224         bool isNullFormat() const { return mFormat.isNull(); }
00226         void setFormat(const Variant & format) { mFormat = format; };
00228         AlignmentType getHAlignment() const;
00229         bool isNullHAlignment() const { return mHAlignment.isNull(); }
00231         void setHAlignment(const Variant & halignment) { mHAlignment = halignment; };
00233         AlignmentType getVAlignment() const;
00234         bool isNullVAlignment() const { return mVAlignment.isNull(); }
00236         void setVAlignment(const Variant & valignment) { mVAlignment = valignment; };
00238         int getMaxLines() const;
00239         bool isNullMaxLines() const { return mMaxLines.isNull(); }
00241         void setMaxLines(const Variant & maxlines) { mMaxLines = maxlines; };
00243         int getMinFontSize() const;
00244         bool isNullMinFontSize() const { return mMinFontSize.isNull(); }
00246         void setMinFontSize(const Variant & minfontsize) { mMinFontSize = minfontsize; };
00248         AdjustmentType getAdjustment() const;
00249         bool isNullAdjustment() const { return mAdjustment.isNull(); }
00251         void setAdjustment(const Variant & adjustment) { mAdjustment = adjustment; };
00253         Color getTextColor() const;
00254         bool isNullTextColor() const { return mTextColor.isNull(); }
00256         void setTextColor(const Variant & textcolor) { mTextColor = textcolor; };
00258         Color getBackColor() const;
00259         bool isNullBackColor() const { return mBackColor.isNull(); }
00261         void setBackColor(const Variant & backcolor) { mBackColor = backcolor; };
00263         Color getBorderColor() const;
00264         bool isNullBorderColor() const { return mBorderColor.isNull(); }
00266         void setBorderColor(const Variant & bordercolor) { mBorderColor = bordercolor; };
00268         int getBorderWidth() const;
00269         bool isNullBorderWidth() const { return mBorderWidth.isNull(); }
00271         void setBorderWidth(const Variant & borderwidth) { mBorderWidth = borderwidth; };
00273         BorderStyle getBorderStyle() const;
00274         bool isNullBorderStyle() const { return mBorderStyle.isNull(); }
00276         void setBorderStyle(const Variant & borderstyle) { mBorderStyle = borderstyle; };
00278         String getBackgroundImage() const;
00279         bool isNullBackgroundImage() const { return mBackgroundImage.isNull(); }
00281         void setBackgroundImage(const Variant & backgroundimage) { mBackgroundImage = backgroundimage; };
00282 protected:
00283         String mName;
00284         Variant mValue;
00285         AggregateType mAggregate;
00286         String mPosX;
00287         String mPosY;
00288         String mSizeX;
00289         String mSizeY;
00290         String mStyle;
00291         String mUrl;
00292         String mTag;
00293         Variant mMarginLeft;
00294         Variant mMarginRight;
00295         Variant mMarginTop;
00296         Variant mMarginBottom;
00297         Variant mVisible;
00298         Variant mSupressed;
00299         Variant mFontFamily;
00300         Variant mFontSize;
00301         Variant mFontWeight;
00302         Variant mFontItalic;
00303         Variant mMask;
00304         Variant mFormat;
00305         Variant mHAlignment;
00306         Variant mVAlignment;
00307         Variant mMaxLines;
00308         Variant mMinFontSize;
00309         Variant mAdjustment;
00310         Variant mTextColor;
00311         Variant mBackColor;
00312         Variant mBorderColor;
00313         Variant mBorderWidth;
00314         Variant mBorderStyle;
00315         Variant mBackgroundImage;
00316 /*>>>>>OBJECT_GETSET*/
00317 
00318 protected:
00319         void setParent(Object *parent) { mParent=parent; }
00320                 UnitsType getUnits(String value, UnitsType defaultunits);
00321                 Measure getMeasure(String value);
00322 
00323 #ifndef NDEBUG
00324 public:
00325         virtual int debug_print() const;
00326 #endif
00327 
00328 private:
00329         Object *mParent;
00330         Report *mReport;
00331 
00332         Measure mFixedPosX;
00333         Measure mFixedPosY;
00334         Measure mFixedSizeX;
00335         Measure mFixedSizeY;
00336         Measure mFixedMarginLeft;
00337         Measure mFixedMarginRight;
00338         Measure mFixedMarginTop;
00339         Measure mFixedMarginBottom;
00340         Measure fixOneMeasure(UnitsType objunit, Measure measure,
00341                               UnitsType repunit, Measure repsize,
00342                               UnitsType outunit, Measure outsize);
00343         QValueList<Variant> mAggValues;
00344         Variant getNonAggregateValue() const;
00345         Variant mRealValue, mNextRealValue;
00346                 bool mIsConst;
00347 };
00348 
00349 }; // namespace
00350 
00351 #endif

Generated on Tue Feb 22 14:44:37 2005 for RTK. Report ToolKit by  doxygen 1.3.9.1