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 <KDXMLTools.h>
00034 #include <KDChartEnums.h>
00035 #include <kdchart_export.h>
00036
00064 class KDCHART_EXPORT KDChartPropertySet :public QObject
00065 {
00066 Q_OBJECT
00067 Q_ENUMS( SpecialDataPropertyID )
00068
00069
00070 Q_ENUMS( PenStyle )
00071
00072 friend class KDChartParams;
00073
00074 public:
00087 enum SpecialDataPropertyID {
00088 UndefinedID = -2,
00089 OwnID = -1
00090 };
00091
00096 KDChartPropertySet() :
00097 mOwnID( UndefinedID )
00098 { fullReset(""); }
00099
00100
00114 KDChartPropertySet( const QString& name, int idParent=KDChartPropertySet::UndefinedID ) :
00115 mOwnID( UndefinedID )
00116 { fullReset( name, idParent ); }
00117
00118
00126 void deepCopy( const KDChartPropertySet* source );
00127
00128
00138 const KDChartPropertySet* clone() const;
00139
00140
00152 void quickReset( const QString& name, int idParent=KDChartPropertySet::UndefinedID );
00153
00154
00167 void fullReset( const QString& name, int idParent=KDChartPropertySet::UndefinedID );
00168
00169
00176 QDomElement saveXML(QDomDocument& doc) const;
00177
00178
00191 static bool loadXML( const QDomElement& element, KDChartPropertySet& set );
00192
00193 public slots:
00197 int id() const { return mOwnID; }
00198
00202 void setName( const QString& name )
00203 {
00204 mName = name;
00205 }
00206
00210 QString name() const { return mName; }
00211
00212
00213
00239 void setShowBar( int idShowBar, bool showBar )
00240 {
00241 mIdShowBar = idShowBar;
00242 mShowBar = showBar;
00243 }
00244
00280 bool hasOwnShowBar( int& idShowBar, bool& showBar )
00281 {
00282 idShowBar = mIdShowBar;
00283 if( OwnID == idShowBar ){
00284 showBar = mShowBar;
00285 return true;
00286 }
00287 return false;
00288 }
00289
00312 void setBarColor( int idBarColor, const QColor& barColor )
00313 {
00314 mIdBarColor = idBarColor;
00315 mBarColor = barColor;
00316 }
00317
00349 bool hasOwnBarColor( int& idBarColor, QColor& barColor )
00350 {
00351 idBarColor = mIdBarColor;
00352 if( OwnID == mIdBarColor ){
00353 barColor = mBarColor;
00354 return true;
00355 }
00356 return false;
00357 }
00358
00359
00383 void setLineWidth( int idLineWidth, int lineWidth )
00384 {
00385 mIdLineWidth = idLineWidth;
00386 mLineWidth = lineWidth;
00387 }
00388
00417 bool hasOwnLineWidth( int& idLineWidth, int& lineWidth )
00418 {
00419 idLineWidth = mIdLineWidth;
00420 if( OwnID == mIdLineWidth ){
00421 lineWidth = mLineWidth;
00422 return true;
00423 }
00424 return false;
00425 }
00426
00450 void setLineColor( int idLineColor, const QColor& lineColor )
00451 {
00452 mIdLineColor = idLineColor;
00453 mLineColor = lineColor;
00454 }
00455
00488 bool hasOwnLineColor( int& idLineColor, QColor& lineColor )
00489 {
00490 idLineColor = mIdLineColor;
00491 if( OwnID == mIdLineColor ){
00492 lineColor = mLineColor;
00493 return true;
00494 }
00495 return false;
00496 }
00497
00521 void setLineStyle( int idLineStyle, const PenStyle& lineStyle )
00522 {
00523 mIdLineStyle = idLineStyle;
00524 mLineStyle = lineStyle;
00525 }
00526
00559 bool hasOwnLineStyle( int& idLineStyle, PenStyle& lineStyle )
00560 {
00561 idLineStyle = mIdLineStyle;
00562 if( OwnID == mIdLineStyle ){
00563 lineStyle = mLineStyle;
00564 return true;
00565 }
00566 return false;
00567 }
00568
00569
00570
00593 void setAreaBrush( int idAreaBrush, const QBrush& areaBrush )
00594 {
00595 mIdAreaBrush = idAreaBrush;
00596 mAreaBrush = areaBrush;
00597 }
00598
00630 bool hasOwnAreaBrush( int& idAreaBrush, QBrush& areaBrush )
00631 {
00632 idAreaBrush = mIdAreaBrush;
00633 if( OwnID == mIdAreaBrush ){
00634 areaBrush = mAreaBrush;
00635 return true;
00636 }
00637 return false;
00638 }
00639
00640
00641
00642
00643
00669 void setShowMarker( int idShowMarker, bool showMarker )
00670 {
00671 mIdShowMarker = idShowMarker;
00672 mShowMarker = showMarker;
00673 }
00674
00710 bool hasOwnShowMarker( int& idShowMarker, bool& showMarker )
00711 {
00712 idShowMarker = mIdShowMarker;
00713 if( OwnID == idShowMarker ){
00714 showMarker = mShowMarker;
00715 return true;
00716 }
00717 return false;
00718 }
00719
00745 void setMarkerAlign( int idMarkerAlign, uint markerAlign )
00746 {
00747 mIdMarkerAlign = idMarkerAlign;
00748 mMarkerAlign = markerAlign;
00749 }
00750 bool hasOwnMarkerAlign( int& idMarkerAlign, uint& markerAlign )
00751 {
00752 idMarkerAlign = mIdMarkerAlign;
00753 if( OwnID == idMarkerAlign ){
00754 markerAlign = mMarkerAlign;
00755 return true;
00756 }
00757 return false;
00758 }
00759 void setMarkerSize( int idMarkerSize, const QSize& markerSize )
00760 {
00761 mIdMarkerSize = idMarkerSize;
00762 mMarkerSize = markerSize;
00763 }
00764 bool hasOwnMarkerSize( int& idMarkerSize, QSize& markerSize )
00765 {
00766 idMarkerSize = mIdMarkerSize;
00767 if( OwnID == idMarkerSize ){
00768 markerSize = mMarkerSize;
00769 return true;
00770 }
00771 return false;
00772 }
00773 void setMarkerColor( int idMarkerColor, const QColor& markerColor )
00774 {
00775 mIdMarkerColor = idMarkerColor;
00776 mMarkerColor = markerColor;
00777 }
00778 bool hasOwnMarkerColor( int& idMarkerColor, QColor& markerColor )
00779 {
00780 idMarkerColor = mIdMarkerColor;
00781 if( OwnID == idMarkerColor ){
00782 markerColor = mMarkerColor;
00783 return true;
00784 }
00785 return false;
00786 }
00787 void setMarkerStyle( int idMarkerStyle, int markerStyle )
00788 {
00789 mIdMarkerStyle = idMarkerStyle;
00790 mMarkerStyle = markerStyle;
00791 }
00792 bool hasOwnMarkerStyle( int& idMarkerStyle, int& markerStyle )
00793 {
00794 idMarkerStyle = mIdMarkerStyle;
00795 if( OwnID == idMarkerStyle ){
00796 markerStyle = mMarkerStyle;
00797 return true;
00798 }
00799 return false;
00800 }
00801
00802
00803
00804
00805
00806
00807 void setExtraLinesAlign( int idExtraLinesAlign, uint extraLinesAlign )
00808 {
00809 mIdExtraLinesAlign = idExtraLinesAlign;
00810 mExtraLinesAlign = extraLinesAlign;
00811 }
00812 bool hasOwnExtraLinesAlign( int& idExtraLinesAlign, uint& extraLinesAlign )
00813 {
00814 idExtraLinesAlign = mIdExtraLinesAlign;
00815 if( OwnID == idExtraLinesAlign ){
00816 extraLinesAlign = mExtraLinesAlign;
00817 return true;
00818 }
00819 return false;
00820 }
00821 void setExtraLinesInFront( int idExtraLinesInFront, bool extraLinesInFront )
00822 {
00823 mIdExtraLinesInFront = idExtraLinesInFront;
00824 mExtraLinesInFront = extraLinesInFront;
00825 }
00826 bool hasOwnExtraLinesInFront( int& idExtraLinesInFront, bool& extraLinesInFront )
00827 {
00828 idExtraLinesInFront = mIdExtraLinesInFront;
00829 if( OwnID == idExtraLinesInFront ){
00830 extraLinesInFront = mExtraLinesInFront;
00831 return true;
00832 }
00833 return false;
00834 }
00835 void setExtraLinesLength( int idExtraLinesLength, int extraLinesLength )
00836 {
00837 mIdExtraLinesLength = idExtraLinesLength;
00838 mExtraLinesLength = extraLinesLength;
00839 }
00840 bool hasOwnExtraLinesLength( int& idExtraLinesLength, int& extraLinesLength )
00841 {
00842 idExtraLinesLength = mIdExtraLinesLength;
00843 if( OwnID == idExtraLinesLength ){
00844 extraLinesLength = mExtraLinesLength;
00845 return true;
00846 }
00847 return false;
00848 }
00849 void setExtraLinesWidth( int idExtraLinesWidth, int extraLinesWidth )
00850 {
00851 mIdExtraLinesWidth = idExtraLinesWidth;
00852 mExtraLinesWidth = extraLinesWidth;
00853 }
00854 bool hasOwnExtraLinesWidth( int& idExtraLinesWidth, int& extraLinesWidth )
00855 {
00856 idExtraLinesWidth = mIdExtraLinesWidth;
00857 if( OwnID == idExtraLinesWidth ){
00858 extraLinesWidth = mExtraLinesWidth;
00859 return true;
00860 }
00861 return false;
00862 }
00863 void setExtraLinesColor( int idExtraLinesColor, const QColor& extraLinesColor )
00864 {
00865 mIdExtraLinesColor = idExtraLinesColor;
00866 mExtraLinesColor = extraLinesColor;
00867 }
00868 bool hasOwnExtraLinesColor( int& idExtraLinesColor, QColor& extraLinesColor )
00869 {
00870 idExtraLinesColor = mIdExtraLinesColor;
00871 if( OwnID == idExtraLinesColor ){
00872 extraLinesColor = mExtraLinesColor;
00873 return true;
00874 }
00875 return false;
00876 }
00877 void setExtraLinesStyle( int idExtraLinesStyle, const PenStyle extraLinesStyle )
00878 {
00879 mIdExtraLinesStyle = idExtraLinesStyle;
00880 mExtraLinesStyle = extraLinesStyle;
00881 }
00882 bool hasOwnExtraLinesStyle( int& idExtraLinesStyle, PenStyle& extraLinesStyle )
00883 {
00884 idExtraLinesStyle = mIdExtraLinesStyle;
00885 if( OwnID == idExtraLinesStyle ){
00886 extraLinesStyle = mExtraLinesStyle;
00887 return true;
00888 }
00889 return false;
00890 }
00891
00892 void setExtraMarkersAlign( int idExtraMarkersAlign, uint extraMarkersAlign )
00893 {
00894 mIdExtraMarkersAlign = idExtraMarkersAlign;
00895 mExtraMarkersAlign = extraMarkersAlign;
00896 }
00897 bool hasOwnExtraMarkersAlign( int& idExtraMarkersAlign, uint& extraMarkersAlign )
00898 {
00899 idExtraMarkersAlign = mIdExtraMarkersAlign;
00900 if( OwnID == idExtraMarkersAlign ){
00901 extraMarkersAlign = mExtraMarkersAlign;
00902 return true;
00903 }
00904 return false;
00905 }
00906 void setExtraMarkersSize( int idExtraMarkersSize, const QSize& extraMarkersSize )
00907 {
00908 mIdExtraMarkersSize = idExtraMarkersSize;
00909 mExtraMarkersSize = extraMarkersSize;
00910 }
00911 bool hasOwnExtraMarkersSize( int& idExtraMarkersSize, QSize& extraMarkersSize )
00912 {
00913 idExtraMarkersSize = mIdExtraMarkersSize;
00914 if( OwnID == idExtraMarkersSize ){
00915 extraMarkersSize = mExtraMarkersSize;
00916 return true;
00917 }
00918 return false;
00919 }
00920 void setExtraMarkersColor( int idExtraMarkersColor, const QColor& extraMarkersColor )
00921 {
00922 mIdExtraMarkersColor = idExtraMarkersColor;
00923 mExtraMarkersColor = extraMarkersColor;
00924 }
00925 bool hasOwnExtraMarkersColor( int& idExtraMarkersColor, QColor& extraMarkersColor )
00926 {
00927 idExtraMarkersColor = mIdExtraMarkersColor;
00928 if( OwnID == idExtraMarkersColor ){
00929 extraMarkersColor = mExtraMarkersColor;
00930 return true;
00931 }
00932 return false;
00933 }
00934 void setExtraMarkersStyle( int idExtraMarkersStyle, int extraMarkersStyle )
00935 {
00936 mIdExtraMarkersStyle = idExtraMarkersStyle;
00937 mExtraMarkersStyle = extraMarkersStyle;
00938 }
00939 bool hasOwnExtraMarkersStyle( int& idExtraMarkersStyle, int& extraMarkersStyle )
00940 {
00941 idExtraMarkersStyle = mIdExtraMarkersStyle;
00942 if( OwnID == idExtraMarkersStyle ){
00943 extraMarkersStyle = mExtraMarkersStyle;
00944 return true;
00945 }
00946 return false;
00947 }
00948
00949 protected:
00950
00951
00952 int mOwnID;
00953
00954 private:
00955 KDChartPropertySet( const KDChartPropertySet& ) : QObject(0) {}
00956
00957 QString mName;
00958
00959 int mIdLineWidth; int mLineWidth;
00960 int mIdLineColor; QColor mLineColor;
00961 int mIdLineStyle; Qt::PenStyle mLineStyle;
00962 int mIdShowMarker; bool mShowMarker;
00963 int mIdMarkerSize; QSize mMarkerSize;
00964 int mIdMarkerColor; QColor mMarkerColor;
00965 int mIdMarkerStyle; int mMarkerStyle;
00966 int mIdMarkerAlign; uint mMarkerAlign;
00967 int mIdExtraLinesAlign; uint mExtraLinesAlign;
00968 int mIdExtraLinesInFront; bool mExtraLinesInFront;
00969 int mIdExtraLinesLength; int mExtraLinesLength;
00970 int mIdExtraLinesWidth; int mExtraLinesWidth;
00971 int mIdExtraLinesColor; QColor mExtraLinesColor;
00972 int mIdExtraLinesStyle; Qt::PenStyle mExtraLinesStyle;
00973 int mIdExtraMarkersAlign; uint mExtraMarkersAlign;
00974 int mIdExtraMarkersSize; QSize mExtraMarkersSize;
00975 int mIdExtraMarkersColor; QColor mExtraMarkersColor;
00976 int mIdExtraMarkersStyle; int mExtraMarkersStyle;
00977 int mIdShowBar; bool mShowBar;
00978 int mIdBarColor; QColor mBarColor;
00979 int mIdAreaBrush; QBrush mAreaBrush;
00980 void fillValueMembersWithDummyValues();
00981 };
00982
00983 #endif