xlsxcell.h 1.6 KB

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