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