File indexing completed on 2024-06-23 03:45:56

0001 // xlsxconditionalformatting_p.h
0002 
0003 #ifndef XLSXCONDITIONALFORMATTING_P_H
0004 #define XLSXCONDITIONALFORMATTING_P_H
0005 
0006 #include <QSharedData>
0007 #include <QMap>
0008 
0009 #include <memory>
0010 
0011 #include "xlsxconditionalformatting.h"
0012 #include "xlsxformat.h"
0013 #include "xlsxcolor_p.h"
0014 
0015 QT_BEGIN_NAMESPACE_XLSX
0016 
0017 class XlsxCfVoData
0018 {
0019 public:
0020     XlsxCfVoData()
0021         :gte(true)
0022     {
0023     }
0024 
0025     XlsxCfVoData(ConditionalFormatting::ValueObjectType type, const QString &value, bool gte=true)
0026         :type(type), value(value), gte(gte)
0027     {
0028     }
0029 
0030     ConditionalFormatting::ValueObjectType type;
0031     QString value;
0032     bool gte;
0033 };
0034 
0035 class XlsxCfRuleData
0036 {
0037 public:
0038     enum Attribute {
0039         A_type,
0040         A_dxfId,
0041         //A_priority,
0042         A_stopIfTrue,
0043         A_aboveAverage,
0044         A_percent,
0045         A_bottom,
0046         A_operator,
0047         A_text,
0048         A_timePeriod,
0049         A_rank,
0050         A_stdDev,
0051         A_equalAverage,
0052 
0053         A_dxfFormat,
0054         A_formula1,
0055         A_formula2,
0056         A_formula3,
0057         A_formula1_temp,
0058 
0059         A_color1,
0060         A_color2,
0061         A_color3,
0062 
0063         A_cfvo1,
0064         A_cfvo2,
0065         A_cfvo3,
0066 
0067         A_hideData
0068     };
0069 
0070     XlsxCfRuleData()
0071         :priority(1)
0072     {}
0073 
0074     int priority;
0075     Format dxfFormat;
0076     QMap<int, QVariant> attrs;
0077 };
0078 
0079 class ConditionalFormattingPrivate : public QSharedData
0080 {
0081 public:
0082     ConditionalFormattingPrivate();
0083     ConditionalFormattingPrivate(const ConditionalFormattingPrivate &other);
0084     ~ConditionalFormattingPrivate();
0085 
0086     void writeCfVo(QXmlStreamWriter &writer, const XlsxCfVoData& cfvo) const;
0087     bool readCfVo(QXmlStreamReader &reader, XlsxCfVoData& cfvo);
0088     bool readCfRule(QXmlStreamReader &reader, XlsxCfRuleData *cfRule, Styles *styles);
0089     bool readCfDataBar(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
0090     bool readCfColorScale(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
0091 
0092     QList<std::shared_ptr<XlsxCfRuleData> >cfRules;
0093     QList<CellRange> ranges;
0094 };
0095 
0096 QT_END_NAMESPACE_XLSX
0097 
0098 Q_DECLARE_METATYPE(QXlsx::XlsxCfVoData)
0099 #endif // XLSXCONDITIONALFORMATTING_P_H