xlsxcell.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // xlsxcell.h
  2. #ifndef QXLSX_XLSXCELL_H
  3. #define QXLSX_XLSXCELL_H
  4. #include "xlsxformat.h"
  5. #include "xlsxglobal.h"
  6. #include <cstdio>
  7. #include <QDate>
  8. #include <QDateTime>
  9. #include <QObject>
  10. #include <QString>
  11. #include <QTime>
  12. #include <QVariant>
  13. #include <QtGlobal>
  14. QT_BEGIN_NAMESPACE_XLSX
  15. class Worksheet;
  16. class Format;
  17. class CellFormula;
  18. class CellPrivate;
  19. class WorksheetPrivate;
  20. class QXLSX_EXPORT Cell
  21. {
  22. Q_DECLARE_PRIVATE(Cell)
  23. private:
  24. friend class Worksheet;
  25. friend class WorksheetPrivate;
  26. public:
  27. enum CellType // See ECMA 376, 18.18.11. ST_CellType (Cell Type) for more information.
  28. {
  29. BooleanType,
  30. DateType,
  31. ErrorType,
  32. InlineStringType,
  33. NumberType,
  34. SharedStringType,
  35. StringType,
  36. CustomType, // custom or un-defined cell type
  37. };
  38. public:
  39. Cell(const QVariant &data = QVariant(),
  40. CellType type = NumberType,
  41. const Format &format = Format(),
  42. Worksheet *parent = nullptr,
  43. qint32 styleIndex = (-1));
  44. Cell(const Cell *const cell);
  45. ~Cell();
  46. public:
  47. CellPrivate *const d_ptr; // See D-pointer and Q-pointer of Qt, for more information.
  48. public:
  49. CellType cellType() const;
  50. QVariant value() const;
  51. QVariant readValue() const;
  52. Format format() const;
  53. bool hasFormula() const;
  54. CellFormula formula() const;
  55. bool isDateTime() const;
  56. QVariant dateTime() const; // QDateTime, QDate, QTime
  57. bool isRichString() const;
  58. qint32 styleNumber() const;
  59. static bool isDateType(CellType cellType, const Format &format);
  60. };
  61. QT_END_NAMESPACE_XLSX
  62. #endif // QXLSX_XLSXCELL_H