andre@1: /****************************************************************************
andre@1: ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
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: 
andre@1: #ifndef XLSXCONDITIONALFORMATTING_P_H
andre@1: #define XLSXCONDITIONALFORMATTING_P_H
andre@1: 
andre@1: //
andre@1: //  W A R N I N G
andre@1: //  -------------
andre@1: //
andre@1: // This file is not part of the Qt Xlsx API.  It exists for the convenience
andre@1: // of the Qt Xlsx.  This header file may change from
andre@1: // version to version without notice, or even be removed.
andre@1: //
andre@1: // We mean it.
andre@1: //
andre@1: 
andre@1: #include "xlsxconditionalformatting.h"
andre@1: #include "xlsxformat.h"
andre@1: #include "xlsxcolor_p.h"
andre@1: #include <QSharedData>
andre@1: #include <QSharedPointer>
andre@1: #include <QMap>
andre@1: 
andre@1: QT_BEGIN_NAMESPACE_XLSX
andre@1: 
andre@1: class XlsxCfVoData
andre@1: {
andre@1: public:
andre@1:     XlsxCfVoData()
andre@1:         :gte(true)
andre@1:     {
andre@1:     }
andre@1: 
andre@1:     XlsxCfVoData(ConditionalFormatting::ValueObjectType type, const QString &value, bool gte=true)
andre@1:         :type(type), value(value), gte(gte)
andre@1:     {
andre@1:     }
andre@1: 
andre@1:     ConditionalFormatting::ValueObjectType type;
andre@1:     QString value;
andre@1:     bool gte;
andre@1: };
andre@1: 
andre@1: class XlsxCfRuleData
andre@1: {
andre@1: public:
andre@1:     enum Attribute {
andre@1:         A_type,
andre@1:         A_dxfId,
andre@1:         //A_priority,
andre@1:         A_stopIfTrue,
andre@1:         A_aboveAverage,
andre@1:         A_percent,
andre@1:         A_bottom,
andre@1:         A_operator,
andre@1:         A_text,
andre@1:         A_timePeriod,
andre@1:         A_rank,
andre@1:         A_stdDev,
andre@1:         A_equalAverage,
andre@1: 
andre@1:         A_dxfFormat,
andre@1:         A_formula1,
andre@1:         A_formula2,
andre@1:         A_formula3,
andre@1:         A_formula1_temp,
andre@1: 
andre@1:         A_color1,
andre@1:         A_color2,
andre@1:         A_color3,
andre@1: 
andre@1:         A_cfvo1,
andre@1:         A_cfvo2,
andre@1:         A_cfvo3,
andre@1: 
andre@1:         A_hideData
andre@1:     };
andre@1: 
andre@1:     XlsxCfRuleData()
andre@1:         :priority(1)
andre@1:     {}
andre@1: 
andre@1:     int priority;
andre@1:     Format dxfFormat;
andre@1:     QMap<int, QVariant> attrs;
andre@1: };
andre@1: 
andre@1: class ConditionalFormattingPrivate : public QSharedData
andre@1: {
andre@1: public:
andre@1:     ConditionalFormattingPrivate();
andre@1:     ConditionalFormattingPrivate(const ConditionalFormattingPrivate &other);
andre@1:     ~ConditionalFormattingPrivate();
andre@1: 
andre@1:     void writeCfVo(QXmlStreamWriter &writer, const XlsxCfVoData& cfvo) const;
andre@1:     bool readCfVo(QXmlStreamReader &reader, XlsxCfVoData& cfvo);
andre@1:     bool readCfRule(QXmlStreamReader &reader, XlsxCfRuleData *cfRule, Styles *styles);
andre@1:     bool readCfDataBar(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
andre@1:     bool readCfColorScale(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
andre@1: 
andre@1:     QList<QSharedPointer<XlsxCfRuleData> >cfRules;
andre@1:     QList<CellRange> ranges;
andre@1: };
andre@1: 
andre@1: QT_END_NAMESPACE_XLSX
andre@1: 
andre@1: Q_DECLARE_METATYPE(QXlsx::XlsxCfVoData)
andre@1: #endif // XLSXCONDITIONALFORMATTING_P_H