00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef __KDCHARTPROPERTYSET__
00030 #define __KDCHARTPROPERTYSET__
00031
00032
00033 #include <KDChartEnums.h>
00034 #include <kdchart_export.h>
00035 #include <qdom.h>
00036 #include <qcolor.h>
00037 #include <qbrush.h>
00038
00066 class KDCHART_EXPORT KDChartPropertySet :public QObject
00067 {
00068 Q_OBJECT
00069 Q_ENUMS( SpecialDataPropertyID )
00070
00071
00072 Q_ENUMS( PenStyle )
00073
00074 friend class KDChartParams;
00075
00076 public:
00089 enum SpecialDataPropertyID {
00090 UndefinedID = -2,
00091 OwnID = -1
00092 };
00093
00098 KDChartPropertySet() :
00099 mOwnID( UndefinedID )
00100 { fullReset(""); }
00101
00102
00116 KDChartPropertySet( const QString& name, int idParent=KDChartPropertySet::UndefinedID ) :
00117 mOwnID( UndefinedID )
00118 { fullReset( name, idParent ); }
00119
00120
00128 void deepCopy( const KDChartPropertySet* source );
00129
00130
00140 const KDChartPropertySet* clone() const;
00141
00142
00154 void quickReset( const QString& name, int idParent=KDChartPropertySet::UndefinedID );
00155
00156
00169 void fullReset( const QString& name, int idParent=KDChartPropertySet::UndefinedID );
00170
00171
00178 QDomElement saveXML(QDomDocument& doc) const;
00179
00180
00193 static bool loadXML( const QDomElement& element, KDChartPropertySet& set );
00194
00195 public slots:
00199 int id() const { return mOwnID; }
00200
00204 void setName( const QString& name )
00205 {
00206 mName = name;
00207 }
00208
00212 QString name() const { return mName; }
00213
00214
00215
00241 void setShowBar( int idShowBar, bool showBar )
00242 {
00243 mIdShowBar = idShowBar;
00244 mShowBar = showBar;
00245 }
00246
00282 bool hasOwnShowBar( int& idShowBar, bool& showBar )
00283 {
00284 idShowBar = mIdShowBar;
00285 if( OwnID == idShowBar ){
00286 showBar = mShowBar;
00287 return true;
00288 }
00289 return false;
00290 }
00291
00314 void setBarColor( int idBarColor, const QColor& barColor )
00315 {
00316 mIdBarColor = idBarColor;
00317 mBarColor = barColor;
00318 }
00319
00351 bool hasOwnBarColor( int& idBarColor, QColor& barColor )
00352 {
00353 idBarColor = mIdBarColor;
00354 if( OwnID == mIdBarColor ){
00355 barColor = mBarColor;
00356 return true;
00357 }
00358 return false;
00359 }
00360
00361
00385 void setLineWidth( int idLineWidth, int lineWidth )
00386 {
00387 mIdLineWidth = idLineWidth;
00388 mLineWidth = lineWidth;
00389 }
00390
00419 bool hasOwnLineWidth( int& idLineWidth, int& lineWidth )
00420 {
00421 idLineWidth = mIdLineWidth;
00422 if( OwnID == mIdLineWidth ){
00423 lineWidth = mLineWidth;
00424 return true;
00425 }
00426 return false;
00427 }
00428
00452 void setLineColor( int idLineColor, const QColor& lineColor )
00453 {
00454 mIdLineColor = idLineColor;
00455 mLineColor = lineColor;
00456 }
00457
00490 bool hasOwnLineColor( int& idLineColor, QColor& lineColor )
00491 {
00492 idLineColor = mIdLineColor;
00493 if( OwnID == mIdLineColor ){
00494 lineColor = mLineColor;
00495 return true;
00496 }
00497 return false;
00498 }
00499
00523 void setLineStyle( int idLineStyle, const PenStyle& lineStyle )
00524 {
00525 mIdLineStyle = idLineStyle;
00526 mLineStyle = lineStyle;
00527 }
00528
00561 bool hasOwnLineStyle( int& idLineStyle, PenStyle& lineStyle )
00562 {
00563 idLineStyle = mIdLineStyle;
00564 if( OwnID == mIdLineStyle ){
00565 lineStyle = mLineStyle;
00566 return true;
00567 }
00568 return false;
00569 }
00570
00571
00572
00595 void setAreaBrush( int idAreaBrush, const QBrush& areaBrush )
00596 {
00597 mIdAreaBrush = idAreaBrush;
00598 mAreaBrush = areaBrush;
00599 }
00600
00632 bool hasOwnAreaBrush( int& idAreaBrush, QBrush& areaBrush )
00633 {
00634 idAreaBrush = mIdAreaBrush;
00635 if( OwnID == mIdAreaBrush ){
00636 areaBrush = mAreaBrush;
00637 return true;
00638 }
00639 return false;
00640 }
00641
00642
00643
00644
00645
00671 void setShowMarker( int idShowMarker, bool showMarker )
00672 {
00673 mIdShowMarker = idShowMarker;
00674 mShowMarker = showMarker;
00675 }
00676
00712 bool hasOwnShowMarker( int& idShowMarker, bool& showMarker )
00713 {
00714 idShowMarker = mIdShowMarker;
00715 if( OwnID == idShowMarker ){
00716 showMarker = mShowMarker;
00717 return true;
00718 }
00719 return false;
00720 }
00721
00747 void setMarkerAlign( int idMarkerAlign, uint markerAlign )
00748 {
00749 mIdMarkerAlign = idMarkerAlign;
00750 mMarkerAlign = markerAlign;
00751 }
00752 bool hasOwnMarkerAlign( int& idMarkerAlign, uint& markerAlign )
00753 {
00754 idMarkerAlign = mIdMarkerAlign;
00755 if( OwnID == idMarkerAlign ){
00756 markerAlign = mMarkerAlign;
00757 return true;
00758 }
00759 return false;
00760 }
00761 void setMarkerSize( int idMarkerSize, const QSize& markerSize )
00762 {
00763 mIdMarkerSize = idMarkerSize;
00764 mMarkerSize = markerSize;
00765 }
00766 bool hasOwnMarkerSize( int& idMarkerSize, QSize& markerSize )
00767 {
00768 idMarkerSize = mIdMarkerSize;
00769 if( OwnID == idMarkerSize ){
00770 markerSize = mMarkerSize;
00771 return true;
00772 }
00773 return false;
00774 }
00775 void setMarkerColor( int idMarkerColor, const QColor& markerColor )
00776 {
00777 mIdMarkerColor = idMarkerColor;
00778 mMarkerColor = markerColor;
00779 }
00780 bool hasOwnMarkerColor( int& idMarkerColor, QColor& markerColor )
00781 {
00782 idMarkerColor = mIdMarkerColor;
00783 if( OwnID == idMarkerColor ){
00784 markerColor = mMarkerColor;
00785 return true;
00786 }
00787 return false;
00788 }
00789 void setMarkerStyle( int idMarkerStyle, int markerStyle )
00790 {
00791 mIdMarkerStyle = idMarkerStyle;
00792 mMarkerStyle = markerStyle;
00793 }
00794 bool hasOwnMarkerStyle( int& idMarkerStyle, int& markerStyle )
00795 {
00796 idMarkerStyle = mIdMarkerStyle;
00797 if( OwnID == idMarkerStyle ){
00798 markerStyle = mMarkerStyle;
00799 return true;
00800 }
00801 return false;
00802 }
00803
00804
00805
00806
00807
00808
00809 void setExtraLinesAlign( int idExtraLinesAlign, uint extraLinesAlign )
00810 {
00811 mIdExtraLinesAlign = idExtraLinesAlign;
00812 mExtraLinesAlign = extraLinesAlign;
00813 }
00814 bool hasOwnExtraLinesAlign( int& idExtraLinesAlign, uint& extraLinesAlign )
00815 {
00816 idExtraLinesAlign = mIdExtraLinesAlign;
00817 if( OwnID == idExtraLinesAlign ){
00818 extraLinesAlign = mExtraLinesAlign;
00819 return true;
00820 }
00821 return false;
00822 }
00823 void setExtraLinesInFront( int idExtraLinesInFront, bool extraLinesInFront )
00824 {
00825 mIdExtraLinesInFront = idExtraLinesInFront;
00826 mExtraLinesInFront = extraLinesInFront;
00827 }
00828 bool hasOwnExtraLinesInFront( int& idExtraLinesInFront, bool& extraLinesInFront )
00829 {
00830 idExtraLinesInFront = mIdExtraLinesInFront;
00831 if( OwnID == idExtraLinesInFront ){
00832 extraLinesInFront = mExtraLinesInFront;
00833 return true;
00834 }
00835 return false;
00836 }
00837 void setExtraLinesLength( int idExtraLinesLength, int extraLinesLength )
00838 {
00839 mIdExtraLinesLength = idExtraLinesLength;
00840 mExtraLinesLength = extraLinesLength;
00841 }
00842 bool hasOwnExtraLinesLength( int& idExtraLinesLength, int& extraLinesLength )
00843 {
00844 idExtraLinesLength = mIdExtraLinesLength;
00845 if( OwnID == idExtraLinesLength ){
00846 extraLinesLength = mExtraLinesLength;
00847 return true;
00848 }
00849 return false;
00850 }
00851 void setExtraLinesWidth( int idExtraLinesWidth, int extraLinesWidth )
00852 {
00853 mIdExtraLinesWidth = idExtraLinesWidth;
00854 mExtraLinesWidth = extraLinesWidth;
00855 }
00856 bool hasOwnExtraLinesWidth( int& idExtraLinesWidth, int& extraLinesWidth )
00857 {
00858 idExtraLinesWidth = mIdExtraLinesWidth;
00859 if( OwnID == idExtraLinesWidth ){
00860 extraLinesWidth = mExtraLinesWidth;
00861 return true;
00862 }
00863 return false;
00864 }
00865 void setExtraLinesColor( int idExtraLinesColor, const QColor& extraLinesColor )
00866 {
00867 mIdExtraLinesColor = idExtraLinesColor;
00868 mExtraLinesColor = extraLinesColor;
00869 }
00870 bool hasOwnExtraLinesColor( int& idExtraLinesColor, QColor& extraLinesColor )
00871 {
00872 idExtraLinesColor = mIdExtraLinesColor;
00873 if( OwnID == idExtraLinesColor ){
00874 extraLinesColor = mExtraLinesColor;
00875 return true;
00876 }
00877 return false;
00878 }
00879 void setExtraLinesStyle( int idExtraLinesStyle, const PenStyle extraLinesStyle )
00880 {
00881 mIdExtraLinesStyle = idExtraLinesStyle;
00882 mExtraLinesStyle = extraLinesStyle;
00883 }
00884 bool hasOwnExtraLinesStyle( int& idExtraLinesStyle, PenStyle& extraLinesStyle )
00885 {
00886 idExtraLinesStyle = mIdExtraLinesStyle;
00887 if( OwnID == idExtraLinesStyle ){
00888 extraLinesStyle = mExtraLinesStyle;
00889 return true;
00890 }
00891 return false;
00892 }
00893
00894 void setExtraMarkersAlign( int idExtraMarkersAlign, uint extraMarkersAlign )
00895 {
00896 mIdExtraMarkersAlign = idExtraMarkersAlign;
00897 mExtraMarkersAlign = extraMarkersAlign;
00898 }
00899 bool hasOwnExtraMarkersAlign( int& idExtraMarkersAlign, uint& extraMarkersAlign )
00900 {
00901 idExtraMarkersAlign = mIdExtraMarkersAlign;
00902 if( OwnID == idExtraMarkersAlign ){
00903 extraMarkersAlign = mExtraMarkersAlign;
00904 return true;
00905 }
00906 return false;
00907 }
00908 void setExtraMarkersSize( int idExtraMarkersSize, const QSize& extraMarkersSize )
00909 {
00910 mIdExtraMarkersSize = idExtraMarkersSize;
00911 mExtraMarkersSize = extraMarkersSize;
00912 }
00913 bool hasOwnExtraMarkersSize( int& idExtraMarkersSize, QSize& extraMarkersSize )
00914 {
00915 idExtraMarkersSize = mIdExtraMarkersSize;
00916 if( OwnID == idExtraMarkersSize ){
00917 extraMarkersSize = mExtraMarkersSize;
00918 return true;
00919 }
00920 return false;
00921 }
00922 void setExtraMarkersColor( int idExtraMarkersColor, const QColor& extraMarkersColor )
00923 {
00924 mIdExtraMarkersColor = idExtraMarkersColor;
00925 mExtraMarkersColor = extraMarkersColor;
00926 }
00927 bool hasOwnExtraMarkersColor( int& idExtraMarkersColor, QColor& extraMarkersColor )
00928 {
00929 idExtraMarkersColor = mIdExtraMarkersColor;
00930 if( OwnID == idExtraMarkersColor ){
00931 extraMarkersColor = mExtraMarkersColor;
00932 return true;
00933 }
00934 return false;
00935 }
00936 void setExtraMarkersStyle( int idExtraMarkersStyle, int extraMarkersStyle )
00937 {
00938 mIdExtraMarkersStyle = idExtraMarkersStyle;
00939 mExtraMarkersStyle = extraMarkersStyle;
00940 }
00941 bool hasOwnExtraMarkersStyle( int& idExtraMarkersStyle, int& extraMarkersStyle )
00942 {
00943 idExtraMarkersStyle = mIdExtraMarkersStyle;
00944 if( OwnID == idExtraMarkersStyle ){
00945 extraMarkersStyle = mExtraMarkersStyle;
00946 return true;
00947 }
00948 return false;
00949 }
00950
00951 protected:
00952
00953
00954 int mOwnID;
00955
00956 private:
00957 KDChartPropertySet( const KDChartPropertySet& ) : QObject(0) {}
00958
00959 QString mName;
00960
00961 int mIdLineWidth; int mLineWidth;
00962 int mIdLineColor; QColor mLineColor;
00963 int mIdLineStyle; Qt::PenStyle mLineStyle;
00964 int mIdShowMarker; bool mShowMarker;
00965 int mIdMarkerSize; QSize mMarkerSize;
00966 int mIdMarkerColor; QColor mMarkerColor;
00967 int mIdMarkerStyle; int mMarkerStyle;
00968 int mIdMarkerAlign; uint mMarkerAlign;
00969 int mIdExtraLinesAlign; uint mExtraLinesAlign;
00970 int mIdExtraLinesInFront; bool mExtraLinesInFront;
00971 int mIdExtraLinesLength; int mExtraLinesLength;
00972 int mIdExtraLinesWidth; int mExtraLinesWidth;
00973 int mIdExtraLinesColor; QColor mExtraLinesColor;
00974 int mIdExtraLinesStyle; Qt::PenStyle mExtraLinesStyle;
00975 int mIdExtraMarkersAlign; uint mExtraMarkersAlign;
00976 int mIdExtraMarkersSize; QSize mExtraMarkersSize;
00977 int mIdExtraMarkersColor; QColor mExtraMarkersColor;
00978 int mIdExtraMarkersStyle; int mExtraMarkersStyle;
00979 int mIdShowBar; bool mShowBar;
00980 int mIdBarColor; QColor mBarColor;
00981 int mIdAreaBrush; QBrush mAreaBrush;
00982 void fillValueMembersWithDummyValues();
00983 };
00984
00985 #endif