andre@1: /**************************************************************************** andre@1: ** Copyright (c) 2013-2014 Debao Zhang andre@1: ** All right reserved. andre@1: ** andre@1: ** Permission is hereby granted, free of charge, to any person obtaining andre@1: ** a copy of this software and associated documentation files (the andre@1: ** "Software"), to deal in the Software without restriction, including andre@1: ** without limitation the rights to use, copy, modify, merge, publish, andre@1: ** distribute, sublicense, and/or sell copies of the Software, and to andre@1: ** permit persons to whom the Software is furnished to do so, subject to andre@1: ** the following conditions: andre@1: ** andre@1: ** The above copyright notice and this permission notice shall be andre@1: ** included in all copies or substantial portions of the Software. andre@1: ** andre@1: ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, andre@1: ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF andre@1: ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND andre@1: ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE andre@1: ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION andre@1: ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION andre@1: ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. andre@1: ** andre@1: ****************************************************************************/ andre@1: #ifndef QXLSX_XLSXCONDITIONALFORMATTING_H andre@1: #define QXLSX_XLSXCONDITIONALFORMATTING_H andre@1: andre@1: #include "xlsxglobal.h" andre@1: #include "xlsxcellrange.h" andre@1: #include "xlsxcellreference.h" andre@1: #include andre@1: #include andre@1: #include andre@1: andre@1: class QXmlStreamReader; andre@1: class QXmlStreamWriter; andre@1: class QColor; andre@1: class ConditionalFormattingTest; andre@1: andre@1: QT_BEGIN_NAMESPACE_XLSX andre@1: andre@1: class Format; andre@1: class Worksheet; andre@1: class Styles; andre@1: andre@1: class ConditionalFormattingPrivate; andre@1: class Q_XLSX_EXPORT ConditionalFormatting andre@1: { andre@1: public: andre@1: enum HighlightRuleType { andre@1: Highlight_LessThan, andre@1: Highlight_LessThanOrEqual, andre@1: Highlight_Equal, andre@1: Highlight_NotEqual, andre@1: Highlight_GreaterThanOrEqual, andre@1: Highlight_GreaterThan, andre@1: Highlight_Between, andre@1: Highlight_NotBetween, andre@1: andre@1: Highlight_ContainsText, andre@1: Highlight_NotContainsText, andre@1: Highlight_BeginsWith, andre@1: Highlight_EndsWith, andre@1: andre@1: Highlight_TimePeriod, andre@1: andre@1: Highlight_Duplicate, andre@1: Highlight_Unique, andre@1: Highlight_Blanks, andre@1: Highlight_NoBlanks, andre@1: Highlight_Errors, andre@1: Highlight_NoErrors, andre@1: andre@1: Highlight_Top, andre@1: Highlight_TopPercent, andre@1: Highlight_Bottom, andre@1: Highlight_BottomPercent, andre@1: andre@1: Highlight_AboveAverage, andre@1: Highlight_AboveOrEqualAverage, andre@1: Highlight_AboveStdDev1, andre@1: Highlight_AboveStdDev2, andre@1: Highlight_AboveStdDev3, andre@1: Highlight_BelowAverage, andre@1: Highlight_BelowOrEqualAverage, andre@1: Highlight_BelowStdDev1, andre@1: Highlight_BelowStdDev2, andre@1: Highlight_BelowStdDev3, andre@1: andre@1: Highlight_Expression andre@1: }; andre@1: andre@1: enum ValueObjectType andre@1: { andre@1: VOT_Formula, andre@1: VOT_Max, andre@1: VOT_Min, andre@1: VOT_Num, andre@1: VOT_Percent, andre@1: VOT_Percentile andre@1: }; andre@1: andre@1: ConditionalFormatting(); andre@1: ConditionalFormatting(const ConditionalFormatting &other); andre@1: ~ConditionalFormatting(); andre@1: andre@1: bool addHighlightCellsRule(HighlightRuleType type, const Format &format, bool stopIfTrue=false); andre@1: bool addHighlightCellsRule(HighlightRuleType type, const QString &formula1, const Format &format, bool stopIfTrue=false); andre@1: bool addHighlightCellsRule(HighlightRuleType type, const QString &formula1, const QString &formula2, const Format &format, bool stopIfTrue=false); andre@1: bool addDataBarRule(const QColor &color, bool showData=true, bool stopIfTrue=false); andre@1: bool addDataBarRule(const QColor &color, ValueObjectType type1, const QString &val1, ValueObjectType type2, const QString &val2, bool showData=true, bool stopIfTrue=false); andre@1: bool add2ColorScaleRule(const QColor &minColor, const QColor &maxColor, bool stopIfTrue=false); andre@1: bool add3ColorScaleRule(const QColor &minColor, const QColor &midColor, const QColor &maxColor, bool stopIfTrue=false); andre@1: andre@1: QList ranges() const; andre@1: andre@1: void addCell(const CellReference &cell); andre@1: void addCell(int row, int col); andre@1: void addRange(int firstRow, int firstCol, int lastRow, int lastCol); andre@1: void addRange(const CellRange &range); andre@1: andre@1: //needed by QSharedDataPointer!! andre@1: ConditionalFormatting &operator=(const ConditionalFormatting &other); andre@1: andre@1: private: andre@1: friend class Worksheet; andre@1: friend class ::ConditionalFormattingTest; andre@1: bool saveToXml(QXmlStreamWriter &writer) const; andre@1: bool loadFromXml(QXmlStreamReader &reader, Styles *styles=0); andre@1: QSharedDataPointer d; andre@1: }; andre@1: andre@1: QT_END_NAMESPACE_XLSX andre@1: andre@1: #endif // QXLSX_XLSXCONDITIONALFORMATTING_H