xlsxconditionalformatting_p.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /****************************************************************************
  2. ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
  3. ** All right reserved.
  4. **
  5. ** Permission is hereby granted, free of charge, to any person obtaining
  6. ** a copy of this software and associated documentation files (the
  7. ** "Software"), to deal in the Software without restriction, including
  8. ** without limitation the rights to use, copy, modify, merge, publish,
  9. ** distribute, sublicense, and/or sell copies of the Software, and to
  10. ** permit persons to whom the Software is furnished to do so, subject to
  11. ** the following conditions:
  12. **
  13. ** The above copyright notice and this permission notice shall be
  14. ** included in all copies or substantial portions of the Software.
  15. **
  16. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  20. ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  21. ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  22. ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. **
  24. ****************************************************************************/
  25. #ifndef XLSXCONDITIONALFORMATTING_P_H
  26. #define XLSXCONDITIONALFORMATTING_P_H
  27. //
  28. // W A R N I N G
  29. // -------------
  30. //
  31. // This file is not part of the Qt Xlsx API. It exists for the convenience
  32. // of the Qt Xlsx. This header file may change from
  33. // version to version without notice, or even be removed.
  34. //
  35. // We mean it.
  36. //
  37. #include "xlsxconditionalformatting.h"
  38. #include "xlsxformat.h"
  39. #include "xlsxcolor_p.h"
  40. #include <QSharedData>
  41. #include <QSharedPointer>
  42. #include <QMap>
  43. QT_BEGIN_NAMESPACE_XLSX
  44. class XlsxCfVoData
  45. {
  46. public:
  47. XlsxCfVoData()
  48. :gte(true)
  49. {
  50. }
  51. XlsxCfVoData(ConditionalFormatting::ValueObjectType type, const QString &value, bool gte=true)
  52. :type(type), value(value), gte(gte)
  53. {
  54. }
  55. ConditionalFormatting::ValueObjectType type;
  56. QString value;
  57. bool gte;
  58. };
  59. class XlsxCfRuleData
  60. {
  61. public:
  62. enum Attribute {
  63. A_type,
  64. A_dxfId,
  65. //A_priority,
  66. A_stopIfTrue,
  67. A_aboveAverage,
  68. A_percent,
  69. A_bottom,
  70. A_operator,
  71. A_text,
  72. A_timePeriod,
  73. A_rank,
  74. A_stdDev,
  75. A_equalAverage,
  76. A_dxfFormat,
  77. A_formula1,
  78. A_formula2,
  79. A_formula3,
  80. A_formula1_temp,
  81. A_color1,
  82. A_color2,
  83. A_color3,
  84. A_cfvo1,
  85. A_cfvo2,
  86. A_cfvo3,
  87. A_hideData
  88. };
  89. XlsxCfRuleData()
  90. :priority(1)
  91. {}
  92. int priority;
  93. Format dxfFormat;
  94. QMap<int, QVariant> attrs;
  95. };
  96. class ConditionalFormattingPrivate : public QSharedData
  97. {
  98. public:
  99. ConditionalFormattingPrivate();
  100. ConditionalFormattingPrivate(const ConditionalFormattingPrivate &other);
  101. ~ConditionalFormattingPrivate();
  102. void writeCfVo(QXmlStreamWriter &writer, const XlsxCfVoData& cfvo) const;
  103. bool readCfVo(QXmlStreamReader &reader, XlsxCfVoData& cfvo);
  104. bool readCfRule(QXmlStreamReader &reader, XlsxCfRuleData *cfRule, Styles *styles);
  105. bool readCfDataBar(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
  106. bool readCfColorScale(QXmlStreamReader &reader, XlsxCfRuleData *cfRule);
  107. QList<QSharedPointer<XlsxCfRuleData> >cfRules;
  108. QList<CellRange> ranges;
  109. };
  110. QT_END_NAMESPACE_XLSX
  111. Q_DECLARE_METATYPE(QXlsx::XlsxCfVoData)
  112. #endif // XLSXCONDITIONALFORMATTING_P_H