kspread
kspread_condition.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __kspread_condition_h__
00023 #define __kspread_condition_h__
00024
00025 #include <qdom.h>
00026 #include <qvaluelist.h>
00027
00028 #include <koffice_export.h>
00029
00030 #include "kspread_global.h"
00031
00032 class QColor;
00033 class QFont;
00034 class QString;
00035 class KoGenStyle;
00036
00037 namespace KSpread
00038 {
00039 class Cell;
00040 class Style;
00041
00046 class KSPREAD_EXPORT Conditional
00047 {
00048 public:
00049 enum Type { None, Equal, Superior, Inferior, SuperiorEqual,
00050 InferiorEqual, Between, Different, DifferentTo };
00051
00052 double val1;
00053 double val2;
00054 QString * strVal1;
00055 QString * strVal2;
00056 QColor * colorcond;
00057 QFont * fontcond;
00058 QString * styleName;
00059 Style * style;
00060 Type cond;
00061
00062 Conditional();
00063 ~Conditional();
00064 Conditional( const Conditional& );
00065 Conditional& operator=( const Conditional& );
00066 bool operator==(const Conditional& other) const;
00067 inline bool operator!=( const Conditional& other ) const { return !operator==( other ); }
00068 };
00069
00070
00074 class Conditions
00075 {
00076 public:
00077
00082 Conditions( const Cell * ownerCell );
00083 virtual ~Conditions();
00084
00095 bool currentCondition( Conditional & condition );
00096
00100 QValueList<Conditional> conditionList() const;
00101
00105 void setConditionList( const QValueList<Conditional> & list );
00106
00111 QDomElement saveConditions( QDomDocument & doc ) const;
00112
00117 void loadConditions( const QDomElement & element );
00118
00119 void loadOasisConditions( const QDomElement & element );
00120
00121 void saveOasisConditions( KoGenStyle ¤tCellStyle );
00122
00123
00127 Style * matchedStyle() const { return m_matchedStyle; }
00128
00129 void checkMatches();
00130
00131 bool operator==( const Conditions& other ) const;
00132 inline bool operator!=( const Conditions& other ) const { return !operator==( other ); }
00133
00134 private:
00135 Conditions() {}
00136
00137 QString saveOasisConditionValue(Conditional &cond);
00138 void loadOasisConditionValue( const QString &styleCondition, Conditional &newCondition );
00139 void loadOasisValidationValue( const QStringList &listVal, Conditional &newCondition );
00140 void loadOasisCondition( QString &valExpression, Conditional &newCondition );
00141
00142
00143 const Cell * m_cell;
00144 QValueList<Conditional> m_condList;
00145 Style * m_matchedStyle;
00146 };
00147
00148 }
00149
00150 #endif
|