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

0001 // xlsxcell.h
0002 
0003 #ifndef QXLSX_XLSXCELL_H
0004 #define QXLSX_XLSXCELL_H
0005 
0006 #include <cstdio>
0007 
0008 #include <QtGlobal>
0009 #include <QObject>
0010 #include <QString>
0011 #include <QVariant>
0012 #include <QDate>
0013 #include <QDateTime>
0014 #include <QTime>
0015 
0016 #include "xlsxglobal.h"
0017 #include "xlsxformat.h"
0018 
0019 QT_BEGIN_NAMESPACE_XLSX
0020 
0021 class Worksheet;
0022 class Format;
0023 class CellFormula;
0024 class CellPrivate;
0025 class WorksheetPrivate;
0026 
0027 class QXLSX_EXPORT Cell
0028 {
0029     Q_DECLARE_PRIVATE(Cell)
0030 
0031 private:
0032     friend class Worksheet;
0033     friend class WorksheetPrivate;
0034 
0035 public:
0036     enum CellType // See ECMA 376, 18.18.11. ST_CellType (Cell Type) for more information.
0037     {
0038         BooleanType,
0039         DateType,
0040         ErrorType,
0041         InlineStringType,
0042         NumberType,
0043         SharedStringType,
0044         StringType,
0045         CustomType, // custom or un-defined cell type
0046     };
0047 
0048 public:
0049     Cell(const QVariant &data = QVariant(),
0050             CellType type = NumberType,
0051             const Format &format = Format(),
0052             Worksheet *parent = nullptr,
0053             qint32 styleIndex = (-1) );
0054     Cell(const Cell * const cell);
0055     ~Cell();
0056 
0057 public:
0058     CellPrivate * const d_ptr; // See D-pointer and Q-pointer of Qt, for more information.
0059 
0060 public:
0061     CellType cellType() const;
0062     QVariant value() const;
0063     QVariant readValue() const;
0064     Format format() const;
0065     
0066     bool hasFormula() const;
0067     CellFormula formula() const;
0068 
0069     bool isDateTime() const;
0070     QVariant dateTime() const; // QDateTime, QDate, QTime
0071 
0072     bool isRichString() const;
0073 
0074     qint32 styleNumber() const;
0075 
0076     static bool isDateType(CellType cellType, const Format &format);
0077 
0078 };
0079 
0080 QT_END_NAMESPACE_XLSX
0081 
0082 #endif // QXLSX_XLSXCELL_H