kspread_condition.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 1999 - 2003 The KSpread Team 00004 www.koffice.org/kspread 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef __kspread_condition_h__ 00023 #define __kspread_condition_h__ 00024 00025 #include "kspread_global.h" 00026 00027 #include <qvaluelist.h> 00028 #include <qdom.h> 00029 #include <koffice_export.h> 00030 class KSpreadCell; 00031 class KSpreadStyle; 00032 class KoGenStyle; 00033 00034 class QColor; 00035 class QFont; 00036 class QString; 00037 00042 class KSPREAD_EXPORT KSpreadConditional 00043 { 00044 public: 00045 double val1; 00046 double val2; 00047 QString * strVal1; 00048 QString * strVal2; 00049 QColor * colorcond; 00050 QFont * fontcond; 00051 QString * styleName; 00052 KSpreadStyle * style; 00053 Conditional cond; 00054 00055 KSpreadConditional(); 00056 ~KSpreadConditional(); 00057 KSpreadConditional( const KSpreadConditional& ); 00058 KSpreadConditional& operator=( const KSpreadConditional& ); 00059 }; 00060 00061 00065 class KSpreadConditions 00066 { 00067 public: 00068 00073 KSpreadConditions( const KSpreadCell * ownerCell ); 00074 virtual ~KSpreadConditions(); 00075 00086 bool currentCondition( KSpreadConditional & condition ); 00087 00091 QValueList<KSpreadConditional> conditionList() const; 00092 00096 void setConditionList( const QValueList<KSpreadConditional> & list ); 00097 00102 QDomElement saveConditions( QDomDocument & doc ) const; 00103 00108 void loadConditions( const QDomElement & element ); 00109 00110 void loadOasisConditions( const QDomElement & element ); 00111 00112 void saveOasisConditions( KoGenStyle ¤tCellStyle ); 00113 00114 00118 KSpreadStyle * matchedStyle() const { return m_matchedStyle; } 00119 00120 void checkMatches(); 00121 00122 private: 00123 KSpreadConditions() {} 00124 00125 QString saveOasisConditionValue(KSpreadConditional &cond); 00126 void loadOasisConditionValue( const QString &styleCondition, KSpreadConditional &newCondition ); 00127 void loadOasisValidationValue( const QStringList &listVal, KSpreadConditional &newCondition ); 00128 void loadOasisCondition( QString &valExpression, KSpreadConditional &newCondition ); 00129 00130 00131 const KSpreadCell * m_cell; 00132 QValueList<KSpreadConditional> m_condList; 00133 KSpreadStyle * m_matchedStyle; 00134 }; 00135 00136 00137 #endif /*defined __kspread_condition_h__ */